golbal node

This commit is contained in:
vadim 2017-12-07 18:45:45 +02:00
parent 280ca04b50
commit 9e73d2b162
3 changed files with 131 additions and 97 deletions

34
node/stmt/global.go Normal file
View File

@ -0,0 +1,34 @@
package stmt
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/token"
)
type Global struct {
node.SimpleNode
token token.Token
vars []node.Node
}
func NewGlobal(token token.Token, vars []node.Node) node.Node {
return Global{
node.SimpleNode{Name: "Global", Attributes: make(map[string]string)},
token,
vars,
}
}
func (n Global) 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.vars != nil {
fmt.Fprintf(out, "\n%vvars:", indent+" ")
for _, nn := range n.vars {
nn.Print(out, indent+" ")
}
}
}

View File

@ -596,15 +596,15 @@ var yyAct = [...]int{
775, 776, 715, 254, 641, 224, 1, 766, 420, 769, 775, 776, 715, 254, 641, 224, 1, 766, 420, 769,
718, 669, 767, 633, 792, 544, 762, 544, 780, 628, 718, 669, 767, 633, 792, 544, 762, 544, 780, 628,
784, 777, 765, 779, 564, 554, 773, 409, 770, 782, 784, 777, 765, 779, 564, 554, 773, 409, 770, 782,
807, 321, 278, 255, 256, 148, 795, 687, 688, 689, 807, 141, 278, 255, 256, 321, 795, 687, 688, 689,
686, 685, 684, 800, 116, 666, 817, 609, 829, 785, 686, 685, 684, 148, 116, 800, 817, 609, 666, 785,
229, 250, 812, 824, 810, 825, 37, 254, 231, 681, 229, 829, 812, 824, 810, 825, 250, 254, 231, 37,
679, 831, 281, 254, 659, 544, 255, 256, 251, 803, 681, 831, 281, 254, 659, 544, 255, 256, 251, 803,
842, 678, 221, 830, 223, 813, 578, 846, 833, 835, 842, 679, 678, 830, 221, 813, 578, 846, 833, 223,
855, 680, 841, 607, 682, 610, 608, 197, 199, 198, 855, 680, 841, 607, 682, 610, 608, 197, 199, 198,
864, 854, 848, 576, 577, 163, 165, 166, 42, 178, 864, 854, 835, 576, 577, 163, 165, 166, 848, 178,
863, 912, 804, 748, 872, 529, 873, 570, 868, 41, 863, 42, 912, 804, 872, 748, 873, 529, 868, 570,
877, 164, 133, 365, 861, 111, 879, 144, 141, 651, 877, 164, 133, 41, 861, 111, 879, 365, 144, 651,
255, 256, 855, 676, 782, 878, 255, 256, 882, 15, 255, 256, 855, 676, 782, 878, 255, 256, 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,
@ -1362,11 +1362,11 @@ var yyPgo = [...]int{
889, 887, 111, 98, 197, 886, 883, 882, 8, 880, 889, 887, 111, 98, 197, 886, 883, 882, 8, 880,
81, 43, 877, 55, 47, 876, 875, 874, 867, 866, 81, 43, 877, 55, 47, 876, 875, 874, 867, 866,
97, 862, 861, 103, 549, 1, 860, 859, 849, 848, 97, 862, 861, 103, 549, 1, 860, 859, 849, 848,
847, 843, 7, 19, 38, 24, 839, 837, 83, 835, 847, 7, 19, 38, 24, 843, 839, 83, 837, 835,
833, 10, 4, 832, 831, 86, 828, 822, 18, 809, 10, 4, 833, 832, 86, 831, 828, 18, 822, 809,
804, 802, 44, 42, 32, 41, 2, 16, 801, 790, 804, 44, 42, 32, 41, 2, 16, 802, 801, 790,
789, 5, 712, 786, 589, 781, 28, 778, 775, 773, 5, 712, 789, 589, 786, 28, 781, 778, 775, 90,
90, 765, 31, 761, 736, 37, 12, 773, 31, 765, 761, 736, 37, 12,
} }
var yyR1 = [...]int{ var yyR1 = [...]int{
@ -1378,27 +1378,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, 73, 73, 6, 6, 6, 6, 6, 6, 7, 7, 73, 73,
116, 116, 9, 9, 9, 8, 8, 8, 8, 8, 115, 115, 9, 9, 9, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 112, 8, 8, 8, 8, 8, 8, 8, 8, 8, 111,
112, 16, 16, 19, 19, 125, 125, 17, 17, 22, 111, 16, 16, 19, 19, 125, 125, 17, 17, 22,
22, 74, 74, 18, 18, 21, 21, 20, 20, 120, 22, 74, 74, 18, 18, 21, 21, 20, 20, 119,
120, 75, 75, 24, 24, 24, 24, 24, 24, 10, 119, 75, 75, 24, 24, 24, 24, 24, 24, 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, 118, 118, 117, 117, 32, 32, 81, 10, 10, 10, 117, 117, 116, 116, 32, 32, 80,
81, 33, 11, 1, 1, 2, 2, 12, 12, 113, 80, 33, 11, 1, 1, 2, 2, 12, 12, 112,
113, 4, 4, 13, 14, 35, 35, 15, 15, 84, 112, 4, 4, 13, 14, 35, 35, 15, 15, 83,
84, 29, 29, 29, 29, 28, 28, 30, 30, 31, 83, 29, 29, 29, 29, 28, 28, 30, 30, 31,
31, 78, 78, 78, 78, 85, 85, 85, 126, 126, 31, 78, 78, 78, 78, 84, 84, 84, 126, 126,
27, 27, 86, 86, 76, 76, 96, 96, 77, 77, 27, 27, 85, 85, 76, 76, 95, 95, 77, 77,
82, 82, 87, 87, 36, 36, 37, 37, 107, 107, 81, 81, 86, 86, 36, 36, 37, 37, 106, 106,
105, 105, 105, 106, 106, 88, 88, 89, 89, 38, 104, 104, 104, 105, 105, 87, 87, 88, 88, 38,
38, 79, 79, 40, 80, 80, 41, 41, 83, 83, 38, 123, 123, 40, 79, 79, 41, 41, 82, 82,
42, 42, 42, 42, 92, 92, 93, 93, 93, 97, 42, 42, 42, 42, 91, 91, 92, 92, 92, 96,
97, 43, 43, 44, 45, 45, 45, 45, 47, 47, 96, 43, 43, 44, 45, 45, 45, 45, 47, 47,
46, 94, 94, 108, 108, 109, 109, 110, 110, 111, 46, 93, 93, 107, 107, 108, 108, 109, 109, 110,
111, 111, 111, 111, 111, 90, 90, 48, 48, 119, 110, 110, 110, 110, 110, 89, 89, 48, 48, 118,
119, 91, 23, 121, 121, 49, 122, 122, 123, 123, 118, 90, 23, 120, 120, 49, 121, 121, 122, 122,
51, 50, 50, 39, 39, 39, 39, 39, 39, 39, 51, 50, 50, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
@ -1407,18 +1407,18 @@ var yyR1 = [...]int{
39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 3, 39, 39, 39, 39, 39, 39, 39, 39, 39, 3,
3, 98, 98, 99, 99, 58, 58, 59, 59, 59, 3, 97, 97, 98, 98, 58, 58, 59, 59, 59,
59, 52, 52, 53, 53, 56, 56, 115, 115, 115, 59, 52, 52, 53, 53, 56, 56, 114, 114, 114,
95, 95, 63, 63, 63, 57, 57, 57, 57, 57, 94, 94, 63, 63, 63, 57, 57, 57, 57, 57,
57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
57, 64, 64, 64, 25, 25, 26, 26, 62, 65, 57, 64, 64, 64, 25, 25, 26, 26, 62, 65,
65, 65, 66, 66, 66, 67, 67, 67, 67, 67, 65, 65, 66, 66, 66, 67, 67, 67, 67, 67,
67, 34, 34, 34, 54, 54, 54, 68, 68, 69, 67, 34, 34, 34, 54, 54, 54, 68, 68, 69,
69, 69, 69, 69, 69, 60, 60, 60, 61, 61, 69, 69, 69, 69, 69, 60, 60, 60, 61, 61,
61, 102, 103, 103, 101, 101, 100, 100, 100, 100, 61, 101, 102, 102, 100, 100, 99, 99, 99, 99,
100, 100, 114, 114, 114, 114, 70, 70, 70, 70, 99, 99, 113, 113, 113, 113, 70, 70, 70, 70,
70, 70, 70, 71, 71, 71, 71, 55, 55, 55, 70, 70, 70, 71, 71, 71, 71, 55, 55, 55,
55, 55, 55, 55, 72, 72, 104, 55, 55, 55, 55, 72, 72, 103,
} }
var yyR2 = [...]int{ var yyR2 = [...]int{
@ -1477,18 +1477,18 @@ var yyChk = [...]int{
-1000, -124, -73, -8, -10, -11, -12, -13, -14, 127, -1000, -124, -73, -8, -10, -11, -12, -13, -14, 127,
154, 120, 114, 161, -76, -77, 97, 96, 99, 106, 154, 120, 114, 161, -76, -77, 97, 96, 99, 106,
110, 111, 115, 122, 76, 95, 90, -25, 124, 101, 110, 111, 115, 122, 76, 95, 90, -25, 124, 101,
103, 165, 116, 119, 112, 86, 113, -113, 128, 129, 103, 165, 116, 119, 112, 86, 113, -112, 128, 129,
130, -86, -96, -34, -39, -4, 83, -67, -68, -65, 130, -85, -95, -34, -39, -4, 83, -67, -68, -65,
134, 69, 71, 58, 59, 49, 50, 55, 57, 163, 134, 69, 71, 58, 59, 49, 50, 55, 57, 163,
-50, -55, 60, 61, 62, 63, 64, 65, 66, 82, -50, -55, 60, 61, 62, 63, 64, 65, 66, 82,
67, -57, 160, 13, 14, 16, 77, 78, -54, -64, 67, -57, 160, 13, 14, 16, 77, 78, -54, -64,
-59, -52, -62, -63, 70, 125, 126, 4, 5, 6, -59, -52, -62, -63, 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, -66, 135, 94, 155, 137, 149, 159, 88, 167, -9, -66, 135, 94,
-116, 157, 163, 157, -116, 161, 86, -19, -112, -74, -115, 157, 163, 157, -115, 161, 86, -19, -111, -74,
-116, 157, 113, 114, -20, -21, -120, -23, 86, -75, -115, 157, 113, 114, -20, -21, -119, -23, 86, -75,
163, -10, 113, 154, 163, 163, -26, -25, 76, -26, 163, -10, 113, 154, 163, 163, -26, -25, 76, -26,
-26, -79, -40, -54, -80, 113, -41, 88, -121, -49, -26, -123, -40, -54, -79, 113, -41, 88, -120, -49,
-25, 165, 33, 34, 10, 12, 11, 35, 37, 36, -25, 165, 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,
@ -1496,26 +1496,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, 163, 69, 161, 133, 163, 26, 27, 28, 58, 59, 163, 69, 161, 133, 163,
-102, -101, -103, -100, -25, 37, 134, -25, -34, -64, -101, -100, -102, -99, -25, 37, 134, -25, -34, -64,
163, -63, 76, 69, -34, -25, -25, -25, -25, -25, 163, -63, 76, 69, -34, -25, -25, -25, -25, -25,
-25, -25, -25, -25, -25, -25, -25, -56, 163, -25, -25, -25, -25, -25, -25, -25, -25, -56, 163, -25,
-115, 93, -114, -70, 88, 151, 152, -25, -25, -25, -114, 93, -113, -70, 88, 151, 152, -25, -25, -25,
69, 153, 153, -53, -51, -52, -69, 128, -9, -54, 69, 153, 153, -53, -51, -52, -69, 128, -9, -54,
163, 163, -25, -25, 163, -25, -25, 93, 150, -114, 163, 163, -25, -25, 163, -25, -25, 93, 150, -113,
-114, 93, 161, -54, -88, 163, -88, 163, 157, -116, -113, 93, 161, -54, -87, 163, -87, 163, 157, -115,
164, -116, 165, 161, -73, 165, -16, -74, -116, 157, 164, -115, 165, 161, -73, 165, -16, -74, -115, 157,
165, 9, 157, 105, -116, -21, 165, 9, 17, -24, 165, 9, 157, 105, -115, -21, 165, 9, 17, -24,
162, -10, -11, -12, -13, -14, 127, -25, 97, -3, 162, -10, -11, -12, -13, -14, 127, -25, 97, -3,
-122, -123, -25, -25, 165, 165, 165, 165, 9, 165, -121, -122, -25, -25, 165, 165, 165, 165, 9, 165,
9, -3, 17, 165, 9, -25, -25, -25, -25, -25, 9, -3, 17, 165, 9, -25, -25, -25, -25, -25,
-25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
-25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
-25, -53, -25, 31, -25, -81, -33, -34, -25, -120, -25, -53, -25, 31, -25, -80, -33, -34, -25, -119,
-75, 165, 165, 86, 163, 86, -35, 131, 161, -15, -75, 165, 165, 86, 163, 86, -35, 131, 161, -15,
131, 163, -10, 163, 165, 31, -25, 37, -25, -25, 131, 163, -10, 163, 165, 31, -25, 37, -25, -25,
-25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
-25, -26, -25, -61, 86, 161, -54, -102, 166, 9, -25, -26, -25, -61, 86, 161, -54, -101, 166, 9,
15, -34, 163, -25, -102, 164, -26, 160, -70, -70, 15, -34, 163, -25, -101, 164, -26, 160, -70, -70,
93, 69, 133, -25, 87, -34, 15, -26, -60, -7, 93, 69, 133, -25, 87, -34, 15, -26, -60, -7,
-54, 161, 86, -6, -5, 76, 77, 78, 79, 80, -54, 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,
@ -1525,47 +1525,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, -60, -7, 137, 138, 140, 139, 141, 142, 156, 155, -60, -7,
-54, -95, -88, 153, 69, 161, 133, 153, -95, -72, -54, -94, -87, 153, 69, 161, 133, 153, -94, -72,
-104, -25, -25, -25, 150, 150, 159, -25, 164, -89, -103, -25, -25, -25, 150, 150, 159, -25, 164, -88,
-38, -25, 158, -102, 86, 165, -73, 162, 165, 165, -38, -25, 158, -101, 86, 165, -73, 162, 165, 165,
157, -116, -20, 157, -116, 161, 86, 157, -23, -25, 157, -115, -20, 157, -115, 161, 86, 157, -23, -25,
163, 164, 163, 165, 9, 164, -40, -41, 163, -25, 163, 164, 163, 165, 9, 164, -40, -41, 163, -25,
-49, 31, -25, -125, 9, 105, 164, 162, 163, -82, -49, 31, -25, -125, 9, 105, 164, 162, 163, -81,
-87, -36, -37, -107, -105, 30, 135, 136, -9, -35, -86, -36, -37, -106, -104, 30, 135, 136, -9, -35,
-84, 132, -9, -83, 161, -92, -9, -25, -25, -75, -83, 132, -9, -82, 161, -91, -9, -25, -25, -75,
-25, 164, 166, 162, -88, -25, 164, 17, -103, -25, -25, 164, 166, 162, -87, -25, 164, 17, -102, -25,
37, 134, -102, 164, 166, 164, -71, 86, 89, 50, 37, 134, -101, 164, 166, 164, -71, 86, 89, 50,
88, 86, 162, 162, 69, 162, -25, 166, -88, -25, 88, 86, 162, 162, 69, 162, -25, 166, -87, -25,
-88, -54, -26, -25, -61, -54, -35, -125, 9, 164, -87, -54, -26, -25, -61, -54, -35, -125, 9, 164,
164, 162, -125, 9, -25, 164, 162, 161, 157, -17, 164, 162, -125, 9, -25, 164, 162, 161, 157, -17,
-18, -21, -112, 161, 164, -27, -10, 31, -25, -122, -18, -21, -111, 161, 164, -27, -10, 31, -25, -121,
-25, -78, 161, 31, -82, -25, 164, -33, -29, -34, -25, -78, 161, 31, -81, -25, 164, -33, -29, -34,
37, 134, 69, -31, -10, 31, -118, -82, 164, 9, 37, 134, 69, -31, -10, 31, -117, -81, 164, 9,
-1, 37, -105, -84, 161, -92, 162, -42, -108, -109, -1, 37, -104, -83, 161, -91, 162, -42, -107, -108,
120, -110, 123, -111, 81, 80, 79, 76, 77, 78, 120, -109, 123, -110, 81, 80, 79, 76, 77, 78,
-83, 9, 164, 164, 75, -10, 31, 162, 17, -25, -82, 9, 164, 164, 75, -10, 31, 162, 17, -25,
-34, 163, 164, 166, 89, -25, 162, 166, 162, -84, -34, 163, 164, 166, 89, -25, 162, 166, 162, -83,
164, -104, 164, -38, -22, -21, 161, -125, 9, -21, 164, -103, 164, -38, -22, -21, 161, -125, 9, -21,
-17, 165, -75, 164, 165, -85, 165, -85, 165, 164, -17, 165, -75, 164, 165, -84, 165, -84, 165, 164,
165, 164, 15, -34, 163, -102, -75, -32, 117, 118, 165, 164, 15, -34, 163, -101, -75, -32, 117, 118,
164, -98, 120, -36, -2, 158, 161, -83, -90, -48, 164, -97, 120, -36, -2, 158, 161, -82, -89, -48,
88, 114, 113, -92, -111, 162, -9, -10, 31, 165, 88, 114, 113, -91, -110, 162, -9, -10, 31, 165,
-75, -25, -102, 166, 161, -125, 9, -22, 162, -18, -75, -25, -101, 166, 161, -125, 9, -22, 162, -18,
-125, 98, 165, -122, 162, 108, 109, -85, 107, -85, -125, 98, 165, -121, 162, 108, 109, -84, 107, -84,
-98, -30, -10, 31, -29, -102, 166, 104, 163, 161, -97, -30, -10, 31, -29, -101, 166, 104, 163, 161,
-106, 31, -106, 163, 88, -83, 162, 165, 9, 17, -105, 31, -105, 163, 88, -82, 162, 165, 9, 17,
-119, -91, -7, -3, -93, 165, 161, -75, 164, 162, -118, -90, -7, -3, -92, 165, 161, -75, 164, 162,
-83, 162, -21, -125, 162, 165, 164, -25, -126, 31, -82, 162, -21, -125, 162, 165, 164, -25, -126, 31,
165, 162, 165, 107, -106, -75, 164, 164, 165, -117, 165, 162, 165, 107, -105, -75, 164, 164, 165, -116,
-9, -75, 161, -107, 161, -99, -58, 88, 37, 17, -9, -75, 161, -106, 161, -98, -58, 88, 37, 17,
162, -48, -25, 165, 9, 17, -7, 162, -97, -43, 162, -48, -25, 165, 9, 17, -7, 162, -96, -43,
-44, -45, -46, -47, -9, -7, 154, 86, 162, 162, -44, -45, -46, -47, -9, -7, 154, 86, 162, 162,
-28, -10, 31, -126, -75, 165, 161, 102, -30, 88, -28, -10, 31, -126, -75, 165, 161, 102, -30, 88,
35, 162, -75, -75, 164, 9, 88, -25, -91, -25, 35, 162, -75, -75, 164, 9, 88, -25, -90, -25,
163, 162, -43, 165, 165, 121, 105, 153, -75, -75, 163, 162, -43, 165, 165, 121, 105, 153, -75, -75,
-75, 165, 164, -9, 162, 162, -58, -82, -92, 86, -75, 165, 164, -9, 162, 162, -58, -81, -91, 86,
-5, -111, -7, 100, 162, 161, 164, -7, 165, -75, -5, -110, -7, 100, 162, 161, 164, -7, 165, -75,
-106, 162, -94, 165, 161, -75, 162, -105, 162, -93, 165, 161, -75, 162,
} }
var yyDef = [...]int{ var yyDef = [...]int{
@ -2858,7 +2858,7 @@ yydefault:
yyDollar = yyS[yypt-3 : yypt+1] yyDollar = yyS[yypt-3 : yypt+1]
//line parser/parser.y:372 //line parser/parser.y:372
{ {
yyVAL.node = yyDollar[2].node yyVAL.node = stmt.NewGlobal(yyDollar[1].token, yyDollar[2].list)
} }
case 140: case 140:
yyDollar = yyS[yypt-3 : yypt+1] yyDollar = yyS[yypt-3 : yypt+1]
@ -3417,13 +3417,13 @@ yydefault:
yyDollar = yyS[yypt-3 : yypt+1] yyDollar = yyS[yypt-3 : yypt+1]
//line parser/parser.y:639 //line parser/parser.y:639
{ {
yyVAL.node = yyDollar[1].node.Append(yyDollar[3].node) yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
} }
case 232: case 232:
yyDollar = yyS[yypt-1 : yypt+1] yyDollar = yyS[yypt-1 : yypt+1]
//line parser/parser.y:640 //line parser/parser.y:640
{ {
yyVAL.node = node.NewSimpleNode("GlobalVarList").Append(yyDollar[1].node) yyVAL.list = []node.Node{yyDollar[1].node}
} }
case 233: case 233:
yyDollar = yyS[yypt-1 : yypt+1] yyDollar = yyS[yypt-1 : yypt+1]

View File

@ -198,7 +198,7 @@ func Parse(src io.Reader, fName string) node.Node {
%type <node> callable_expr callable_variable static_member new_variable %type <node> callable_expr callable_variable static_member new_variable
%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 inner_statement_list if_stmt %type <node> top_statement_list use_declarations inner_statement_list if_stmt
%type <node> alt_if_stmt switch_case_list global_var_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 property_list
@ -214,7 +214,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 %type <list> const_list echo_expr_list for_exprs non_empty_for_exprs global_var_list
%% %%
@ -369,7 +369,7 @@ statement:
| T_BREAK optional_expr ';' { $$ = stmt.NewBreak($1, $2) } | T_BREAK optional_expr ';' { $$ = stmt.NewBreak($1, $2) }
| T_CONTINUE optional_expr ';' { $$ = stmt.NewContinue($1, $2) } | T_CONTINUE optional_expr ';' { $$ = stmt.NewContinue($1, $2) }
| T_RETURN optional_expr ';' { $$ = node.NewSimpleNode("Return").Append($2) } | T_RETURN optional_expr ';' { $$ = node.NewSimpleNode("Return").Append($2) }
| T_GLOBAL global_var_list ';' { $$ = $2; } | T_GLOBAL global_var_list ';' { $$ = stmt.NewGlobal($1, $2) }
| T_STATIC static_var_list ';' { $$ = $2; } | T_STATIC static_var_list ';' { $$ = $2; }
| T_ECHO echo_expr_list ';' { $$ = stmt.NewEcho($1, $2) } | T_ECHO echo_expr_list ';' { $$ = stmt.NewEcho($1, $2) }
| T_INLINE_HTML { $$ = node.NewSimpleNode("Echo").Append(node.NewSimpleNode("InlineHtml").Attribute("value", $1.String())) } | T_INLINE_HTML { $$ = node.NewSimpleNode("Echo").Append(node.NewSimpleNode("InlineHtml").Attribute("value", $1.String())) }
@ -636,8 +636,8 @@ argument:
; ;
global_var_list: global_var_list:
global_var_list ',' global_var { $$ = $1.Append($3); } global_var_list ',' global_var { $$ = append($1, $3); }
| global_var { $$ = node.NewSimpleNode("GlobalVarList").Append($1); } | global_var { $$ = []node.Node{$1} }
; ;
global_var: global_var: