[refactoring] update ast structure of "Switch", "Case", "Default" nodes; remove "CaseList" node

This commit is contained in:
Vadym Slizov
2020-09-06 12:45:08 +03:00
parent 0e73cd8852
commit f6cb2bff4d
21 changed files with 1882 additions and 2254 deletions

View File

@@ -10226,78 +10226,68 @@ func TestStmtSwitch(t *testing.T) {
},
Value: []byte("1"),
},
CaseList: &ast.StmtCaseList{
Node: ast.Node{
Position: &position.Position{
StartLine: 2,
EndLine: 5,
StartPos: 17,
EndPos: 58,
CaseList: []ast.Vertex{
&ast.StmtCase{
Node: ast.Node{
Position: &position.Position{
StartLine: 3,
EndLine: 3,
StartPos: 22,
EndPos: 36,
},
},
},
Cases: []ast.Vertex{
&ast.StmtCase{
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
StartLine: 3,
EndLine: 3,
StartPos: 22,
EndPos: 36,
StartPos: 27,
EndPos: 28,
},
},
Cond: &ast.ScalarLnumber{
Value: []byte("1"),
},
Stmts: []ast.Vertex{
&ast.StmtBreak{
Node: ast.Node{
Position: &position.Position{
StartLine: 3,
EndLine: 3,
StartPos: 27,
EndPos: 28,
},
},
Value: []byte("1"),
},
Stmts: []ast.Vertex{
&ast.StmtBreak{
Node: ast.Node{
Position: &position.Position{
StartLine: 3,
EndLine: 3,
StartPos: 30,
EndPos: 36,
},
StartPos: 30,
EndPos: 36,
},
},
},
},
&ast.StmtCase{
},
&ast.StmtCase{
Node: ast.Node{
Position: &position.Position{
StartLine: 4,
EndLine: 4,
StartPos: 40,
EndPos: 54,
},
},
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
StartLine: 4,
EndLine: 4,
StartPos: 40,
EndPos: 54,
StartPos: 45,
EndPos: 46,
},
},
Cond: &ast.ScalarLnumber{
Value: []byte("2"),
},
Stmts: []ast.Vertex{
&ast.StmtBreak{
Node: ast.Node{
Position: &position.Position{
StartLine: 4,
EndLine: 4,
StartPos: 45,
EndPos: 46,
},
},
Value: []byte("2"),
},
Stmts: []ast.Vertex{
&ast.StmtBreak{
Node: ast.Node{
Position: &position.Position{
StartLine: 4,
EndLine: 4,
StartPos: 48,
EndPos: 54,
},
StartPos: 48,
EndPos: 54,
},
},
},
@@ -10355,78 +10345,68 @@ func TestStmtSwitch_Semicolon(t *testing.T) {
},
Value: []byte("1"),
},
CaseList: &ast.StmtCaseList{
Node: ast.Node{
Position: &position.Position{
StartLine: 2,
EndLine: 5,
StartPos: 17,
EndPos: 59,
CaseList: []ast.Vertex{
&ast.StmtCase{
Node: ast.Node{
Position: &position.Position{
StartLine: 3,
EndLine: 3,
StartPos: 23,
EndPos: 37,
},
},
},
Cases: []ast.Vertex{
&ast.StmtCase{
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
StartLine: 3,
EndLine: 3,
StartPos: 23,
EndPos: 37,
StartPos: 28,
EndPos: 29,
},
},
Cond: &ast.ScalarLnumber{
Value: []byte("1"),
},
Stmts: []ast.Vertex{
&ast.StmtBreak{
Node: ast.Node{
Position: &position.Position{
StartLine: 3,
EndLine: 3,
StartPos: 28,
EndPos: 29,
},
},
Value: []byte("1"),
},
Stmts: []ast.Vertex{
&ast.StmtBreak{
Node: ast.Node{
Position: &position.Position{
StartLine: 3,
EndLine: 3,
StartPos: 31,
EndPos: 37,
},
StartPos: 31,
EndPos: 37,
},
},
},
},
&ast.StmtCase{
},
&ast.StmtCase{
Node: ast.Node{
Position: &position.Position{
StartLine: 4,
EndLine: 4,
StartPos: 41,
EndPos: 55,
},
},
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
StartLine: 4,
EndLine: 4,
StartPos: 41,
EndPos: 55,
StartPos: 46,
EndPos: 47,
},
},
Cond: &ast.ScalarLnumber{
Value: []byte("2"),
},
Stmts: []ast.Vertex{
&ast.StmtBreak{
Node: ast.Node{
Position: &position.Position{
StartLine: 4,
EndLine: 4,
StartPos: 46,
EndPos: 47,
},
},
Value: []byte("2"),
},
Stmts: []ast.Vertex{
&ast.StmtBreak{
Node: ast.Node{
Position: &position.Position{
StartLine: 4,
EndLine: 4,
StartPos: 49,
EndPos: 55,
},
StartPos: 49,
EndPos: 55,
},
},
},
@@ -10465,7 +10445,7 @@ func TestStmtSwitch_Alt(t *testing.T) {
},
},
Stmts: []ast.Vertex{
&ast.StmtAltSwitch{
&ast.StmtSwitch{
Node: ast.Node{
Position: &position.Position{
StartLine: 2,
@@ -10474,6 +10454,7 @@ func TestStmtSwitch_Alt(t *testing.T) {
EndPos: 65,
},
},
Alt: true,
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
@@ -10485,71 +10466,61 @@ func TestStmtSwitch_Alt(t *testing.T) {
},
Value: []byte("1"),
},
CaseList: &ast.StmtCaseList{
Node: ast.Node{
Position: &position.Position{
StartLine: 3,
EndLine: -1,
StartPos: 22,
EndPos: -1,
CaseList: []ast.Vertex{
&ast.StmtCase{
Node: ast.Node{
Position: &position.Position{
StartLine: 3,
EndLine: -1,
StartPos: 22,
EndPos: -1,
},
},
},
Cases: []ast.Vertex{
&ast.StmtCase{
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
StartLine: 3,
EndLine: -1,
StartPos: 22,
EndPos: -1,
EndLine: 3,
StartPos: 27,
EndPos: 28,
},
},
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
StartLine: 3,
EndLine: 3,
StartPos: 27,
EndPos: 28,
},
},
Value: []byte("1"),
},
Stmts: []ast.Vertex{},
Value: []byte("1"),
},
&ast.StmtDefault{
Node: ast.Node{
Position: &position.Position{
StartLine: 4,
EndLine: -1,
StartPos: 33,
EndPos: -1,
},
Stmts: []ast.Vertex{},
},
&ast.StmtDefault{
Node: ast.Node{
Position: &position.Position{
StartLine: 4,
EndLine: -1,
StartPos: 33,
EndPos: -1,
},
Stmts: []ast.Vertex{},
},
&ast.StmtCase{
Stmts: []ast.Vertex{},
},
&ast.StmtCase{
Node: ast.Node{
Position: &position.Position{
StartLine: 5,
EndLine: -1,
StartPos: 45,
EndPos: -1,
},
},
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
StartLine: 5,
EndLine: -1,
StartPos: 45,
EndPos: -1,
EndLine: 5,
StartPos: 50,
EndPos: 51,
},
},
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
StartLine: 5,
EndLine: 5,
StartPos: 50,
EndPos: 51,
},
},
Value: []byte("2"),
},
Stmts: []ast.Vertex{},
Value: []byte("2"),
},
Stmts: []ast.Vertex{},
},
},
},
@@ -10583,7 +10554,7 @@ func TestStmtSwitch_AltSemicolon(t *testing.T) {
},
},
Stmts: []ast.Vertex{
&ast.StmtAltSwitch{
&ast.StmtSwitch{
Node: ast.Node{
Position: &position.Position{
StartLine: 2,
@@ -10592,6 +10563,7 @@ func TestStmtSwitch_AltSemicolon(t *testing.T) {
EndPos: 54,
},
},
Alt: true,
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
@@ -10603,60 +10575,50 @@ func TestStmtSwitch_AltSemicolon(t *testing.T) {
},
Value: []byte("1"),
},
CaseList: &ast.StmtCaseList{
Node: ast.Node{
Position: &position.Position{
StartLine: 3,
EndLine: -1,
StartPos: 23,
EndPos: -1,
CaseList: []ast.Vertex{
&ast.StmtCase{
Node: ast.Node{
Position: &position.Position{
StartLine: 3,
EndLine: -1,
StartPos: 23,
EndPos: -1,
},
},
},
Cases: []ast.Vertex{
&ast.StmtCase{
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
StartLine: 3,
EndLine: -1,
StartPos: 23,
EndPos: -1,
EndLine: 3,
StartPos: 28,
EndPos: 29,
},
},
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
StartLine: 3,
EndLine: 3,
StartPos: 28,
EndPos: 29,
},
},
Value: []byte("1"),
},
Stmts: []ast.Vertex{},
Value: []byte("1"),
},
&ast.StmtCase{
Stmts: []ast.Vertex{},
},
&ast.StmtCase{
Node: ast.Node{
Position: &position.Position{
StartLine: 4,
EndLine: -1,
StartPos: 34,
EndPos: -1,
},
},
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
StartLine: 4,
EndLine: -1,
StartPos: 34,
EndPos: -1,
EndLine: 4,
StartPos: 39,
EndPos: 40,
},
},
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
StartLine: 4,
EndLine: 4,
StartPos: 39,
EndPos: 40,
},
},
Value: []byte("2"),
},
Stmts: []ast.Vertex{},
Value: []byte("2"),
},
Stmts: []ast.Vertex{},
},
},
},

867
internal/php7/php7.go generated

File diff suppressed because it is too large Load Diff

View File

@@ -909,34 +909,13 @@ statement:
}
| T_SWITCH '(' expr ')' switch_case_list
{
exprBrackets := &ast.ParserBrackets{
Node: ast.Node{
Position: position.NewTokensPosition($2, $4),
},
OpenBracketTkn: $2,
Child: $3,
CloseBracketTkn: $4,
}
switch n := $5.(type) {
case *ast.StmtSwitch:
n.Cond = exprBrackets
case *ast.StmtAltSwitch:
n.Cond = exprBrackets
default:
panic("unexpected node type")
}
$5.(*ast.StmtSwitch).SwitchTkn = $1
$5.(*ast.StmtSwitch).OpenParenthesisTkn = $2
$5.(*ast.StmtSwitch).Cond = $3
$5.(*ast.StmtSwitch).CloseParenthesisTkn = $4
$5.(*ast.StmtSwitch).Node.Position = position.NewTokenNodePosition($1, $5)
$$ = $5
// save position
exprBrackets.GetNode().Position = position.NewTokensPosition($2, $4)
$$.GetNode().Position = position.NewTokenNodePosition($1, $5)
// save comments
yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens)
yylex.(*Parser).setFreeFloatingTokens(exprBrackets, token.Start, $2.SkippedTokens)
yylex.(*Parser).setFreeFloatingTokens(exprBrackets, token.End, $4.SkippedTokens)
}
| T_BREAK optional_expr ';'
{
@@ -1599,95 +1578,83 @@ declare_statement:
switch_case_list:
'{' case_list '}'
{
caseList := &ast.StmtCaseList{ast.Node{}, $2}
$$ = &ast.StmtSwitch{ast.Node{}, nil, caseList}
// save position
caseList.GetNode().Position = position.NewTokensPosition($1, $3)
$$.GetNode().Position = position.NewTokensPosition($1, $3)
// save comments
yylex.(*Parser).setFreeFloating(caseList, token.Start, $1.SkippedTokens)
yylex.(*Parser).setFreeFloating(caseList, token.CaseListEnd, $3.SkippedTokens)
$$ = &ast.StmtSwitch{
Node: ast.Node{
Position: position.NewTokensPosition($1, $3),
},
OpenCurlyBracketTkn: $1,
CaseList: $2,
CloseCurlyBracketTkn: $3,
}
}
| '{' ';' case_list '}'
{
caseList := &ast.StmtCaseList{ast.Node{}, $3}
$$ = &ast.StmtSwitch{ast.Node{}, nil, caseList}
// save position
caseList.GetNode().Position = position.NewTokensPosition($1, $4)
$$.GetNode().Position = position.NewTokensPosition($1, $4)
// save comments
yylex.(*Parser).setFreeFloating(caseList, token.Start, $1.SkippedTokens)
yylex.(*Parser).setFreeFloatingTokens(caseList, token.CaseListStart, $2.SkippedTokens)
yylex.(*Parser).setFreeFloating(caseList, token.CaseListEnd, $4.SkippedTokens)
$$ = &ast.StmtSwitch{
Node: ast.Node{
Position: position.NewTokensPosition($1, $4),
},
OpenCurlyBracketTkn: $1,
CaseSeparatorTkn: $2,
CaseList: $3,
CloseCurlyBracketTkn: $4,
}
}
| ':' case_list T_ENDSWITCH ';'
{
caseList := &ast.StmtCaseList{ast.Node{}, $2}
$$ = &ast.StmtAltSwitch{ast.Node{}, nil, caseList}
// save position
caseList.GetNode().Position = position.NewNodeListPosition($2)
$$.GetNode().Position = position.NewTokensPosition($1, $4)
// save comments
yylex.(*Parser).setFreeFloating($$, token.Cond, $1.SkippedTokens)
yylex.(*Parser).setFreeFloating(caseList, token.CaseListEnd, $3.SkippedTokens)
yylex.(*Parser).setFreeFloating($$, token.AltEnd, $4.SkippedTokens)
yylex.(*Parser).setToken($$, token.SemiColon, $4.SkippedTokens)
$$ = &ast.StmtSwitch{
Node: ast.Node{
Position: position.NewTokensPosition($1, $4),
},
Alt: true,
ColonTkn: $1,
CaseList: $2,
EndSwitchTkn: $3,
SemiColonTkn: $4,
}
}
| ':' ';' case_list T_ENDSWITCH ';'
{
caseList := &ast.StmtCaseList{ast.Node{}, $3}
$$ = &ast.StmtAltSwitch{ast.Node{}, nil, caseList}
// save position
caseList.GetNode().Position = position.NewNodeListPosition($3)
$$.GetNode().Position = position.NewTokensPosition($1, $5)
// save comments
yylex.(*Parser).setFreeFloating($$, token.Cond, $1.SkippedTokens)
yylex.(*Parser).setFreeFloatingTokens(caseList, token.CaseListStart, $2.SkippedTokens)
yylex.(*Parser).setFreeFloating(caseList, token.CaseListEnd, $4.SkippedTokens)
yylex.(*Parser).setFreeFloating($$, token.AltEnd, $5.SkippedTokens)
yylex.(*Parser).setToken($$, token.SemiColon, $5.SkippedTokens)
$$ = &ast.StmtSwitch{
Node: ast.Node{
Position: position.NewTokensPosition($1, $5),
},
Alt: true,
ColonTkn: $1,
CaseSeparatorTkn: $2,
CaseList: $3,
EndSwitchTkn: $4,
SemiColonTkn: $5,
}
}
;
case_list:
/* empty */
{
$$ = []ast.Vertex{}
$$ = nil
}
| case_list T_CASE expr case_separator inner_statement_list
{
_case := &ast.StmtCase{ast.Node{}, $3, $5}
$$ = append($1, _case)
// save position
_case.GetNode().Position = position.NewTokenNodeListPosition($2, $5)
// save comments
yylex.(*Parser).setFreeFloating(_case, token.Start, $2.SkippedTokens)
yylex.(*Parser).setFreeFloating(_case, token.Expr, append($4.SkippedTokens))
yylex.(*Parser).setToken(_case, token.CaseSeparator, $4.SkippedTokens)
$$ = append($1, &ast.StmtCase{
Node: ast.Node{
Position: position.NewTokenNodeListPosition($2, $5),
},
CaseTkn: $2,
Cond: $3,
CaseSeparatorTkn: $4,
Stmts: $5,
})
}
| case_list T_DEFAULT case_separator inner_statement_list
{
_default := &ast.StmtDefault{ast.Node{}, $4}
$$ = append($1, _default)
// save position
_default.GetNode().Position = position.NewTokenNodeListPosition($2, $4)
// save comments
yylex.(*Parser).setFreeFloating(_default, token.Start, $2.SkippedTokens)
yylex.(*Parser).setFreeFloating(_default, token.Default, $3.SkippedTokens)
yylex.(*Parser).setToken(_default, token.CaseSeparator, $3.SkippedTokens)
$$ = append($1, &ast.StmtDefault{
Node: ast.Node{
Position: position.NewTokenNodeListPosition($2, $4),
},
DefaultTkn: $2,
CaseSeparatorTkn: $3,
Stmts: $4,
})
}
;

View File

@@ -7338,7 +7338,7 @@ func TestPhp7(t *testing.T) {
},
},
},
&ast.StmtAltSwitch{
&ast.StmtSwitch{
Node: ast.Node{
Position: &position.Position{
StartLine: 122,
@@ -7347,6 +7347,7 @@ func TestPhp7(t *testing.T) {
EndPos: 2694,
},
},
Alt: true,
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
@@ -7358,75 +7359,65 @@ func TestPhp7(t *testing.T) {
},
Value: []byte("1"),
},
CaseList: &ast.StmtCaseList{
Node: ast.Node{
Position: &position.Position{
StartLine: 123,
EndLine: -1,
StartPos: 2651,
EndPos: -1,
CaseList: []ast.Vertex{
&ast.StmtCase{
Node: ast.Node{
Position: &position.Position{
StartLine: 123,
EndLine: -1,
StartPos: 2651,
EndPos: -1,
},
},
},
Cases: []ast.Vertex{
&ast.StmtCase{
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
StartLine: 123,
EndLine: -1,
StartPos: 2651,
EndPos: -1,
EndLine: 123,
StartPos: 2656,
EndPos: 2657,
},
},
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
StartLine: 123,
EndLine: 123,
StartPos: 2656,
EndPos: 2657,
},
},
Value: []byte("1"),
},
Stmts: []ast.Vertex{},
Value: []byte("1"),
},
&ast.StmtDefault{
Node: ast.Node{
Position: &position.Position{
StartLine: 124,
EndLine: -1,
StartPos: 2663,
EndPos: -1,
},
Stmts: []ast.Vertex{},
},
&ast.StmtDefault{
Node: ast.Node{
Position: &position.Position{
StartLine: 124,
EndLine: -1,
StartPos: 2663,
EndPos: -1,
},
Stmts: []ast.Vertex{},
},
&ast.StmtCase{
Stmts: []ast.Vertex{},
},
&ast.StmtCase{
Node: ast.Node{
Position: &position.Position{
StartLine: 125,
EndLine: -1,
StartPos: 2676,
EndPos: -1,
},
},
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
StartLine: 125,
EndLine: -1,
StartPos: 2676,
EndPos: -1,
EndLine: 125,
StartPos: 2681,
EndPos: 2682,
},
},
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
StartLine: 125,
EndLine: 125,
StartPos: 2681,
EndPos: 2682,
},
},
Value: []byte("2"),
},
Stmts: []ast.Vertex{},
Value: []byte("2"),
},
Stmts: []ast.Vertex{},
},
},
},
&ast.StmtAltSwitch{
&ast.StmtSwitch{
Node: ast.Node{
Position: &position.Position{
StartLine: 128,
@@ -7435,6 +7426,7 @@ func TestPhp7(t *testing.T) {
EndPos: 2744,
},
},
Alt: true,
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
@@ -7446,60 +7438,50 @@ func TestPhp7(t *testing.T) {
},
Value: []byte("1"),
},
CaseList: &ast.StmtCaseList{
Node: ast.Node{
Position: &position.Position{
StartLine: 129,
EndLine: -1,
StartPos: 2714,
EndPos: -1,
CaseList: []ast.Vertex{
&ast.StmtCase{
Node: ast.Node{
Position: &position.Position{
StartLine: 129,
EndLine: -1,
StartPos: 2714,
EndPos: -1,
},
},
},
Cases: []ast.Vertex{
&ast.StmtCase{
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
StartLine: 129,
EndLine: -1,
StartPos: 2714,
EndPos: -1,
EndLine: 129,
StartPos: 2719,
EndPos: 2720,
},
},
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
StartLine: 129,
EndLine: 129,
StartPos: 2719,
EndPos: 2720,
},
},
Value: []byte("1"),
},
Stmts: []ast.Vertex{},
Value: []byte("1"),
},
&ast.StmtCase{
Stmts: []ast.Vertex{},
},
&ast.StmtCase{
Node: ast.Node{
Position: &position.Position{
StartLine: 130,
EndLine: -1,
StartPos: 2726,
EndPos: -1,
},
},
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
StartLine: 130,
EndLine: -1,
StartPos: 2726,
EndPos: -1,
EndLine: 130,
StartPos: 2731,
EndPos: 2732,
},
},
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
StartLine: 130,
EndLine: 130,
StartPos: 2731,
EndPos: 2732,
},
},
Value: []byte("2"),
},
Stmts: []ast.Vertex{},
Value: []byte("2"),
},
Stmts: []ast.Vertex{},
},
},
},
@@ -7523,78 +7505,68 @@ func TestPhp7(t *testing.T) {
},
Value: []byte("1"),
},
CaseList: &ast.StmtCaseList{
Node: ast.Node{
Position: &position.Position{
StartLine: 133,
EndLine: 136,
StartPos: 2757,
EndPos: 2798,
CaseList: []ast.Vertex{
&ast.StmtCase{
Node: ast.Node{
Position: &position.Position{
StartLine: 134,
EndLine: 134,
StartPos: 2763,
EndPos: 2777,
},
},
},
Cases: []ast.Vertex{
&ast.StmtCase{
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
StartLine: 134,
EndLine: 134,
StartPos: 2763,
EndPos: 2777,
StartPos: 2768,
EndPos: 2769,
},
},
Cond: &ast.ScalarLnumber{
Value: []byte("1"),
},
Stmts: []ast.Vertex{
&ast.StmtBreak{
Node: ast.Node{
Position: &position.Position{
StartLine: 134,
EndLine: 134,
StartPos: 2768,
EndPos: 2769,
},
},
Value: []byte("1"),
},
Stmts: []ast.Vertex{
&ast.StmtBreak{
Node: ast.Node{
Position: &position.Position{
StartLine: 134,
EndLine: 134,
StartPos: 2771,
EndPos: 2777,
},
StartPos: 2771,
EndPos: 2777,
},
},
},
},
&ast.StmtCase{
},
&ast.StmtCase{
Node: ast.Node{
Position: &position.Position{
StartLine: 135,
EndLine: 135,
StartPos: 2782,
EndPos: 2796,
},
},
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
StartLine: 135,
EndLine: 135,
StartPos: 2782,
EndPos: 2796,
StartPos: 2787,
EndPos: 2788,
},
},
Cond: &ast.ScalarLnumber{
Value: []byte("2"),
},
Stmts: []ast.Vertex{
&ast.StmtBreak{
Node: ast.Node{
Position: &position.Position{
StartLine: 135,
EndLine: 135,
StartPos: 2787,
EndPos: 2788,
},
},
Value: []byte("2"),
},
Stmts: []ast.Vertex{
&ast.StmtBreak{
Node: ast.Node{
Position: &position.Position{
StartLine: 135,
EndLine: 135,
StartPos: 2790,
EndPos: 2796,
},
StartPos: 2790,
EndPos: 2796,
},
},
},
@@ -7622,78 +7594,68 @@ func TestPhp7(t *testing.T) {
},
Value: []byte("1"),
},
CaseList: &ast.StmtCaseList{
Node: ast.Node{
Position: &position.Position{
StartLine: 138,
EndLine: 141,
StartPos: 2811,
EndPos: 2853,
CaseList: []ast.Vertex{
&ast.StmtCase{
Node: ast.Node{
Position: &position.Position{
StartLine: 139,
EndLine: 139,
StartPos: 2818,
EndPos: 2832,
},
},
},
Cases: []ast.Vertex{
&ast.StmtCase{
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
StartLine: 139,
EndLine: 139,
StartPos: 2818,
EndPos: 2832,
StartPos: 2823,
EndPos: 2824,
},
},
Cond: &ast.ScalarLnumber{
Value: []byte("1"),
},
Stmts: []ast.Vertex{
&ast.StmtBreak{
Node: ast.Node{
Position: &position.Position{
StartLine: 139,
EndLine: 139,
StartPos: 2823,
EndPos: 2824,
},
},
Value: []byte("1"),
},
Stmts: []ast.Vertex{
&ast.StmtBreak{
Node: ast.Node{
Position: &position.Position{
StartLine: 139,
EndLine: 139,
StartPos: 2826,
EndPos: 2832,
},
StartPos: 2826,
EndPos: 2832,
},
},
},
},
&ast.StmtCase{
},
&ast.StmtCase{
Node: ast.Node{
Position: &position.Position{
StartLine: 140,
EndLine: 140,
StartPos: 2837,
EndPos: 2851,
},
},
Cond: &ast.ScalarLnumber{
Node: ast.Node{
Position: &position.Position{
StartLine: 140,
EndLine: 140,
StartPos: 2837,
EndPos: 2851,
StartPos: 2842,
EndPos: 2843,
},
},
Cond: &ast.ScalarLnumber{
Value: []byte("2"),
},
Stmts: []ast.Vertex{
&ast.StmtBreak{
Node: ast.Node{
Position: &position.Position{
StartLine: 140,
EndLine: 140,
StartPos: 2842,
EndPos: 2843,
},
},
Value: []byte("2"),
},
Stmts: []ast.Vertex{
&ast.StmtBreak{
Node: ast.Node{
Position: &position.Position{
StartLine: 140,
EndLine: 140,
StartPos: 2845,
EndPos: 2851,
},
StartPos: 2845,
EndPos: 2851,
},
},
},