catch node

This commit is contained in:
vadim 2017-12-06 14:30:45 +02:00
parent de066981b7
commit 059275b3bf
3 changed files with 137 additions and 94 deletions

43
node/stmt/catch.go Normal file
View File

@ -0,0 +1,43 @@
package stmt
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/token"
)
type Catch struct {
node.SimpleNode
token token.Token
types []node.Node
variable node.Node
stmts node.Node
}
//TODO: stmts myst be []node.Node
func NewCatch(token token.Token, types []node.Node, variable node.Node, stmts node.Node) node.Node {
return Catch{
node.SimpleNode{Name: "Catch", Attributes: make(map[string]string)},
token,
types,
variable,
stmts,
}
}
func (n Catch) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [%d %d] %q", indent, n.Name, n.token.StartLine, n.token.EndLine, n.token.Value)
fmt.Fprintf(out, "\n%vtyps:", indent+" ")
for _, nn := range n.types {
nn.Print(out, indent+" ")
}
fmt.Fprintf(out, "\n%vvariable:", indent+" ")
n.variable.Print(out, indent+" ")
fmt.Fprintf(out, "\n%vstmts:", indent+" ")
n.stmts.Print(out, indent+" ")
}

View File

@ -599,11 +599,11 @@ var yyAct = [...]int{
229, 308, 812, 824, 810, 825, 642, 691, 231, 766, 229, 308, 812, 824, 810, 825, 642, 691, 231, 766,
718, 831, 669, 633, 659, 544, 255, 256, 118, 803, 718, 831, 669, 633, 659, 544, 255, 256, 118, 803,
842, 628, 564, 830, 554, 813, 578, 846, 833, 409, 842, 628, 564, 830, 554, 813, 578, 846, 833, 409,
855, 1, 841, 687, 688, 689, 686, 685, 684, 250, 855, 1, 841, 687, 688, 689, 686, 685, 684, 829,
864, 854, 37, 163, 165, 166, 681, 178, 255, 256, 864, 854, 250, 163, 165, 166, 37, 178, 255, 256,
863, 679, 678, 221, 872, 223, 873, 835, 868, 164, 863, 681, 679, 678, 872, 221, 873, 223, 868, 164,
877, 848, 42, 321, 861, 912, 879, 804, 800, 748, 877, 835, 848, 42, 861, 321, 879, 912, 804, 800,
529, 570, 855, 41, 782, 878, 666, 829, 882, 365, 748, 529, 855, 570, 782, 878, 41, 666, 882, 365,
148, 144, 141, 854, 888, 889, 651, 15, 890, 87, 148, 144, 141, 854, 888, 889, 651, 15, 890, 87,
88, 89, 90, 91, 14, 519, 606, 266, 73, 74, 88, 89, 90, 91, 14, 519, 606, 266, 73, 74,
48, 75, 47, 107, 896, 893, 49, 82, 897, 80, 48, 75, 47, 107, 896, 893, 49, 82, 897, 80,
@ -1363,11 +1363,11 @@ var yyPgo = [...]int{
898, 111, 98, 197, 897, 896, 894, 8, 889, 81, 898, 111, 98, 197, 897, 896, 894, 8, 889, 81,
43, 887, 55, 47, 886, 883, 882, 880, 877, 97, 43, 887, 55, 47, 886, 883, 882, 880, 877, 97,
876, 875, 103, 541, 90, 1, 874, 867, 31, 866, 876, 875, 103, 541, 90, 1, 874, 867, 31, 866,
862, 861, 860, 859, 857, 856, 7, 19, 38, 24, 862, 861, 860, 859, 857, 7, 19, 38, 24, 856,
853, 851, 83, 850, 849, 848, 10, 4, 847, 845, 853, 83, 851, 850, 849, 10, 4, 848, 847, 845,
843, 86, 842, 841, 18, 837, 835, 833, 44, 42, 86, 843, 842, 18, 841, 837, 835, 44, 42, 32,
32, 41, 2, 16, 3, 832, 831, 826, 5, 822, 41, 2, 16, 3, 833, 832, 831, 5, 826, 786,
786, 664, 819, 28, 811, 37, 12, 664, 822, 28, 819, 811, 37, 12,
} }
var yyR1 = [...]int{ var yyR1 = [...]int{
@ -1378,28 +1378,28 @@ var yyR1 = [...]int{
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6,
6, 6, 6, 6, 6, 6, 114, 114, 72, 72, 6, 6, 6, 6, 6, 6, 113, 113, 72, 72,
123, 123, 8, 8, 8, 7, 7, 7, 7, 7, 122, 122, 8, 8, 8, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 120, 7, 7, 7, 7, 7, 7, 7, 7, 7, 119,
120, 15, 15, 18, 18, 125, 125, 16, 16, 21, 119, 15, 15, 18, 18, 125, 125, 16, 16, 21,
21, 73, 73, 17, 17, 20, 20, 19, 19, 74, 21, 73, 73, 17, 17, 20, 20, 19, 19, 74,
74, 75, 75, 23, 23, 23, 23, 23, 23, 9, 74, 75, 75, 23, 23, 23, 23, 23, 23, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 85, 85, 84, 84, 31, 31, 83, 9, 9, 9, 84, 84, 123, 123, 31, 31, 83,
83, 32, 10, 1, 1, 2, 2, 11, 11, 119, 83, 32, 10, 1, 1, 2, 2, 11, 11, 118,
119, 4, 4, 12, 13, 34, 34, 14, 14, 88, 118, 4, 4, 12, 13, 34, 34, 14, 14, 87,
88, 28, 28, 28, 28, 27, 27, 29, 29, 30, 87, 28, 28, 28, 28, 27, 27, 29, 29, 30,
30, 79, 79, 79, 79, 89, 89, 89, 126, 126, 30, 79, 79, 79, 79, 88, 88, 88, 126, 126,
26, 26, 90, 90, 76, 76, 102, 102, 77, 77, 26, 26, 89, 89, 76, 76, 101, 101, 77, 77,
86, 86, 91, 91, 35, 35, 36, 36, 113, 113, 85, 85, 90, 90, 35, 35, 36, 36, 112, 112,
111, 111, 111, 112, 112, 92, 92, 93, 93, 37, 110, 110, 110, 111, 111, 91, 91, 92, 92, 37,
37, 80, 80, 39, 81, 81, 40, 40, 87, 87, 37, 80, 80, 39, 81, 81, 40, 40, 86, 86,
41, 41, 41, 41, 97, 97, 98, 98, 98, 103, 41, 41, 41, 41, 96, 96, 97, 97, 97, 102,
103, 42, 42, 43, 44, 44, 44, 44, 46, 46, 102, 42, 42, 43, 44, 44, 44, 44, 46, 46,
45, 99, 99, 115, 115, 116, 116, 117, 117, 118, 45, 98, 98, 114, 114, 115, 115, 116, 116, 117,
118, 118, 118, 118, 118, 94, 94, 47, 47, 95, 117, 117, 117, 117, 117, 93, 93, 47, 47, 94,
95, 96, 22, 82, 82, 48, 78, 78, 100, 100, 94, 95, 22, 82, 82, 48, 78, 78, 99, 99,
50, 49, 49, 38, 38, 38, 38, 38, 38, 38, 50, 49, 49, 38, 38, 38, 38, 38, 38, 38,
38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
@ -1408,18 +1408,18 @@ var yyR1 = [...]int{
38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
38, 38, 38, 38, 38, 38, 38, 38, 38, 3, 38, 38, 38, 38, 38, 38, 38, 38, 38, 3,
3, 104, 104, 105, 105, 57, 57, 58, 58, 58, 3, 103, 103, 104, 104, 57, 57, 58, 58, 58,
58, 51, 51, 52, 52, 55, 55, 122, 122, 122, 58, 51, 51, 52, 52, 55, 55, 121, 121, 121,
101, 101, 62, 62, 62, 56, 56, 56, 56, 56, 100, 100, 62, 62, 62, 56, 56, 56, 56, 56,
56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
56, 63, 63, 63, 24, 24, 25, 25, 61, 64, 56, 63, 63, 63, 24, 24, 25, 25, 61, 64,
64, 64, 65, 65, 65, 66, 66, 66, 66, 66, 64, 64, 65, 65, 65, 66, 66, 66, 66, 66,
66, 33, 33, 33, 53, 53, 53, 67, 67, 68, 66, 33, 33, 33, 53, 53, 53, 67, 67, 68,
68, 68, 68, 68, 68, 59, 59, 59, 60, 60, 68, 68, 68, 68, 68, 59, 59, 59, 60, 60,
60, 108, 109, 109, 107, 107, 106, 106, 106, 106, 60, 107, 108, 108, 106, 106, 105, 105, 105, 105,
106, 106, 121, 121, 121, 121, 69, 69, 69, 69, 105, 105, 120, 120, 120, 120, 69, 69, 69, 69,
69, 69, 69, 70, 70, 70, 70, 54, 54, 54, 69, 69, 69, 70, 70, 70, 70, 54, 54, 54,
54, 54, 54, 54, 71, 71, 110, 54, 54, 54, 54, 71, 71, 109,
} }
var yyR2 = [...]int{ var yyR2 = [...]int{
@ -1478,16 +1478,16 @@ var yyChk = [...]int{
-1000, -124, -72, -7, -9, -10, -11, -12, -13, 127, -1000, -124, -72, -7, -9, -10, -11, -12, -13, 127,
154, 120, 114, 164, -76, -77, 97, 96, 99, 106, 154, 120, 114, 164, -76, -77, 97, 96, 99, 106,
110, 111, 115, 122, 76, 95, 90, -24, 124, 101, 110, 111, 115, 122, 76, 95, 90, -24, 124, 101,
103, 163, 116, 119, 112, 86, 113, -119, 128, 129, 103, 163, 116, 119, 112, 86, 113, -118, 128, 129,
130, -90, -102, -33, -38, -4, 83, -66, -67, -64, 130, -89, -101, -33, -38, -4, 83, -66, -67, -64,
134, 69, 71, 58, 59, 49, 50, 55, 57, 161, 134, 69, 71, 58, 59, 49, 50, 55, 57, 161,
-49, -54, 60, 61, 62, 63, 64, 65, 66, 82, -49, -54, 60, 61, 62, 63, 64, 65, 66, 82,
67, -56, 160, 13, 14, 16, 77, 78, -53, -63, 67, -56, 160, 13, 14, 16, 77, 78, -53, -63,
-58, -51, -61, -62, 70, 125, 126, 4, 5, 6, -58, -51, -61, -62, 70, 125, 126, 4, 5, 6,
7, 8, 84, 85, 141, 142, 156, 138, 139, 140, 7, 8, 84, 85, 141, 142, 156, 138, 139, 140,
155, 137, 149, 159, 88, 167, -8, -65, 135, 94, 155, 137, 149, 159, 88, 167, -8, -65, 135, 94,
-123, 157, 161, 157, -123, 164, 86, -18, -120, -73, -122, 157, 161, 157, -122, 164, 86, -18, -119, -73,
-123, 157, 113, 114, -19, -20, -74, -22, 86, -75, -122, 157, 113, 114, -19, -20, -74, -22, 86, -75,
161, -9, 113, 154, 161, 161, -25, -24, 76, -25, 161, -9, 113, 154, 161, 161, -25, -24, 76, -25,
-25, -80, -39, -53, -81, 113, -40, 88, -82, -48, -25, -80, -39, -53, -81, 113, -40, 88, -82, -48,
-24, 163, 33, 34, 10, 12, 11, 35, 37, 36, -24, 163, 33, 34, 10, 12, 11, 35, 37, 36,
@ -1497,17 +1497,17 @@ var yyChk = [...]int{
128, -4, 86, 86, 86, 73, 74, 73, 75, 74, 128, -4, 86, 86, 86, 73, 74, 73, 75, 74,
17, 18, 19, 20, 29, 21, 22, 23, 24, 25, 17, 18, 19, 20, 29, 21, 22, 23, 24, 25,
26, 27, 28, 58, 59, 161, 69, 164, 133, 161, 26, 27, 28, 58, 59, 161, 69, 164, 133, 161,
-108, -107, -109, -106, -24, 37, 134, -24, -33, -63, -107, -106, -108, -105, -24, 37, 134, -24, -33, -63,
161, -62, 76, 69, -33, -24, -24, -24, -24, -24, 161, -62, 76, 69, -33, -24, -24, -24, -24, -24,
-24, -24, -24, -24, -24, -24, -24, -55, 161, -24, -24, -24, -24, -24, -24, -24, -24, -55, 161, -24,
-122, 93, -121, -69, 88, 151, 152, -24, -24, -24, -121, 93, -120, -69, 88, 151, 152, -24, -24, -24,
69, 153, 153, -52, -50, -51, -68, 128, -8, -53, 69, 153, 153, -52, -50, -51, -68, 128, -8, -53,
161, 161, -24, -24, 161, -24, -24, 93, 150, -121, 161, 161, -24, -24, 161, -24, -24, 93, 150, -120,
-121, 93, 164, -53, -92, 161, -92, 161, 157, -123, -120, 93, 164, -53, -91, 161, -91, 161, 157, -122,
162, -123, 163, 164, -72, 163, -15, -73, -123, 157, 162, -122, 163, 164, -72, 163, -15, -73, -122, 157,
163, 9, 157, 105, -123, -20, 163, 9, 17, -23, 163, 9, 157, 105, -122, -20, 163, 9, 17, -23,
165, -9, -10, -11, -12, -13, 127, -24, 97, -3, 165, -9, -10, -11, -12, -13, 127, -24, 97, -3,
-78, -100, -24, -24, 163, 163, 163, 163, 9, 163, -78, -99, -24, -24, 163, 163, 163, 163, 9, 163,
9, -3, 17, 163, 9, -24, -24, -24, -24, -24, 9, -3, 17, 163, 9, -24, -24, -24, -24, -24,
-24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24,
-24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24,
@ -1515,9 +1515,9 @@ var yyChk = [...]int{
-75, 163, 163, 86, 161, 86, -34, 131, 164, -14, -75, 163, 163, 86, 161, 86, -34, 131, 164, -14,
131, 161, -9, 161, 163, 31, -24, 37, -24, -24, 131, 161, -9, 161, 163, 31, -24, 37, -24, -24,
-24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24,
-24, -25, -24, -60, 86, 164, -53, -108, 166, 9, -24, -25, -24, -60, 86, 164, -53, -107, 166, 9,
15, -33, 161, -24, -108, 162, -25, 160, -69, -69, 15, -33, 161, -24, -107, 162, -25, 160, -69, -69,
93, 69, 133, -24, 87, -33, 15, -25, -59, -114, 93, 69, 133, -24, 87, -33, 15, -25, -59, -113,
-53, 164, 86, -6, -5, 76, 77, 78, 79, 80, -53, 164, 86, -6, -5, 76, 77, 78, 79, 80,
81, 4, 5, 6, 7, 8, 10, 11, 12, 56, 81, 4, 5, 6, 7, 8, 10, 11, 12, 56,
70, 71, 82, 83, 73, 74, 75, 95, 96, 97, 70, 71, 82, 83, 73, 74, 75, 95, 96, 97,
@ -1525,48 +1525,48 @@ var yyChk = [...]int{
118, 119, 120, 121, 122, 123, 124, 125, 126, 111, 118, 119, 120, 121, 122, 123, 124, 125, 126, 111,
112, 113, 114, 115, 13, 14, 134, 106, 107, 108, 112, 113, 114, 115, 13, 14, 134, 106, 107, 108,
109, 110, 135, 136, 131, 132, 154, 129, 130, 128, 109, 110, 135, 136, 131, 132, 154, 129, 130, 128,
137, 138, 140, 139, 141, 142, 156, 155, -59, -114, 137, 138, 140, 139, 141, 142, 156, 155, -59, -113,
-53, -101, -92, 153, 69, 164, 133, 153, -101, -71, -53, -100, -91, 153, 69, 164, 133, 153, -100, -71,
-110, -24, -24, -24, 150, 150, 159, -24, 162, -93, -109, -24, -24, -24, 150, 150, 159, -24, 162, -92,
-37, -24, 158, -108, 86, 163, -72, 165, 163, 163, -37, -24, 158, -107, 86, 163, -72, 165, 163, 163,
157, -123, -19, 157, -123, 164, 86, 157, -22, -24, 157, -122, -19, 157, -122, 164, 86, 157, -22, -24,
161, 162, 161, 163, 9, 162, -39, -40, 161, -24, 161, 162, 161, 163, 9, 162, -39, -40, 161, -24,
-48, 31, -24, -125, 9, 105, 162, 165, 161, -86, -48, 31, -24, -125, 9, 105, 162, 165, 161, -85,
-91, -35, -36, -113, -111, 30, 135, 136, -8, -34, -90, -35, -36, -112, -110, 30, 135, 136, -8, -34,
-88, 132, -8, -87, 164, -97, -8, -24, -24, -75, -87, 132, -8, -86, 164, -96, -8, -24, -24, -75,
-24, 162, 166, 165, -92, -24, 162, 17, -109, -24, -24, 162, 166, 165, -91, -24, 162, 17, -108, -24,
37, 134, -108, 162, 166, 162, -70, 86, 89, 50, 37, 134, -107, 162, 166, 162, -70, 86, 89, 50,
88, 86, 165, 165, 69, 165, -24, 166, -92, -24, 88, 86, 165, 165, 69, 165, -24, 166, -91, -24,
-92, -53, -25, -24, -60, -53, -34, -125, 9, 162, -91, -53, -25, -24, -60, -53, -34, -125, 9, 162,
162, 165, -125, 9, -24, 162, 165, 164, 157, -16, 162, 165, -125, 9, -24, 162, 165, 164, 157, -16,
-17, -20, -120, 164, 162, -26, -9, 31, -24, -78, -17, -20, -119, 164, 162, -26, -9, 31, -24, -78,
-24, -79, 164, 31, -86, -24, 162, -32, -28, -33, -24, -79, 164, 31, -85, -24, 162, -32, -28, -33,
37, 134, 69, -30, -9, 31, -85, -86, 162, 9, 37, 134, 69, -30, -9, 31, -84, -85, 162, 9,
-1, 37, -111, -88, 164, -97, 165, -41, -115, -116, -1, 37, -110, -87, 164, -96, 165, -41, -114, -115,
120, -117, 123, -118, 81, 80, 79, 76, 77, 78, 120, -116, 123, -117, 81, 80, 79, 76, 77, 78,
-87, 9, 162, 162, 75, -9, 31, 165, 17, -24, -86, 9, 162, 162, 75, -9, 31, 165, 17, -24,
-33, 161, 162, 166, 89, -24, 165, 166, 165, -88, -33, 161, 162, 166, 89, -24, 165, 166, 165, -87,
162, -110, 162, -37, -21, -20, 164, -125, 9, -20, 162, -109, 162, -37, -21, -20, 164, -125, 9, -20,
-16, 163, -75, 162, 163, -89, 163, -89, 163, 162, -16, 163, -75, 162, 163, -88, 163, -88, 163, 162,
163, 162, 15, -33, 161, -108, -75, -31, 117, 118, 163, 162, 15, -33, 161, -107, -75, -31, 117, 118,
162, -104, 120, -35, -2, 158, 164, -87, -94, -47, 162, -103, 120, -35, -2, 158, 164, -86, -93, -47,
88, 114, 113, -97, -118, 165, -8, -9, 31, 163, 88, 114, 113, -96, -117, 165, -8, -9, 31, 163,
-75, -24, -108, 166, 164, -125, 9, -21, 165, -17, -75, -24, -107, 166, 164, -125, 9, -21, 165, -17,
-125, 98, 163, -78, 165, 108, 109, -89, 107, -89, -125, 98, 163, -78, 165, 108, 109, -88, 107, -88,
-104, -29, -9, 31, -28, -108, 166, 104, 161, 164, -103, -29, -9, 31, -28, -107, 166, 104, 161, 164,
-112, 31, -112, 161, 88, -87, 165, 163, 9, 17, -111, 31, -111, 161, 88, -86, 165, 163, 9, 17,
-95, -96, -114, -3, -98, 163, 164, -75, 162, 165, -94, -95, -113, -3, -97, 163, 164, -75, 162, 165,
-87, 165, -20, -125, 165, 163, 162, -24, -126, 31, -86, 165, -20, -125, 165, 163, 162, -24, -126, 31,
163, 165, 163, 107, -112, -75, 162, 162, 163, -84, 163, 165, 163, 107, -111, -75, 162, 162, 163, -123,
-8, -75, 164, -113, 164, -105, -57, 88, 37, 17, -8, -75, 164, -112, 164, -104, -57, 88, 37, 17,
165, -47, -24, 163, 9, 17, -114, 165, -103, -42, 165, -47, -24, 163, 9, 17, -113, 165, -102, -42,
-43, -44, -45, -46, -8, -114, 154, 86, 165, 165, -43, -44, -45, -46, -8, -113, 154, 86, 165, 165,
-27, -9, 31, -126, -75, 163, 164, 102, -29, 88, -27, -9, 31, -126, -75, 163, 164, 102, -29, 88,
35, 165, -75, -75, 162, 9, 88, -24, -96, -24, 35, 165, -75, -75, 162, 9, 88, -24, -95, -24,
161, 165, -42, 163, 163, 121, 105, 153, -75, -75, 161, 165, -42, 163, 163, 121, 105, 153, -75, -75,
-75, 163, 162, -8, 165, 165, -57, -86, -97, 86, -75, 163, 162, -8, 165, 165, -57, -85, -96, 86,
-5, -118, -114, 100, 165, 164, 162, -114, 163, -75, -5, -117, -113, 100, 165, 164, 162, -113, 163, -75,
-112, 165, -99, 163, 164, -75, 165, -111, 165, -98, 163, 164, -75, 165,
} }
var yyDef = [...]int{ var yyDef = [...]int{
@ -2965,19 +2965,19 @@ yydefault:
yyDollar = yyS[yypt-9 : yypt+1] yyDollar = yyS[yypt-9 : yypt+1]
//line parser/parser.y:415 //line parser/parser.y:415
{ {
yyVAL.node = yyDollar[1].node.Append(yyDollar[4].node).Append(node.NewSimpleNode("Variable").Attribute("name", yyDollar[5].token.String())).Append(yyDollar[8].node) yyVAL.node = yyDollar[1].node.Append(stmt.NewCatch(yyDollar[2].token, yyDollar[4].list, node.NewSimpleNode("TODO: handle variable"), yyDollar[8].node))
} }
case 155: case 155:
yyDollar = yyS[yypt-1 : yypt+1] yyDollar = yyS[yypt-1 : yypt+1]
//line parser/parser.y:418 //line parser/parser.y:418
{ {
yyVAL.node = node.NewSimpleNode("CatchNameList").Append(yyDollar[1].node) yyVAL.list = []node.Node{yyDollar[1].node}
} }
case 156: case 156:
yyDollar = yyS[yypt-3 : yypt+1] yyDollar = yyS[yypt-3 : yypt+1]
//line parser/parser.y:419 //line parser/parser.y:419
{ {
yyVAL.node = yyDollar[1].node.Append(yyDollar[3].node) yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
} }
case 157: case 157:
yyDollar = yyS[yypt-0 : yypt+1] yyDollar = yyS[yypt-0 : yypt+1]

View File

@ -194,7 +194,7 @@ func Parse(src io.Reader, fName string) node.Node {
%type <node> encaps_var encaps_var_offset isset_variables %type <node> encaps_var encaps_var_offset isset_variables
%type <node> top_statement_list use_declarations const_list inner_statement_list if_stmt %type <node> top_statement_list use_declarations const_list inner_statement_list if_stmt
%type <node> alt_if_stmt for_exprs switch_case_list global_var_list static_var_list %type <node> alt_if_stmt for_exprs switch_case_list global_var_list static_var_list
%type <node> echo_expr_list unset_variables catch_name_list catch_list parameter_list class_statement_list %type <node> echo_expr_list unset_variables catch_list parameter_list class_statement_list
%type <node> implements_list case_list if_stmt_without_else %type <node> implements_list case_list if_stmt_without_else
%type <node> non_empty_parameter_list argument_list non_empty_argument_list property_list %type <node> non_empty_parameter_list argument_list non_empty_argument_list property_list
%type <node> class_const_list class_const_decl name_list trait_adaptations method_body non_empty_for_exprs %type <node> class_const_list class_const_decl name_list trait_adaptations method_body non_empty_for_exprs
@ -208,7 +208,7 @@ func Parse(src io.Reader, fName string) node.Node {
%type <node> method_modifiers non_empty_member_modifiers member_modifier %type <node> method_modifiers non_empty_member_modifiers member_modifier
%type <node> class_modifiers use_type %type <node> class_modifiers use_type
%type <list> encaps_list backticks_expr namespace_name %type <list> encaps_list backticks_expr namespace_name catch_name_list
%% %%
@ -412,11 +412,11 @@ statement:
catch_list: catch_list:
/* empty */ { $$ = node.NewSimpleNode("CatchList") } /* empty */ { $$ = node.NewSimpleNode("CatchList") }
| catch_list T_CATCH '(' catch_name_list T_VARIABLE ')' '{' inner_statement_list '}' | catch_list T_CATCH '(' catch_name_list T_VARIABLE ')' '{' inner_statement_list '}'
{ $$ = $1.Append($4).Append(node.NewSimpleNode("Variable").Attribute("name", $5.String())).Append($8) } { $$ = $1.Append(stmt.NewCatch($2, $4, node.NewSimpleNode("TODO: handle variable"), $8)) }
; ;
catch_name_list: catch_name_list:
name { $$ = node.NewSimpleNode("CatchNameList").Append($1) } name { $$ = []node.Node{$1} }
| catch_name_list '|' name { $$ = $1.Append($3) } | catch_name_list '|' name { $$ = append($1, $3) }
; ;
finally_statement: finally_statement: