Skip to content

Commit 0f5f5e7

Browse files
committed
refactoring: update ast structure of "ArrayItem" node
1 parent 8bf1fa8 commit 0f5f5e7

File tree

10 files changed

+228
-271
lines changed

10 files changed

+228
-271
lines changed

internal/php5/parser_test.go

+52-68
Original file line numberDiff line numberDiff line change
@@ -30786,61 +30786,53 @@ func TestExprArray_Items(t *testing.T) {
3078630786
StartPos: 15,
3078730787
EndPos: 18,
3078830788
},
30789-
Val: &ast.ExprReference{
30789+
AmpersandTkn: &token.Token{
30790+
ID: token.ID(38),
30791+
Value: []byte("&"),
3079030792
Position: &position.Position{
3079130793
StartLine: 1,
3079230794
EndLine: 1,
3079330795
StartPos: 15,
30794-
EndPos: 18,
30796+
EndPos: 16,
3079530797
},
30796-
AmpersandTkn: &token.Token{
30797-
ID: token.ID(38),
30798-
Value: []byte("&"),
30799-
Position: &position.Position{
30800-
StartLine: 1,
30801-
EndLine: 1,
30802-
StartPos: 15,
30803-
EndPos: 16,
30804-
},
30805-
FreeFloating: []*token.Token{
30806-
{
30807-
ID: token.T_WHITESPACE,
30808-
Value: []byte(" "),
30809-
Position: &position.Position{
30810-
StartLine: 1,
30811-
EndLine: 1,
30812-
StartPos: 14,
30813-
EndPos: 15,
30814-
},
30798+
FreeFloating: []*token.Token{
30799+
{
30800+
ID: token.T_WHITESPACE,
30801+
Value: []byte(" "),
30802+
Position: &position.Position{
30803+
StartLine: 1,
30804+
EndLine: 1,
30805+
StartPos: 14,
30806+
EndPos: 15,
3081530807
},
3081630808
},
3081730809
},
30818-
Var: &ast.ExprVariable{
30810+
},
30811+
Val: &ast.ExprVariable{
30812+
Position: &position.Position{
30813+
StartLine: 1,
30814+
EndLine: 1,
30815+
StartPos: 16,
30816+
EndPos: 18,
30817+
},
30818+
VarName: &ast.Identifier{
3081930819
Position: &position.Position{
3082030820
StartLine: 1,
3082130821
EndLine: 1,
3082230822
StartPos: 16,
3082330823
EndPos: 18,
3082430824
},
30825-
VarName: &ast.Identifier{
30825+
IdentifierTkn: &token.Token{
30826+
ID: token.T_VARIABLE,
30827+
Value: []byte("$b"),
3082630828
Position: &position.Position{
3082730829
StartLine: 1,
3082830830
EndLine: 1,
3082930831
StartPos: 16,
3083030832
EndPos: 18,
3083130833
},
30832-
IdentifierTkn: &token.Token{
30833-
ID: token.T_VARIABLE,
30834-
Value: []byte("$b"),
30835-
Position: &position.Position{
30836-
StartLine: 1,
30837-
EndLine: 1,
30838-
StartPos: 16,
30839-
EndPos: 18,
30840-
},
30841-
},
30842-
Value: []byte("$b"),
3084330834
},
30835+
Value: []byte("$b"),
3084430836
},
3084530837
},
3084630838
},
@@ -39025,61 +39017,53 @@ func TestExprShortArray_Items(t *testing.T) {
3902539017
StartPos: 10,
3902639018
EndPos: 13,
3902739019
},
39028-
Val: &ast.ExprReference{
39020+
AmpersandTkn: &token.Token{
39021+
ID: token.ID(38),
39022+
Value: []byte("&"),
3902939023
Position: &position.Position{
3903039024
StartLine: 1,
3903139025
EndLine: 1,
3903239026
StartPos: 10,
39033-
EndPos: 13,
39027+
EndPos: 11,
3903439028
},
39035-
AmpersandTkn: &token.Token{
39036-
ID: token.ID(38),
39037-
Value: []byte("&"),
39038-
Position: &position.Position{
39039-
StartLine: 1,
39040-
EndLine: 1,
39041-
StartPos: 10,
39042-
EndPos: 11,
39043-
},
39044-
FreeFloating: []*token.Token{
39045-
{
39046-
ID: token.T_WHITESPACE,
39047-
Value: []byte(" "),
39048-
Position: &position.Position{
39049-
StartLine: 1,
39050-
EndLine: 1,
39051-
StartPos: 9,
39052-
EndPos: 10,
39053-
},
39029+
FreeFloating: []*token.Token{
39030+
{
39031+
ID: token.T_WHITESPACE,
39032+
Value: []byte(" "),
39033+
Position: &position.Position{
39034+
StartLine: 1,
39035+
EndLine: 1,
39036+
StartPos: 9,
39037+
EndPos: 10,
3905439038
},
3905539039
},
3905639040
},
39057-
Var: &ast.ExprVariable{
39041+
},
39042+
Val: &ast.ExprVariable{
39043+
Position: &position.Position{
39044+
StartLine: 1,
39045+
EndLine: 1,
39046+
StartPos: 11,
39047+
EndPos: 13,
39048+
},
39049+
VarName: &ast.Identifier{
3905839050
Position: &position.Position{
3905939051
StartLine: 1,
3906039052
EndLine: 1,
3906139053
StartPos: 11,
3906239054
EndPos: 13,
3906339055
},
39064-
VarName: &ast.Identifier{
39056+
IdentifierTkn: &token.Token{
39057+
ID: token.T_VARIABLE,
39058+
Value: []byte("$b"),
3906539059
Position: &position.Position{
3906639060
StartLine: 1,
3906739061
EndLine: 1,
3906839062
StartPos: 11,
3906939063
EndPos: 13,
3907039064
},
39071-
IdentifierTkn: &token.Token{
39072-
ID: token.T_VARIABLE,
39073-
Value: []byte("$b"),
39074-
Position: &position.Position{
39075-
StartLine: 1,
39076-
EndLine: 1,
39077-
StartPos: 11,
39078-
EndPos: 13,
39079-
},
39080-
},
39081-
Value: []byte("$b"),
3908239065
},
39066+
Value: []byte("$b"),
3908339067
},
3908439068
},
3908539069
},

0 commit comments

Comments
 (0)