property_list property nodes
This commit is contained in:
parent
20626ef69b
commit
ed49675a35
32
node/stmt/property.go
Normal file
32
node/stmt/property.go
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
package stmt
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/z7zmey/php-parser/node"
|
||||||
|
"github.com/z7zmey/php-parser/token"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Property struct {
|
||||||
|
node.SimpleNode
|
||||||
|
token token.Token
|
||||||
|
expr node.Node
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewProperty(token token.Token, expr node.Node) node.Node {
|
||||||
|
return Property{
|
||||||
|
node.SimpleNode{Name: "Property", Attributes: make(map[string]string)},
|
||||||
|
token,
|
||||||
|
expr,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (n Property) 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)
|
||||||
|
|
||||||
|
if n.expr != nil {
|
||||||
|
fmt.Fprintf(out, "\n%vexpr:", indent+" ")
|
||||||
|
n.expr.Print(out, indent+" ")
|
||||||
|
}
|
||||||
|
}
|
38
node/stmt/property_list.go
Normal file
38
node/stmt/property_list.go
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
package stmt
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/z7zmey/php-parser/node"
|
||||||
|
)
|
||||||
|
|
||||||
|
type PropertyList struct {
|
||||||
|
node.SimpleNode
|
||||||
|
modifiers node.Node
|
||||||
|
properties []node.Node
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewPropertyList(modifiers node.Node, properties []node.Node) node.Node {
|
||||||
|
return PropertyList{
|
||||||
|
node.SimpleNode{Name: "PropertyList", Attributes: make(map[string]string)},
|
||||||
|
modifiers,
|
||||||
|
properties,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (n PropertyList) Print(out io.Writer, indent string) {
|
||||||
|
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name)
|
||||||
|
|
||||||
|
if n.modifiers != nil {
|
||||||
|
fmt.Fprintf(out, "\n%vmodifiers:", indent+" ")
|
||||||
|
n.modifiers.Print(out, indent+" ")
|
||||||
|
}
|
||||||
|
|
||||||
|
if n.properties != nil {
|
||||||
|
fmt.Fprintf(out, "\n%vproperties:", indent+" ")
|
||||||
|
for _, nn := range n.properties {
|
||||||
|
nn.Print(out, indent+" ")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
166
parser/parser.go
166
parser/parser.go
@ -600,12 +600,12 @@ var yyAct = [...]int{
|
|||||||
807, 197, 199, 198, 332, 607, 795, 610, 608, 308,
|
807, 197, 199, 198, 332, 607, 795, 610, 608, 308,
|
||||||
766, 718, 669, 279, 280, 642, 817, 633, 628, 785,
|
766, 718, 669, 279, 280, 642, 817, 633, 628, 785,
|
||||||
229, 564, 812, 824, 810, 825, 554, 118, 231, 409,
|
229, 564, 812, 824, 810, 825, 554, 118, 231, 409,
|
||||||
1, 831, 141, 321, 659, 544, 255, 256, 148, 803,
|
1, 831, 748, 141, 659, 544, 255, 256, 321, 803,
|
||||||
842, 800, 666, 830, 829, 813, 578, 846, 833, 250,
|
842, 148, 800, 830, 666, 813, 578, 846, 833, 829,
|
||||||
855, 37, 841, 687, 688, 689, 686, 685, 684, 681,
|
855, 250, 841, 687, 688, 689, 686, 685, 684, 37,
|
||||||
864, 854, 167, 168, 161, 162, 160, 163, 165, 166,
|
864, 854, 167, 168, 161, 162, 160, 163, 165, 166,
|
||||||
863, 178, 679, 678, 872, 221, 873, 223, 868, 835,
|
863, 178, 681, 679, 872, 678, 873, 221, 868, 223,
|
||||||
877, 848, 42, 164, 861, 912, 879, 804, 748, 529,
|
877, 835, 848, 164, 861, 42, 879, 912, 804, 529,
|
||||||
570, 41, 855, 365, 782, 878, 144, 651, 882, 15,
|
570, 41, 855, 365, 782, 878, 144, 651, 882, 15,
|
||||||
14, 519, 606, 854, 888, 889, 266, 48, 890, 87,
|
14, 519, 606, 854, 888, 889, 266, 48, 890, 87,
|
||||||
88, 89, 90, 91, 47, 107, 49, 82, 73, 74,
|
88, 89, 90, 91, 47, 107, 49, 82, 73, 74,
|
||||||
@ -1368,11 +1368,11 @@ var yyPgo = [...]int{
|
|||||||
111, 98, 197, 886, 883, 882, 8, 880, 81, 43,
|
111, 98, 197, 886, 883, 882, 8, 880, 81, 43,
|
||||||
877, 55, 47, 876, 875, 874, 867, 866, 97, 862,
|
877, 55, 47, 876, 875, 874, 867, 866, 97, 862,
|
||||||
861, 103, 549, 1, 860, 859, 857, 856, 853, 7,
|
861, 103, 549, 1, 860, 859, 857, 856, 853, 7,
|
||||||
19, 38, 24, 851, 850, 83, 849, 848, 10, 4,
|
19, 38, 24, 851, 850, 83, 849, 10, 4, 848,
|
||||||
847, 845, 86, 842, 841, 18, 839, 837, 835, 44,
|
847, 86, 845, 842, 18, 841, 839, 837, 44, 42,
|
||||||
42, 32, 41, 2, 16, 833, 832, 819, 5, 775,
|
32, 41, 2, 16, 835, 833, 832, 5, 775, 819,
|
||||||
811, 670, 809, 28, 804, 802, 801, 90, 798, 31,
|
670, 811, 28, 809, 804, 802, 90, 801, 31, 798,
|
||||||
793, 792, 25, 29, 790, 37, 12,
|
793, 25, 29, 792, 790, 37, 12,
|
||||||
}
|
}
|
||||||
var yyR1 = [...]int{
|
var yyR1 = [...]int{
|
||||||
|
|
||||||
@ -1384,27 +1384,27 @@ 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, 6,
|
5, 5, 5, 5, 5, 5, 5, 5, 5, 6,
|
||||||
6, 6, 6, 6, 6, 6, 7, 7, 71, 71,
|
6, 6, 6, 6, 6, 6, 7, 7, 71, 71,
|
||||||
113, 113, 9, 9, 9, 8, 8, 8, 8, 8,
|
112, 112, 9, 9, 9, 8, 8, 8, 8, 8,
|
||||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 109,
|
8, 8, 8, 8, 8, 8, 8, 8, 8, 108,
|
||||||
109, 16, 16, 18, 18, 125, 125, 123, 123, 122,
|
108, 16, 16, 18, 18, 125, 125, 122, 122, 121,
|
||||||
122, 72, 72, 17, 17, 20, 20, 19, 19, 117,
|
121, 72, 72, 17, 17, 20, 20, 19, 19, 116,
|
||||||
117, 73, 73, 22, 22, 22, 22, 22, 22, 10,
|
116, 73, 73, 22, 22, 22, 22, 22, 22, 10,
|
||||||
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
|
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
|
||||||
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
|
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
|
||||||
10, 10, 10, 115, 115, 114, 114, 30, 30, 78,
|
10, 10, 10, 114, 114, 113, 113, 30, 30, 78,
|
||||||
78, 31, 11, 1, 1, 2, 2, 12, 12, 110,
|
78, 31, 11, 1, 1, 2, 2, 12, 12, 109,
|
||||||
110, 4, 4, 13, 14, 33, 33, 15, 15, 81,
|
109, 4, 4, 13, 14, 33, 33, 15, 15, 81,
|
||||||
81, 27, 27, 27, 27, 26, 26, 28, 28, 29,
|
81, 27, 27, 27, 27, 26, 26, 28, 28, 29,
|
||||||
29, 76, 76, 76, 76, 82, 82, 82, 126, 126,
|
29, 76, 76, 76, 76, 82, 82, 82, 126, 126,
|
||||||
25, 25, 83, 83, 74, 74, 93, 93, 75, 75,
|
25, 25, 83, 83, 74, 74, 92, 92, 75, 75,
|
||||||
79, 79, 84, 84, 34, 34, 35, 35, 104, 104,
|
79, 79, 84, 84, 34, 34, 35, 35, 103, 103,
|
||||||
102, 102, 102, 103, 103, 85, 85, 86, 86, 36,
|
101, 101, 101, 102, 102, 85, 85, 86, 86, 36,
|
||||||
36, 121, 121, 38, 77, 77, 39, 39, 80, 80,
|
36, 120, 120, 38, 77, 77, 39, 39, 80, 80,
|
||||||
40, 40, 40, 40, 89, 89, 90, 90, 90, 94,
|
40, 40, 40, 40, 88, 88, 89, 89, 89, 93,
|
||||||
94, 41, 41, 42, 43, 43, 43, 43, 45, 45,
|
93, 41, 41, 42, 43, 43, 43, 43, 45, 45,
|
||||||
44, 91, 91, 105, 105, 106, 106, 107, 107, 108,
|
44, 90, 90, 104, 104, 105, 105, 106, 106, 107,
|
||||||
108, 108, 108, 108, 108, 87, 87, 46, 46, 116,
|
107, 107, 107, 107, 107, 123, 123, 46, 46, 115,
|
||||||
116, 88, 21, 118, 118, 47, 119, 119, 120, 120,
|
115, 87, 21, 117, 117, 47, 118, 118, 119, 119,
|
||||||
49, 48, 48, 37, 37, 37, 37, 37, 37, 37,
|
49, 48, 48, 37, 37, 37, 37, 37, 37, 37,
|
||||||
37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
|
37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
|
||||||
37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
|
37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
|
||||||
@ -1413,18 +1413,18 @@ var yyR1 = [...]int{
|
|||||||
37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
|
37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
|
||||||
37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
|
37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
|
||||||
37, 37, 37, 37, 37, 37, 37, 37, 37, 3,
|
37, 37, 37, 37, 37, 37, 37, 37, 37, 3,
|
||||||
3, 95, 95, 96, 96, 56, 56, 57, 57, 57,
|
3, 94, 94, 95, 95, 56, 56, 57, 57, 57,
|
||||||
57, 50, 50, 51, 51, 54, 54, 112, 112, 112,
|
57, 50, 50, 51, 51, 54, 54, 111, 111, 111,
|
||||||
92, 92, 61, 61, 61, 55, 55, 55, 55, 55,
|
91, 91, 61, 61, 61, 55, 55, 55, 55, 55,
|
||||||
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||||
55, 62, 62, 62, 23, 23, 24, 24, 60, 63,
|
55, 62, 62, 62, 23, 23, 24, 24, 60, 63,
|
||||||
63, 63, 64, 64, 64, 65, 65, 65, 65, 65,
|
63, 63, 64, 64, 64, 65, 65, 65, 65, 65,
|
||||||
65, 32, 32, 32, 52, 52, 52, 66, 66, 67,
|
65, 32, 32, 32, 52, 52, 52, 66, 66, 67,
|
||||||
67, 67, 67, 67, 67, 58, 58, 58, 59, 59,
|
67, 67, 67, 67, 67, 58, 58, 58, 59, 59,
|
||||||
59, 99, 100, 100, 98, 98, 97, 97, 97, 97,
|
59, 98, 99, 99, 97, 97, 96, 96, 96, 96,
|
||||||
97, 97, 111, 111, 111, 111, 68, 68, 68, 68,
|
96, 96, 110, 110, 110, 110, 68, 68, 68, 68,
|
||||||
68, 68, 68, 69, 69, 69, 69, 53, 53, 53,
|
68, 68, 68, 69, 69, 69, 69, 53, 53, 53,
|
||||||
53, 53, 53, 53, 70, 70, 101,
|
53, 53, 53, 53, 70, 70, 100,
|
||||||
}
|
}
|
||||||
var yyR2 = [...]int{
|
var yyR2 = [...]int{
|
||||||
|
|
||||||
@ -1483,18 +1483,18 @@ var yyChk = [...]int{
|
|||||||
-1000, -124, -71, -8, -10, -11, -12, -13, -14, 127,
|
-1000, -124, -71, -8, -10, -11, -12, -13, -14, 127,
|
||||||
154, 120, 114, 161, -74, -75, 97, 96, 99, 106,
|
154, 120, 114, 161, -74, -75, 97, 96, 99, 106,
|
||||||
110, 111, 115, 122, 76, 95, 90, -23, 124, 101,
|
110, 111, 115, 122, 76, 95, 90, -23, 124, 101,
|
||||||
103, 163, 116, 119, 112, 86, 113, -110, 128, 129,
|
103, 163, 116, 119, 112, 86, 113, -109, 128, 129,
|
||||||
130, -83, -93, -32, -37, -4, 83, -65, -66, -63,
|
130, -83, -92, -32, -37, -4, 83, -65, -66, -63,
|
||||||
134, 69, 71, 58, 59, 49, 50, 55, 57, 164,
|
134, 69, 71, 58, 59, 49, 50, 55, 57, 164,
|
||||||
-48, -53, 60, 61, 62, 63, 64, 65, 66, 82,
|
-48, -53, 60, 61, 62, 63, 64, 65, 66, 82,
|
||||||
67, -55, 160, 13, 14, 16, 77, 78, -52, -62,
|
67, -55, 160, 13, 14, 16, 77, 78, -52, -62,
|
||||||
-57, -50, -60, -61, 70, 125, 126, 4, 5, 6,
|
-57, -50, -60, -61, 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, -9, -64, 135, 94,
|
155, 137, 149, 159, 88, 167, -9, -64, 135, 94,
|
||||||
-113, 157, 164, 157, -113, 161, 86, -18, -109, -72,
|
-112, 157, 164, 157, -112, 161, 86, -18, -108, -72,
|
||||||
-113, 157, 113, 114, -19, -20, -117, -21, 86, -73,
|
-112, 157, 113, 114, -19, -20, -116, -21, 86, -73,
|
||||||
164, -10, 113, 154, 164, 164, -24, -23, 76, -24,
|
164, -10, 113, 154, 164, 164, -24, -23, 76, -24,
|
||||||
-24, -121, -38, -52, -77, 113, -39, 88, -118, -47,
|
-24, -120, -38, -52, -77, 113, -39, 88, -117, -47,
|
||||||
-23, 163, 33, 34, 10, 12, 11, 35, 37, 36,
|
-23, 163, 33, 34, 10, 12, 11, 35, 37, 36,
|
||||||
51, 49, 50, 52, 68, 53, 54, 47, 48, 40,
|
51, 49, 50, 52, 68, 53, 54, 47, 48, 40,
|
||||||
41, 38, 39, 43, 44, 45, 46, 42, 56, 30,
|
41, 38, 39, 43, 44, 45, 46, 42, 56, 30,
|
||||||
@ -1502,26 +1502,26 @@ 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, 164, 69, 161, 133, 164,
|
26, 27, 28, 58, 59, 164, 69, 161, 133, 164,
|
||||||
-99, -98, -100, -97, -23, 37, 134, -23, -32, -62,
|
-98, -97, -99, -96, -23, 37, 134, -23, -32, -62,
|
||||||
164, -61, 76, 69, -32, -23, -23, -23, -23, -23,
|
164, -61, 76, 69, -32, -23, -23, -23, -23, -23,
|
||||||
-23, -23, -23, -23, -23, -23, -23, -54, 164, -23,
|
-23, -23, -23, -23, -23, -23, -23, -54, 164, -23,
|
||||||
-112, 93, -111, -68, 88, 151, 152, -23, -23, -23,
|
-111, 93, -110, -68, 88, 151, 152, -23, -23, -23,
|
||||||
69, 153, 153, -51, -49, -50, -67, 128, -9, -52,
|
69, 153, 153, -51, -49, -50, -67, 128, -9, -52,
|
||||||
164, 164, -23, -23, 164, -23, -23, 93, 150, -111,
|
164, 164, -23, -23, 164, -23, -23, 93, 150, -110,
|
||||||
-111, 93, 161, -52, -85, 164, -85, 164, 157, -113,
|
-110, 93, 161, -52, -85, 164, -85, 164, 157, -112,
|
||||||
165, -113, 163, 161, -71, 163, -16, -72, -113, 157,
|
165, -112, 163, 161, -71, 163, -16, -72, -112, 157,
|
||||||
163, 9, 157, 105, -113, -20, 163, 9, 17, -22,
|
163, 9, 157, 105, -112, -20, 163, 9, 17, -22,
|
||||||
162, -10, -11, -12, -13, -14, 127, -23, 97, -3,
|
162, -10, -11, -12, -13, -14, 127, -23, 97, -3,
|
||||||
-119, -120, -23, -23, 163, 163, 163, 163, 9, 163,
|
-118, -119, -23, -23, 163, 163, 163, 163, 9, 163,
|
||||||
9, -3, 17, 163, 9, -23, -23, -23, -23, -23,
|
9, -3, 17, 163, 9, -23, -23, -23, -23, -23,
|
||||||
-23, -23, -23, -23, -23, -23, -23, -23, -23, -23,
|
-23, -23, -23, -23, -23, -23, -23, -23, -23, -23,
|
||||||
-23, -23, -23, -23, -23, -23, -23, -23, -23, -23,
|
-23, -23, -23, -23, -23, -23, -23, -23, -23, -23,
|
||||||
-23, -51, -23, 31, -23, -78, -31, -32, -23, -117,
|
-23, -51, -23, 31, -23, -78, -31, -32, -23, -116,
|
||||||
-73, 163, 163, 86, 164, 86, -33, 131, 161, -15,
|
-73, 163, 163, 86, 164, 86, -33, 131, 161, -15,
|
||||||
131, 164, -10, 164, 163, 31, -23, 37, -23, -23,
|
131, 164, -10, 164, 163, 31, -23, 37, -23, -23,
|
||||||
-23, -23, -23, -23, -23, -23, -23, -23, -23, -23,
|
-23, -23, -23, -23, -23, -23, -23, -23, -23, -23,
|
||||||
-23, -24, -23, -59, 86, 161, -52, -99, 166, 9,
|
-23, -24, -23, -59, 86, 161, -52, -98, 166, 9,
|
||||||
15, -32, 164, -23, -99, 165, -24, 160, -68, -68,
|
15, -32, 164, -23, -98, 165, -24, 160, -68, -68,
|
||||||
93, 69, 133, -23, 87, -32, 15, -24, -58, -7,
|
93, 69, 133, -23, 87, -32, 15, -24, -58, -7,
|
||||||
-52, 161, 86, -6, -5, 76, 77, 78, 79, 80,
|
-52, 161, 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,
|
||||||
@ -1531,47 +1531,47 @@ var yyChk = [...]int{
|
|||||||
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, -58, -7,
|
137, 138, 140, 139, 141, 142, 156, 155, -58, -7,
|
||||||
-52, -92, -85, 153, 69, 161, 133, 153, -92, -70,
|
-52, -91, -85, 153, 69, 161, 133, 153, -91, -70,
|
||||||
-101, -23, -23, -23, 150, 150, 159, -23, 165, -86,
|
-100, -23, -23, -23, 150, 150, 159, -23, 165, -86,
|
||||||
-36, -23, 158, -99, 86, 163, -71, 162, 163, 163,
|
-36, -23, 158, -98, 86, 163, -71, 162, 163, 163,
|
||||||
157, -113, -19, 157, -113, 161, 86, 157, -21, -23,
|
157, -112, -19, 157, -112, 161, 86, 157, -21, -23,
|
||||||
164, 165, 164, 163, 9, 165, -38, -39, 164, -23,
|
164, 165, 164, 163, 9, 165, -38, -39, 164, -23,
|
||||||
-47, 31, -23, -125, 9, 105, 165, 162, 164, -79,
|
-47, 31, -23, -125, 9, 105, 165, 162, 164, -79,
|
||||||
-84, -34, -35, -104, -102, 30, 135, 136, -9, -33,
|
-84, -34, -35, -103, -101, 30, 135, 136, -9, -33,
|
||||||
-81, 132, -9, -80, 161, -89, -9, -23, -23, -73,
|
-81, 132, -9, -80, 161, -88, -9, -23, -23, -73,
|
||||||
-23, 165, 166, 162, -85, -23, 165, 17, -100, -23,
|
-23, 165, 166, 162, -85, -23, 165, 17, -99, -23,
|
||||||
37, 134, -99, 165, 166, 165, -69, 86, 89, 50,
|
37, 134, -98, 165, 166, 165, -69, 86, 89, 50,
|
||||||
88, 86, 162, 162, 69, 162, -23, 166, -85, -23,
|
88, 86, 162, 162, 69, 162, -23, 166, -85, -23,
|
||||||
-85, -52, -24, -23, -59, -52, -33, -125, 9, 165,
|
-85, -52, -24, -23, -59, -52, -33, -125, 9, 165,
|
||||||
165, 162, -125, 9, -23, 165, 162, 161, 157, -123,
|
165, 162, -125, 9, -23, 165, 162, 161, 157, -122,
|
||||||
-17, -20, -109, 161, 165, -25, -10, 31, -23, -119,
|
-17, -20, -108, 161, 165, -25, -10, 31, -23, -118,
|
||||||
-23, -76, 161, 31, -79, -23, 165, -31, -27, -32,
|
-23, -76, 161, 31, -79, -23, 165, -31, -27, -32,
|
||||||
37, 134, 69, -29, -10, 31, -115, -79, 165, 9,
|
37, 134, 69, -29, -10, 31, -114, -79, 165, 9,
|
||||||
-1, 37, -102, -81, 161, -89, 162, -40, -105, -106,
|
-1, 37, -101, -81, 161, -88, 162, -40, -104, -105,
|
||||||
120, -107, 123, -108, 81, 80, 79, 76, 77, 78,
|
120, -106, 123, -107, 81, 80, 79, 76, 77, 78,
|
||||||
-80, 9, 165, 165, 75, -10, 31, 162, 17, -23,
|
-80, 9, 165, 165, 75, -10, 31, 162, 17, -23,
|
||||||
-32, 164, 165, 166, 89, -23, 162, 166, 162, -81,
|
-32, 164, 165, 166, 89, -23, 162, 166, 162, -81,
|
||||||
165, -101, 165, -36, -122, -20, 161, -125, 9, -20,
|
165, -100, 165, -36, -121, -20, 161, -125, 9, -20,
|
||||||
-123, 163, -73, 165, 163, -82, 163, -82, 163, 165,
|
-122, 163, -73, 165, 163, -82, 163, -82, 163, 165,
|
||||||
163, 165, 15, -32, 164, -99, -73, -30, 117, 118,
|
163, 165, 15, -32, 164, -98, -73, -30, 117, 118,
|
||||||
165, -95, 120, -34, -2, 158, 161, -80, -87, -46,
|
165, -94, 120, -34, -2, 158, 161, -80, -123, -46,
|
||||||
88, 114, 113, -89, -108, 162, -9, -10, 31, 163,
|
88, 114, 113, -88, -107, 162, -9, -10, 31, 163,
|
||||||
-73, -23, -99, 166, 161, -125, 9, -122, 162, -17,
|
-73, -23, -98, 166, 161, -125, 9, -121, 162, -17,
|
||||||
-125, 98, 163, -119, 162, 108, 109, -82, 107, -82,
|
-125, 98, 163, -118, 162, 108, 109, -82, 107, -82,
|
||||||
-95, -28, -10, 31, -27, -99, 166, 104, 164, 161,
|
-94, -28, -10, 31, -27, -98, 166, 104, 164, 161,
|
||||||
-103, 31, -103, 164, 88, -80, 162, 163, 9, 17,
|
-102, 31, -102, 164, 88, -80, 162, 163, 9, 17,
|
||||||
-116, -88, -7, -3, -90, 163, 161, -73, 165, 162,
|
-115, -87, -7, -3, -89, 163, 161, -73, 165, 162,
|
||||||
-80, 162, -20, -125, 162, 163, 165, -23, -126, 31,
|
-80, 162, -20, -125, 162, 163, 165, -23, -126, 31,
|
||||||
163, 162, 163, 107, -103, -73, 165, 165, 163, -114,
|
163, 162, 163, 107, -102, -73, 165, 165, 163, -113,
|
||||||
-9, -73, 161, -104, 161, -96, -56, 88, 37, 17,
|
-9, -73, 161, -103, 161, -95, -56, 88, 37, 17,
|
||||||
162, -46, -23, 163, 9, 17, -7, 162, -94, -41,
|
162, -46, -23, 163, 9, 17, -7, 162, -93, -41,
|
||||||
-42, -43, -44, -45, -9, -7, 154, 86, 162, 162,
|
-42, -43, -44, -45, -9, -7, 154, 86, 162, 162,
|
||||||
-26, -10, 31, -126, -73, 163, 161, 102, -28, 88,
|
-26, -10, 31, -126, -73, 163, 161, 102, -28, 88,
|
||||||
35, 162, -73, -73, 165, 9, 88, -23, -88, -23,
|
35, 162, -73, -73, 165, 9, 88, -23, -87, -23,
|
||||||
164, 162, -41, 163, 163, 121, 105, 153, -73, -73,
|
164, 162, -41, 163, 163, 121, 105, 153, -73, -73,
|
||||||
-73, 163, 165, -9, 162, 162, -56, -79, -89, 86,
|
-73, 163, 165, -9, 162, 162, -56, -79, -88, 86,
|
||||||
-5, -108, -7, 100, 162, 161, 165, -7, 163, -73,
|
-5, -107, -7, 100, 162, 161, 165, -7, 163, -73,
|
||||||
-103, 162, -91, 163, 161, -73, 162,
|
-102, 162, -90, 163, 161, -73, 162,
|
||||||
}
|
}
|
||||||
var yyDef = [...]int{
|
var yyDef = [...]int{
|
||||||
|
|
||||||
@ -3476,7 +3476,7 @@ yydefault:
|
|||||||
yyDollar = yyS[yypt-3 : yypt+1]
|
yyDollar = yyS[yypt-3 : yypt+1]
|
||||||
//line parser/parser.y:671
|
//line parser/parser.y:671
|
||||||
{
|
{
|
||||||
yyVAL.node = yyDollar[2].node.Append(yyDollar[1].node)
|
yyVAL.node = stmt.NewPropertyList(yyDollar[1].node, yyDollar[2].list)
|
||||||
}
|
}
|
||||||
case 241:
|
case 241:
|
||||||
yyDollar = yyS[yypt-4 : yypt+1]
|
yyDollar = yyS[yypt-4 : yypt+1]
|
||||||
@ -3686,25 +3686,25 @@ yydefault:
|
|||||||
yyDollar = yyS[yypt-3 : yypt+1]
|
yyDollar = yyS[yypt-3 : yypt+1]
|
||||||
//line parser/parser.y:754
|
//line parser/parser.y:754
|
||||||
{
|
{
|
||||||
yyVAL.node = yyDollar[1].node.Append(yyDollar[3].node)
|
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
|
||||||
}
|
}
|
||||||
case 276:
|
case 276:
|
||||||
yyDollar = yyS[yypt-1 : yypt+1]
|
yyDollar = yyS[yypt-1 : yypt+1]
|
||||||
//line parser/parser.y:755
|
//line parser/parser.y:755
|
||||||
{
|
{
|
||||||
yyVAL.node = node.NewSimpleNode("PropertyList").Append(yyDollar[1].node)
|
yyVAL.list = []node.Node{yyDollar[1].node}
|
||||||
}
|
}
|
||||||
case 277:
|
case 277:
|
||||||
yyDollar = yyS[yypt-1 : yypt+1]
|
yyDollar = yyS[yypt-1 : yypt+1]
|
||||||
//line parser/parser.y:759
|
//line parser/parser.y:759
|
||||||
{
|
{
|
||||||
yyVAL.node = node.NewSimpleNode("Property").Attribute("name", yyDollar[1].token.String())
|
yyVAL.node = stmt.NewProperty(yyDollar[1].token, nil)
|
||||||
}
|
}
|
||||||
case 278:
|
case 278:
|
||||||
yyDollar = yyS[yypt-3 : yypt+1]
|
yyDollar = yyS[yypt-3 : yypt+1]
|
||||||
//line parser/parser.y:760
|
//line parser/parser.y:760
|
||||||
{
|
{
|
||||||
yyVAL.node = node.NewSimpleNode("Property").Attribute("name", yyDollar[1].token.String()).Append(node.NewSimpleNode("Default").Append(yyDollar[3].node))
|
yyVAL.node = stmt.NewProperty(yyDollar[1].token, yyDollar[3].node)
|
||||||
}
|
}
|
||||||
case 279:
|
case 279:
|
||||||
yyDollar = yyS[yypt-3 : yypt+1]
|
yyDollar = yyS[yypt-3 : yypt+1]
|
||||||
|
@ -203,7 +203,7 @@ func Parse(src io.Reader, fName string) node.Node {
|
|||||||
%type <node> alt_if_stmt switch_case_list static_var_list
|
%type <node> alt_if_stmt switch_case_list static_var_list
|
||||||
%type <node> unset_variables parameter_list class_statement_list
|
%type <node> unset_variables 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
|
||||||
%type <node> class_const_decl name_list trait_adaptations method_body
|
%type <node> class_const_decl name_list trait_adaptations method_body
|
||||||
%type <node> ctor_arguments alt_if_stmt_without_else trait_adaptation_list lexical_vars
|
%type <node> ctor_arguments alt_if_stmt_without_else trait_adaptation_list lexical_vars
|
||||||
%type <node> lexical_var_list
|
%type <node> lexical_var_list
|
||||||
@ -217,7 +217,7 @@ func Parse(src io.Reader, fName string) node.Node {
|
|||||||
%type <strings> class_modifiers
|
%type <strings> class_modifiers
|
||||||
%type <list> encaps_list backticks_expr namespace_name catch_name_list catch_list class_const_list
|
%type <list> encaps_list backticks_expr namespace_name catch_name_list catch_list class_const_list
|
||||||
%type <list> const_list echo_expr_list for_exprs non_empty_for_exprs global_var_list
|
%type <list> const_list echo_expr_list for_exprs non_empty_for_exprs global_var_list
|
||||||
%type <list> unprefixed_use_declarations inline_use_declarations
|
%type <list> unprefixed_use_declarations inline_use_declarations property_list
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
@ -668,7 +668,7 @@ class_statement_list:
|
|||||||
;
|
;
|
||||||
|
|
||||||
class_statement:
|
class_statement:
|
||||||
variable_modifiers property_list ';' { $$ = $2.Append($1) }
|
variable_modifiers property_list ';' { $$ = stmt.NewPropertyList($1, $2) }
|
||||||
| method_modifiers T_CONST class_const_list ';' { $$ = stmt.NewClassConst($2, $1.(node.SimpleNode).Children, $3); }
|
| method_modifiers T_CONST class_const_list ';' { $$ = stmt.NewClassConst($2, $1.(node.SimpleNode).Children, $3); }
|
||||||
| T_USE name_list trait_adaptations { $$ = node.NewSimpleNode("Use").Append($2).Append($3); }
|
| T_USE name_list trait_adaptations { $$ = node.NewSimpleNode("Use").Append($2).Append($3); }
|
||||||
| method_modifiers T_FUNCTION returns_ref identifier '(' parameter_list ')' return_type method_body
|
| method_modifiers T_FUNCTION returns_ref identifier '(' parameter_list ')' return_type method_body
|
||||||
@ -751,13 +751,13 @@ member_modifier:
|
|||||||
;
|
;
|
||||||
|
|
||||||
property_list:
|
property_list:
|
||||||
property_list ',' property { $$ = $1.Append($3) }
|
property_list ',' property { $$ = append($1, $3) }
|
||||||
| property { $$ = node.NewSimpleNode("PropertyList").Append($1) }
|
| property { $$ = []node.Node{$1} }
|
||||||
;
|
;
|
||||||
|
|
||||||
property:
|
property:
|
||||||
T_VARIABLE { $$ = node.NewSimpleNode("Property").Attribute("name", $1.String()) }
|
T_VARIABLE { $$ = stmt.NewProperty($1, nil) }
|
||||||
| T_VARIABLE '=' expr { $$ = node.NewSimpleNode("Property").Attribute("name", $1.String()).Append(node.NewSimpleNode("Default").Append($3)) }
|
| T_VARIABLE '=' expr { $$ = stmt.NewProperty($1, $3) }
|
||||||
;
|
;
|
||||||
|
|
||||||
class_const_list:
|
class_const_list:
|
||||||
|
Loading…
Reference in New Issue
Block a user