From f6cb2bff4d16ec439f8bd9dce56fb058e2bd5cbb Mon Sep 17 00:00:00 2001 From: Vadym Slizov Date: Sun, 6 Sep 2020 12:45:08 +0300 Subject: [PATCH] [refactoring] update ast structure of "Switch", "Case", "Default" nodes; remove "CaseList" node --- internal/php5/parser_test.go | 336 +++---- internal/php5/php5.go | 1185 +++++++++++------------ internal/php5/php5.y | 143 ++- internal/php5/php5_test.go | 336 +++---- internal/php7/parser_test.go | 336 +++---- internal/php7/php7.go | 867 ++++++++--------- internal/php7/php7.y | 155 ++- internal/php7/php7_test.go | 336 +++---- pkg/ast/ast.go | 2 - pkg/ast/node.go | 45 +- pkg/ast/traverser/dfs.go | 39 +- pkg/ast/visitor/dump.go | 17 +- pkg/ast/visitor/filter_parser_nodes.go | 20 - pkg/ast/visitor/filter_tokens.go | 22 + pkg/ast/visitor/null.go | 8 - pkg/printer/pretty_printer.go | 39 +- pkg/printer/pretty_printer_test.go | 47 +- pkg/printer/printer.go | 128 +-- pkg/printer/printer_parsed_php5_test.go | 6 +- pkg/printer/printer_parsed_php7_test.go | 6 +- pkg/printer/printer_test.go | 63 +- 21 files changed, 1882 insertions(+), 2254 deletions(-) diff --git a/internal/php5/parser_test.go b/internal/php5/parser_test.go index 1af3152..11e39da 100644 --- a/internal/php5/parser_test.go +++ b/internal/php5/parser_test.go @@ -9431,78 +9431,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, }, }, }, @@ -9560,78 +9550,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, }, }, }, @@ -9670,7 +9650,7 @@ func TestStmtSwitch_Alt(t *testing.T) { }, }, Stmts: []ast.Vertex{ - &ast.StmtAltSwitch{ + &ast.StmtSwitch{ Node: ast.Node{ Position: &position.Position{ StartLine: 2, @@ -9679,6 +9659,7 @@ func TestStmtSwitch_Alt(t *testing.T) { EndPos: 65, }, }, + Alt: true, Cond: &ast.ScalarLnumber{ Node: ast.Node{ Position: &position.Position{ @@ -9690,71 +9671,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{}, }, }, }, @@ -9788,7 +9759,7 @@ func TestStmtSwitch_AltSemicolon(t *testing.T) { }, }, Stmts: []ast.Vertex{ - &ast.StmtAltSwitch{ + &ast.StmtSwitch{ Node: ast.Node{ Position: &position.Position{ StartLine: 2, @@ -9797,6 +9768,7 @@ func TestStmtSwitch_AltSemicolon(t *testing.T) { EndPos: 54, }, }, + Alt: true, Cond: &ast.ScalarLnumber{ Node: ast.Node{ Position: &position.Position{ @@ -9808,60 +9780,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{}, }, }, }, diff --git a/internal/php5/php5.go b/internal/php5/php5.go index 90079ef..86cad0f 100644 --- a/internal/php5/php5.go +++ b/internal/php5/php5.go @@ -346,7 +346,7 @@ const yyEofCode = 1 const yyErrCode = 2 const yyInitialStackSize = 16 -// line internal/php5/php5.y:6201 +// line internal/php5/php5.y:6180 type simpleIndirectReference struct { all []*ast.ExprVariable @@ -2315,7 +2315,7 @@ yydefault: case 1: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:275 + // line internal/php5/php5.y:275 { yylex.(*Parser).rootNode = &ast.Root{ast.Node{}, yyDollar[1].list} yylex.(*Parser).rootNode.GetNode().Position = position.NewNodeListPosition(yyDollar[1].list) @@ -2324,7 +2324,7 @@ yydefault: } case 2: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:285 + // line internal/php5/php5.y:285 { if inlineHtmlNode, ok := yyDollar[2].node.(*ast.StmtInlineHtml); ok && len(yyDollar[1].list) > 0 { prevNode := lastNode(yyDollar[1].list) @@ -2337,13 +2337,13 @@ yydefault: } case 3: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:296 + // line internal/php5/php5.y:296 { yyVAL.list = []ast.Vertex{} } case 4: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:303 + // line internal/php5/php5.y:303 { yyVAL.list = []ast.Vertex{ &ast.NameNamePart{ @@ -2357,7 +2357,7 @@ yydefault: } case 5: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:315 + // line internal/php5/php5.y:315 { yyVAL.list = append(yyDollar[1].list, &ast.NameNamePart{ Node: ast.Node{ @@ -2370,32 +2370,32 @@ yydefault: } case 6: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:329 + // line internal/php5/php5.y:329 { // error yyVAL.node = nil } case 7: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:334 + // line internal/php5/php5.y:334 { yyVAL.node = yyDollar[1].node } case 8: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:338 + // line internal/php5/php5.y:338 { yyVAL.node = yyDollar[1].node } case 9: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:342 + // line internal/php5/php5.y:342 { yyVAL.node = yyDollar[1].node } case 10: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:346 + // line internal/php5/php5.y:346 { yyVAL.node = &ast.StmtHaltCompiler{ Node: ast.Node{ @@ -2409,7 +2409,7 @@ yydefault: } case 11: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:358 + // line internal/php5/php5.y:358 { yyVAL.node = &ast.StmtNamespace{ Node: ast.Node{ @@ -2427,7 +2427,7 @@ yydefault: } case 12: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:374 + // line internal/php5/php5.y:374 { yyVAL.node = &ast.StmtNamespace{ Node: ast.Node{ @@ -2447,7 +2447,7 @@ yydefault: } case 13: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:392 + // line internal/php5/php5.y:392 { yyVAL.node = &ast.StmtNamespace{ Node: ast.Node{ @@ -2461,7 +2461,7 @@ yydefault: } case 14: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:404 + // line internal/php5/php5.y:404 { yyVAL.node = &ast.StmtUse{ Node: ast.Node{ @@ -2474,7 +2474,7 @@ yydefault: } case 15: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:415 + // line internal/php5/php5.y:415 { yyVAL.node = &ast.StmtUse{ Node: ast.Node{ @@ -2493,7 +2493,7 @@ yydefault: } case 16: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:432 + // line internal/php5/php5.y:432 { yyVAL.node = &ast.StmtUse{ Node: ast.Node{ @@ -2512,7 +2512,7 @@ yydefault: } case 17: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:449 + // line internal/php5/php5.y:449 { yyDollar[1].node.(*ast.StmtConstList).SemiColonTkn = yyDollar[2].token yyDollar[1].node.(*ast.StmtConstList).Node.Position = position.NewNodeTokenPosition(yyDollar[1].node, yyDollar[2].token) @@ -2520,7 +2520,7 @@ yydefault: } case 18: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:458 + // line internal/php5/php5.y:458 { yyDollar[1].list[len(yyDollar[1].list)-1].(*ast.StmtUseDeclaration).CommaTkn = yyDollar[2].token @@ -2528,13 +2528,13 @@ yydefault: } case 19: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:464 + // line internal/php5/php5.y:464 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 20: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:471 + // line internal/php5/php5.y:471 { yyVAL.node = &ast.StmtUseDeclaration{ Node: ast.Node{ @@ -2550,7 +2550,7 @@ yydefault: } case 21: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:485 + // line internal/php5/php5.y:485 { yyVAL.node = &ast.StmtUseDeclaration{ Node: ast.Node{ @@ -2573,7 +2573,7 @@ yydefault: } case 22: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:506 + // line internal/php5/php5.y:506 { yyVAL.node = &ast.StmtUseDeclaration{ Node: ast.Node{ @@ -2590,7 +2590,7 @@ yydefault: } case 23: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:521 + // line internal/php5/php5.y:521 { yyVAL.node = &ast.StmtUseDeclaration{ Node: ast.Node{ @@ -2614,7 +2614,7 @@ yydefault: } case 24: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:546 + // line internal/php5/php5.y:546 { yyDollar[1].list[len(yyDollar[1].list)-1].(*ast.StmtUseDeclaration).CommaTkn = yyDollar[2].token @@ -2622,13 +2622,13 @@ yydefault: } case 25: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:552 + // line internal/php5/php5.y:552 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 26: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:559 + // line internal/php5/php5.y:559 { yyVAL.node = &ast.StmtUseDeclaration{ Node: ast.Node{ @@ -2644,7 +2644,7 @@ yydefault: } case 27: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:573 + // line internal/php5/php5.y:573 { yyVAL.node = &ast.StmtUseDeclaration{ Node: ast.Node{ @@ -2667,7 +2667,7 @@ yydefault: } case 28: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:594 + // line internal/php5/php5.y:594 { yyVAL.node = &ast.StmtUseDeclaration{ Node: ast.Node{ @@ -2684,7 +2684,7 @@ yydefault: } case 29: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:609 + // line internal/php5/php5.y:609 { yyVAL.node = &ast.StmtUseDeclaration{ Node: ast.Node{ @@ -2708,7 +2708,7 @@ yydefault: } case 30: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:634 + // line internal/php5/php5.y:634 { yyDollar[1].list[len(yyDollar[1].list)-1].(*ast.StmtUseDeclaration).CommaTkn = yyDollar[2].token @@ -2716,13 +2716,13 @@ yydefault: } case 31: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:640 + // line internal/php5/php5.y:640 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 32: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:647 + // line internal/php5/php5.y:647 { yyVAL.node = &ast.StmtUseDeclaration{ Node: ast.Node{ @@ -2738,7 +2738,7 @@ yydefault: } case 33: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:661 + // line internal/php5/php5.y:661 { yyVAL.node = &ast.StmtUseDeclaration{ Node: ast.Node{ @@ -2761,7 +2761,7 @@ yydefault: } case 34: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:682 + // line internal/php5/php5.y:682 { yyVAL.node = &ast.StmtUseDeclaration{ Node: ast.Node{ @@ -2778,7 +2778,7 @@ yydefault: } case 35: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:697 + // line internal/php5/php5.y:697 { yyVAL.node = &ast.StmtUseDeclaration{ Node: ast.Node{ @@ -2802,7 +2802,7 @@ yydefault: } case 36: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:722 + // line internal/php5/php5.y:722 { constList := yyDollar[1].node.(*ast.StmtConstList) constList.Node.Position = position.NewNodesPosition(yyDollar[1].node, yyDollar[5].node) @@ -2827,7 +2827,7 @@ yydefault: } case 37: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:745 + // line internal/php5/php5.y:745 { yyVAL.node = &ast.StmtConstList{ Node: ast.Node{ @@ -2855,7 +2855,7 @@ yydefault: } case 38: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:774 + // line internal/php5/php5.y:774 { if inlineHtmlNode, ok := yyDollar[2].node.(*ast.StmtInlineHtml); ok && len(yyDollar[1].list) > 0 { prevNode := lastNode(yyDollar[1].list) @@ -2868,38 +2868,38 @@ yydefault: } case 39: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:785 + // line internal/php5/php5.y:785 { yyVAL.list = []ast.Vertex{} } case 40: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:793 + // line internal/php5/php5.y:793 { // error yyVAL.node = nil } case 41: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:798 + // line internal/php5/php5.y:798 { yyVAL.node = yyDollar[1].node } case 42: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:802 + // line internal/php5/php5.y:802 { yyVAL.node = yyDollar[1].node } case 43: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:806 + // line internal/php5/php5.y:806 { yyVAL.node = yyDollar[1].node } case 44: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:810 + // line internal/php5/php5.y:810 { yyVAL.node = &ast.StmtHaltCompiler{ Node: ast.Node{ @@ -2913,13 +2913,13 @@ yydefault: } case 45: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:826 + // line internal/php5/php5.y:826 { yyVAL.node = yyDollar[1].node } case 46: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:830 + // line internal/php5/php5.y:830 { label := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.StmtLabel{ast.Node{}, label} @@ -2934,7 +2934,7 @@ yydefault: } case 47: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:846 + // line internal/php5/php5.y:846 { yyVAL.node = &ast.StmtStmtList{ Node: ast.Node{ @@ -2947,7 +2947,7 @@ yydefault: } case 48: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:857 + // line internal/php5/php5.y:857 { pos := position.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node) if yyDollar[5].node != nil { @@ -2971,7 +2971,7 @@ yydefault: } case 49: yyDollar = yyS[yypt-8 : yypt+1] -// line internal/php5/php5.y:879 + // line internal/php5/php5.y:879 { yyVAL.node = &ast.StmtIf{ Node: ast.Node{ @@ -2997,7 +2997,7 @@ yydefault: } case 50: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:903 + // line internal/php5/php5.y:903 { yyDollar[3].node.(*ast.StmtWhile).WhileTkn = yyDollar[1].token yyDollar[3].node.(*ast.StmtWhile).OpenParenthesisTkn = yyDollar[2].node.(*ast.ParserBrackets).OpenBracketTkn @@ -3009,7 +3009,7 @@ yydefault: } case 51: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:913 + // line internal/php5/php5.y:913 { yyVAL.node = &ast.StmtDo{ Node: ast.Node{ @@ -3026,7 +3026,7 @@ yydefault: } case 52: yyDollar = yyS[yypt-9 : yypt+1] -// line internal/php5/php5.y:928 + // line internal/php5/php5.y:928 { yyDollar[9].node.(*ast.StmtFor).ForTkn = yyDollar[1].token yyDollar[9].node.(*ast.StmtFor).OpenParenthesisTkn = yyDollar[2].token @@ -3042,28 +3042,19 @@ yydefault: } case 53: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:942 + // line internal/php5/php5.y:942 { - switch n := yyDollar[3].node.(type) { - case *ast.StmtSwitch: - n.Cond = yyDollar[2].node - case *ast.StmtAltSwitch: - n.Cond = yyDollar[2].node - default: - panic("unexpected node type") - } + yyDollar[3].node.(*ast.StmtSwitch).SwitchTkn = yyDollar[1].token + yyDollar[3].node.(*ast.StmtSwitch).OpenParenthesisTkn = yyDollar[2].node.(*ast.ParserBrackets).OpenBracketTkn + yyDollar[3].node.(*ast.StmtSwitch).Cond = yyDollar[2].node.(*ast.ParserBrackets).Child + yyDollar[3].node.(*ast.StmtSwitch).CloseParenthesisTkn = yyDollar[2].node.(*ast.ParserBrackets).CloseBracketTkn + yyDollar[3].node.(*ast.StmtSwitch).Node.Position = position.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node) yyVAL.node = yyDollar[3].node - - // save position - yyVAL.node.GetNode().Position = position.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node) - - // save comments - yylex.(*Parser).setFreeFloating(yyVAL.node, token.Start, yyDollar[1].token.SkippedTokens) } case 54: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:961 + // line internal/php5/php5.y:952 { yyVAL.node = &ast.StmtBreak{ast.Node{}, nil} @@ -3077,7 +3068,7 @@ yydefault: } case 55: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:973 + // line internal/php5/php5.y:964 { yyVAL.node = &ast.StmtBreak{ast.Node{}, yyDollar[2].node} @@ -3091,7 +3082,7 @@ yydefault: } case 56: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:985 + // line internal/php5/php5.y:976 { yyVAL.node = &ast.StmtContinue{ast.Node{}, nil} @@ -3105,7 +3096,7 @@ yydefault: } case 57: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:997 + // line internal/php5/php5.y:988 { yyVAL.node = &ast.StmtContinue{ast.Node{}, yyDollar[2].node} @@ -3119,7 +3110,7 @@ yydefault: } case 58: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:1009 + // line internal/php5/php5.y:1000 { yyVAL.node = &ast.StmtReturn{ast.Node{}, nil} @@ -3133,7 +3124,7 @@ yydefault: } case 59: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:1021 + // line internal/php5/php5.y:1012 { yyVAL.node = &ast.StmtReturn{ast.Node{}, yyDollar[2].node} @@ -3147,7 +3138,7 @@ yydefault: } case 60: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:1033 + // line internal/php5/php5.y:1024 { yyVAL.node = &ast.StmtReturn{ast.Node{}, yyDollar[2].node} @@ -3161,7 +3152,7 @@ yydefault: } case 61: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:1045 + // line internal/php5/php5.y:1036 { yyVAL.node = &ast.StmtExpression{ast.Node{}, yyDollar[1].node} @@ -3175,7 +3166,7 @@ yydefault: } case 62: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:1057 + // line internal/php5/php5.y:1048 { yyVAL.node = &ast.StmtGlobal{ast.Node{}, yyDollar[2].list} @@ -3189,7 +3180,7 @@ yydefault: } case 63: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:1069 + // line internal/php5/php5.y:1060 { yyVAL.node = &ast.StmtStatic{ast.Node{}, yyDollar[2].list} @@ -3203,7 +3194,7 @@ yydefault: } case 64: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:1081 + // line internal/php5/php5.y:1072 { yyVAL.node = &ast.StmtEcho{ast.Node{}, yyDollar[2].list} @@ -3218,7 +3209,7 @@ yydefault: } case 65: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1094 + // line internal/php5/php5.y:1085 { yyVAL.node = &ast.StmtInlineHtml{ast.Node{}, yyDollar[1].token.Value} @@ -3230,7 +3221,7 @@ yydefault: } case 66: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:1104 + // line internal/php5/php5.y:1095 { yyVAL.node = &ast.StmtExpression{ast.Node{}, yyDollar[1].node} @@ -3244,7 +3235,7 @@ yydefault: } case 67: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:1116 + // line internal/php5/php5.y:1107 { yyVAL.node = &ast.StmtUnset{ast.Node{}, yyDollar[3].list} @@ -3260,7 +3251,7 @@ yydefault: } case 68: yyDollar = yyS[yypt-8 : yypt+1] -// line internal/php5/php5.y:1130 + // line internal/php5/php5.y:1121 { if yyDollar[6].node == nil { switch n := yyDollar[8].node.(type) { @@ -3301,7 +3292,7 @@ yydefault: } case 69: yyDollar = yyS[yypt-8 : yypt+1] -// line internal/php5/php5.y:1168 + // line internal/php5/php5.y:1159 { if yyDollar[6].node == nil { switch n := yyDollar[8].node.(type) { @@ -3342,7 +3333,7 @@ yydefault: } case 70: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:1206 + // line internal/php5/php5.y:1197 { yyVAL.node = yyDollar[5].node yyVAL.node.(*ast.StmtDeclare).Consts = yyDollar[3].list @@ -3357,7 +3348,7 @@ yydefault: } case 71: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1219 + // line internal/php5/php5.y:1210 { yyVAL.node = &ast.StmtNop{ast.Node{}} @@ -3370,7 +3361,7 @@ yydefault: } case 72: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php5/php5.y:1230 + // line internal/php5/php5.y:1221 { yyVAL.node = &ast.StmtTry{ast.Node{}, yyDollar[3].list, yyDollar[5].list, yyDollar[6].node} @@ -3388,7 +3379,7 @@ yydefault: } case 73: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:1246 + // line internal/php5/php5.y:1237 { yyVAL.node = &ast.StmtThrow{ast.Node{}, yyDollar[2].node} @@ -3402,7 +3393,7 @@ yydefault: } case 74: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:1258 + // line internal/php5/php5.y:1249 { label := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} yyVAL.node = &ast.StmtGoto{ast.Node{}, label} @@ -3419,13 +3410,13 @@ yydefault: } case 75: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1276 + // line internal/php5/php5.y:1267 { yyVAL.list = []ast.Vertex{} } case 76: yyDollar = yyS[yypt-9 : yypt+1] -// line internal/php5/php5.y:1280 + // line internal/php5/php5.y:1271 { identifier := &ast.Identifier{ast.Node{}, yyDollar[4].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -3447,13 +3438,13 @@ yydefault: } case 77: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1303 + // line internal/php5/php5.y:1294 { yyVAL.node = nil } case 78: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:1307 + // line internal/php5/php5.y:1298 { yyVAL.node = &ast.StmtFinally{ast.Node{}, yyDollar[3].list} @@ -3467,31 +3458,31 @@ yydefault: } case 79: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1322 + // line internal/php5/php5.y:1313 { yyVAL.list = yyDollar[1].list } case 80: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1326 + // line internal/php5/php5.y:1317 { yyVAL.list = []ast.Vertex{} } case 81: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1333 + // line internal/php5/php5.y:1324 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 82: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:1337 + // line internal/php5/php5.y:1328 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 83: yyDollar = yyS[yypt-8 : yypt+1] -// line internal/php5/php5.y:1344 + // line internal/php5/php5.y:1335 { identifier := &ast.Identifier{ast.Node{}, yyDollar[4].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -3512,13 +3503,13 @@ yydefault: } case 84: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1366 + // line internal/php5/php5.y:1357 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 85: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:1370 + // line internal/php5/php5.y:1361 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -3527,49 +3518,49 @@ yydefault: } case 86: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1380 + // line internal/php5/php5.y:1371 { yyVAL.node = yyDollar[1].node } case 87: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1387 + // line internal/php5/php5.y:1378 { yyVAL.node = yyDollar[1].node } case 88: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1394 + // line internal/php5/php5.y:1385 { yyVAL.node = yyDollar[1].node } case 89: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1401 + // line internal/php5/php5.y:1392 { yyVAL.token = nil } case 90: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1405 + // line internal/php5/php5.y:1396 { yyVAL.token = yyDollar[1].token } case 91: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1412 + // line internal/php5/php5.y:1403 { yyVAL.token = nil } case 92: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1416 + // line internal/php5/php5.y:1407 { yyVAL.token = yyDollar[1].token } case 93: yyDollar = yyS[yypt-9 : yypt+1] -// line internal/php5/php5.y:1423 + // line internal/php5/php5.y:1414 { name := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.StmtFunction{ast.Node{}, yyDollar[2].token != nil, name, yyDollar[5].list, nil, yyDollar[8].list} @@ -3593,7 +3584,7 @@ yydefault: } case 94: yyDollar = yyS[yypt-7 : yypt+1] -// line internal/php5/php5.y:1448 + // line internal/php5/php5.y:1439 { name := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} switch n := yyDollar[1].node.(type) { @@ -3621,7 +3612,7 @@ yydefault: } case 95: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php5/php5.y:1474 + // line internal/php5/php5.y:1465 { name := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} yyVAL.node = &ast.StmtInterface{ast.Node{}, name, yyDollar[3].InterfaceExtends, yyDollar[5].list} @@ -3638,7 +3629,7 @@ yydefault: } case 96: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1493 + // line internal/php5/php5.y:1484 { yyVAL.node = &ast.StmtClass{ast.Node{}, nil, nil, nil, nil, nil, nil} @@ -3650,7 +3641,7 @@ yydefault: } case 97: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:1503 + // line internal/php5/php5.y:1494 { classModifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.StmtClass{ast.Node{}, nil, []ast.Vertex{classModifier}, nil, nil, nil, nil} @@ -3665,7 +3656,7 @@ yydefault: } case 98: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1516 + // line internal/php5/php5.y:1507 { yyVAL.node = &ast.StmtTrait{ast.Node{}, nil, nil} @@ -3677,7 +3668,7 @@ yydefault: } case 99: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:1526 + // line internal/php5/php5.y:1517 { classModifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.StmtClass{ast.Node{}, nil, []ast.Vertex{classModifier}, nil, nil, nil, nil} @@ -3692,13 +3683,13 @@ yydefault: } case 100: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1542 + // line internal/php5/php5.y:1533 { yyVAL.ClassExtends = nil } case 101: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:1546 + // line internal/php5/php5.y:1537 { yyVAL.ClassExtends = &ast.StmtClassExtends{ast.Node{}, yyDollar[2].node} @@ -3710,19 +3701,19 @@ yydefault: } case 102: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1559 + // line internal/php5/php5.y:1550 { yyVAL.token = yyDollar[1].token } case 103: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1566 + // line internal/php5/php5.y:1557 { yyVAL.InterfaceExtends = nil } case 104: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:1570 + // line internal/php5/php5.y:1561 { yyVAL.InterfaceExtends = &ast.StmtInterfaceExtends{ast.Node{}, yyDollar[2].list} @@ -3734,13 +3725,13 @@ yydefault: } case 105: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1583 + // line internal/php5/php5.y:1574 { yyVAL.ClassImplements = nil } case 106: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:1587 + // line internal/php5/php5.y:1578 { yyVAL.ClassImplements = &ast.StmtClassImplements{ast.Node{}, yyDollar[2].list} @@ -3752,13 +3743,13 @@ yydefault: } case 107: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1600 + // line internal/php5/php5.y:1591 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 108: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:1604 + // line internal/php5/php5.y:1595 { switch n := lastNode(yyDollar[1].list).(type) { case *ast.NameName: @@ -3772,13 +3763,13 @@ yydefault: } case 109: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1616 + // line internal/php5/php5.y:1607 { yyVAL.node = nil } case 110: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:1620 + // line internal/php5/php5.y:1611 { yyVAL.node = yyDollar[2].node @@ -3787,13 +3778,13 @@ yydefault: } case 111: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1630 + // line internal/php5/php5.y:1621 { yyVAL.node = yyDollar[1].node } case 112: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:1634 + // line internal/php5/php5.y:1625 { yyVAL.node = &ast.ExprReference{ast.Node{}, yyDollar[2].node} @@ -3805,7 +3796,7 @@ yydefault: } case 113: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:1644 + // line internal/php5/php5.y:1635 { yyVAL.node = &ast.ExprList{ast.Node{}, yyDollar[3].list} @@ -3819,7 +3810,7 @@ yydefault: } case 114: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1659 + // line internal/php5/php5.y:1650 { yyVAL.node = &ast.StmtFor{ Node: ast.Node{ @@ -3830,7 +3821,7 @@ yydefault: } case 115: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:1668 + // line internal/php5/php5.y:1659 { yyVAL.node = &ast.StmtFor{ Node: ast.Node{ @@ -3850,7 +3841,7 @@ yydefault: } case 116: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1689 + // line internal/php5/php5.y:1680 { yyVAL.node = &ast.StmtForeach{ast.Node{}, nil, nil, nil, yyDollar[1].node} @@ -3859,7 +3850,7 @@ yydefault: } case 117: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:1696 + // line internal/php5/php5.y:1687 { stmtList := &ast.StmtStmtList{ Node: ast.Node{ @@ -3880,7 +3871,7 @@ yydefault: } case 118: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1719 + // line internal/php5/php5.y:1710 { yyVAL.node = &ast.StmtDeclare{ast.Node{}, false, nil, yyDollar[1].node} @@ -3889,7 +3880,7 @@ yydefault: } case 119: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:1726 + // line internal/php5/php5.y:1717 { stmtList := &ast.StmtStmtList{ Node: ast.Node{ @@ -3910,7 +3901,7 @@ yydefault: } case 120: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:1749 + // line internal/php5/php5.y:1740 { yyVAL.list = []ast.Vertex{ &ast.StmtConstant{ @@ -3932,7 +3923,7 @@ yydefault: } case 121: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:1769 + // line internal/php5/php5.y:1760 { lastNode(yyDollar[1].list).(*ast.StmtConstant).CommaTkn = yyDollar[2].token yyVAL.list = append(yyDollar[1].list, &ast.StmtConstant{ @@ -3953,122 +3944,110 @@ yydefault: } case 122: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:1792 + // line internal/php5/php5.y:1783 { - caseList := &ast.StmtCaseList{ast.Node{}, yyDollar[2].list} - yyVAL.node = &ast.StmtSwitch{ast.Node{}, nil, caseList} - - // save position - caseList.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[3].token) - yyVAL.node.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[3].token) - - // save comments - yylex.(*Parser).setFreeFloating(caseList, token.Start, yyDollar[1].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(caseList, token.CaseListEnd, yyDollar[3].token.SkippedTokens) + yyVAL.node = &ast.StmtSwitch{ + Node: ast.Node{ + Position: position.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), + }, + OpenCurlyBracketTkn: yyDollar[1].token, + CaseList: yyDollar[2].list, + CloseCurlyBracketTkn: yyDollar[3].token, + } } case 123: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:1805 + // line internal/php5/php5.y:1794 { - caseList := &ast.StmtCaseList{ast.Node{}, yyDollar[3].list} - yyVAL.node = &ast.StmtSwitch{ast.Node{}, nil, caseList} - - // save position - caseList.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[4].token) - yyVAL.node.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[4].token) - - // save comments - yylex.(*Parser).setFreeFloating(caseList, token.Start, yyDollar[1].token.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens(caseList, token.CaseListStart, yyDollar[2].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(caseList, token.CaseListEnd, yyDollar[4].token.SkippedTokens) + yyVAL.node = &ast.StmtSwitch{ + Node: ast.Node{ + Position: position.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), + }, + OpenCurlyBracketTkn: yyDollar[1].token, + CaseSeparatorTkn: yyDollar[2].token, + CaseList: yyDollar[3].list, + CloseCurlyBracketTkn: yyDollar[4].token, + } } case 124: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:1819 + // line internal/php5/php5.y:1806 { - caseList := &ast.StmtCaseList{ast.Node{}, yyDollar[2].list} - yyVAL.node = &ast.StmtAltSwitch{ast.Node{}, nil, caseList} - - // save position - caseList.GetNode().Position = position.NewNodeListPosition(yyDollar[2].list) - yyVAL.node.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[4].token) - - // save comments - yylex.(*Parser).setFreeFloating(yyVAL.node, token.Cond, yyDollar[1].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(caseList, token.CaseListEnd, yyDollar[3].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(yyVAL.node, token.AltEnd, yyDollar[4].token.SkippedTokens) - yylex.(*Parser).setToken(yyVAL.node, token.SemiColon, yyDollar[4].token.SkippedTokens) + yyVAL.node = &ast.StmtSwitch{ + Node: ast.Node{ + Position: position.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), + }, + Alt: true, + ColonTkn: yyDollar[1].token, + CaseList: yyDollar[2].list, + EndSwitchTkn: yyDollar[3].token, + SemiColonTkn: yyDollar[4].token, + } } case 125: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:1834 + // line internal/php5/php5.y:1819 { - - caseList := &ast.StmtCaseList{ast.Node{}, yyDollar[3].list} - yyVAL.node = &ast.StmtAltSwitch{ast.Node{}, nil, caseList} - - // save position - caseList.GetNode().Position = position.NewNodeListPosition(yyDollar[3].list) - yyVAL.node.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[5].token) - - // save comments - yylex.(*Parser).setFreeFloating(yyVAL.node, token.Cond, yyDollar[1].token.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens(caseList, token.CaseListStart, yyDollar[2].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(caseList, token.CaseListEnd, yyDollar[4].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(yyVAL.node, token.AltEnd, yyDollar[5].token.SkippedTokens) - yylex.(*Parser).setToken(yyVAL.node, token.SemiColon, yyDollar[5].token.SkippedTokens) + yyVAL.node = &ast.StmtSwitch{ + Node: ast.Node{ + Position: position.NewTokensPosition(yyDollar[1].token, yyDollar[5].token), + }, + Alt: true, + ColonTkn: yyDollar[1].token, + CaseSeparatorTkn: yyDollar[2].token, + CaseList: yyDollar[3].list, + EndSwitchTkn: yyDollar[4].token, + SemiColonTkn: yyDollar[5].token, + } } case 126: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1855 + // line internal/php5/php5.y:1837 { - yyVAL.list = []ast.Vertex{} + yyVAL.list = nil } case 127: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:1859 + // line internal/php5/php5.y:1841 { - _case := &ast.StmtCase{ast.Node{}, yyDollar[3].node, yyDollar[5].list} - yyVAL.list = append(yyDollar[1].list, _case) - - // save position - _case.GetNode().Position = position.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[5].list) - - // save comments - yylex.(*Parser).setFreeFloating(_case, token.Start, yyDollar[2].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(_case, token.Expr, yyDollar[4].token.SkippedTokens) - yylex.(*Parser).setToken(_case, token.CaseSeparator, yyDollar[4].token.SkippedTokens) + yyVAL.list = append(yyDollar[1].list, &ast.StmtCase{ + Node: ast.Node{ + Position: position.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[5].list), + }, + CaseTkn: yyDollar[2].token, + Cond: yyDollar[3].node, + CaseSeparatorTkn: yyDollar[4].token, + Stmts: yyDollar[5].list, + }) } case 128: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:1872 + // line internal/php5/php5.y:1853 { - _default := &ast.StmtDefault{ast.Node{}, yyDollar[4].list} - yyVAL.list = append(yyDollar[1].list, _default) - - // save position - _default.GetNode().Position = position.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[4].list) - - // save comments - yylex.(*Parser).setFreeFloating(_default, token.Start, yyDollar[2].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(_default, token.Default, yyDollar[3].token.SkippedTokens) - yylex.(*Parser).setToken(_default, token.CaseSeparator, yyDollar[3].token.SkippedTokens) + yyVAL.list = append(yyDollar[1].list, &ast.StmtDefault{ + Node: ast.Node{ + Position: position.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[4].list), + }, + DefaultTkn: yyDollar[2].token, + CaseSeparatorTkn: yyDollar[3].token, + Stmts: yyDollar[4].list, + }) } case 129: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1889 + // line internal/php5/php5.y:1868 { yyVAL.token = yyDollar[1].token } case 130: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1893 + // line internal/php5/php5.y:1872 { yyVAL.token = yyDollar[1].token } case 131: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1901 + // line internal/php5/php5.y:1880 { yyVAL.node = &ast.StmtWhile{ Node: ast.Node{ @@ -4079,7 +4058,7 @@ yydefault: } case 132: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:1910 + // line internal/php5/php5.y:1889 { yyVAL.node = &ast.StmtWhile{ Node: ast.Node{ @@ -4099,13 +4078,13 @@ yydefault: } case 133: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1933 + // line internal/php5/php5.y:1912 { yyVAL.list = nil } case 134: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:1937 + // line internal/php5/php5.y:1916 { yyVAL.list = append(yyDollar[1].list, &ast.StmtElseIf{ Node: ast.Node{ @@ -4120,13 +4099,13 @@ yydefault: } case 135: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1954 + // line internal/php5/php5.y:1933 { yyVAL.list = nil } case 136: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:1958 + // line internal/php5/php5.y:1937 { yyVAL.list = append(yyDollar[1].list, &ast.StmtElseIf{ Node: ast.Node{ @@ -4148,13 +4127,13 @@ yydefault: } case 137: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1982 + // line internal/php5/php5.y:1961 { yyVAL.node = nil } case 138: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:1986 + // line internal/php5/php5.y:1965 { yyVAL.node = &ast.StmtElse{ Node: ast.Node{ @@ -4166,13 +4145,13 @@ yydefault: } case 139: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:2000 + // line internal/php5/php5.y:1979 { yyVAL.node = nil } case 140: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2004 + // line internal/php5/php5.y:1983 { yyVAL.node = &ast.StmtElse{ Node: ast.Node{ @@ -4191,25 +4170,25 @@ yydefault: } case 141: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2025 + // line internal/php5/php5.y:2004 { yyVAL.list = yyDollar[1].list } case 142: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:2029 + // line internal/php5/php5.y:2008 { yyVAL.list = nil } case 143: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2036 + // line internal/php5/php5.y:2015 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 144: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2040 + // line internal/php5/php5.y:2019 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -4218,7 +4197,7 @@ yydefault: } case 145: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:2050 + // line internal/php5/php5.y:2029 { identifier := &ast.Identifier{ast.Node{}, yyDollar[4].token.Value} identifier.GetNode().Position = position.NewTokenPosition(yyDollar[4].token) @@ -4254,7 +4233,7 @@ yydefault: } case 146: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php5/php5.y:2084 + // line internal/php5/php5.y:2063 { identifier := &ast.Identifier{ast.Node{}, yyDollar[4].token.Value} identifier.GetNode().Position = position.NewTokenPosition(yyDollar[4].token) @@ -4291,13 +4270,13 @@ yydefault: } case 147: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:2123 + // line internal/php5/php5.y:2102 { yyVAL.node = nil } case 148: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2127 + // line internal/php5/php5.y:2106 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4309,7 +4288,7 @@ yydefault: } case 149: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2137 + // line internal/php5/php5.y:2116 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4321,13 +4300,13 @@ yydefault: } case 150: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2147 + // line internal/php5/php5.y:2126 { yyVAL.node = yyDollar[1].node } case 151: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:2155 + // line internal/php5/php5.y:2134 { yyVAL.node = &ast.ArgumentList{ast.Node{}, nil} @@ -4340,7 +4319,7 @@ yydefault: } case 152: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2166 + // line internal/php5/php5.y:2145 { yyVAL.node = &ast.ArgumentList{ast.Node{}, yyDollar[2].list} @@ -4353,7 +4332,7 @@ yydefault: } case 153: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2177 + // line internal/php5/php5.y:2156 { arg := &ast.Argument{ast.Node{}, false, false, yyDollar[2].node} yyVAL.node = &ast.ArgumentList{ast.Node{}, []ast.Vertex{arg}} @@ -4368,13 +4347,13 @@ yydefault: } case 154: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2194 + // line internal/php5/php5.y:2173 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 155: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2198 + // line internal/php5/php5.y:2177 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -4383,7 +4362,7 @@ yydefault: } case 156: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2208 + // line internal/php5/php5.y:2187 { yyVAL.node = &ast.Argument{ast.Node{}, false, false, yyDollar[1].node} @@ -4395,7 +4374,7 @@ yydefault: } case 157: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2218 + // line internal/php5/php5.y:2197 { yyVAL.node = &ast.Argument{ast.Node{}, false, false, yyDollar[1].node} @@ -4407,7 +4386,7 @@ yydefault: } case 158: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:2228 + // line internal/php5/php5.y:2207 { yyVAL.node = &ast.Argument{ast.Node{}, false, true, yyDollar[2].node} @@ -4419,7 +4398,7 @@ yydefault: } case 159: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:2238 + // line internal/php5/php5.y:2217 { yyVAL.node = &ast.Argument{ast.Node{}, true, false, yyDollar[2].node} @@ -4431,7 +4410,7 @@ yydefault: } case 160: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2251 + // line internal/php5/php5.y:2230 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -4440,13 +4419,13 @@ yydefault: } case 161: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2258 + // line internal/php5/php5.y:2237 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 162: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2266 + // line internal/php5/php5.y:2245 { name := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ExprVariable{ast.Node{}, name} @@ -4460,7 +4439,7 @@ yydefault: } case 163: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:2278 + // line internal/php5/php5.y:2257 { yyVAL.node = &ast.ExprVariable{ast.Node{}, yyDollar[2].node} @@ -4472,7 +4451,7 @@ yydefault: } case 164: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:2288 + // line internal/php5/php5.y:2267 { yyVAL.node = &ast.ExprVariable{ast.Node{}, yyDollar[3].node} @@ -4486,7 +4465,7 @@ yydefault: } case 165: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2304 + // line internal/php5/php5.y:2283 { identifier := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -4504,7 +4483,7 @@ yydefault: } case 166: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:2320 + // line internal/php5/php5.y:2299 { identifier := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -4523,7 +4502,7 @@ yydefault: } case 167: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2337 + // line internal/php5/php5.y:2316 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -4540,7 +4519,7 @@ yydefault: } case 168: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2352 + // line internal/php5/php5.y:2331 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -4558,19 +4537,19 @@ yydefault: } case 169: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:2372 + // line internal/php5/php5.y:2351 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 170: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:2376 + // line internal/php5/php5.y:2355 { yyVAL.list = []ast.Vertex{} } case 171: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2384 + // line internal/php5/php5.y:2363 { yyVAL.node = &ast.StmtPropertyList{ast.Node{}, yyDollar[1].list, nil, yyDollar[2].list} @@ -4584,7 +4563,7 @@ yydefault: } case 172: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:2396 + // line internal/php5/php5.y:2375 { yyDollar[1].node.(*ast.StmtClassConstList).SemiColonTkn = yyDollar[2].token yyDollar[1].node.(*ast.StmtClassConstList).Node.Position = position.NewNodeTokenPosition(yyDollar[1].node, yyDollar[2].token) @@ -4592,13 +4571,13 @@ yydefault: } case 173: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2402 + // line internal/php5/php5.y:2381 { yyVAL.node = yyDollar[1].node } case 174: yyDollar = yyS[yypt-8 : yypt+1] -// line internal/php5/php5.y:2406 + // line internal/php5/php5.y:2385 { name := &ast.Identifier{ast.Node{}, yyDollar[4].token.Value} yyVAL.node = &ast.StmtClassMethod{ast.Node{}, yyDollar[3].token != nil, name, yyDollar[1].list, yyDollar[6].list, nil, yyDollar[8].node} @@ -4629,7 +4608,7 @@ yydefault: } case 175: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2438 + // line internal/php5/php5.y:2417 { yyVAL.node = &ast.StmtTraitUse{ast.Node{}, yyDollar[2].list, yyDollar[3].node} @@ -4641,13 +4620,13 @@ yydefault: } case 176: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2451 + // line internal/php5/php5.y:2430 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 177: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2455 + // line internal/php5/php5.y:2434 { switch n := lastNode(yyDollar[1].list).(type) { case *ast.NameName: @@ -4661,7 +4640,7 @@ yydefault: } case 178: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2467 + // line internal/php5/php5.y:2446 { yyVAL.node = &ast.StmtNop{ast.Node{}} @@ -4673,7 +4652,7 @@ yydefault: } case 179: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2477 + // line internal/php5/php5.y:2456 { yyVAL.node = &ast.StmtTraitAdaptationList{ast.Node{}, yyDollar[2].list} @@ -4685,31 +4664,31 @@ yydefault: } case 180: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:2490 + // line internal/php5/php5.y:2469 { yyVAL.list = nil } case 181: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2494 + // line internal/php5/php5.y:2473 { yyVAL.list = yyDollar[1].list } case 182: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2501 + // line internal/php5/php5.y:2480 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 183: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:2505 + // line internal/php5/php5.y:2484 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 184: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:2512 + // line internal/php5/php5.y:2491 { yyVAL.node = yyDollar[1].node @@ -4719,7 +4698,7 @@ yydefault: } case 185: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:2520 + // line internal/php5/php5.y:2499 { yyVAL.node = yyDollar[1].node @@ -4729,7 +4708,7 @@ yydefault: } case 186: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2531 + // line internal/php5/php5.y:2510 { yyVAL.node = &ast.StmtTraitUsePrecedence{ast.Node{}, yyDollar[1].node, yyDollar[3].list} @@ -4742,13 +4721,13 @@ yydefault: } case 187: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2545 + // line internal/php5/php5.y:2524 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 188: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2549 + // line internal/php5/php5.y:2528 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -4757,7 +4736,7 @@ yydefault: } case 189: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2559 + // line internal/php5/php5.y:2538 { name := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.StmtTraitMethodRef{ast.Node{}, nil, name} @@ -4771,13 +4750,13 @@ yydefault: } case 190: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2571 + // line internal/php5/php5.y:2550 { yyVAL.node = yyDollar[1].node } case 191: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2578 + // line internal/php5/php5.y:2557 { target := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.StmtTraitMethodRef{ast.Node{}, yyDollar[1].node, target} @@ -4793,7 +4772,7 @@ yydefault: } case 192: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:2595 + // line internal/php5/php5.y:2574 { alias := &ast.Identifier{ast.Node{}, yyDollar[4].token.Value} yyVAL.node = &ast.StmtTraitUseAlias{ast.Node{}, yyDollar[1].node, yyDollar[3].node, alias} @@ -4809,7 +4788,7 @@ yydefault: } case 193: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2609 + // line internal/php5/php5.y:2588 { yyVAL.node = &ast.StmtTraitUseAlias{ast.Node{}, yyDollar[1].node, yyDollar[3].node, nil} @@ -4822,19 +4801,19 @@ yydefault: } case 194: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:2623 + // line internal/php5/php5.y:2602 { yyVAL.node = nil } case 195: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2627 + // line internal/php5/php5.y:2606 { yyVAL.node = yyDollar[1].node } case 196: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2634 + // line internal/php5/php5.y:2613 { yyVAL.node = &ast.StmtNop{ast.Node{}} @@ -4847,7 +4826,7 @@ yydefault: } case 197: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2645 + // line internal/php5/php5.y:2624 { yyVAL.node = &ast.StmtStmtList{ Node: ast.Node{ @@ -4860,13 +4839,13 @@ yydefault: } case 198: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2659 + // line internal/php5/php5.y:2638 { yyVAL.list = yyDollar[1].list } case 199: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2663 + // line internal/php5/php5.y:2642 { modifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.list = []ast.Vertex{modifier} @@ -4879,31 +4858,31 @@ yydefault: } case 200: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:2677 + // line internal/php5/php5.y:2656 { yyVAL.list = nil } case 201: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2681 + // line internal/php5/php5.y:2660 { yyVAL.list = yyDollar[1].list } case 202: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2688 + // line internal/php5/php5.y:2667 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 203: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:2692 + // line internal/php5/php5.y:2671 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 204: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2699 + // line internal/php5/php5.y:2678 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4915,7 +4894,7 @@ yydefault: } case 205: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2709 + // line internal/php5/php5.y:2688 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4927,7 +4906,7 @@ yydefault: } case 206: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2719 + // line internal/php5/php5.y:2698 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4939,7 +4918,7 @@ yydefault: } case 207: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2729 + // line internal/php5/php5.y:2708 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4951,7 +4930,7 @@ yydefault: } case 208: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2739 + // line internal/php5/php5.y:2718 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4963,7 +4942,7 @@ yydefault: } case 209: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2749 + // line internal/php5/php5.y:2728 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4975,7 +4954,7 @@ yydefault: } case 210: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2762 + // line internal/php5/php5.y:2741 { identifier := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -4993,7 +4972,7 @@ yydefault: } case 211: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:2778 + // line internal/php5/php5.y:2757 { identifier := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -5012,7 +4991,7 @@ yydefault: } case 212: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2795 + // line internal/php5/php5.y:2774 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -5029,7 +5008,7 @@ yydefault: } case 213: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2810 + // line internal/php5/php5.y:2789 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -5047,7 +5026,7 @@ yydefault: } case 214: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:2829 + // line internal/php5/php5.y:2808 { constList := yyDollar[1].node.(*ast.StmtClassConstList) constList.Node.Position = position.NewNodesPosition(yyDollar[1].node, yyDollar[5].node) @@ -5072,7 +5051,7 @@ yydefault: } case 215: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:2852 + // line internal/php5/php5.y:2831 { yyVAL.node = &ast.StmtClassConstList{ Node: ast.Node{ @@ -5100,7 +5079,7 @@ yydefault: } case 216: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2881 + // line internal/php5/php5.y:2860 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -5109,25 +5088,25 @@ yydefault: } case 217: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2888 + // line internal/php5/php5.y:2867 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 218: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:2896 + // line internal/php5/php5.y:2875 { yyVAL.list = nil } case 219: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2900 + // line internal/php5/php5.y:2879 { yyVAL.list = yyDollar[1].list } case 220: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2907 + // line internal/php5/php5.y:2886 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -5136,25 +5115,25 @@ yydefault: } case 221: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2914 + // line internal/php5/php5.y:2893 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 222: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:2921 + // line internal/php5/php5.y:2900 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].list...) } case 223: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2925 + // line internal/php5/php5.y:2904 { yyVAL.list = yyDollar[1].list } case 224: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:2932 + // line internal/php5/php5.y:2911 { fetch := &ast.ExprArrayDimFetch{ast.Node{}, nil, yyDollar[3].node} yyVAL.list = append(yyDollar[1].list, fetch) @@ -5168,7 +5147,7 @@ yydefault: } case 225: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2944 + // line internal/php5/php5.y:2923 { fetch := &ast.ExprArrayDimFetch{ast.Node{}, nil, yyDollar[2].node} yyVAL.list = []ast.Vertex{fetch} @@ -5182,37 +5161,37 @@ yydefault: } case 226: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:2959 + // line internal/php5/php5.y:2938 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].list...) } case 227: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2963 + // line internal/php5/php5.y:2942 { yyVAL.list = yyDollar[1].list } case 228: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2967 + // line internal/php5/php5.y:2946 { yyVAL.list = yyDollar[1].list } case 229: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:2974 + // line internal/php5/php5.y:2953 { yyVAL.list = nil } case 230: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2978 + // line internal/php5/php5.y:2957 { yyVAL.list = yyDollar[1].list } case 231: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2985 + // line internal/php5/php5.y:2964 { if yyDollar[3].node != nil { @@ -5228,7 +5207,7 @@ yydefault: } case 232: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php5/php5.y:3002 + // line internal/php5/php5.y:2981 { listNode := &ast.ExprList{ast.Node{}, yyDollar[3].list} yyVAL.node = &ast.ExprAssign{ast.Node{}, listNode, yyDollar[6].node} @@ -5245,7 +5224,7 @@ yydefault: } case 233: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3017 + // line internal/php5/php5.y:2996 { yyVAL.node = &ast.ExprAssign{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5258,7 +5237,7 @@ yydefault: } case 234: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:3028 + // line internal/php5/php5.y:3007 { yyVAL.node = &ast.ExprAssignReference{ast.Node{}, yyDollar[1].node, yyDollar[4].node} @@ -5272,7 +5251,7 @@ yydefault: } case 235: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php5/php5.y:3040 + // line internal/php5/php5.y:3019 { var _new *ast.ExprNew @@ -5299,7 +5278,7 @@ yydefault: } case 236: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3065 + // line internal/php5/php5.y:3044 { yyVAL.node = &ast.ExprClone{ast.Node{}, yyDollar[2].node} @@ -5311,7 +5290,7 @@ yydefault: } case 237: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3075 + // line internal/php5/php5.y:3054 { yyVAL.node = &ast.ExprAssignPlus{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5323,7 +5302,7 @@ yydefault: } case 238: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3085 + // line internal/php5/php5.y:3064 { yyVAL.node = &ast.ExprAssignMinus{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5336,7 +5315,7 @@ yydefault: } case 239: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3096 + // line internal/php5/php5.y:3075 { yyVAL.node = &ast.ExprAssignMul{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5349,7 +5328,7 @@ yydefault: } case 240: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3107 + // line internal/php5/php5.y:3086 { yyVAL.node = &ast.ExprAssignPow{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5362,7 +5341,7 @@ yydefault: } case 241: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3118 + // line internal/php5/php5.y:3097 { yyVAL.node = &ast.ExprAssignDiv{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5375,7 +5354,7 @@ yydefault: } case 242: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3129 + // line internal/php5/php5.y:3108 { yyVAL.node = &ast.ExprAssignConcat{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5388,7 +5367,7 @@ yydefault: } case 243: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3140 + // line internal/php5/php5.y:3119 { yyVAL.node = &ast.ExprAssignMod{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5401,7 +5380,7 @@ yydefault: } case 244: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3151 + // line internal/php5/php5.y:3130 { yyVAL.node = &ast.ExprAssignBitwiseAnd{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5414,7 +5393,7 @@ yydefault: } case 245: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3162 + // line internal/php5/php5.y:3141 { yyVAL.node = &ast.ExprAssignBitwiseOr{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5427,7 +5406,7 @@ yydefault: } case 246: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3173 + // line internal/php5/php5.y:3152 { yyVAL.node = &ast.ExprAssignBitwiseXor{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5440,7 +5419,7 @@ yydefault: } case 247: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3184 + // line internal/php5/php5.y:3163 { yyVAL.node = &ast.ExprAssignShiftLeft{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5453,7 +5432,7 @@ yydefault: } case 248: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3195 + // line internal/php5/php5.y:3174 { yyVAL.node = &ast.ExprAssignShiftRight{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5466,7 +5445,7 @@ yydefault: } case 249: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3206 + // line internal/php5/php5.y:3185 { yyVAL.node = &ast.ExprPostInc{ast.Node{}, yyDollar[1].node} @@ -5479,7 +5458,7 @@ yydefault: } case 250: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3217 + // line internal/php5/php5.y:3196 { yyVAL.node = &ast.ExprPreInc{ast.Node{}, yyDollar[2].node} @@ -5491,7 +5470,7 @@ yydefault: } case 251: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3227 + // line internal/php5/php5.y:3206 { yyVAL.node = &ast.ExprPostDec{ast.Node{}, yyDollar[1].node} @@ -5504,7 +5483,7 @@ yydefault: } case 252: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3238 + // line internal/php5/php5.y:3217 { yyVAL.node = &ast.ExprPreDec{ast.Node{}, yyDollar[2].node} @@ -5516,7 +5495,7 @@ yydefault: } case 253: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3248 + // line internal/php5/php5.y:3227 { yyVAL.node = &ast.ExprBinaryBooleanOr{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5529,7 +5508,7 @@ yydefault: } case 254: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3259 + // line internal/php5/php5.y:3238 { yyVAL.node = &ast.ExprBinaryBooleanAnd{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5542,7 +5521,7 @@ yydefault: } case 255: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3270 + // line internal/php5/php5.y:3249 { yyVAL.node = &ast.ExprBinaryLogicalOr{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5555,7 +5534,7 @@ yydefault: } case 256: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3281 + // line internal/php5/php5.y:3260 { yyVAL.node = &ast.ExprBinaryLogicalAnd{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5568,7 +5547,7 @@ yydefault: } case 257: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3292 + // line internal/php5/php5.y:3271 { yyVAL.node = &ast.ExprBinaryLogicalXor{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5581,7 +5560,7 @@ yydefault: } case 258: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3303 + // line internal/php5/php5.y:3282 { yyVAL.node = &ast.ExprBinaryBitwiseOr{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5594,7 +5573,7 @@ yydefault: } case 259: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3314 + // line internal/php5/php5.y:3293 { yyVAL.node = &ast.ExprBinaryBitwiseAnd{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5607,7 +5586,7 @@ yydefault: } case 260: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3325 + // line internal/php5/php5.y:3304 { yyVAL.node = &ast.ExprBinaryBitwiseXor{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5620,7 +5599,7 @@ yydefault: } case 261: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3336 + // line internal/php5/php5.y:3315 { yyVAL.node = &ast.ExprBinaryConcat{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5633,7 +5612,7 @@ yydefault: } case 262: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3347 + // line internal/php5/php5.y:3326 { yyVAL.node = &ast.ExprBinaryPlus{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5646,7 +5625,7 @@ yydefault: } case 263: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3358 + // line internal/php5/php5.y:3337 { yyVAL.node = &ast.ExprBinaryMinus{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5659,7 +5638,7 @@ yydefault: } case 264: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3369 + // line internal/php5/php5.y:3348 { yyVAL.node = &ast.ExprBinaryMul{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5672,7 +5651,7 @@ yydefault: } case 265: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3380 + // line internal/php5/php5.y:3359 { yyVAL.node = &ast.ExprBinaryPow{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5685,7 +5664,7 @@ yydefault: } case 266: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3391 + // line internal/php5/php5.y:3370 { yyVAL.node = &ast.ExprBinaryDiv{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5698,7 +5677,7 @@ yydefault: } case 267: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3402 + // line internal/php5/php5.y:3381 { yyVAL.node = &ast.ExprBinaryMod{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5711,7 +5690,7 @@ yydefault: } case 268: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3413 + // line internal/php5/php5.y:3392 { yyVAL.node = &ast.ExprBinaryShiftLeft{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5724,7 +5703,7 @@ yydefault: } case 269: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3424 + // line internal/php5/php5.y:3403 { yyVAL.node = &ast.ExprBinaryShiftRight{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5737,7 +5716,7 @@ yydefault: } case 270: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3435 + // line internal/php5/php5.y:3414 { yyVAL.node = &ast.ExprUnaryPlus{ast.Node{}, yyDollar[2].node} @@ -5749,7 +5728,7 @@ yydefault: } case 271: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3445 + // line internal/php5/php5.y:3424 { yyVAL.node = &ast.ExprUnaryMinus{ast.Node{}, yyDollar[2].node} @@ -5761,7 +5740,7 @@ yydefault: } case 272: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3455 + // line internal/php5/php5.y:3434 { yyVAL.node = &ast.ExprBooleanNot{ast.Node{}, yyDollar[2].node} @@ -5773,7 +5752,7 @@ yydefault: } case 273: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3465 + // line internal/php5/php5.y:3444 { yyVAL.node = &ast.ExprBitwiseNot{ast.Node{}, yyDollar[2].node} @@ -5785,7 +5764,7 @@ yydefault: } case 274: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3475 + // line internal/php5/php5.y:3454 { yyVAL.node = &ast.ExprBinaryIdentical{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5798,7 +5777,7 @@ yydefault: } case 275: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3486 + // line internal/php5/php5.y:3465 { yyVAL.node = &ast.ExprBinaryNotIdentical{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5811,7 +5790,7 @@ yydefault: } case 276: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3497 + // line internal/php5/php5.y:3476 { yyVAL.node = &ast.ExprBinaryEqual{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5824,7 +5803,7 @@ yydefault: } case 277: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3508 + // line internal/php5/php5.y:3487 { yyVAL.node = &ast.ExprBinaryNotEqual{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5838,7 +5817,7 @@ yydefault: } case 278: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3520 + // line internal/php5/php5.y:3499 { yyVAL.node = &ast.ExprBinarySmaller{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5851,7 +5830,7 @@ yydefault: } case 279: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3531 + // line internal/php5/php5.y:3510 { yyVAL.node = &ast.ExprBinarySmallerOrEqual{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5864,7 +5843,7 @@ yydefault: } case 280: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3542 + // line internal/php5/php5.y:3521 { yyVAL.node = &ast.ExprBinaryGreater{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5877,7 +5856,7 @@ yydefault: } case 281: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3553 + // line internal/php5/php5.y:3532 { yyVAL.node = &ast.ExprBinaryGreaterOrEqual{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5890,7 +5869,7 @@ yydefault: } case 282: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3564 + // line internal/php5/php5.y:3543 { yyVAL.node = &ast.ExprInstanceOf{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5903,19 +5882,19 @@ yydefault: } case 283: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:3575 + // line internal/php5/php5.y:3554 { yyVAL.node = yyDollar[1].node } case 284: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:3579 + // line internal/php5/php5.y:3558 { yyVAL.node = yyDollar[1].node } case 285: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:3583 + // line internal/php5/php5.y:3562 { yyVAL.node = yyDollar[2].node @@ -5947,7 +5926,7 @@ yydefault: } case 286: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:3613 + // line internal/php5/php5.y:3592 { yyVAL.node = &ast.ExprTernary{ast.Node{}, yyDollar[1].node, yyDollar[3].node, yyDollar[5].node} @@ -5961,7 +5940,7 @@ yydefault: } case 287: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:3625 + // line internal/php5/php5.y:3604 { yyVAL.node = &ast.ExprTernary{ast.Node{}, yyDollar[1].node, nil, yyDollar[4].node} @@ -5975,13 +5954,13 @@ yydefault: } case 288: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:3637 + // line internal/php5/php5.y:3616 { yyVAL.node = yyDollar[1].node } case 289: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3641 + // line internal/php5/php5.y:3620 { yyVAL.node = &ast.ExprCastInt{ast.Node{}, yyDollar[2].node} @@ -5994,7 +5973,7 @@ yydefault: } case 290: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3652 + // line internal/php5/php5.y:3631 { yyVAL.node = &ast.ExprCastDouble{ast.Node{}, yyDollar[2].node} @@ -6007,7 +5986,7 @@ yydefault: } case 291: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3663 + // line internal/php5/php5.y:3642 { yyVAL.node = &ast.ExprCastString{ast.Node{}, yyDollar[2].node} @@ -6020,7 +5999,7 @@ yydefault: } case 292: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3674 + // line internal/php5/php5.y:3653 { yyVAL.node = &ast.ExprCastArray{ast.Node{}, yyDollar[2].node} @@ -6033,7 +6012,7 @@ yydefault: } case 293: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3685 + // line internal/php5/php5.y:3664 { yyVAL.node = &ast.ExprCastObject{ast.Node{}, yyDollar[2].node} @@ -6046,7 +6025,7 @@ yydefault: } case 294: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3696 + // line internal/php5/php5.y:3675 { yyVAL.node = &ast.ExprCastBool{ast.Node{}, yyDollar[2].node} @@ -6059,7 +6038,7 @@ yydefault: } case 295: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3707 + // line internal/php5/php5.y:3686 { yyVAL.node = &ast.ExprCastUnset{ast.Node{}, yyDollar[2].node} @@ -6072,7 +6051,7 @@ yydefault: } case 296: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3718 + // line internal/php5/php5.y:3697 { yyVAL.node = &ast.ExprExit{ast.Node{}, false, yyDollar[2].node} @@ -6092,7 +6071,7 @@ yydefault: } case 297: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3736 + // line internal/php5/php5.y:3715 { yyVAL.node = &ast.ExprErrorSuppress{ast.Node{}, yyDollar[2].node} @@ -6104,25 +6083,25 @@ yydefault: } case 298: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:3746 + // line internal/php5/php5.y:3725 { yyVAL.node = yyDollar[1].node } case 299: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:3750 + // line internal/php5/php5.y:3729 { yyVAL.node = yyDollar[1].node } case 300: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:3754 + // line internal/php5/php5.y:3733 { yyVAL.node = yyDollar[1].node } case 301: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3758 + // line internal/php5/php5.y:3737 { yyVAL.node = &ast.ExprShellExec{ast.Node{}, yyDollar[2].list} @@ -6134,7 +6113,7 @@ yydefault: } case 302: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3768 + // line internal/php5/php5.y:3747 { yyVAL.node = &ast.ExprPrint{ast.Node{}, yyDollar[2].node} @@ -6146,7 +6125,7 @@ yydefault: } case 303: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:3778 + // line internal/php5/php5.y:3757 { yyVAL.node = &ast.ExprYield{ast.Node{}, nil, nil} @@ -6158,7 +6137,7 @@ yydefault: } case 304: yyDollar = yyS[yypt-9 : yypt+1] -// line internal/php5/php5.y:3788 + // line internal/php5/php5.y:3767 { yyVAL.node = &ast.ExprClosure{ast.Node{}, yyDollar[2].token != nil, false, yyDollar[4].list, yyDollar[6].ClosureUse, nil, yyDollar[8].list} @@ -6185,7 +6164,7 @@ yydefault: } case 305: yyDollar = yyS[yypt-10 : yypt+1] -// line internal/php5/php5.y:3812 + // line internal/php5/php5.y:3791 { yyVAL.node = &ast.ExprClosure{ast.Node{}, yyDollar[3].token != nil, true, yyDollar[5].list, yyDollar[7].ClosureUse, nil, yyDollar[9].list} @@ -6213,7 +6192,7 @@ yydefault: } case 306: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3840 + // line internal/php5/php5.y:3819 { yyVAL.node = &ast.ExprYield{ast.Node{}, nil, yyDollar[2].node} @@ -6225,7 +6204,7 @@ yydefault: } case 307: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3850 + // line internal/php5/php5.y:3829 { yyVAL.node = &ast.ExprYield{ast.Node{}, nil, yyDollar[2].node} @@ -6237,7 +6216,7 @@ yydefault: } case 308: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:3860 + // line internal/php5/php5.y:3839 { yyVAL.node = &ast.ExprYield{ast.Node{}, yyDollar[2].node, yyDollar[4].node} @@ -6250,7 +6229,7 @@ yydefault: } case 309: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:3871 + // line internal/php5/php5.y:3850 { yyVAL.node = &ast.ExprYield{ast.Node{}, yyDollar[2].node, yyDollar[4].node} @@ -6263,7 +6242,7 @@ yydefault: } case 310: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:3885 + // line internal/php5/php5.y:3864 { yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -6276,7 +6255,7 @@ yydefault: } case 311: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:3896 + // line internal/php5/php5.y:3875 { yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -6289,7 +6268,7 @@ yydefault: } case 312: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:3907 + // line internal/php5/php5.y:3886 { str := &ast.ScalarString{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, str, yyDollar[3].node} @@ -6305,7 +6284,7 @@ yydefault: } case 313: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:3921 + // line internal/php5/php5.y:3900 { yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -6318,7 +6297,7 @@ yydefault: } case 314: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:3935 + // line internal/php5/php5.y:3914 { yyVAL.node = &ast.ExprArray{ast.Node{}, yyDollar[3].list} @@ -6332,7 +6311,7 @@ yydefault: } case 315: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3947 + // line internal/php5/php5.y:3926 { yyVAL.node = &ast.ExprShortArray{ast.Node{}, yyDollar[2].list} @@ -6345,19 +6324,19 @@ yydefault: } case 316: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:3961 + // line internal/php5/php5.y:3940 { yyVAL.token = yyDollar[1].token } case 317: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:3968 + // line internal/php5/php5.y:3947 { yyVAL.ClosureUse = nil } case 318: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:3972 + // line internal/php5/php5.y:3951 { yyVAL.ClosureUse = &ast.ExprClosureUse{ast.Node{}, yyDollar[3].list} @@ -6371,7 +6350,7 @@ yydefault: } case 319: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3987 + // line internal/php5/php5.y:3966 { identifier := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -6387,7 +6366,7 @@ yydefault: } case 320: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:4001 + // line internal/php5/php5.y:3980 { identifier := &ast.Identifier{ast.Node{}, yyDollar[4].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -6406,7 +6385,7 @@ yydefault: } case 321: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4018 + // line internal/php5/php5.y:3997 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -6421,7 +6400,7 @@ yydefault: } case 322: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4031 + // line internal/php5/php5.y:4010 { identifier := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -6439,7 +6418,7 @@ yydefault: } case 323: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4050 + // line internal/php5/php5.y:4029 { name := &ast.NameName{ Node: ast.Node{ @@ -6454,7 +6433,7 @@ yydefault: } case 324: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:4063 + // line internal/php5/php5.y:4042 { name := &ast.NameRelative{ Node: ast.Node{ @@ -6471,7 +6450,7 @@ yydefault: } case 325: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4078 + // line internal/php5/php5.y:4057 { name := &ast.NameFullyQualified{ Node: ast.Node{ @@ -6487,7 +6466,7 @@ yydefault: } case 326: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:4092 + // line internal/php5/php5.y:4071 { yyVAL.node = &ast.ExprStaticCall{ast.Node{}, yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*ast.ArgumentList)} @@ -6500,7 +6479,7 @@ yydefault: } case 327: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:4103 + // line internal/php5/php5.y:4082 { yyVAL.node = &ast.ExprStaticCall{ast.Node{}, yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*ast.ArgumentList)} @@ -6513,7 +6492,7 @@ yydefault: } case 328: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:4114 + // line internal/php5/php5.y:4093 { yyVAL.node = &ast.ExprStaticCall{ast.Node{}, yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*ast.ArgumentList)} @@ -6526,7 +6505,7 @@ yydefault: } case 329: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:4125 + // line internal/php5/php5.y:4104 { yyVAL.node = &ast.ExprStaticCall{ast.Node{}, yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*ast.ArgumentList)} @@ -6539,7 +6518,7 @@ yydefault: } case 330: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4136 + // line internal/php5/php5.y:4115 { yyVAL.node = &ast.ExprFunctionCall{ast.Node{}, yyDollar[1].node, yyDollar[2].node.(*ast.ArgumentList)} @@ -6551,7 +6530,7 @@ yydefault: } case 331: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4149 + // line internal/php5/php5.y:4128 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -6563,7 +6542,7 @@ yydefault: } case 332: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4159 + // line internal/php5/php5.y:4138 { yyVAL.node = &ast.NameName{ Node: ast.Node{ @@ -6574,7 +6553,7 @@ yydefault: } case 333: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4168 + // line internal/php5/php5.y:4147 { yyVAL.node = &ast.NameRelative{ Node: ast.Node{ @@ -6587,7 +6566,7 @@ yydefault: } case 334: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4179 + // line internal/php5/php5.y:4158 { yyVAL.node = &ast.NameFullyQualified{ Node: ast.Node{ @@ -6599,7 +6578,7 @@ yydefault: } case 335: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4192 + // line internal/php5/php5.y:4171 { yyVAL.node = &ast.NameName{ Node: ast.Node{ @@ -6610,7 +6589,7 @@ yydefault: } case 336: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4201 + // line internal/php5/php5.y:4180 { yyVAL.node = &ast.NameRelative{ Node: ast.Node{ @@ -6623,7 +6602,7 @@ yydefault: } case 337: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4212 + // line internal/php5/php5.y:4191 { yyVAL.node = &ast.NameFullyQualified{ Node: ast.Node{ @@ -6635,19 +6614,19 @@ yydefault: } case 338: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4225 + // line internal/php5/php5.y:4204 { yyVAL.node = yyDollar[1].node } case 339: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4229 + // line internal/php5/php5.y:4208 { yyVAL.node = yyDollar[1].node } case 340: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:4236 + // line internal/php5/php5.y:4215 { yyVAL.node = yyDollar[1].node @@ -6688,25 +6667,25 @@ yydefault: } case 341: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4275 + // line internal/php5/php5.y:4254 { yyVAL.node = yyDollar[1].node } case 342: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4283 + // line internal/php5/php5.y:4262 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].list...) } case 343: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:4287 + // line internal/php5/php5.y:4266 { yyVAL.list = []ast.Vertex{} } case 344: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4295 + // line internal/php5/php5.y:4274 { yyVAL.list = yyDollar[2].list @@ -6715,13 +6694,13 @@ yydefault: } case 345: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:4305 + // line internal/php5/php5.y:4284 { yyVAL.node = nil } case 346: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4309 + // line internal/php5/php5.y:4288 { yyVAL.node = &ast.ParserBrackets{ Node: ast.Node{ @@ -6737,19 +6716,19 @@ yydefault: } case 347: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4323 + // line internal/php5/php5.y:4302 { yyVAL.node = yyDollar[1].node } case 348: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:4330 + // line internal/php5/php5.y:4309 { yyVAL.list = []ast.Vertex{} } case 349: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4334 + // line internal/php5/php5.y:4313 { part := &ast.ScalarEncapsedStringPart{ast.Node{}, yyDollar[1].token.Value} yyVAL.list = []ast.Vertex{part} @@ -6759,25 +6738,25 @@ yydefault: } case 350: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4342 + // line internal/php5/php5.y:4321 { yyVAL.list = yyDollar[1].list } case 351: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:4349 + // line internal/php5/php5.y:4328 { yyVAL.node = nil } case 352: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4353 + // line internal/php5/php5.y:4332 { yyVAL.node = yyDollar[1].node } case 353: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4360 + // line internal/php5/php5.y:4339 { yyVAL.node = &ast.ScalarLnumber{ast.Node{}, yyDollar[1].token.Value} @@ -6789,7 +6768,7 @@ yydefault: } case 354: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4370 + // line internal/php5/php5.y:4349 { yyVAL.node = &ast.ScalarDnumber{ast.Node{}, yyDollar[1].token.Value} @@ -6801,7 +6780,7 @@ yydefault: } case 355: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4380 + // line internal/php5/php5.y:4359 { yyVAL.node = &ast.ScalarString{ast.Node{}, yyDollar[1].token.Value} @@ -6813,7 +6792,7 @@ yydefault: } case 356: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4390 + // line internal/php5/php5.y:4369 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6825,7 +6804,7 @@ yydefault: } case 357: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4400 + // line internal/php5/php5.y:4379 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6837,7 +6816,7 @@ yydefault: } case 358: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4410 + // line internal/php5/php5.y:4389 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6849,7 +6828,7 @@ yydefault: } case 359: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4420 + // line internal/php5/php5.y:4399 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6861,7 +6840,7 @@ yydefault: } case 360: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4430 + // line internal/php5/php5.y:4409 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6873,7 +6852,7 @@ yydefault: } case 361: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4440 + // line internal/php5/php5.y:4419 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6885,7 +6864,7 @@ yydefault: } case 362: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4450 + // line internal/php5/php5.y:4429 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6897,7 +6876,7 @@ yydefault: } case 363: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4460 + // line internal/php5/php5.y:4439 { encapsed := &ast.ScalarEncapsedStringPart{ast.Node{}, yyDollar[2].token.Value} yyVAL.node = &ast.ScalarHeredoc{ast.Node{}, yyDollar[1].token.Value, []ast.Vertex{encapsed}} @@ -6911,7 +6890,7 @@ yydefault: } case 364: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4472 + // line internal/php5/php5.y:4451 { yyVAL.node = &ast.ScalarHeredoc{ast.Node{}, yyDollar[1].token.Value, nil} @@ -6923,7 +6902,7 @@ yydefault: } case 365: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4485 + // line internal/php5/php5.y:4464 { target := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.ExprClassConstFetch{ast.Node{}, yyDollar[1].node, target} @@ -6939,25 +6918,25 @@ yydefault: } case 366: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4502 + // line internal/php5/php5.y:4481 { yyVAL.node = yyDollar[1].node } case 367: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4509 + // line internal/php5/php5.y:4488 { yyVAL.node = yyDollar[1].node } case 368: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4513 + // line internal/php5/php5.y:4492 { yyVAL.node = yyDollar[1].node } case 369: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4517 + // line internal/php5/php5.y:4496 { name := &ast.NameName{ Node: ast.Node{ @@ -6972,7 +6951,7 @@ yydefault: } case 370: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4530 + // line internal/php5/php5.y:4509 { name := &ast.NameRelative{ Node: ast.Node{ @@ -6989,7 +6968,7 @@ yydefault: } case 371: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4545 + // line internal/php5/php5.y:4524 { name := &ast.NameFullyQualified{ Node: ast.Node{ @@ -7005,7 +6984,7 @@ yydefault: } case 372: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:4559 + // line internal/php5/php5.y:4538 { yyVAL.node = &ast.ExprArray{ast.Node{}, yyDollar[3].list} @@ -7019,7 +6998,7 @@ yydefault: } case 373: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4571 + // line internal/php5/php5.y:4550 { yyVAL.node = &ast.ExprShortArray{ast.Node{}, yyDollar[2].list} @@ -7032,13 +7011,13 @@ yydefault: } case 374: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4582 + // line internal/php5/php5.y:4561 { yyVAL.node = yyDollar[1].node } case 375: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4586 + // line internal/php5/php5.y:4565 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -7050,13 +7029,13 @@ yydefault: } case 376: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4596 + // line internal/php5/php5.y:4575 { yyVAL.node = yyDollar[1].node } case 377: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:4603 + // line internal/php5/php5.y:4582 { yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7069,7 +7048,7 @@ yydefault: } case 378: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4614 + // line internal/php5/php5.y:4593 { yyVAL.node = &ast.ExprBinaryPlus{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7082,7 +7061,7 @@ yydefault: } case 379: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4625 + // line internal/php5/php5.y:4604 { yyVAL.node = &ast.ExprBinaryMinus{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7095,7 +7074,7 @@ yydefault: } case 380: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4636 + // line internal/php5/php5.y:4615 { yyVAL.node = &ast.ExprBinaryMul{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7108,7 +7087,7 @@ yydefault: } case 381: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4647 + // line internal/php5/php5.y:4626 { yyVAL.node = &ast.ExprBinaryPow{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7121,7 +7100,7 @@ yydefault: } case 382: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4658 + // line internal/php5/php5.y:4637 { yyVAL.node = &ast.ExprBinaryDiv{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7134,7 +7113,7 @@ yydefault: } case 383: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4669 + // line internal/php5/php5.y:4648 { yyVAL.node = &ast.ExprBinaryMod{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7147,7 +7126,7 @@ yydefault: } case 384: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4680 + // line internal/php5/php5.y:4659 { yyVAL.node = &ast.ExprBooleanNot{ast.Node{}, yyDollar[2].node} @@ -7159,7 +7138,7 @@ yydefault: } case 385: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4690 + // line internal/php5/php5.y:4669 { yyVAL.node = &ast.ExprBitwiseNot{ast.Node{}, yyDollar[2].node} @@ -7171,7 +7150,7 @@ yydefault: } case 386: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4700 + // line internal/php5/php5.y:4679 { yyVAL.node = &ast.ExprBinaryBitwiseOr{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7184,7 +7163,7 @@ yydefault: } case 387: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4711 + // line internal/php5/php5.y:4690 { yyVAL.node = &ast.ExprBinaryBitwiseAnd{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7197,7 +7176,7 @@ yydefault: } case 388: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4722 + // line internal/php5/php5.y:4701 { yyVAL.node = &ast.ExprBinaryBitwiseXor{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7210,7 +7189,7 @@ yydefault: } case 389: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4733 + // line internal/php5/php5.y:4712 { yyVAL.node = &ast.ExprBinaryShiftLeft{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7223,7 +7202,7 @@ yydefault: } case 390: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4744 + // line internal/php5/php5.y:4723 { yyVAL.node = &ast.ExprBinaryShiftRight{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7236,7 +7215,7 @@ yydefault: } case 391: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4755 + // line internal/php5/php5.y:4734 { yyVAL.node = &ast.ExprBinaryConcat{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7249,7 +7228,7 @@ yydefault: } case 392: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4766 + // line internal/php5/php5.y:4745 { yyVAL.node = &ast.ExprBinaryLogicalXor{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7262,7 +7241,7 @@ yydefault: } case 393: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4777 + // line internal/php5/php5.y:4756 { yyVAL.node = &ast.ExprBinaryLogicalAnd{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7275,7 +7254,7 @@ yydefault: } case 394: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4788 + // line internal/php5/php5.y:4767 { yyVAL.node = &ast.ExprBinaryLogicalOr{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7288,7 +7267,7 @@ yydefault: } case 395: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4799 + // line internal/php5/php5.y:4778 { yyVAL.node = &ast.ExprBinaryBooleanAnd{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7301,7 +7280,7 @@ yydefault: } case 396: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4810 + // line internal/php5/php5.y:4789 { yyVAL.node = &ast.ExprBinaryBooleanOr{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7314,7 +7293,7 @@ yydefault: } case 397: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4821 + // line internal/php5/php5.y:4800 { yyVAL.node = &ast.ExprBinaryIdentical{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7327,7 +7306,7 @@ yydefault: } case 398: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4832 + // line internal/php5/php5.y:4811 { yyVAL.node = &ast.ExprBinaryNotIdentical{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7340,7 +7319,7 @@ yydefault: } case 399: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4843 + // line internal/php5/php5.y:4822 { yyVAL.node = &ast.ExprBinaryEqual{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7353,7 +7332,7 @@ yydefault: } case 400: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4854 + // line internal/php5/php5.y:4833 { yyVAL.node = &ast.ExprBinaryNotEqual{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7367,7 +7346,7 @@ yydefault: } case 401: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4866 + // line internal/php5/php5.y:4845 { yyVAL.node = &ast.ExprBinarySmaller{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7380,7 +7359,7 @@ yydefault: } case 402: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4877 + // line internal/php5/php5.y:4856 { yyVAL.node = &ast.ExprBinaryGreater{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7393,7 +7372,7 @@ yydefault: } case 403: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4888 + // line internal/php5/php5.y:4867 { yyVAL.node = &ast.ExprBinarySmallerOrEqual{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7406,7 +7385,7 @@ yydefault: } case 404: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4899 + // line internal/php5/php5.y:4878 { yyVAL.node = &ast.ExprBinaryGreaterOrEqual{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7419,7 +7398,7 @@ yydefault: } case 405: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:4910 + // line internal/php5/php5.y:4889 { yyVAL.node = &ast.ExprTernary{ast.Node{}, yyDollar[1].node, nil, yyDollar[4].node} @@ -7433,7 +7412,7 @@ yydefault: } case 406: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:4922 + // line internal/php5/php5.y:4901 { yyVAL.node = &ast.ExprTernary{ast.Node{}, yyDollar[1].node, yyDollar[3].node, yyDollar[5].node} @@ -7447,7 +7426,7 @@ yydefault: } case 407: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4934 + // line internal/php5/php5.y:4913 { yyVAL.node = &ast.ExprUnaryPlus{ast.Node{}, yyDollar[2].node} @@ -7459,7 +7438,7 @@ yydefault: } case 408: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4944 + // line internal/php5/php5.y:4923 { yyVAL.node = &ast.ExprUnaryMinus{ast.Node{}, yyDollar[2].node} @@ -7471,7 +7450,7 @@ yydefault: } case 409: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4954 + // line internal/php5/php5.y:4933 { yyVAL.node = yyDollar[2].node @@ -7481,13 +7460,13 @@ yydefault: } case 410: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4965 + // line internal/php5/php5.y:4944 { yyVAL.node = yyDollar[1].node } case 411: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4969 + // line internal/php5/php5.y:4948 { name := &ast.NameName{ Node: ast.Node{ @@ -7502,7 +7481,7 @@ yydefault: } case 412: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4982 + // line internal/php5/php5.y:4961 { name := &ast.NameRelative{ Node: ast.Node{ @@ -7519,7 +7498,7 @@ yydefault: } case 413: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4997 + // line internal/php5/php5.y:4976 { name := &ast.NameFullyQualified{ Node: ast.Node{ @@ -7535,7 +7514,7 @@ yydefault: } case 414: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5014 + // line internal/php5/php5.y:4993 { name := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ExprVariable{ast.Node{}, name} @@ -7549,25 +7528,25 @@ yydefault: } case 415: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5026 + // line internal/php5/php5.y:5005 { yyVAL.node = yyDollar[1].node } case 416: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5030 + // line internal/php5/php5.y:5009 { yyVAL.node = yyDollar[1].node } case 417: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5034 + // line internal/php5/php5.y:5013 { yyVAL.node = yyDollar[1].node } case 418: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5038 + // line internal/php5/php5.y:5017 { yyVAL.node = &ast.ScalarEncapsed{ast.Node{}, yyDollar[2].list} @@ -7579,7 +7558,7 @@ yydefault: } case 419: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5048 + // line internal/php5/php5.y:5027 { yyVAL.node = &ast.ScalarHeredoc{ast.Node{}, yyDollar[1].token.Value, yyDollar[2].list} @@ -7591,7 +7570,7 @@ yydefault: } case 420: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5058 + // line internal/php5/php5.y:5037 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -7603,13 +7582,13 @@ yydefault: } case 421: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:5071 + // line internal/php5/php5.y:5050 { yyVAL.list = nil } case 422: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:5075 + // line internal/php5/php5.y:5054 { yyVAL.list = yyDollar[1].list @@ -7620,19 +7599,19 @@ yydefault: } case 423: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:5087 + // line internal/php5/php5.y:5066 { yyVAL.token = nil } case 424: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5091 + // line internal/php5/php5.y:5070 { yyVAL.token = yyDollar[1].token } case 425: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:5098 + // line internal/php5/php5.y:5077 { arrayItem := &ast.ExprArrayItem{ast.Node{}, false, yyDollar[3].node, yyDollar[5].node} yyVAL.list = append(yyDollar[1].list, arrayItem) @@ -7647,7 +7626,7 @@ yydefault: } case 426: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5111 + // line internal/php5/php5.y:5090 { arrayItem := &ast.ExprArrayItem{ast.Node{}, false, nil, yyDollar[3].node} yyVAL.list = append(yyDollar[1].list, arrayItem) @@ -7661,7 +7640,7 @@ yydefault: } case 427: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5123 + // line internal/php5/php5.y:5102 { arrayItem := &ast.ExprArrayItem{ast.Node{}, false, yyDollar[1].node, yyDollar[3].node} yyVAL.list = []ast.Vertex{arrayItem} @@ -7675,7 +7654,7 @@ yydefault: } case 428: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5135 + // line internal/php5/php5.y:5114 { arrayItem := &ast.ExprArrayItem{ast.Node{}, false, nil, yyDollar[1].node} yyVAL.list = []ast.Vertex{arrayItem} @@ -7688,19 +7667,19 @@ yydefault: } case 429: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5149 + // line internal/php5/php5.y:5128 { yyVAL.node = yyDollar[1].node } case 430: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5153 + // line internal/php5/php5.y:5132 { yyVAL.node = yyDollar[1].node } case 431: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5160 + // line internal/php5/php5.y:5139 { yyVAL.node = &ast.ParserBrackets{ Node: ast.Node{ @@ -7717,7 +7696,7 @@ yydefault: } case 432: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5175 + // line internal/php5/php5.y:5154 { yyVAL.node = &ast.ParserBrackets{ Node: ast.Node{ @@ -7734,25 +7713,25 @@ yydefault: } case 433: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5194 + // line internal/php5/php5.y:5173 { yyVAL.node = yyDollar[1].node } case 434: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5202 + // line internal/php5/php5.y:5181 { yyVAL.node = yyDollar[1].node } case 435: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5209 + // line internal/php5/php5.y:5188 { yyVAL.node = yyDollar[1].node } case 436: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:5216 + // line internal/php5/php5.y:5195 { yyVAL.node = yyDollar[1].node @@ -7810,25 +7789,25 @@ yydefault: } case 437: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5272 + // line internal/php5/php5.y:5251 { yyVAL.node = yyDollar[1].node } case 438: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:5279 + // line internal/php5/php5.y:5258 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].list...) } case 439: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:5283 + // line internal/php5/php5.y:5262 { yyVAL.list = []ast.Vertex{} } case 440: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5291 + // line internal/php5/php5.y:5270 { if yyDollar[3].list != nil { yyDollar[3].list[0].(*ast.ExprMethodCall).Method = yyDollar[2].list[len(yyDollar[2].list)-1].(*ast.ExprPropertyFetch).Property @@ -7842,7 +7821,7 @@ yydefault: } case 441: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5306 + // line internal/php5/php5.y:5285 { fetch := &ast.ExprArrayDimFetch{ast.Node{}, nil, yyDollar[3].node} yyVAL.list = append(yyDollar[1].list, fetch) @@ -7856,7 +7835,7 @@ yydefault: } case 442: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5318 + // line internal/php5/php5.y:5297 { fetch := &ast.ExprArrayDimFetch{ast.Node{}, nil, yyDollar[3].node} yyVAL.list = []ast.Vertex{yyDollar[1].node, fetch} @@ -7870,7 +7849,7 @@ yydefault: } case 443: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5333 + // line internal/php5/php5.y:5312 { yyVAL.node = &ast.ExprMethodCall{ast.Node{}, nil, nil, yyDollar[1].node.(*ast.ArgumentList)} @@ -7879,31 +7858,31 @@ yydefault: } case 444: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5343 + // line internal/php5/php5.y:5322 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 445: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5347 + // line internal/php5/php5.y:5326 { yyVAL.list = yyDollar[1].list } case 446: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:5351 + // line internal/php5/php5.y:5330 { yyVAL.list = nil } case 447: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5358 + // line internal/php5/php5.y:5337 { yyVAL.node = yyDollar[1].node } case 448: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:5362 + // line internal/php5/php5.y:5341 { yyDollar[1].simpleIndirectReference.last.VarName = yyDollar[2].node @@ -7915,7 +7894,7 @@ yydefault: } case 449: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5375 + // line internal/php5/php5.y:5354 { yyVAL.node = &ast.ExprStaticPropertyFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7928,7 +7907,7 @@ yydefault: } case 450: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5386 + // line internal/php5/php5.y:5365 { yyVAL.node = &ast.ExprStaticPropertyFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7941,13 +7920,13 @@ yydefault: } case 451: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5400 + // line internal/php5/php5.y:5379 { yyVAL.node = yyDollar[1].node } case 452: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5407 + // line internal/php5/php5.y:5386 { yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7960,7 +7939,7 @@ yydefault: } case 453: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5418 + // line internal/php5/php5.y:5397 { yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7973,31 +7952,31 @@ yydefault: } case 454: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5432 + // line internal/php5/php5.y:5411 { yyVAL.node = yyDollar[1].node } case 455: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5436 + // line internal/php5/php5.y:5415 { yyVAL.node = yyDollar[1].node } case 456: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5440 + // line internal/php5/php5.y:5419 { yyVAL.node = yyDollar[1].node } case 457: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5448 + // line internal/php5/php5.y:5427 { yyVAL.node = yyDollar[1].node } case 458: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:5452 + // line internal/php5/php5.y:5431 { yyDollar[1].simpleIndirectReference.last.VarName = yyDollar[2].node @@ -8009,13 +7988,13 @@ yydefault: } case 459: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5462 + // line internal/php5/php5.y:5441 { yyVAL.node = yyDollar[1].node } case 460: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5469 + // line internal/php5/php5.y:5448 { yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -8028,7 +8007,7 @@ yydefault: } case 461: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5480 + // line internal/php5/php5.y:5459 { yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -8041,13 +8020,13 @@ yydefault: } case 462: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5491 + // line internal/php5/php5.y:5470 { yyVAL.node = yyDollar[1].node } case 463: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5499 + // line internal/php5/php5.y:5478 { name := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ExprVariable{ast.Node{}, name} @@ -8061,7 +8040,7 @@ yydefault: } case 464: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5511 + // line internal/php5/php5.y:5490 { yyVAL.node = &ast.ExprVariable{ast.Node{}, yyDollar[3].node} @@ -8075,25 +8054,25 @@ yydefault: } case 465: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:5526 + // line internal/php5/php5.y:5505 { yyVAL.node = nil } case 466: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5530 + // line internal/php5/php5.y:5509 { yyVAL.node = yyDollar[1].node } case 467: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5538 + // line internal/php5/php5.y:5517 { yyVAL.list = yyDollar[1].list } case 468: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5542 + // line internal/php5/php5.y:5521 { fetch := &ast.ExprPropertyFetch{ast.Node{}, nil, yyDollar[1].node} yyVAL.list = []ast.Vertex{fetch} @@ -8103,7 +8082,7 @@ yydefault: } case 469: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5553 + // line internal/php5/php5.y:5532 { fetch := &ast.ExprArrayDimFetch{ast.Node{}, nil, yyDollar[3].node} yyVAL.list = append(yyDollar[1].list, fetch) @@ -8117,7 +8096,7 @@ yydefault: } case 470: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5565 + // line internal/php5/php5.y:5544 { fetch := &ast.ExprArrayDimFetch{ast.Node{}, nil, yyDollar[3].node} yyVAL.list = append(yyDollar[1].list, fetch) @@ -8131,7 +8110,7 @@ yydefault: } case 471: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5577 + // line internal/php5/php5.y:5556 { fetch := &ast.ExprPropertyFetch{ast.Node{}, nil, yyDollar[1].node} yyVAL.list = []ast.Vertex{fetch} @@ -8141,7 +8120,7 @@ yydefault: } case 472: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5588 + // line internal/php5/php5.y:5567 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -8153,7 +8132,7 @@ yydefault: } case 473: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5598 + // line internal/php5/php5.y:5577 { yyVAL.node = yyDollar[2].node @@ -8166,7 +8145,7 @@ yydefault: } case 474: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5612 + // line internal/php5/php5.y:5591 { n := &ast.ExprVariable{ast.Node{}, nil} yyVAL.simpleIndirectReference = simpleIndirectReference{[]*ast.ExprVariable{n}, n} @@ -8179,7 +8158,7 @@ yydefault: } case 475: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:5623 + // line internal/php5/php5.y:5602 { n := &ast.ExprVariable{ast.Node{}, nil} @@ -8196,7 +8175,7 @@ yydefault: } case 476: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5641 + // line internal/php5/php5.y:5620 { if len(yyDollar[1].list) == 0 { yyDollar[1].list = []ast.Vertex{&ast.ExprArrayItem{ast.Node{}, false, nil, nil}} @@ -8209,7 +8188,7 @@ yydefault: } case 477: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5652 + // line internal/php5/php5.y:5631 { if yyDollar[1].node.(*ast.ExprArrayItem).Key == nil && yyDollar[1].node.(*ast.ExprArrayItem).Val == nil { yyVAL.list = []ast.Vertex{} @@ -8219,7 +8198,7 @@ yydefault: } case 478: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5664 + // line internal/php5/php5.y:5643 { yyVAL.node = &ast.ExprArrayItem{ast.Node{}, false, nil, yyDollar[1].node} @@ -8231,7 +8210,7 @@ yydefault: } case 479: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5674 + // line internal/php5/php5.y:5653 { listNode := &ast.ExprList{ast.Node{}, yyDollar[3].list} yyVAL.node = &ast.ExprArrayItem{ast.Node{}, false, nil, listNode} @@ -8247,19 +8226,19 @@ yydefault: } case 480: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:5688 + // line internal/php5/php5.y:5667 { yyVAL.node = &ast.ExprArrayItem{ast.Node{}, false, nil, nil} } case 481: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:5696 + // line internal/php5/php5.y:5675 { yyVAL.list = []ast.Vertex{} } case 482: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:5700 + // line internal/php5/php5.y:5679 { yyVAL.list = yyDollar[1].list @@ -8274,7 +8253,7 @@ yydefault: } case 483: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:5716 + // line internal/php5/php5.y:5695 { arrayItem := &ast.ExprArrayItem{ast.Node{}, false, yyDollar[3].node, yyDollar[5].node} yyVAL.list = append(yyDollar[1].list, arrayItem) @@ -8289,7 +8268,7 @@ yydefault: } case 484: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5729 + // line internal/php5/php5.y:5708 { arrayItem := &ast.ExprArrayItem{ast.Node{}, false, nil, yyDollar[3].node} yyVAL.list = append(yyDollar[1].list, arrayItem) @@ -8303,7 +8282,7 @@ yydefault: } case 485: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5741 + // line internal/php5/php5.y:5720 { arrayItem := &ast.ExprArrayItem{ast.Node{}, false, yyDollar[1].node, yyDollar[3].node} yyVAL.list = []ast.Vertex{arrayItem} @@ -8317,7 +8296,7 @@ yydefault: } case 486: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5753 + // line internal/php5/php5.y:5732 { arrayItem := &ast.ExprArrayItem{ast.Node{}, false, nil, yyDollar[1].node} yyVAL.list = []ast.Vertex{arrayItem} @@ -8330,7 +8309,7 @@ yydefault: } case 487: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php5/php5.y:5764 + // line internal/php5/php5.y:5743 { reference := &ast.ExprReference{ast.Node{}, yyDollar[6].node} arrayItem := &ast.ExprArrayItem{ast.Node{}, false, yyDollar[3].node, reference} @@ -8348,7 +8327,7 @@ yydefault: } case 488: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5780 + // line internal/php5/php5.y:5759 { reference := &ast.ExprReference{ast.Node{}, yyDollar[4].node} arrayItem := &ast.ExprArrayItem{ast.Node{}, false, nil, reference} @@ -8364,7 +8343,7 @@ yydefault: } case 489: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5794 + // line internal/php5/php5.y:5773 { reference := &ast.ExprReference{ast.Node{}, yyDollar[4].node} arrayItem := &ast.ExprArrayItem{ast.Node{}, false, yyDollar[1].node, reference} @@ -8381,7 +8360,7 @@ yydefault: } case 490: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:5809 + // line internal/php5/php5.y:5788 { reference := &ast.ExprReference{ast.Node{}, yyDollar[2].node} arrayItem := &ast.ExprArrayItem{ast.Node{}, false, nil, reference} @@ -8396,13 +8375,13 @@ yydefault: } case 491: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:5825 + // line internal/php5/php5.y:5804 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 492: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:5829 + // line internal/php5/php5.y:5808 { encapsed := &ast.ScalarEncapsedStringPart{ast.Node{}, yyDollar[2].token.Value} yyVAL.list = append(yyDollar[1].list, encapsed) @@ -8415,13 +8394,13 @@ yydefault: } case 493: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5840 + // line internal/php5/php5.y:5819 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 494: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:5844 + // line internal/php5/php5.y:5823 { encapsed := &ast.ScalarEncapsedStringPart{ast.Node{}, yyDollar[1].token.Value} yyVAL.list = []ast.Vertex{encapsed, yyDollar[2].node} @@ -8434,7 +8413,7 @@ yydefault: } case 495: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5858 + // line internal/php5/php5.y:5837 { name := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ExprVariable{ast.Node{}, name} @@ -8448,7 +8427,7 @@ yydefault: } case 496: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5870 + // line internal/php5/php5.y:5849 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -8465,7 +8444,7 @@ yydefault: } case 497: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5885 + // line internal/php5/php5.y:5864 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -8484,7 +8463,7 @@ yydefault: } case 498: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5902 + // line internal/php5/php5.y:5881 { variable := &ast.ExprVariable{ast.Node{}, yyDollar[2].node} @@ -8499,7 +8478,7 @@ yydefault: } case 499: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5915 + // line internal/php5/php5.y:5894 { name := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} variable := &ast.ExprVariable{ast.Node{}, name} @@ -8516,7 +8495,7 @@ yydefault: } case 500: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php5/php5.y:5930 + // line internal/php5/php5.y:5909 { identifier := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -8535,7 +8514,7 @@ yydefault: } case 501: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5947 + // line internal/php5/php5.y:5926 { yyVAL.node = yyDollar[2].node @@ -8545,7 +8524,7 @@ yydefault: } case 502: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5958 + // line internal/php5/php5.y:5937 { yyVAL.node = &ast.ScalarString{ast.Node{}, yyDollar[1].token.Value} @@ -8557,7 +8536,7 @@ yydefault: } case 503: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5968 + // line internal/php5/php5.y:5947 { // TODO: add option to handle 64 bit integer if _, err := strconv.Atoi(string(yyDollar[1].token.Value)); err == nil { @@ -8574,7 +8553,7 @@ yydefault: } case 504: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5983 + // line internal/php5/php5.y:5962 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ExprVariable{ast.Node{}, identifier} @@ -8588,7 +8567,7 @@ yydefault: } case 505: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5998 + // line internal/php5/php5.y:5977 { yyVAL.node = &ast.ExprIsset{ast.Node{}, yyDollar[3].list} @@ -8602,7 +8581,7 @@ yydefault: } case 506: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:6010 + // line internal/php5/php5.y:5989 { exprBrackets := &ast.ParserBrackets{ Node: ast.Node{ @@ -8624,7 +8603,7 @@ yydefault: } case 507: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:6030 + // line internal/php5/php5.y:6009 { exprBrackets := &ast.ParserBrackets{ Node: ast.Node{ @@ -8646,7 +8625,7 @@ yydefault: } case 508: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:6050 + // line internal/php5/php5.y:6029 { yyVAL.node = &ast.ExprInclude{ast.Node{}, yyDollar[2].node} @@ -8658,7 +8637,7 @@ yydefault: } case 509: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:6060 + // line internal/php5/php5.y:6039 { yyVAL.node = &ast.ExprIncludeOnce{ast.Node{}, yyDollar[2].node} @@ -8670,7 +8649,7 @@ yydefault: } case 510: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:6070 + // line internal/php5/php5.y:6049 { exprBrackets := &ast.ParserBrackets{ Node: ast.Node{ @@ -8692,7 +8671,7 @@ yydefault: } case 511: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:6090 + // line internal/php5/php5.y:6069 { yyVAL.node = &ast.ExprRequire{ast.Node{}, yyDollar[2].node} @@ -8704,7 +8683,7 @@ yydefault: } case 512: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:6100 + // line internal/php5/php5.y:6079 { yyVAL.node = &ast.ExprRequireOnce{ast.Node{}, yyDollar[2].node} @@ -8716,13 +8695,13 @@ yydefault: } case 513: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:6113 + // line internal/php5/php5.y:6092 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 514: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:6117 + // line internal/php5/php5.y:6096 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -8731,19 +8710,19 @@ yydefault: } case 515: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:6127 + // line internal/php5/php5.y:6106 { yyVAL.node = yyDollar[1].node } case 516: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:6131 + // line internal/php5/php5.y:6110 { yyVAL.node = yyDollar[1].node } case 517: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:6138 + // line internal/php5/php5.y:6117 { target := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.ExprClassConstFetch{ast.Node{}, yyDollar[1].node, target} @@ -8759,7 +8738,7 @@ yydefault: } case 518: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:6152 + // line internal/php5/php5.y:6131 { target := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.ExprClassConstFetch{ast.Node{}, yyDollar[1].node, target} @@ -8775,7 +8754,7 @@ yydefault: } case 519: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:6169 + // line internal/php5/php5.y:6148 { target := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.ExprClassConstFetch{ast.Node{}, yyDollar[1].node, target} @@ -8791,7 +8770,7 @@ yydefault: } case 520: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:6186 + // line internal/php5/php5.y:6165 { target := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.ExprClassConstFetch{ast.Node{}, yyDollar[1].node, target} diff --git a/internal/php5/php5.y b/internal/php5/php5.y index 4bae606..cab691e 100644 --- a/internal/php5/php5.y +++ b/internal/php5/php5.y @@ -940,22 +940,13 @@ unticked_statement: } | T_SWITCH parenthesis_expr switch_case_list { - switch n := $3.(type) { - case *ast.StmtSwitch: - n.Cond = $2 - case *ast.StmtAltSwitch: - n.Cond = $2 - default: - panic("unexpected node type") - } + $3.(*ast.StmtSwitch).SwitchTkn = $1 + $3.(*ast.StmtSwitch).OpenParenthesisTkn = $2.(*ast.ParserBrackets).OpenBracketTkn + $3.(*ast.StmtSwitch).Cond = $2.(*ast.ParserBrackets).Child + $3.(*ast.StmtSwitch).CloseParenthesisTkn = $2.(*ast.ParserBrackets).CloseBracketTkn + $3.(*ast.StmtSwitch).Node.Position = position.NewTokenNodePosition($1, $3) $$ = $3 - - // save position - $$.GetNode().Position = position.NewTokenNodePosition($1, $3) - - // save comments - yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens) } | T_BREAK ';' { @@ -1790,62 +1781,53 @@ declare_list: 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, + } } ; @@ -1853,33 +1835,30 @@ switch_case_list: 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, $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, + }) } ; diff --git a/internal/php5/php5_test.go b/internal/php5/php5_test.go index 1fdd0e7..8537e6c 100644 --- a/internal/php5/php5_test.go +++ b/internal/php5/php5_test.go @@ -6894,7 +6894,7 @@ func TestPhp5(t *testing.T) { }, }, }, - &ast.StmtAltSwitch{ + &ast.StmtSwitch{ Node: ast.Node{ Position: &position.Position{ StartLine: 118, @@ -6903,6 +6903,7 @@ func TestPhp5(t *testing.T) { EndPos: 2606, }, }, + Alt: true, Cond: &ast.ScalarLnumber{ Node: ast.Node{ Position: &position.Position{ @@ -6914,75 +6915,65 @@ func TestPhp5(t *testing.T) { }, Value: []byte("1"), }, - CaseList: &ast.StmtCaseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 119, - EndLine: -1, - StartPos: 2563, - EndPos: -1, + CaseList: []ast.Vertex{ + &ast.StmtCase{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 119, + EndLine: -1, + StartPos: 2563, + EndPos: -1, + }, }, - }, - Cases: []ast.Vertex{ - &ast.StmtCase{ + Cond: &ast.ScalarLnumber{ Node: ast.Node{ Position: &position.Position{ StartLine: 119, - EndLine: -1, - StartPos: 2563, - EndPos: -1, + EndLine: 119, + StartPos: 2568, + EndPos: 2569, }, }, - Cond: &ast.ScalarLnumber{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 119, - EndLine: 119, - StartPos: 2568, - EndPos: 2569, - }, - }, - Value: []byte("1"), - }, - Stmts: []ast.Vertex{}, + Value: []byte("1"), }, - &ast.StmtDefault{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 120, - EndLine: -1, - StartPos: 2575, - EndPos: -1, - }, + Stmts: []ast.Vertex{}, + }, + &ast.StmtDefault{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 120, + EndLine: -1, + StartPos: 2575, + EndPos: -1, }, - Stmts: []ast.Vertex{}, }, - &ast.StmtCase{ + Stmts: []ast.Vertex{}, + }, + &ast.StmtCase{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 121, + EndLine: -1, + StartPos: 2588, + EndPos: -1, + }, + }, + Cond: &ast.ScalarLnumber{ Node: ast.Node{ Position: &position.Position{ StartLine: 121, - EndLine: -1, - StartPos: 2588, - EndPos: -1, + EndLine: 121, + StartPos: 2593, + EndPos: 2594, }, }, - Cond: &ast.ScalarLnumber{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 121, - EndLine: 121, - StartPos: 2593, - EndPos: 2594, - }, - }, - Value: []byte("2"), - }, - Stmts: []ast.Vertex{}, + Value: []byte("2"), }, + Stmts: []ast.Vertex{}, }, }, }, - &ast.StmtAltSwitch{ + &ast.StmtSwitch{ Node: ast.Node{ Position: &position.Position{ StartLine: 124, @@ -6991,6 +6982,7 @@ func TestPhp5(t *testing.T) { EndPos: 2656, }, }, + Alt: true, Cond: &ast.ScalarLnumber{ Node: ast.Node{ Position: &position.Position{ @@ -7002,60 +6994,50 @@ func TestPhp5(t *testing.T) { }, Value: []byte("1"), }, - CaseList: &ast.StmtCaseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 125, - EndLine: -1, - StartPos: 2626, - EndPos: -1, + CaseList: []ast.Vertex{ + &ast.StmtCase{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 125, + EndLine: -1, + StartPos: 2626, + EndPos: -1, + }, }, - }, - Cases: []ast.Vertex{ - &ast.StmtCase{ + Cond: &ast.ScalarLnumber{ Node: ast.Node{ Position: &position.Position{ StartLine: 125, - EndLine: -1, - StartPos: 2626, - EndPos: -1, + EndLine: 125, + StartPos: 2631, + EndPos: 2632, }, }, - Cond: &ast.ScalarLnumber{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 125, - EndLine: 125, - StartPos: 2631, - EndPos: 2632, - }, - }, - Value: []byte("1"), - }, - Stmts: []ast.Vertex{}, + Value: []byte("1"), }, - &ast.StmtCase{ + Stmts: []ast.Vertex{}, + }, + &ast.StmtCase{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 126, + EndLine: -1, + StartPos: 2638, + EndPos: -1, + }, + }, + Cond: &ast.ScalarLnumber{ Node: ast.Node{ Position: &position.Position{ StartLine: 126, - EndLine: -1, - StartPos: 2638, - EndPos: -1, + EndLine: 126, + StartPos: 2643, + EndPos: 2644, }, }, - Cond: &ast.ScalarLnumber{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 126, - EndLine: 126, - StartPos: 2643, - EndPos: 2644, - }, - }, - Value: []byte("2"), - }, - Stmts: []ast.Vertex{}, + Value: []byte("2"), }, + Stmts: []ast.Vertex{}, }, }, }, @@ -7079,78 +7061,68 @@ func TestPhp5(t *testing.T) { }, Value: []byte("1"), }, - CaseList: &ast.StmtCaseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 129, - EndLine: 132, - StartPos: 2669, - EndPos: 2710, + CaseList: []ast.Vertex{ + &ast.StmtCase{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 130, + EndLine: 130, + StartPos: 2675, + EndPos: 2689, + }, }, - }, - Cases: []ast.Vertex{ - &ast.StmtCase{ + Cond: &ast.ScalarLnumber{ Node: ast.Node{ Position: &position.Position{ StartLine: 130, EndLine: 130, - StartPos: 2675, - EndPos: 2689, + StartPos: 2680, + EndPos: 2681, }, }, - Cond: &ast.ScalarLnumber{ + Value: []byte("1"), + }, + Stmts: []ast.Vertex{ + &ast.StmtBreak{ Node: ast.Node{ Position: &position.Position{ StartLine: 130, EndLine: 130, - StartPos: 2680, - EndPos: 2681, - }, - }, - Value: []byte("1"), - }, - Stmts: []ast.Vertex{ - &ast.StmtBreak{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 130, - EndLine: 130, - StartPos: 2683, - EndPos: 2689, - }, + StartPos: 2683, + EndPos: 2689, }, }, }, }, - &ast.StmtCase{ + }, + &ast.StmtCase{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 131, + EndLine: 131, + StartPos: 2694, + EndPos: 2708, + }, + }, + Cond: &ast.ScalarLnumber{ Node: ast.Node{ Position: &position.Position{ StartLine: 131, EndLine: 131, - StartPos: 2694, - EndPos: 2708, + StartPos: 2699, + EndPos: 2700, }, }, - Cond: &ast.ScalarLnumber{ + Value: []byte("2"), + }, + Stmts: []ast.Vertex{ + &ast.StmtBreak{ Node: ast.Node{ Position: &position.Position{ StartLine: 131, EndLine: 131, - StartPos: 2699, - EndPos: 2700, - }, - }, - Value: []byte("2"), - }, - Stmts: []ast.Vertex{ - &ast.StmtBreak{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 131, - EndLine: 131, - StartPos: 2702, - EndPos: 2708, - }, + StartPos: 2702, + EndPos: 2708, }, }, }, @@ -7178,78 +7150,68 @@ func TestPhp5(t *testing.T) { }, Value: []byte("1"), }, - CaseList: &ast.StmtCaseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 134, - EndLine: 137, - StartPos: 2723, - EndPos: 2765, + CaseList: []ast.Vertex{ + &ast.StmtCase{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 135, + EndLine: 135, + StartPos: 2730, + EndPos: 2744, + }, }, - }, - Cases: []ast.Vertex{ - &ast.StmtCase{ + Cond: &ast.ScalarLnumber{ Node: ast.Node{ Position: &position.Position{ StartLine: 135, EndLine: 135, - StartPos: 2730, - EndPos: 2744, + StartPos: 2735, + EndPos: 2736, }, }, - Cond: &ast.ScalarLnumber{ + Value: []byte("1"), + }, + Stmts: []ast.Vertex{ + &ast.StmtBreak{ Node: ast.Node{ Position: &position.Position{ StartLine: 135, EndLine: 135, - StartPos: 2735, - EndPos: 2736, - }, - }, - Value: []byte("1"), - }, - Stmts: []ast.Vertex{ - &ast.StmtBreak{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 135, - EndLine: 135, - StartPos: 2738, - EndPos: 2744, - }, + StartPos: 2738, + EndPos: 2744, }, }, }, }, - &ast.StmtCase{ + }, + &ast.StmtCase{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 136, + EndLine: 136, + StartPos: 2749, + EndPos: 2763, + }, + }, + Cond: &ast.ScalarLnumber{ Node: ast.Node{ Position: &position.Position{ StartLine: 136, EndLine: 136, - StartPos: 2749, - EndPos: 2763, + StartPos: 2754, + EndPos: 2755, }, }, - Cond: &ast.ScalarLnumber{ + Value: []byte("2"), + }, + Stmts: []ast.Vertex{ + &ast.StmtBreak{ Node: ast.Node{ Position: &position.Position{ StartLine: 136, EndLine: 136, - StartPos: 2754, - EndPos: 2755, - }, - }, - Value: []byte("2"), - }, - Stmts: []ast.Vertex{ - &ast.StmtBreak{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 136, - EndLine: 136, - StartPos: 2757, - EndPos: 2763, - }, + StartPos: 2757, + EndPos: 2763, }, }, }, diff --git a/internal/php7/parser_test.go b/internal/php7/parser_test.go index cfcf491..5efe233 100644 --- a/internal/php7/parser_test.go +++ b/internal/php7/parser_test.go @@ -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{}, }, }, }, diff --git a/internal/php7/php7.go b/internal/php7/php7.go index 80adf9a..90b1972 100644 --- a/internal/php7/php7.go +++ b/internal/php7/php7.go @@ -346,7 +346,7 @@ const yyEofCode = 1 const yyErrCode = 2 const yyInitialStackSize = 16 -// line internal/php7/php7.y:4855 +// line internal/php7/php7.y:4822 // line yacctab:1 var yyExca = [...]int{ @@ -3233,38 +3233,17 @@ yydefault: yyDollar = yyS[yypt-5 : yypt+1] // line internal/php7/php7.y:911 { - exprBrackets := &ast.ParserBrackets{ - Node: ast.Node{ - Position: position.NewTokensPosition(yyDollar[2].token, yyDollar[4].token), - }, - OpenBracketTkn: yyDollar[2].token, - Child: yyDollar[3].node, - CloseBracketTkn: yyDollar[4].token, - } - - switch n := yyDollar[5].node.(type) { - case *ast.StmtSwitch: - n.Cond = exprBrackets - case *ast.StmtAltSwitch: - n.Cond = exprBrackets - default: - panic("unexpected node type") - } + yyDollar[5].node.(*ast.StmtSwitch).SwitchTkn = yyDollar[1].token + yyDollar[5].node.(*ast.StmtSwitch).OpenParenthesisTkn = yyDollar[2].token + yyDollar[5].node.(*ast.StmtSwitch).Cond = yyDollar[3].node + yyDollar[5].node.(*ast.StmtSwitch).CloseParenthesisTkn = yyDollar[4].token + yyDollar[5].node.(*ast.StmtSwitch).Node.Position = position.NewTokenNodePosition(yyDollar[1].token, yyDollar[5].node) yyVAL.node = yyDollar[5].node - - // save position - exprBrackets.GetNode().Position = position.NewTokensPosition(yyDollar[2].token, yyDollar[4].token) - yyVAL.node.GetNode().Position = position.NewTokenNodePosition(yyDollar[1].token, yyDollar[5].node) - - // save comments - yylex.(*Parser).setFreeFloating(yyVAL.node, token.Start, yyDollar[1].token.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens(exprBrackets, token.Start, yyDollar[2].token.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens(exprBrackets, token.End, yyDollar[4].token.SkippedTokens) } case 139: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:942 +// line internal/php7/php7.y:921 { yyVAL.node = &ast.StmtBreak{ast.Node{}, yyDollar[2].node} @@ -3278,7 +3257,7 @@ yydefault: } case 140: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:954 +// line internal/php7/php7.y:933 { yyVAL.node = &ast.StmtContinue{ast.Node{}, yyDollar[2].node} @@ -3292,7 +3271,7 @@ yydefault: } case 141: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:966 +// line internal/php7/php7.y:945 { yyVAL.node = &ast.StmtReturn{ast.Node{}, yyDollar[2].node} @@ -3306,7 +3285,7 @@ yydefault: } case 142: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:978 +// line internal/php7/php7.y:957 { yyVAL.node = &ast.StmtGlobal{ast.Node{}, yyDollar[2].list} @@ -3320,7 +3299,7 @@ yydefault: } case 143: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:990 +// line internal/php7/php7.y:969 { yyVAL.node = &ast.StmtStatic{ast.Node{}, yyDollar[2].list} @@ -3334,7 +3313,7 @@ yydefault: } case 144: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:1002 +// line internal/php7/php7.y:981 { yyVAL.node = &ast.StmtEcho{ast.Node{}, yyDollar[2].list} @@ -3349,7 +3328,7 @@ yydefault: } case 145: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1015 +// line internal/php7/php7.y:994 { yyVAL.node = &ast.StmtInlineHtml{ast.Node{}, yyDollar[1].token.Value} @@ -3361,7 +3340,7 @@ yydefault: } case 146: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:1025 +// line internal/php7/php7.y:1004 { yyVAL.node = &ast.StmtExpression{ast.Node{}, yyDollar[1].node} @@ -3375,7 +3354,7 @@ yydefault: } case 147: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php7/php7.y:1037 +// line internal/php7/php7.y:1016 { yyVAL.node = &ast.StmtUnset{ast.Node{}, yyDollar[3].list} @@ -3395,7 +3374,7 @@ yydefault: } case 148: yyDollar = yyS[yypt-7 : yypt+1] -// line internal/php7/php7.y:1055 +// line internal/php7/php7.y:1034 { switch n := yyDollar[7].node.(type) { case *ast.StmtForeach: @@ -3419,7 +3398,7 @@ yydefault: } case 149: yyDollar = yyS[yypt-9 : yypt+1] -// line internal/php7/php7.y:1077 +// line internal/php7/php7.y:1056 { switch n := yyDollar[9].node.(type) { case *ast.StmtForeach: @@ -3446,7 +3425,7 @@ yydefault: } case 150: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php7/php7.y:1102 +// line internal/php7/php7.y:1081 { yyVAL.node = yyDollar[5].node yyVAL.node.(*ast.StmtDeclare).Consts = yyDollar[3].list @@ -3461,7 +3440,7 @@ yydefault: } case 151: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1115 +// line internal/php7/php7.y:1094 { yyVAL.node = &ast.StmtNop{ast.Node{}} @@ -3474,7 +3453,7 @@ yydefault: } case 152: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php7/php7.y:1126 +// line internal/php7/php7.y:1105 { if yyDollar[6].node == nil { yyVAL.node = &ast.StmtTry{ast.Node{}, yyDollar[3].list, yyDollar[5].list, yyDollar[6].node} @@ -3491,7 +3470,7 @@ yydefault: } case 153: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:1141 +// line internal/php7/php7.y:1120 { yyVAL.node = &ast.StmtThrow{ast.Node{}, yyDollar[2].node} @@ -3505,7 +3484,7 @@ yydefault: } case 154: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:1153 +// line internal/php7/php7.y:1132 { label := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} yyVAL.node = &ast.StmtGoto{ast.Node{}, label} @@ -3522,7 +3501,7 @@ yydefault: } case 155: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:1168 +// line internal/php7/php7.y:1147 { label := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.StmtLabel{ast.Node{}, label} @@ -3537,13 +3516,13 @@ yydefault: } case 156: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:1183 +// line internal/php7/php7.y:1162 { yyVAL.list = []ast.Vertex{} } case 157: yyDollar = yyS[yypt-9 : yypt+1] -// line internal/php7/php7.y:1187 +// line internal/php7/php7.y:1166 { identifier := &ast.Identifier{ast.Node{}, yyDollar[5].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -3565,13 +3544,13 @@ yydefault: } case 158: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1209 +// line internal/php7/php7.y:1188 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 159: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:1213 +// line internal/php7/php7.y:1192 { switch n := lastNode(yyDollar[1].list).(type) { case *ast.NameName: @@ -3585,13 +3564,13 @@ yydefault: } case 160: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:1225 +// line internal/php7/php7.y:1204 { yyVAL.node = nil } case 161: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:1229 +// line internal/php7/php7.y:1208 { yyVAL.node = &ast.StmtFinally{ast.Node{}, yyDollar[3].list} @@ -3605,13 +3584,13 @@ yydefault: } case 162: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1244 +// line internal/php7/php7.y:1223 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 163: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:1248 +// line internal/php7/php7.y:1227 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -3620,13 +3599,13 @@ yydefault: } case 164: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1258 +// line internal/php7/php7.y:1237 { yyVAL.node = yyDollar[1].node } case 165: yyDollar = yyS[yypt-11 : yypt+1] -// line internal/php7/php7.y:1265 +// line internal/php7/php7.y:1244 { name := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.StmtFunction{ast.Node{}, yyDollar[2].token != nil, name, yyDollar[6].list, yyDollar[8].node, yyDollar[10].list} @@ -3656,31 +3635,31 @@ yydefault: } case 166: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:1296 +// line internal/php7/php7.y:1275 { yyVAL.token = nil } case 167: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1300 +// line internal/php7/php7.y:1279 { yyVAL.token = yyDollar[1].token } case 168: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:1307 +// line internal/php7/php7.y:1286 { yyVAL.token = nil } case 169: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1311 +// line internal/php7/php7.y:1290 { yyVAL.token = yyDollar[1].token } case 170: yyDollar = yyS[yypt-9 : yypt+1] -// line internal/php7/php7.y:1318 +// line internal/php7/php7.y:1297 { name := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.StmtClass{ast.Node{}, name, yyDollar[1].list, nil, yyDollar[4].ClassExtends, yyDollar[5].ClassImplements, yyDollar[8].list} @@ -3698,7 +3677,7 @@ yydefault: } case 171: yyDollar = yyS[yypt-8 : yypt+1] -// line internal/php7/php7.y:1334 +// line internal/php7/php7.y:1313 { name := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} yyVAL.node = &ast.StmtClass{ast.Node{}, name, nil, nil, yyDollar[3].ClassExtends, yyDollar[4].ClassImplements, yyDollar[7].list} @@ -3715,19 +3694,19 @@ yydefault: } case 172: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1352 +// line internal/php7/php7.y:1331 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 173: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:1356 +// line internal/php7/php7.y:1335 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 174: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1363 +// line internal/php7/php7.y:1342 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -3739,7 +3718,7 @@ yydefault: } case 175: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1373 +// line internal/php7/php7.y:1352 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -3751,7 +3730,7 @@ yydefault: } case 176: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php7/php7.y:1386 +// line internal/php7/php7.y:1365 { name := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} yyVAL.node = &ast.StmtTrait{ast.Node{}, name, yyDollar[5].list} @@ -3768,7 +3747,7 @@ yydefault: } case 177: yyDollar = yyS[yypt-7 : yypt+1] -// line internal/php7/php7.y:1404 +// line internal/php7/php7.y:1383 { name := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} yyVAL.node = &ast.StmtInterface{ast.Node{}, name, yyDollar[3].InterfaceExtends, yyDollar[6].list} @@ -3785,13 +3764,13 @@ yydefault: } case 178: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:1422 +// line internal/php7/php7.y:1401 { yyVAL.ClassExtends = nil } case 179: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:1426 +// line internal/php7/php7.y:1405 { yyVAL.ClassExtends = &ast.StmtClassExtends{ast.Node{}, yyDollar[2].node} @@ -3803,13 +3782,13 @@ yydefault: } case 180: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:1439 +// line internal/php7/php7.y:1418 { yyVAL.InterfaceExtends = nil } case 181: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:1443 +// line internal/php7/php7.y:1422 { yyVAL.InterfaceExtends = &ast.StmtInterfaceExtends{ast.Node{}, yyDollar[2].list} @@ -3821,13 +3800,13 @@ yydefault: } case 182: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:1456 +// line internal/php7/php7.y:1435 { yyVAL.ClassImplements = nil } case 183: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:1460 +// line internal/php7/php7.y:1439 { yyVAL.ClassImplements = &ast.StmtClassImplements{ast.Node{}, yyDollar[2].list} @@ -3839,13 +3818,13 @@ yydefault: } case 184: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1473 +// line internal/php7/php7.y:1452 { yyVAL.node = yyDollar[1].node } case 185: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:1477 +// line internal/php7/php7.y:1456 { yyVAL.node = &ast.ExprReference{ast.Node{}, yyDollar[2].node} @@ -3857,7 +3836,7 @@ yydefault: } case 186: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:1487 +// line internal/php7/php7.y:1466 { yyVAL.node = &ast.ExprList{ast.Node{}, yyDollar[3].list} @@ -3871,7 +3850,7 @@ yydefault: } case 187: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:1499 +// line internal/php7/php7.y:1478 { yyVAL.node = &ast.ExprShortList{ast.Node{}, yyDollar[2].list} @@ -3884,7 +3863,7 @@ yydefault: } case 188: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1513 +// line internal/php7/php7.y:1492 { yyVAL.node = &ast.StmtFor{ Node: ast.Node{ @@ -3895,7 +3874,7 @@ yydefault: } case 189: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:1522 +// line internal/php7/php7.y:1501 { yyVAL.node = &ast.StmtFor{ Node: ast.Node{ @@ -3915,7 +3894,7 @@ yydefault: } case 190: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1543 +// line internal/php7/php7.y:1522 { yyVAL.node = &ast.StmtForeach{ast.Node{}, nil, nil, nil, yyDollar[1].node} @@ -3924,7 +3903,7 @@ yydefault: } case 191: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:1550 +// line internal/php7/php7.y:1529 { stmtList := &ast.StmtStmtList{ Node: ast.Node{ @@ -3945,7 +3924,7 @@ yydefault: } case 192: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1572 +// line internal/php7/php7.y:1551 { yyVAL.node = &ast.StmtDeclare{ast.Node{}, false, nil, yyDollar[1].node} @@ -3954,7 +3933,7 @@ yydefault: } case 193: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:1579 +// line internal/php7/php7.y:1558 { stmtList := &ast.StmtStmtList{ Node: ast.Node{ @@ -3975,122 +3954,110 @@ yydefault: } case 194: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:1601 +// line internal/php7/php7.y:1580 { - caseList := &ast.StmtCaseList{ast.Node{}, yyDollar[2].list} - yyVAL.node = &ast.StmtSwitch{ast.Node{}, nil, caseList} - - // save position - caseList.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[3].token) - yyVAL.node.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[3].token) - - // save comments - yylex.(*Parser).setFreeFloating(caseList, token.Start, yyDollar[1].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(caseList, token.CaseListEnd, yyDollar[3].token.SkippedTokens) + yyVAL.node = &ast.StmtSwitch{ + Node: ast.Node{ + Position: position.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), + }, + OpenCurlyBracketTkn: yyDollar[1].token, + CaseList: yyDollar[2].list, + CloseCurlyBracketTkn: yyDollar[3].token, + } } case 195: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:1614 +// line internal/php7/php7.y:1591 { - caseList := &ast.StmtCaseList{ast.Node{}, yyDollar[3].list} - yyVAL.node = &ast.StmtSwitch{ast.Node{}, nil, caseList} - - // save position - caseList.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[4].token) - yyVAL.node.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[4].token) - - // save comments - yylex.(*Parser).setFreeFloating(caseList, token.Start, yyDollar[1].token.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens(caseList, token.CaseListStart, yyDollar[2].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(caseList, token.CaseListEnd, yyDollar[4].token.SkippedTokens) + yyVAL.node = &ast.StmtSwitch{ + Node: ast.Node{ + Position: position.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), + }, + OpenCurlyBracketTkn: yyDollar[1].token, + CaseSeparatorTkn: yyDollar[2].token, + CaseList: yyDollar[3].list, + CloseCurlyBracketTkn: yyDollar[4].token, + } } case 196: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:1628 +// line internal/php7/php7.y:1603 { - caseList := &ast.StmtCaseList{ast.Node{}, yyDollar[2].list} - yyVAL.node = &ast.StmtAltSwitch{ast.Node{}, nil, caseList} - - // save position - caseList.GetNode().Position = position.NewNodeListPosition(yyDollar[2].list) - yyVAL.node.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[4].token) - - // save comments - yylex.(*Parser).setFreeFloating(yyVAL.node, token.Cond, yyDollar[1].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(caseList, token.CaseListEnd, yyDollar[3].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(yyVAL.node, token.AltEnd, yyDollar[4].token.SkippedTokens) - yylex.(*Parser).setToken(yyVAL.node, token.SemiColon, yyDollar[4].token.SkippedTokens) + yyVAL.node = &ast.StmtSwitch{ + Node: ast.Node{ + Position: position.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), + }, + Alt: true, + ColonTkn: yyDollar[1].token, + CaseList: yyDollar[2].list, + EndSwitchTkn: yyDollar[3].token, + SemiColonTkn: yyDollar[4].token, + } } case 197: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php7/php7.y:1643 +// line internal/php7/php7.y:1616 { - - caseList := &ast.StmtCaseList{ast.Node{}, yyDollar[3].list} - yyVAL.node = &ast.StmtAltSwitch{ast.Node{}, nil, caseList} - - // save position - caseList.GetNode().Position = position.NewNodeListPosition(yyDollar[3].list) - yyVAL.node.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[5].token) - - // save comments - yylex.(*Parser).setFreeFloating(yyVAL.node, token.Cond, yyDollar[1].token.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens(caseList, token.CaseListStart, yyDollar[2].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(caseList, token.CaseListEnd, yyDollar[4].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(yyVAL.node, token.AltEnd, yyDollar[5].token.SkippedTokens) - yylex.(*Parser).setToken(yyVAL.node, token.SemiColon, yyDollar[5].token.SkippedTokens) + yyVAL.node = &ast.StmtSwitch{ + Node: ast.Node{ + Position: position.NewTokensPosition(yyDollar[1].token, yyDollar[5].token), + }, + Alt: true, + ColonTkn: yyDollar[1].token, + CaseSeparatorTkn: yyDollar[2].token, + CaseList: yyDollar[3].list, + EndSwitchTkn: yyDollar[4].token, + SemiColonTkn: yyDollar[5].token, + } } case 198: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:1663 +// line internal/php7/php7.y:1633 { - yyVAL.list = []ast.Vertex{} + yyVAL.list = nil } case 199: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php7/php7.y:1667 +// line internal/php7/php7.y:1637 { - _case := &ast.StmtCase{ast.Node{}, yyDollar[3].node, yyDollar[5].list} - yyVAL.list = append(yyDollar[1].list, _case) - - // save position - _case.GetNode().Position = position.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[5].list) - - // save comments - yylex.(*Parser).setFreeFloating(_case, token.Start, yyDollar[2].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(_case, token.Expr, append(yyDollar[4].token.SkippedTokens)) - yylex.(*Parser).setToken(_case, token.CaseSeparator, yyDollar[4].token.SkippedTokens) + yyVAL.list = append(yyDollar[1].list, &ast.StmtCase{ + Node: ast.Node{ + Position: position.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[5].list), + }, + CaseTkn: yyDollar[2].token, + Cond: yyDollar[3].node, + CaseSeparatorTkn: yyDollar[4].token, + Stmts: yyDollar[5].list, + }) } case 200: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:1680 +// line internal/php7/php7.y:1649 { - _default := &ast.StmtDefault{ast.Node{}, yyDollar[4].list} - yyVAL.list = append(yyDollar[1].list, _default) - - // save position - _default.GetNode().Position = position.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[4].list) - - // save comments - yylex.(*Parser).setFreeFloating(_default, token.Start, yyDollar[2].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(_default, token.Default, yyDollar[3].token.SkippedTokens) - yylex.(*Parser).setToken(_default, token.CaseSeparator, yyDollar[3].token.SkippedTokens) + yyVAL.list = append(yyDollar[1].list, &ast.StmtDefault{ + Node: ast.Node{ + Position: position.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[4].list), + }, + DefaultTkn: yyDollar[2].token, + CaseSeparatorTkn: yyDollar[3].token, + Stmts: yyDollar[4].list, + }) } case 201: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1696 +// line internal/php7/php7.y:1663 { yyVAL.token = yyDollar[1].token } case 202: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1700 +// line internal/php7/php7.y:1667 { yyVAL.token = yyDollar[1].token } case 203: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1707 +// line internal/php7/php7.y:1674 { yyVAL.node = &ast.StmtWhile{ Node: ast.Node{ @@ -4101,7 +4068,7 @@ yydefault: } case 204: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:1716 +// line internal/php7/php7.y:1683 { yyVAL.node = &ast.StmtWhile{ Node: ast.Node{ @@ -4121,7 +4088,7 @@ yydefault: } case 205: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php7/php7.y:1737 +// line internal/php7/php7.y:1704 { yyVAL.node = &ast.StmtIf{ Node: ast.Node{ @@ -4136,7 +4103,7 @@ yydefault: } case 206: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php7/php7.y:1750 +// line internal/php7/php7.y:1717 { yyDollar[1].node.(*ast.StmtIf).ElseIf = append(yyDollar[1].node.(*ast.StmtIf).ElseIf, &ast.StmtElseIf{ Node: ast.Node{ @@ -4155,13 +4122,13 @@ yydefault: } case 207: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1770 +// line internal/php7/php7.y:1737 { yyVAL.node = yyDollar[1].node } case 208: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:1774 +// line internal/php7/php7.y:1741 { yyDollar[1].node.(*ast.StmtIf).Else = &ast.StmtElse{ Node: ast.Node{ @@ -4177,7 +4144,7 @@ yydefault: } case 209: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php7/php7.y:1791 +// line internal/php7/php7.y:1758 { yyVAL.node = &ast.StmtIf{ Node: ast.Node{ @@ -4199,7 +4166,7 @@ yydefault: } case 210: yyDollar = yyS[yypt-7 : yypt+1] -// line internal/php7/php7.y:1811 +// line internal/php7/php7.y:1778 { yyDollar[1].node.(*ast.StmtIf).ElseIf = append(yyDollar[1].node.(*ast.StmtIf).ElseIf, &ast.StmtElseIf{ Node: ast.Node{ @@ -4223,7 +4190,7 @@ yydefault: } case 211: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:1836 +// line internal/php7/php7.y:1803 { yyDollar[1].node.(*ast.StmtIf).EndIfTkn = yyDollar[2].token yyDollar[1].node.(*ast.StmtIf).SemiColonTkn = yyDollar[3].token @@ -4233,7 +4200,7 @@ yydefault: } case 212: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php7/php7.y:1844 +// line internal/php7/php7.y:1811 { yyDollar[1].node.(*ast.StmtIf).Else = &ast.StmtElse{ Node: ast.Node{ @@ -4257,25 +4224,25 @@ yydefault: } case 213: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1869 +// line internal/php7/php7.y:1836 { yyVAL.list = yyDollar[1].list } case 214: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:1873 +// line internal/php7/php7.y:1840 { yyVAL.list = nil } case 215: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1880 +// line internal/php7/php7.y:1847 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 216: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:1884 +// line internal/php7/php7.y:1851 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -4284,7 +4251,7 @@ yydefault: } case 217: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:1894 +// line internal/php7/php7.y:1861 { identifier := &ast.Identifier{ast.Node{}, yyDollar[4].token.Value} identifier.GetNode().Position = position.NewTokenPosition(yyDollar[4].token) @@ -4320,7 +4287,7 @@ yydefault: } case 218: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php7/php7.y:1928 +// line internal/php7/php7.y:1895 { identifier := &ast.Identifier{ast.Node{}, yyDollar[4].token.Value} identifier.GetNode().Position = position.NewTokenPosition(yyDollar[4].token) @@ -4357,25 +4324,25 @@ yydefault: } case 219: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:1966 +// line internal/php7/php7.y:1933 { yyVAL.node = nil } case 220: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1970 +// line internal/php7/php7.y:1937 { yyVAL.node = yyDollar[1].node } case 221: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1977 +// line internal/php7/php7.y:1944 { yyVAL.node = yyDollar[1].node } case 222: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:1981 +// line internal/php7/php7.y:1948 { yyVAL.node = &ast.Nullable{ast.Node{}, yyDollar[2].node} @@ -4387,7 +4354,7 @@ yydefault: } case 223: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1994 +// line internal/php7/php7.y:1961 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4399,7 +4366,7 @@ yydefault: } case 224: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2004 +// line internal/php7/php7.y:1971 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4411,19 +4378,19 @@ yydefault: } case 225: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2014 +// line internal/php7/php7.y:1981 { yyVAL.node = yyDollar[1].node } case 226: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:2021 +// line internal/php7/php7.y:1988 { yyVAL.node = nil } case 227: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2025 +// line internal/php7/php7.y:1992 { yyVAL.node = yyDollar[2].node @@ -4432,7 +4399,7 @@ yydefault: } case 228: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2035 +// line internal/php7/php7.y:2002 { yyVAL.node = &ast.ArgumentList{ast.Node{}, nil} @@ -4445,7 +4412,7 @@ yydefault: } case 229: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:2046 +// line internal/php7/php7.y:2013 { yyVAL.node = &ast.ArgumentList{ast.Node{}, yyDollar[2].list} @@ -4462,13 +4429,13 @@ yydefault: } case 230: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2064 +// line internal/php7/php7.y:2031 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 231: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2068 +// line internal/php7/php7.y:2035 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -4477,7 +4444,7 @@ yydefault: } case 232: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2078 +// line internal/php7/php7.y:2045 { yyVAL.node = &ast.Argument{ast.Node{}, false, false, yyDollar[1].node} @@ -4489,7 +4456,7 @@ yydefault: } case 233: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2088 +// line internal/php7/php7.y:2055 { yyVAL.node = &ast.Argument{ast.Node{}, true, false, yyDollar[2].node} @@ -4501,7 +4468,7 @@ yydefault: } case 234: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2101 +// line internal/php7/php7.y:2068 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -4510,19 +4477,19 @@ yydefault: } case 235: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2108 +// line internal/php7/php7.y:2075 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 236: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2115 +// line internal/php7/php7.y:2082 { yyVAL.node = yyDollar[1].node } case 237: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2122 +// line internal/php7/php7.y:2089 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -4531,13 +4498,13 @@ yydefault: } case 238: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2129 +// line internal/php7/php7.y:2096 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 239: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2136 +// line internal/php7/php7.y:2103 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -4553,7 +4520,7 @@ yydefault: } case 240: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2150 +// line internal/php7/php7.y:2117 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -4570,19 +4537,19 @@ yydefault: } case 241: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2168 +// line internal/php7/php7.y:2135 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 242: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:2172 +// line internal/php7/php7.y:2139 { yyVAL.list = []ast.Vertex{} } case 243: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:2179 +// line internal/php7/php7.y:2146 { yyVAL.node = &ast.StmtPropertyList{ast.Node{}, yyDollar[1].list, yyDollar[2].node, yyDollar[3].list} @@ -4596,7 +4563,7 @@ yydefault: } case 244: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:2191 +// line internal/php7/php7.y:2158 { yyVAL.node = &ast.StmtClassConstList{ Node: ast.Node{ @@ -4610,7 +4577,7 @@ yydefault: } case 245: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2203 +// line internal/php7/php7.y:2170 { yyVAL.node = &ast.StmtTraitUse{ast.Node{}, yyDollar[2].list, yyDollar[3].node} @@ -4622,7 +4589,7 @@ yydefault: } case 246: yyDollar = yyS[yypt-10 : yypt+1] -// line internal/php7/php7.y:2213 +// line internal/php7/php7.y:2180 { name := &ast.Identifier{ast.Node{}, yyDollar[4].token.Value} yyVAL.node = &ast.StmtClassMethod{ast.Node{}, yyDollar[3].token != nil, name, yyDollar[1].list, yyDollar[7].list, yyDollar[9].node, yyDollar[10].node} @@ -4653,13 +4620,13 @@ yydefault: } case 247: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2245 +// line internal/php7/php7.y:2212 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 248: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2249 +// line internal/php7/php7.y:2216 { switch n := lastNode(yyDollar[1].list).(type) { case *ast.NameName: @@ -4673,7 +4640,7 @@ yydefault: } case 249: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2261 +// line internal/php7/php7.y:2228 { yyVAL.node = &ast.StmtNop{ast.Node{}} @@ -4685,7 +4652,7 @@ yydefault: } case 250: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2271 +// line internal/php7/php7.y:2238 { yyVAL.node = &ast.StmtTraitAdaptationList{ast.Node{}, nil} @@ -4697,7 +4664,7 @@ yydefault: } case 251: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2281 +// line internal/php7/php7.y:2248 { yyVAL.node = &ast.StmtTraitAdaptationList{ast.Node{}, yyDollar[2].list} @@ -4709,19 +4676,19 @@ yydefault: } case 252: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2294 +// line internal/php7/php7.y:2261 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 253: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2298 +// line internal/php7/php7.y:2265 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 254: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2305 +// line internal/php7/php7.y:2272 { yyVAL.node = yyDollar[1].node @@ -4731,7 +4698,7 @@ yydefault: } case 255: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2313 +// line internal/php7/php7.y:2280 { yyVAL.node = yyDollar[1].node @@ -4741,7 +4708,7 @@ yydefault: } case 256: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2324 +// line internal/php7/php7.y:2291 { yyVAL.node = &ast.StmtTraitUsePrecedence{ast.Node{}, yyDollar[1].node, yyDollar[3].list} @@ -4754,7 +4721,7 @@ yydefault: } case 257: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2338 +// line internal/php7/php7.y:2305 { alias := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.StmtTraitUseAlias{ast.Node{}, yyDollar[1].node, nil, alias} @@ -4770,7 +4737,7 @@ yydefault: } case 258: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2352 +// line internal/php7/php7.y:2319 { alias := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.StmtTraitUseAlias{ast.Node{}, yyDollar[1].node, nil, alias} @@ -4786,7 +4753,7 @@ yydefault: } case 259: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:2366 +// line internal/php7/php7.y:2333 { alias := &ast.Identifier{ast.Node{}, yyDollar[4].token.Value} yyVAL.node = &ast.StmtTraitUseAlias{ast.Node{}, yyDollar[1].node, yyDollar[3].node, alias} @@ -4802,7 +4769,7 @@ yydefault: } case 260: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2380 +// line internal/php7/php7.y:2347 { yyVAL.node = &ast.StmtTraitUseAlias{ast.Node{}, yyDollar[1].node, yyDollar[3].node, nil} @@ -4815,7 +4782,7 @@ yydefault: } case 261: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2394 +// line internal/php7/php7.y:2361 { name := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.StmtTraitMethodRef{ast.Node{}, nil, name} @@ -4829,13 +4796,13 @@ yydefault: } case 262: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2406 +// line internal/php7/php7.y:2373 { yyVAL.node = yyDollar[1].node } case 263: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2413 +// line internal/php7/php7.y:2380 { target := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.StmtTraitMethodRef{ast.Node{}, yyDollar[1].node, target} @@ -4851,7 +4818,7 @@ yydefault: } case 264: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2430 +// line internal/php7/php7.y:2397 { yyVAL.node = &ast.StmtNop{ast.Node{}} @@ -4864,7 +4831,7 @@ yydefault: } case 265: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2441 +// line internal/php7/php7.y:2408 { yyVAL.node = &ast.StmtStmtList{ Node: ast.Node{ @@ -4877,13 +4844,13 @@ yydefault: } case 266: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2455 +// line internal/php7/php7.y:2422 { yyVAL.list = yyDollar[1].list } case 267: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2459 +// line internal/php7/php7.y:2426 { modifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.list = []ast.Vertex{modifier} @@ -4896,31 +4863,31 @@ yydefault: } case 268: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:2473 +// line internal/php7/php7.y:2440 { yyVAL.list = nil } case 269: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2477 +// line internal/php7/php7.y:2444 { yyVAL.list = yyDollar[1].list } case 270: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2484 +// line internal/php7/php7.y:2451 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 271: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2488 +// line internal/php7/php7.y:2455 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 272: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2495 +// line internal/php7/php7.y:2462 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4932,7 +4899,7 @@ yydefault: } case 273: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2505 +// line internal/php7/php7.y:2472 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4944,7 +4911,7 @@ yydefault: } case 274: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2515 +// line internal/php7/php7.y:2482 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4956,7 +4923,7 @@ yydefault: } case 275: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2525 +// line internal/php7/php7.y:2492 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4968,7 +4935,7 @@ yydefault: } case 276: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2535 +// line internal/php7/php7.y:2502 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4980,7 +4947,7 @@ yydefault: } case 277: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2545 +// line internal/php7/php7.y:2512 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4992,7 +4959,7 @@ yydefault: } case 278: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2558 +// line internal/php7/php7.y:2525 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -5001,13 +4968,13 @@ yydefault: } case 279: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2565 +// line internal/php7/php7.y:2532 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 280: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2572 +// line internal/php7/php7.y:2539 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -5023,7 +4990,7 @@ yydefault: } case 281: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:2586 +// line internal/php7/php7.y:2553 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -5040,7 +5007,7 @@ yydefault: } case 282: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2604 +// line internal/php7/php7.y:2571 { lastNode(yyDollar[1].list).(*ast.StmtConstant).CommaTkn = yyDollar[2].token @@ -5048,13 +5015,13 @@ yydefault: } case 283: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2610 +// line internal/php7/php7.y:2577 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 284: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:2617 +// line internal/php7/php7.y:2584 { yyVAL.node = &ast.StmtConstant{ Node: ast.Node{ @@ -5074,7 +5041,7 @@ yydefault: } case 285: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:2638 +// line internal/php7/php7.y:2605 { yyVAL.node = &ast.StmtConstant{ Node: ast.Node{ @@ -5094,7 +5061,7 @@ yydefault: } case 286: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2659 +// line internal/php7/php7.y:2626 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -5103,31 +5070,31 @@ yydefault: } case 287: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2666 +// line internal/php7/php7.y:2633 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 288: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2673 +// line internal/php7/php7.y:2640 { yyVAL.node = yyDollar[1].node } case 289: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:2680 +// line internal/php7/php7.y:2647 { yyVAL.list = nil } case 290: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2684 +// line internal/php7/php7.y:2651 { yyVAL.list = yyDollar[1].list } case 291: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2691 +// line internal/php7/php7.y:2658 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -5136,13 +5103,13 @@ yydefault: } case 292: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2698 +// line internal/php7/php7.y:2665 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 293: yyDollar = yyS[yypt-8 : yypt+1] -// line internal/php7/php7.y:2705 +// line internal/php7/php7.y:2672 { if yyDollar[2].node != nil { yyVAL.node = &ast.StmtClass{ast.Node{}, nil, nil, yyDollar[2].node.(*ast.ArgumentList), yyDollar[3].ClassExtends, yyDollar[4].ClassImplements, yyDollar[7].list} @@ -5160,7 +5127,7 @@ yydefault: } case 294: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2724 +// line internal/php7/php7.y:2691 { if yyDollar[3].node != nil { yyVAL.node = &ast.ExprNew{ast.Node{}, yyDollar[2].node, yyDollar[3].node.(*ast.ArgumentList)} @@ -5175,7 +5142,7 @@ yydefault: } case 295: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2737 +// line internal/php7/php7.y:2704 { yyVAL.node = &ast.ExprNew{ast.Node{}, yyDollar[2].node, nil} @@ -5187,7 +5154,7 @@ yydefault: } case 296: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php7/php7.y:2750 +// line internal/php7/php7.y:2717 { listNode := &ast.ExprList{ast.Node{}, yyDollar[3].list} yyVAL.node = &ast.ExprAssign{ast.Node{}, listNode, yyDollar[6].node} @@ -5204,7 +5171,7 @@ yydefault: } case 297: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php7/php7.y:2765 +// line internal/php7/php7.y:2732 { shortList := &ast.ExprShortList{ast.Node{}, yyDollar[2].list} yyVAL.node = &ast.ExprAssign{ast.Node{}, shortList, yyDollar[5].node} @@ -5220,7 +5187,7 @@ yydefault: } case 298: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2779 +// line internal/php7/php7.y:2746 { yyVAL.node = &ast.ExprAssign{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5233,7 +5200,7 @@ yydefault: } case 299: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:2790 +// line internal/php7/php7.y:2757 { yyVAL.node = &ast.ExprAssignReference{ast.Node{}, yyDollar[1].node, yyDollar[4].node} @@ -5247,7 +5214,7 @@ yydefault: } case 300: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2802 +// line internal/php7/php7.y:2769 { yyVAL.node = &ast.ExprClone{ast.Node{}, yyDollar[2].node} @@ -5259,7 +5226,7 @@ yydefault: } case 301: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2812 +// line internal/php7/php7.y:2779 { yyVAL.node = &ast.ExprAssignPlus{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5272,7 +5239,7 @@ yydefault: } case 302: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2823 +// line internal/php7/php7.y:2790 { yyVAL.node = &ast.ExprAssignMinus{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5285,7 +5252,7 @@ yydefault: } case 303: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2834 +// line internal/php7/php7.y:2801 { yyVAL.node = &ast.ExprAssignMul{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5298,7 +5265,7 @@ yydefault: } case 304: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2845 +// line internal/php7/php7.y:2812 { yyVAL.node = &ast.ExprAssignPow{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5311,7 +5278,7 @@ yydefault: } case 305: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2856 +// line internal/php7/php7.y:2823 { yyVAL.node = &ast.ExprAssignDiv{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5324,7 +5291,7 @@ yydefault: } case 306: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2867 +// line internal/php7/php7.y:2834 { yyVAL.node = &ast.ExprAssignConcat{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5337,7 +5304,7 @@ yydefault: } case 307: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2878 +// line internal/php7/php7.y:2845 { yyVAL.node = &ast.ExprAssignMod{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5350,7 +5317,7 @@ yydefault: } case 308: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2889 +// line internal/php7/php7.y:2856 { yyVAL.node = &ast.ExprAssignBitwiseAnd{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5363,7 +5330,7 @@ yydefault: } case 309: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2900 +// line internal/php7/php7.y:2867 { yyVAL.node = &ast.ExprAssignBitwiseOr{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5376,7 +5343,7 @@ yydefault: } case 310: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2911 +// line internal/php7/php7.y:2878 { yyVAL.node = &ast.ExprAssignBitwiseXor{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5389,7 +5356,7 @@ yydefault: } case 311: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2922 +// line internal/php7/php7.y:2889 { yyVAL.node = &ast.ExprAssignShiftLeft{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5402,7 +5369,7 @@ yydefault: } case 312: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2933 +// line internal/php7/php7.y:2900 { yyVAL.node = &ast.ExprAssignShiftRight{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5415,7 +5382,7 @@ yydefault: } case 313: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2944 +// line internal/php7/php7.y:2911 { yyVAL.node = &ast.ExprAssignCoalesce{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5428,7 +5395,7 @@ yydefault: } case 314: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2955 +// line internal/php7/php7.y:2922 { yyVAL.node = &ast.ExprPostInc{ast.Node{}, yyDollar[1].node} @@ -5441,7 +5408,7 @@ yydefault: } case 315: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2966 +// line internal/php7/php7.y:2933 { yyVAL.node = &ast.ExprPreInc{ast.Node{}, yyDollar[2].node} @@ -5453,7 +5420,7 @@ yydefault: } case 316: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2976 +// line internal/php7/php7.y:2943 { yyVAL.node = &ast.ExprPostDec{ast.Node{}, yyDollar[1].node} @@ -5466,7 +5433,7 @@ yydefault: } case 317: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2987 +// line internal/php7/php7.y:2954 { yyVAL.node = &ast.ExprPreDec{ast.Node{}, yyDollar[2].node} @@ -5478,7 +5445,7 @@ yydefault: } case 318: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2997 +// line internal/php7/php7.y:2964 { yyVAL.node = &ast.ExprBinaryBooleanOr{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5491,7 +5458,7 @@ yydefault: } case 319: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3008 +// line internal/php7/php7.y:2975 { yyVAL.node = &ast.ExprBinaryBooleanAnd{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5504,7 +5471,7 @@ yydefault: } case 320: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3019 +// line internal/php7/php7.y:2986 { yyVAL.node = &ast.ExprBinaryLogicalOr{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5517,7 +5484,7 @@ yydefault: } case 321: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3030 +// line internal/php7/php7.y:2997 { yyVAL.node = &ast.ExprBinaryLogicalAnd{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5530,7 +5497,7 @@ yydefault: } case 322: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3041 +// line internal/php7/php7.y:3008 { yyVAL.node = &ast.ExprBinaryLogicalXor{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5543,7 +5510,7 @@ yydefault: } case 323: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3052 +// line internal/php7/php7.y:3019 { yyVAL.node = &ast.ExprBinaryBitwiseOr{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5556,7 +5523,7 @@ yydefault: } case 324: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3063 +// line internal/php7/php7.y:3030 { yyVAL.node = &ast.ExprBinaryBitwiseAnd{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5569,7 +5536,7 @@ yydefault: } case 325: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3074 +// line internal/php7/php7.y:3041 { yyVAL.node = &ast.ExprBinaryBitwiseXor{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5582,7 +5549,7 @@ yydefault: } case 326: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3085 +// line internal/php7/php7.y:3052 { yyVAL.node = &ast.ExprBinaryConcat{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5595,7 +5562,7 @@ yydefault: } case 327: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3096 +// line internal/php7/php7.y:3063 { yyVAL.node = &ast.ExprBinaryPlus{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5608,7 +5575,7 @@ yydefault: } case 328: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3107 +// line internal/php7/php7.y:3074 { yyVAL.node = &ast.ExprBinaryMinus{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5621,7 +5588,7 @@ yydefault: } case 329: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3118 +// line internal/php7/php7.y:3085 { yyVAL.node = &ast.ExprBinaryMul{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5634,7 +5601,7 @@ yydefault: } case 330: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3129 +// line internal/php7/php7.y:3096 { yyVAL.node = &ast.ExprBinaryPow{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5647,7 +5614,7 @@ yydefault: } case 331: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3140 +// line internal/php7/php7.y:3107 { yyVAL.node = &ast.ExprBinaryDiv{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5660,7 +5627,7 @@ yydefault: } case 332: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3151 +// line internal/php7/php7.y:3118 { yyVAL.node = &ast.ExprBinaryMod{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5673,7 +5640,7 @@ yydefault: } case 333: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3162 +// line internal/php7/php7.y:3129 { yyVAL.node = &ast.ExprBinaryShiftLeft{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5686,7 +5653,7 @@ yydefault: } case 334: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3173 +// line internal/php7/php7.y:3140 { yyVAL.node = &ast.ExprBinaryShiftRight{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5699,7 +5666,7 @@ yydefault: } case 335: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3184 +// line internal/php7/php7.y:3151 { yyVAL.node = &ast.ExprUnaryPlus{ast.Node{}, yyDollar[2].node} @@ -5711,7 +5678,7 @@ yydefault: } case 336: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3194 +// line internal/php7/php7.y:3161 { yyVAL.node = &ast.ExprUnaryMinus{ast.Node{}, yyDollar[2].node} @@ -5723,7 +5690,7 @@ yydefault: } case 337: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3204 +// line internal/php7/php7.y:3171 { yyVAL.node = &ast.ExprBooleanNot{ast.Node{}, yyDollar[2].node} @@ -5735,7 +5702,7 @@ yydefault: } case 338: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3214 +// line internal/php7/php7.y:3181 { yyVAL.node = &ast.ExprBitwiseNot{ast.Node{}, yyDollar[2].node} @@ -5747,7 +5714,7 @@ yydefault: } case 339: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3224 +// line internal/php7/php7.y:3191 { yyVAL.node = &ast.ExprBinaryIdentical{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5760,7 +5727,7 @@ yydefault: } case 340: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3235 +// line internal/php7/php7.y:3202 { yyVAL.node = &ast.ExprBinaryNotIdentical{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5773,7 +5740,7 @@ yydefault: } case 341: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3246 +// line internal/php7/php7.y:3213 { yyVAL.node = &ast.ExprBinaryEqual{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5786,7 +5753,7 @@ yydefault: } case 342: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3257 +// line internal/php7/php7.y:3224 { yyVAL.node = &ast.ExprBinaryNotEqual{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5800,7 +5767,7 @@ yydefault: } case 343: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3269 +// line internal/php7/php7.y:3236 { yyVAL.node = &ast.ExprBinarySmaller{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5813,7 +5780,7 @@ yydefault: } case 344: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3280 +// line internal/php7/php7.y:3247 { yyVAL.node = &ast.ExprBinarySmallerOrEqual{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5826,7 +5793,7 @@ yydefault: } case 345: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3291 +// line internal/php7/php7.y:3258 { yyVAL.node = &ast.ExprBinaryGreater{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5839,7 +5806,7 @@ yydefault: } case 346: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3302 +// line internal/php7/php7.y:3269 { yyVAL.node = &ast.ExprBinaryGreaterOrEqual{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5852,7 +5819,7 @@ yydefault: } case 347: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3313 +// line internal/php7/php7.y:3280 { yyVAL.node = &ast.ExprBinarySpaceship{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5865,7 +5832,7 @@ yydefault: } case 348: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3324 +// line internal/php7/php7.y:3291 { yyVAL.node = &ast.ExprInstanceOf{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5878,7 +5845,7 @@ yydefault: } case 349: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3335 +// line internal/php7/php7.y:3302 { yyVAL.node = &ast.ParserBrackets{ Node: ast.Node{ @@ -5895,13 +5862,13 @@ yydefault: } case 350: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3350 +// line internal/php7/php7.y:3317 { yyVAL.node = yyDollar[1].node } case 351: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php7/php7.y:3354 +// line internal/php7/php7.y:3321 { yyVAL.node = &ast.ExprTernary{ast.Node{}, yyDollar[1].node, yyDollar[3].node, yyDollar[5].node} @@ -5915,7 +5882,7 @@ yydefault: } case 352: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:3366 +// line internal/php7/php7.y:3333 { yyVAL.node = &ast.ExprTernary{ast.Node{}, yyDollar[1].node, nil, yyDollar[4].node} @@ -5929,7 +5896,7 @@ yydefault: } case 353: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3378 +// line internal/php7/php7.y:3345 { yyVAL.node = &ast.ExprBinaryCoalesce{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5942,13 +5909,13 @@ yydefault: } case 354: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3389 +// line internal/php7/php7.y:3356 { yyVAL.node = yyDollar[1].node } case 355: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3393 +// line internal/php7/php7.y:3360 { yyVAL.node = &ast.ExprCastInt{ast.Node{}, yyDollar[2].node} @@ -5961,7 +5928,7 @@ yydefault: } case 356: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3404 +// line internal/php7/php7.y:3371 { yyVAL.node = &ast.ExprCastDouble{ast.Node{}, yyDollar[2].node} @@ -5974,7 +5941,7 @@ yydefault: } case 357: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3415 +// line internal/php7/php7.y:3382 { yyVAL.node = &ast.ExprCastString{ast.Node{}, yyDollar[2].node} @@ -5987,7 +5954,7 @@ yydefault: } case 358: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3426 +// line internal/php7/php7.y:3393 { yyVAL.node = &ast.ExprCastArray{ast.Node{}, yyDollar[2].node} @@ -6000,7 +5967,7 @@ yydefault: } case 359: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3437 +// line internal/php7/php7.y:3404 { yyVAL.node = &ast.ExprCastObject{ast.Node{}, yyDollar[2].node} @@ -6013,7 +5980,7 @@ yydefault: } case 360: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3448 +// line internal/php7/php7.y:3415 { yyVAL.node = &ast.ExprCastBool{ast.Node{}, yyDollar[2].node} @@ -6026,7 +5993,7 @@ yydefault: } case 361: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3459 +// line internal/php7/php7.y:3426 { yyVAL.node = &ast.ExprCastUnset{ast.Node{}, yyDollar[2].node} @@ -6039,7 +6006,7 @@ yydefault: } case 362: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3470 +// line internal/php7/php7.y:3437 { yyVAL.node = &ast.ExprExit{ast.Node{}, false, yyDollar[2].node} @@ -6059,7 +6026,7 @@ yydefault: } case 363: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3488 +// line internal/php7/php7.y:3455 { yyVAL.node = &ast.ExprErrorSuppress{ast.Node{}, yyDollar[2].node} @@ -6071,13 +6038,13 @@ yydefault: } case 364: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3498 +// line internal/php7/php7.y:3465 { yyVAL.node = yyDollar[1].node } case 365: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3502 +// line internal/php7/php7.y:3469 { yyVAL.node = &ast.ExprShellExec{ast.Node{}, yyDollar[2].list} @@ -6089,7 +6056,7 @@ yydefault: } case 366: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3512 +// line internal/php7/php7.y:3479 { yyVAL.node = &ast.ExprPrint{ast.Node{}, yyDollar[2].node} @@ -6101,7 +6068,7 @@ yydefault: } case 367: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3522 +// line internal/php7/php7.y:3489 { yyVAL.node = &ast.ExprYield{ast.Node{}, nil, nil} @@ -6113,7 +6080,7 @@ yydefault: } case 368: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3532 +// line internal/php7/php7.y:3499 { yyVAL.node = &ast.ExprYield{ast.Node{}, nil, yyDollar[2].node} @@ -6125,7 +6092,7 @@ yydefault: } case 369: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:3542 +// line internal/php7/php7.y:3509 { yyVAL.node = &ast.ExprYield{ast.Node{}, yyDollar[2].node, yyDollar[4].node} @@ -6138,7 +6105,7 @@ yydefault: } case 370: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3553 +// line internal/php7/php7.y:3520 { yyVAL.node = &ast.ExprYieldFrom{ast.Node{}, yyDollar[2].node} @@ -6150,13 +6117,13 @@ yydefault: } case 371: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3563 +// line internal/php7/php7.y:3530 { yyVAL.node = yyDollar[1].node } case 372: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3567 +// line internal/php7/php7.y:3534 { yyVAL.node = yyDollar[2].node @@ -6177,7 +6144,7 @@ yydefault: } case 373: yyDollar = yyS[yypt-11 : yypt+1] -// line internal/php7/php7.y:3588 +// line internal/php7/php7.y:3555 { yyVAL.node = &ast.ExprClosure{ast.Node{}, yyDollar[2].token != nil, false, yyDollar[5].list, yyDollar[7].ClosureUse, yyDollar[8].node, yyDollar[10].list} @@ -6208,7 +6175,7 @@ yydefault: } case 374: yyDollar = yyS[yypt-9 : yypt+1] -// line internal/php7/php7.y:3615 +// line internal/php7/php7.y:3582 { yyVAL.node = &ast.ExprArrowFunction{ast.Node{}, yyDollar[2].token != nil, false, yyDollar[4].list, yyDollar[6].node, yyDollar[9].node} @@ -6234,25 +6201,25 @@ yydefault: } case 376: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:3645 +// line internal/php7/php7.y:3612 { yyVAL.token = nil } case 377: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3649 +// line internal/php7/php7.y:3616 { yyVAL.token = yyDollar[1].token } case 378: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:3656 +// line internal/php7/php7.y:3623 { yyVAL.ClosureUse = nil } case 379: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:3660 +// line internal/php7/php7.y:3627 { yyVAL.ClosureUse = &ast.ExprClosureUse{ast.Node{}, yyDollar[3].list} @@ -6266,7 +6233,7 @@ yydefault: } case 380: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3675 +// line internal/php7/php7.y:3642 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -6275,13 +6242,13 @@ yydefault: } case 381: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3682 +// line internal/php7/php7.y:3649 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 382: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3689 +// line internal/php7/php7.y:3656 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ExprVariable{ast.Node{}, identifier} @@ -6295,7 +6262,7 @@ yydefault: } case 383: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3701 +// line internal/php7/php7.y:3668 { identifier := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -6312,7 +6279,7 @@ yydefault: } case 384: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3719 +// line internal/php7/php7.y:3686 { yyVAL.node = &ast.ExprFunctionCall{ast.Node{}, yyDollar[1].node, yyDollar[2].node.(*ast.ArgumentList)} @@ -6324,7 +6291,7 @@ yydefault: } case 385: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:3729 +// line internal/php7/php7.y:3696 { yyVAL.node = &ast.ExprStaticCall{ast.Node{}, yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*ast.ArgumentList)} @@ -6337,7 +6304,7 @@ yydefault: } case 386: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:3740 +// line internal/php7/php7.y:3707 { yyVAL.node = &ast.ExprStaticCall{ast.Node{}, yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*ast.ArgumentList)} @@ -6350,7 +6317,7 @@ yydefault: } case 387: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3751 +// line internal/php7/php7.y:3718 { yyVAL.node = &ast.ExprFunctionCall{ast.Node{}, yyDollar[1].node, yyDollar[2].node.(*ast.ArgumentList)} @@ -6362,7 +6329,7 @@ yydefault: } case 388: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3764 +// line internal/php7/php7.y:3731 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -6374,31 +6341,31 @@ yydefault: } case 389: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3774 +// line internal/php7/php7.y:3741 { yyVAL.node = yyDollar[1].node } case 390: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3781 +// line internal/php7/php7.y:3748 { yyVAL.node = yyDollar[1].node } case 391: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3785 +// line internal/php7/php7.y:3752 { yyVAL.node = yyDollar[1].node } case 392: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:3792 +// line internal/php7/php7.y:3759 { yyVAL.node = nil } case 393: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3796 +// line internal/php7/php7.y:3763 { yyVAL.node = &ast.ParserBrackets{ Node: ast.Node{ @@ -6415,13 +6382,13 @@ yydefault: } case 394: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:3814 +// line internal/php7/php7.y:3781 { yyVAL.list = []ast.Vertex{} } case 395: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3818 +// line internal/php7/php7.y:3785 { part := &ast.ScalarEncapsedStringPart{ast.Node{}, yyDollar[1].token.Value} yyVAL.list = []ast.Vertex{part} @@ -6431,25 +6398,25 @@ yydefault: } case 396: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3826 +// line internal/php7/php7.y:3793 { yyVAL.list = yyDollar[1].list } case 397: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:3833 +// line internal/php7/php7.y:3800 { yyVAL.node = nil } case 398: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3837 +// line internal/php7/php7.y:3804 { yyVAL.node = yyDollar[1].node } case 399: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:3844 +// line internal/php7/php7.y:3811 { yyVAL.node = &ast.ExprArray{ast.Node{}, yyDollar[3].list} @@ -6463,7 +6430,7 @@ yydefault: } case 400: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3856 +// line internal/php7/php7.y:3823 { yyVAL.node = &ast.ExprShortArray{ast.Node{}, yyDollar[2].list} @@ -6476,7 +6443,7 @@ yydefault: } case 401: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3867 +// line internal/php7/php7.y:3834 { yyVAL.node = &ast.ScalarString{ast.Node{}, yyDollar[1].token.Value} @@ -6488,7 +6455,7 @@ yydefault: } case 402: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3880 +// line internal/php7/php7.y:3847 { yyVAL.node = &ast.ScalarLnumber{ast.Node{}, yyDollar[1].token.Value} @@ -6500,7 +6467,7 @@ yydefault: } case 403: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3890 +// line internal/php7/php7.y:3857 { yyVAL.node = &ast.ScalarDnumber{ast.Node{}, yyDollar[1].token.Value} @@ -6512,7 +6479,7 @@ yydefault: } case 404: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3900 +// line internal/php7/php7.y:3867 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6524,7 +6491,7 @@ yydefault: } case 405: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3910 +// line internal/php7/php7.y:3877 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6536,7 +6503,7 @@ yydefault: } case 406: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3920 +// line internal/php7/php7.y:3887 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6548,7 +6515,7 @@ yydefault: } case 407: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3930 +// line internal/php7/php7.y:3897 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6560,7 +6527,7 @@ yydefault: } case 408: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3940 +// line internal/php7/php7.y:3907 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6572,7 +6539,7 @@ yydefault: } case 409: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3950 +// line internal/php7/php7.y:3917 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6584,7 +6551,7 @@ yydefault: } case 410: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3960 +// line internal/php7/php7.y:3927 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6596,7 +6563,7 @@ yydefault: } case 411: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3970 +// line internal/php7/php7.y:3937 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6608,7 +6575,7 @@ yydefault: } case 412: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3980 +// line internal/php7/php7.y:3947 { encapsed := &ast.ScalarEncapsedStringPart{ast.Node{}, yyDollar[2].token.Value} yyVAL.node = &ast.ScalarHeredoc{ast.Node{}, yyDollar[1].token.Value, []ast.Vertex{encapsed}} @@ -6622,7 +6589,7 @@ yydefault: } case 413: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3992 +// line internal/php7/php7.y:3959 { yyVAL.node = &ast.ScalarHeredoc{ast.Node{}, yyDollar[1].token.Value, nil} @@ -6634,7 +6601,7 @@ yydefault: } case 414: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4002 +// line internal/php7/php7.y:3969 { yyVAL.node = &ast.ScalarEncapsed{ast.Node{}, yyDollar[2].list} @@ -6646,7 +6613,7 @@ yydefault: } case 415: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4012 +// line internal/php7/php7.y:3979 { yyVAL.node = &ast.ScalarHeredoc{ast.Node{}, yyDollar[1].token.Value, yyDollar[2].list} @@ -6658,19 +6625,19 @@ yydefault: } case 416: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4022 +// line internal/php7/php7.y:3989 { yyVAL.node = yyDollar[1].node } case 417: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4026 +// line internal/php7/php7.y:3993 { yyVAL.node = yyDollar[1].node } case 418: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4033 +// line internal/php7/php7.y:4000 { yyVAL.node = &ast.ExprConstFetch{ast.Node{}, yyDollar[1].node} @@ -6682,7 +6649,7 @@ yydefault: } case 419: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4043 +// line internal/php7/php7.y:4010 { target := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.ExprClassConstFetch{ast.Node{}, yyDollar[1].node, target} @@ -6698,7 +6665,7 @@ yydefault: } case 420: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4057 +// line internal/php7/php7.y:4024 { target := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.ExprClassConstFetch{ast.Node{}, yyDollar[1].node, target} @@ -6714,43 +6681,43 @@ yydefault: } case 421: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4074 +// line internal/php7/php7.y:4041 { yyVAL.node = yyDollar[1].node } case 422: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4078 +// line internal/php7/php7.y:4045 { yyVAL.node = yyDollar[1].node } case 423: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:4085 +// line internal/php7/php7.y:4052 { yyVAL.node = nil } case 424: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4089 +// line internal/php7/php7.y:4056 { yyVAL.node = yyDollar[1].node } case 425: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4096 +// line internal/php7/php7.y:4063 { yyVAL.node = yyDollar[1].node } case 426: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4103 +// line internal/php7/php7.y:4070 { yyVAL.node = yyDollar[1].node } case 427: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4107 +// line internal/php7/php7.y:4074 { yyVAL.node = &ast.ParserBrackets{ Node: ast.Node{ @@ -6767,19 +6734,19 @@ yydefault: } case 428: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4122 +// line internal/php7/php7.y:4089 { yyVAL.node = yyDollar[1].node } case 429: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4129 +// line internal/php7/php7.y:4096 { yyVAL.node = yyDollar[1].node } case 430: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4133 +// line internal/php7/php7.y:4100 { yyVAL.node = &ast.ParserBrackets{ Node: ast.Node{ @@ -6796,19 +6763,19 @@ yydefault: } case 431: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4148 +// line internal/php7/php7.y:4115 { yyVAL.node = yyDollar[1].node } case 432: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4155 +// line internal/php7/php7.y:4122 { yyVAL.node = yyDollar[1].node } case 433: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:4159 +// line internal/php7/php7.y:4126 { yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -6821,7 +6788,7 @@ yydefault: } case 434: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:4170 +// line internal/php7/php7.y:4137 { yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -6834,7 +6801,7 @@ yydefault: } case 435: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:4181 +// line internal/php7/php7.y:4148 { yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -6847,7 +6814,7 @@ yydefault: } case 436: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:4192 +// line internal/php7/php7.y:4159 { yyVAL.node = &ast.ExprMethodCall{ast.Node{}, yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*ast.ArgumentList)} @@ -6860,25 +6827,25 @@ yydefault: } case 437: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4203 +// line internal/php7/php7.y:4170 { yyVAL.node = yyDollar[1].node } case 438: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4210 +// line internal/php7/php7.y:4177 { yyVAL.node = yyDollar[1].node } case 439: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4214 +// line internal/php7/php7.y:4181 { yyVAL.node = yyDollar[1].node } case 440: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4218 +// line internal/php7/php7.y:4185 { yyVAL.node = &ast.ExprPropertyFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -6891,7 +6858,7 @@ yydefault: } case 441: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4232 +// line internal/php7/php7.y:4199 { name := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ExprVariable{ast.Node{}, name} @@ -6905,7 +6872,7 @@ yydefault: } case 442: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:4244 +// line internal/php7/php7.y:4211 { yyVAL.node = &ast.ExprVariable{ast.Node{}, yyDollar[3].node} @@ -6919,7 +6886,7 @@ yydefault: } case 443: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:4256 +// line internal/php7/php7.y:4223 { yyVAL.node = &ast.ExprVariable{ast.Node{}, yyDollar[2].node} @@ -6931,7 +6898,7 @@ yydefault: } case 444: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4269 +// line internal/php7/php7.y:4236 { yyVAL.node = &ast.ExprStaticPropertyFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -6944,7 +6911,7 @@ yydefault: } case 445: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4280 +// line internal/php7/php7.y:4247 { yyVAL.node = &ast.ExprStaticPropertyFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -6957,13 +6924,13 @@ yydefault: } case 446: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4294 +// line internal/php7/php7.y:4261 { yyVAL.node = yyDollar[1].node } case 447: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:4298 +// line internal/php7/php7.y:4265 { yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -6976,7 +6943,7 @@ yydefault: } case 448: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:4309 +// line internal/php7/php7.y:4276 { yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -6989,7 +6956,7 @@ yydefault: } case 449: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4320 +// line internal/php7/php7.y:4287 { yyVAL.node = &ast.ExprPropertyFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7002,7 +6969,7 @@ yydefault: } case 450: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4331 +// line internal/php7/php7.y:4298 { yyVAL.node = &ast.ExprStaticPropertyFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7015,7 +6982,7 @@ yydefault: } case 451: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4342 +// line internal/php7/php7.y:4309 { yyVAL.node = &ast.ExprStaticPropertyFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7028,7 +6995,7 @@ yydefault: } case 452: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4356 +// line internal/php7/php7.y:4323 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -7040,7 +7007,7 @@ yydefault: } case 453: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4366 +// line internal/php7/php7.y:4333 { yyVAL.node = yyDollar[2].node @@ -7050,13 +7017,13 @@ yydefault: } case 454: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4374 +// line internal/php7/php7.y:4341 { yyVAL.node = yyDollar[1].node } case 455: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4381 +// line internal/php7/php7.y:4348 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -7068,7 +7035,7 @@ yydefault: } case 456: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4391 +// line internal/php7/php7.y:4358 { yyVAL.node = yyDollar[2].node @@ -7078,31 +7045,31 @@ yydefault: } case 457: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4399 +// line internal/php7/php7.y:4366 { yyVAL.node = yyDollar[1].node } case 458: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4406 +// line internal/php7/php7.y:4373 { yyVAL.list = yyDollar[1].list } case 459: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:4413 +// line internal/php7/php7.y:4380 { yyVAL.node = &ast.ExprArrayItem{ast.Node{}, false, nil, nil} } case 460: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4417 +// line internal/php7/php7.y:4384 { yyVAL.node = yyDollar[1].node } case 461: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4424 +// line internal/php7/php7.y:4391 { if len(yyDollar[1].list) == 0 { yyDollar[1].list = []ast.Vertex{&ast.ExprArrayItem{ast.Node{}, false, nil, nil}} @@ -7115,7 +7082,7 @@ yydefault: } case 462: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4435 +// line internal/php7/php7.y:4402 { if yyDollar[1].node.(*ast.ExprArrayItem).Key == nil && yyDollar[1].node.(*ast.ExprArrayItem).Val == nil { yyVAL.list = []ast.Vertex{} @@ -7125,7 +7092,7 @@ yydefault: } case 463: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4446 +// line internal/php7/php7.y:4413 { yyVAL.node = &ast.ExprArrayItem{ast.Node{}, false, yyDollar[1].node, yyDollar[3].node} @@ -7138,7 +7105,7 @@ yydefault: } case 464: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4457 +// line internal/php7/php7.y:4424 { yyVAL.node = &ast.ExprArrayItem{ast.Node{}, false, nil, yyDollar[1].node} @@ -7150,7 +7117,7 @@ yydefault: } case 465: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:4467 +// line internal/php7/php7.y:4434 { reference := &ast.ExprReference{ast.Node{}, yyDollar[4].node} yyVAL.node = &ast.ExprArrayItem{ast.Node{}, false, yyDollar[1].node, reference} @@ -7166,7 +7133,7 @@ yydefault: } case 466: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:4481 +// line internal/php7/php7.y:4448 { reference := &ast.ExprReference{ast.Node{}, yyDollar[2].node} yyVAL.node = &ast.ExprArrayItem{ast.Node{}, false, nil, reference} @@ -7180,7 +7147,7 @@ yydefault: } case 467: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:4493 +// line internal/php7/php7.y:4460 { yyVAL.node = &ast.ExprArrayItem{ast.Node{}, true, nil, yyDollar[2].node} @@ -7192,7 +7159,7 @@ yydefault: } case 468: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php7/php7.y:4503 +// line internal/php7/php7.y:4470 { // TODO: Cannot use list() as standalone expression listNode := &ast.ExprList{ast.Node{}, yyDollar[5].list} @@ -7211,7 +7178,7 @@ yydefault: } case 469: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:4520 +// line internal/php7/php7.y:4487 { // TODO: Cannot use list() as standalone expression listNode := &ast.ExprList{ast.Node{}, yyDollar[3].list} @@ -7228,13 +7195,13 @@ yydefault: } case 470: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:4538 +// line internal/php7/php7.y:4505 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 471: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:4542 +// line internal/php7/php7.y:4509 { encapsed := &ast.ScalarEncapsedStringPart{ast.Node{}, yyDollar[2].token.Value} yyVAL.list = append(yyDollar[1].list, encapsed) @@ -7247,13 +7214,13 @@ yydefault: } case 472: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4553 +// line internal/php7/php7.y:4520 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 473: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:4557 +// line internal/php7/php7.y:4524 { encapsed := &ast.ScalarEncapsedStringPart{ast.Node{}, yyDollar[1].token.Value} yyVAL.list = []ast.Vertex{encapsed, yyDollar[2].node} @@ -7266,7 +7233,7 @@ yydefault: } case 474: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4571 +// line internal/php7/php7.y:4538 { name := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ExprVariable{ast.Node{}, name} @@ -7280,7 +7247,7 @@ yydefault: } case 475: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:4583 +// line internal/php7/php7.y:4550 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -7297,7 +7264,7 @@ yydefault: } case 476: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4598 +// line internal/php7/php7.y:4565 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -7316,7 +7283,7 @@ yydefault: } case 477: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4615 +// line internal/php7/php7.y:4582 { variable := &ast.ExprVariable{ast.Node{}, yyDollar[2].node} @@ -7331,7 +7298,7 @@ yydefault: } case 478: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4628 +// line internal/php7/php7.y:4595 { name := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} variable := &ast.ExprVariable{ast.Node{}, name} @@ -7348,7 +7315,7 @@ yydefault: } case 479: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php7/php7.y:4643 +// line internal/php7/php7.y:4610 { identifier := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -7367,7 +7334,7 @@ yydefault: } case 480: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4660 +// line internal/php7/php7.y:4627 { yyVAL.node = yyDollar[2].node @@ -7377,7 +7344,7 @@ yydefault: } case 481: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4671 +// line internal/php7/php7.y:4638 { yyVAL.node = &ast.ScalarString{ast.Node{}, yyDollar[1].token.Value} @@ -7389,7 +7356,7 @@ yydefault: } case 482: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4681 +// line internal/php7/php7.y:4648 { // TODO: add option to handle 64 bit integer if _, err := strconv.Atoi(string(yyDollar[1].token.Value)); err == nil { @@ -7406,7 +7373,7 @@ yydefault: } case 483: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:4696 +// line internal/php7/php7.y:4663 { var lnumber *ast.ScalarLnumber // TODO: add option to handle 64 bit integer @@ -7432,7 +7399,7 @@ yydefault: } case 484: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4720 +// line internal/php7/php7.y:4687 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ExprVariable{ast.Node{}, identifier} @@ -7446,7 +7413,7 @@ yydefault: } case 485: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php7/php7.y:4735 +// line internal/php7/php7.y:4702 { yyVAL.node = &ast.ExprIsset{ast.Node{}, yyDollar[3].list} @@ -7464,7 +7431,7 @@ yydefault: } case 486: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:4751 +// line internal/php7/php7.y:4718 { exprBrackets := &ast.ParserBrackets{ Node: ast.Node{ @@ -7486,7 +7453,7 @@ yydefault: } case 487: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:4771 +// line internal/php7/php7.y:4738 { yyVAL.node = &ast.ExprInclude{ast.Node{}, yyDollar[2].node} @@ -7498,7 +7465,7 @@ yydefault: } case 488: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:4781 +// line internal/php7/php7.y:4748 { yyVAL.node = &ast.ExprIncludeOnce{ast.Node{}, yyDollar[2].node} @@ -7510,7 +7477,7 @@ yydefault: } case 489: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:4791 +// line internal/php7/php7.y:4758 { exprBrackets := &ast.ParserBrackets{ Node: ast.Node{ @@ -7532,7 +7499,7 @@ yydefault: } case 490: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:4811 +// line internal/php7/php7.y:4778 { yyVAL.node = &ast.ExprRequire{ast.Node{}, yyDollar[2].node} @@ -7544,7 +7511,7 @@ yydefault: } case 491: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:4821 +// line internal/php7/php7.y:4788 { yyVAL.node = &ast.ExprRequireOnce{ast.Node{}, yyDollar[2].node} @@ -7556,13 +7523,13 @@ yydefault: } case 492: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4834 +// line internal/php7/php7.y:4801 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 493: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4838 +// line internal/php7/php7.y:4805 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -7571,7 +7538,7 @@ yydefault: } case 494: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4848 +// line internal/php7/php7.y:4815 { yyVAL.node = yyDollar[1].node } diff --git a/internal/php7/php7.y b/internal/php7/php7.y index 0ecf1de..9cf8c08 100644 --- a/internal/php7/php7.y +++ b/internal/php7/php7.y @@ -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, + }) } ; diff --git a/internal/php7/php7_test.go b/internal/php7/php7_test.go index 24499be..06528b4 100644 --- a/internal/php7/php7_test.go +++ b/internal/php7/php7_test.go @@ -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, }, }, }, diff --git a/pkg/ast/ast.go b/pkg/ast/ast.go index d86bf68..33713e7 100644 --- a/pkg/ast/ast.go +++ b/pkg/ast/ast.go @@ -28,10 +28,8 @@ type NodeVisitor interface { Argument(n *Argument) StmtAltForeach(n *StmtAltForeach) - StmtAltSwitch(n *StmtAltSwitch) StmtBreak(n *StmtBreak) StmtCase(n *StmtCase) - StmtCaseList(n *StmtCaseList) StmtCatch(n *StmtCatch) StmtClass(n *StmtClass) StmtClassConstList(n *StmtClassConstList) diff --git a/pkg/ast/node.go b/pkg/ast/node.go index 80685cd..26850a4 100644 --- a/pkg/ast/node.go +++ b/pkg/ast/node.go @@ -188,17 +188,6 @@ func (n *StmtAltForeach) Accept(v NodeVisitor) { v.StmtAltForeach(n) } -// StmtAltSwitch node -type StmtAltSwitch struct { - Node - Cond Vertex - CaseList *StmtCaseList -} - -func (n *StmtAltSwitch) Accept(v NodeVisitor) { - v.StmtAltSwitch(n) -} - // StmtBreak node type StmtBreak struct { Node @@ -212,24 +201,16 @@ func (n *StmtBreak) Accept(v NodeVisitor) { // StmtCase node type StmtCase struct { Node - Cond Vertex - Stmts []Vertex + CaseTkn *token.Token + Cond Vertex + CaseSeparatorTkn *token.Token + Stmts []Vertex } func (n *StmtCase) Accept(v NodeVisitor) { v.StmtCase(n) } -// StmtCaseList node -type StmtCaseList struct { - Node - Cases []Vertex -} - -func (n *StmtCaseList) Accept(v NodeVisitor) { - v.StmtCaseList(n) -} - // StmtCatch node type StmtCatch struct { Node @@ -355,7 +336,9 @@ func (n *StmtDeclare) Accept(v NodeVisitor) { // StmtDefault node type StmtDefault struct { Node - Stmts []Vertex + DefaultTkn *token.Token + CaseSeparatorTkn *token.Token + Stmts []Vertex } func (n *StmtDefault) Accept(v NodeVisitor) { @@ -674,8 +657,18 @@ func (n *StmtStmtList) Accept(v NodeVisitor) { // StmtSwitch node type StmtSwitch struct { Node - Cond Vertex - CaseList *StmtCaseList + Alt bool + SwitchTkn *token.Token + OpenParenthesisTkn *token.Token + Cond Vertex + CloseParenthesisTkn *token.Token + ColonTkn *token.Token + OpenCurlyBracketTkn *token.Token + CaseSeparatorTkn *token.Token + CaseList []Vertex + CloseCurlyBracketTkn *token.Token + EndSwitchTkn *token.Token + SemiColonTkn *token.Token } func (n *StmtSwitch) Accept(v NodeVisitor) { diff --git a/pkg/ast/traverser/dfs.go b/pkg/ast/traverser/dfs.go index 629d6ec..cca893c 100644 --- a/pkg/ast/traverser/dfs.go +++ b/pkg/ast/traverser/dfs.go @@ -146,23 +146,6 @@ func (t *DFS) Traverse(n ast.Vertex) { t.Traverse(nn.Stmt) t.visitor.Leave("Stmt", true) } - case *ast.StmtAltSwitch: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Cond != nil { - t.visitor.Enter("Cond", true) - t.Traverse(nn.Cond) - t.visitor.Leave("Cond", true) - } - if nn.CaseList != nil { - t.visitor.Enter("CaseList", true) - t.Traverse(nn.CaseList) - t.visitor.Leave("CaseList", true) - } case *ast.StmtBreak: if nn == nil { return @@ -194,20 +177,6 @@ func (t *DFS) Traverse(n ast.Vertex) { } t.visitor.Leave("Stmts", false) } - case *ast.StmtCaseList: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Cases != nil { - t.visitor.Enter("Cases", false) - for _, c := range nn.Cases { - t.Traverse(c) - } - t.visitor.Leave("Cases", false) - } case *ast.StmtCatch: if nn == nil { return @@ -869,9 +838,11 @@ func (t *DFS) Traverse(n ast.Vertex) { t.visitor.Leave("Cond", true) } if nn.CaseList != nil { - t.visitor.Enter("CaseList", true) - t.Traverse(nn.CaseList) - t.visitor.Leave("CaseList", true) + t.visitor.Enter("CaseList", false) + for _, c := range nn.CaseList { + t.Traverse(c) + } + t.visitor.Leave("CaseList", false) } case *ast.StmtThrow: if nn == nil { diff --git a/pkg/ast/visitor/dump.go b/pkg/ast/visitor/dump.go index bd9cc4e..5569a60 100644 --- a/pkg/ast/visitor/dump.go +++ b/pkg/ast/visitor/dump.go @@ -258,12 +258,6 @@ func (v *Dump) StmtAltForeach(n *ast.StmtAltForeach) { v.printNode(n.GetNode()) } -func (v *Dump) StmtAltSwitch(n *ast.StmtAltSwitch) { - v.printIndentIfNotSingle(v.indent - 1) - v.print("&ast.StmtAltSwitch{\n") - v.printNode(n.GetNode()) -} - func (v *Dump) StmtBreak(n *ast.StmtBreak) { v.printIndentIfNotSingle(v.indent - 1) v.print("&ast.StmtBreak{\n") @@ -276,12 +270,6 @@ func (v *Dump) StmtCase(n *ast.StmtCase) { v.printNode(n.GetNode()) } -func (v *Dump) StmtCaseList(n *ast.StmtCaseList) { - v.printIndentIfNotSingle(v.indent - 1) - v.print("&ast.StmtCaseList{\n") - v.printNode(n.GetNode()) -} - func (v *Dump) StmtCatch(n *ast.StmtCatch) { v.printIndentIfNotSingle(v.indent - 1) v.print("&ast.StmtCatch{\n") @@ -540,6 +528,11 @@ func (v *Dump) StmtSwitch(n *ast.StmtSwitch) { v.printIndentIfNotSingle(v.indent - 1) v.print("&ast.StmtSwitch{\n") v.printNode(n.GetNode()) + + if n.Alt { + v.printIndent(v.indent) + v.print("Alt: true,\n") + } } func (v *Dump) StmtThrow(n *ast.StmtThrow) { diff --git a/pkg/ast/visitor/filter_parser_nodes.go b/pkg/ast/visitor/filter_parser_nodes.go index 9160d72..0d7ce76 100644 --- a/pkg/ast/visitor/filter_parser_nodes.go +++ b/pkg/ast/visitor/filter_parser_nodes.go @@ -13,26 +13,6 @@ func (v *FilterParserNodes) EnterNode(n ast.Vertex) bool { return true } -func (v *FilterParserNodes) StmtSwitch(n *ast.StmtSwitch) { - for { - if nn, ok := n.Cond.(*ast.ParserBrackets); ok { - n.Cond = nn.Child - } else { - break - } - } -} - -func (v *FilterParserNodes) StmtAltSwitch(n *ast.StmtAltSwitch) { - for { - if nn, ok := n.Cond.(*ast.ParserBrackets); ok { - n.Cond = nn.Child - } else { - break - } - } -} - func (v *FilterParserNodes) ExprExit(n *ast.ExprExit) { for { if nn, ok := n.Expr.(*ast.ParserBrackets); ok { diff --git a/pkg/ast/visitor/filter_tokens.go b/pkg/ast/visitor/filter_tokens.go index 9ec8a3d..b59f05b 100644 --- a/pkg/ast/visitor/filter_tokens.go +++ b/pkg/ast/visitor/filter_tokens.go @@ -141,3 +141,25 @@ func (v *FilterTokens) StmtFor(n *ast.StmtFor) { n.EndForTkn = nil n.SemiColonTkn = nil } + +func (v *FilterTokens) StmtSwitch(n *ast.StmtSwitch) { + n.SwitchTkn = nil + n.OpenParenthesisTkn = nil + n.CloseParenthesisTkn = nil + n.OpenCurlyBracketTkn = nil + n.CaseSeparatorTkn = nil + n.ColonTkn = nil + n.CloseCurlyBracketTkn = nil + n.EndSwitchTkn = nil + n.SemiColonTkn = nil +} + +func (v *FilterTokens) StmtCase(n *ast.StmtCase) { + n.CaseTkn = nil + n.CaseSeparatorTkn = nil +} + +func (v *FilterTokens) StmtDefault(n *ast.StmtDefault) { + n.DefaultTkn = nil + n.CaseSeparatorTkn = nil +} diff --git a/pkg/ast/visitor/null.go b/pkg/ast/visitor/null.go index 7fd4992..225a604 100644 --- a/pkg/ast/visitor/null.go +++ b/pkg/ast/visitor/null.go @@ -58,10 +58,6 @@ func (v *Null) StmtAltForeach(_ *ast.StmtAltForeach) { // do nothing } -func (v *Null) StmtAltSwitch(_ *ast.StmtAltSwitch) { - // do nothing -} - func (v *Null) StmtBreak(_ *ast.StmtBreak) { // do nothing } @@ -70,10 +66,6 @@ func (v *Null) StmtCase(_ *ast.StmtCase) { // do nothing } -func (v *Null) StmtCaseList(_ *ast.StmtCaseList) { - // do nothing -} - func (v *Null) StmtCatch(_ *ast.StmtCatch) { // do nothing } diff --git a/pkg/printer/pretty_printer.go b/pkg/printer/pretty_printer.go index 1053b76..987655d 100644 --- a/pkg/printer/pretty_printer.go +++ b/pkg/printer/pretty_printer.go @@ -299,8 +299,6 @@ func (p *PrettyPrinter) printNode(n ast.Vertex) { case *ast.StmtAltForeach: p.printStmtAltForeach(n) - case *ast.StmtAltSwitch: - p.printStmtAltSwitch(n) case *ast.StmtBreak: p.printStmtBreak(n) case *ast.StmtCase: @@ -1412,21 +1410,6 @@ func (p *PrettyPrinter) printStmtAltIf(n ast.Vertex) { io.WriteString(p.w, "endif;") } -func (p *PrettyPrinter) printStmtAltSwitch(n ast.Vertex) { - nn := n.(*ast.StmtAltSwitch) - - io.WriteString(p.w, "switch (") - p.Print(nn.Cond) - io.WriteString(p.w, ") :\n") - - s := nn.CaseList.Cases - p.printNodes(s) - - io.WriteString(p.w, "\n") - p.printIndent() - io.WriteString(p.w, "endswitch;") -} - func (p *PrettyPrinter) printStmtBreak(n ast.Vertex) { nn := n.(*ast.StmtBreak) @@ -2005,17 +1988,37 @@ func (p *PrettyPrinter) printStmtStmtList(n ast.Vertex) { func (p *PrettyPrinter) printStmtSwitch(n ast.Vertex) { nn := n.(*ast.StmtSwitch) + if nn.Alt { + p.printStmtAltSwitch(n) + return + } + io.WriteString(p.w, "switch (") p.Print(nn.Cond) io.WriteString(p.w, ")") io.WriteString(p.w, " {\n") - p.printNodes(nn.CaseList.Cases) + p.printNodes(nn.CaseList) io.WriteString(p.w, "\n") p.printIndent() io.WriteString(p.w, "}") } +func (p *PrettyPrinter) printStmtAltSwitch(n ast.Vertex) { + nn := n.(*ast.StmtSwitch) + + io.WriteString(p.w, "switch (") + p.Print(nn.Cond) + io.WriteString(p.w, ") :\n") + + s := nn.CaseList + p.printNodes(s) + + io.WriteString(p.w, "\n") + p.printIndent() + io.WriteString(p.w, "endswitch;") +} + func (p *PrettyPrinter) printStmtThrow(n ast.Vertex) { nn := n.(*ast.StmtThrow) diff --git a/pkg/printer/pretty_printer_test.go b/pkg/printer/pretty_printer_test.go index 0eec375..54fcdd0 100644 --- a/pkg/printer/pretty_printer_test.go +++ b/pkg/printer/pretty_printer_test.go @@ -2300,21 +2300,20 @@ func TestPrintStmtAltSwitch(t *testing.T) { p := printer.NewPrettyPrinter(o, " ") p.Print(&ast.StmtNamespace{ Stmts: []ast.Vertex{ - &ast.StmtAltSwitch{ + &ast.StmtSwitch{ + Alt: true, Cond: &ast.ExprVariable{VarName: &ast.Identifier{Value: []byte("var")}}, - CaseList: &ast.StmtCaseList{ - Cases: []ast.Vertex{ - &ast.StmtCase{ - Cond: &ast.ScalarString{Value: []byte("'a'")}, - Stmts: []ast.Vertex{ - &ast.StmtExpression{Expr: &ast.ExprVariable{VarName: &ast.Identifier{Value: []byte("a")}}}, - }, + CaseList: []ast.Vertex{ + &ast.StmtCase{ + Cond: &ast.ScalarString{Value: []byte("'a'")}, + Stmts: []ast.Vertex{ + &ast.StmtExpression{Expr: &ast.ExprVariable{VarName: &ast.Identifier{Value: []byte("a")}}}, }, - &ast.StmtCase{ - Cond: &ast.ScalarString{Value: []byte("'b'")}, - Stmts: []ast.Vertex{ - &ast.StmtExpression{Expr: &ast.ExprVariable{VarName: &ast.Identifier{Value: []byte("b")}}}, - }, + }, + &ast.StmtCase{ + Cond: &ast.ScalarString{Value: []byte("'b'")}, + Stmts: []ast.Vertex{ + &ast.StmtExpression{Expr: &ast.ExprVariable{VarName: &ast.Identifier{Value: []byte("b")}}}, }, }, }, @@ -3682,19 +3681,17 @@ func TestPrintStmtSwitch(t *testing.T) { Stmts: []ast.Vertex{ &ast.StmtSwitch{ Cond: &ast.ExprVariable{VarName: &ast.Identifier{Value: []byte("var")}}, - CaseList: &ast.StmtCaseList{ - Cases: []ast.Vertex{ - &ast.StmtCase{ - Cond: &ast.ScalarString{Value: []byte("'a'")}, - Stmts: []ast.Vertex{ - &ast.StmtExpression{Expr: &ast.ExprVariable{VarName: &ast.Identifier{Value: []byte("a")}}}, - }, + CaseList: []ast.Vertex{ + &ast.StmtCase{ + Cond: &ast.ScalarString{Value: []byte("'a'")}, + Stmts: []ast.Vertex{ + &ast.StmtExpression{Expr: &ast.ExprVariable{VarName: &ast.Identifier{Value: []byte("a")}}}, }, - &ast.StmtCase{ - Cond: &ast.ScalarString{Value: []byte("'b'")}, - Stmts: []ast.Vertex{ - &ast.StmtExpression{Expr: &ast.ExprVariable{VarName: &ast.Identifier{Value: []byte("b")}}}, - }, + }, + &ast.StmtCase{ + Cond: &ast.ScalarString{Value: []byte("'b'")}, + Stmts: []ast.Vertex{ + &ast.StmtExpression{Expr: &ast.ExprVariable{VarName: &ast.Identifier{Value: []byte("b")}}}, }, }, }, diff --git a/pkg/printer/printer.go b/pkg/printer/printer.go index b7ded2f..5064d70 100644 --- a/pkg/printer/printer.go +++ b/pkg/printer/printer.go @@ -361,8 +361,6 @@ func (p *Printer) printNode(n ast.Vertex) { case *ast.StmtAltForeach: p.printStmtAltForeach(n) - case *ast.StmtAltSwitch: - p.printStmtAltSwitch(n) case *ast.StmtBreak: p.printStmtBreak(n) case *ast.StmtCase: @@ -2019,41 +2017,6 @@ func (p *Printer) printStmtAltForeach(n ast.Vertex) { p.printFreeFloating(nn, token.End) } -func (p *Printer) printStmtAltSwitch(n ast.Vertex) { - nn := n.(*ast.StmtAltSwitch) - p.printFreeFloating(nn, token.Start) - - io.WriteString(p.w, "switch") - - if _, ok := nn.Cond.(*ast.ParserBrackets); !ok { - io.WriteString(p.w, "(") - } - - p.Print(nn.Cond) - - if _, ok := nn.Cond.(*ast.ParserBrackets); !ok { - io.WriteString(p.w, ")") - } - - p.printFreeFloating(nn, token.Cond) - io.WriteString(p.w, ":") - - p.printFreeFloating(nn.CaseList, token.Start) - p.printFreeFloating(nn.CaseList, token.CaseListStart) - p.printNodes(nn.CaseList.Cases) - p.printFreeFloating(nn.CaseList, token.CaseListEnd) - p.printFreeFloating(nn.CaseList, token.End) - - io.WriteString(p.w, "endswitch") - p.printFreeFloating(nn, token.AltEnd) - p.printFreeFloating(nn, token.SemiColon) - if nn.GetNode().Tokens.IsEmpty() { - io.WriteString(p.w, ";") - } - - p.printFreeFloating(nn, token.End) -} - func (p *Printer) printStmtBreak(n ast.Vertex) { nn := n.(*ast.StmtBreak) p.printFreeFloating(nn, token.Start) @@ -2075,26 +2038,12 @@ func (p *Printer) printStmtBreak(n ast.Vertex) { p.printFreeFloating(nn, token.End) } -func (p *Printer) printStmtCase(n ast.Vertex) { - nn := n.(*ast.StmtCase) - p.printFreeFloating(nn, token.Start) - - io.WriteString(p.w, "case") - if nn.Cond.GetNode().Tokens.IsEmpty() { - io.WriteString(p.w, " ") - } - p.Print(nn.Cond) - p.printFreeFloating(nn, token.Expr) - p.printFreeFloating(nn, token.CaseSeparator) - if nn.GetNode().Tokens.IsEmpty() { - io.WriteString(p.w, ":") - } - - if len(nn.Stmts) > 0 { - p.printNodes(nn.Stmts) - } - - p.printFreeFloating(nn, token.End) +func (p *Printer) printStmtCase(n *ast.StmtCase) { + p.printToken(n.CaseTkn, "case") + p.bufStart = " " + p.Print(n.Cond) + p.printToken(n.CaseSeparatorTkn, ":") + p.printNodes(n.Stmts) } func (p *Printer) printStmtCatch(n ast.Vertex) { @@ -2308,22 +2257,10 @@ func (p *Printer) printStmtDeclare(n ast.Vertex) { p.printFreeFloating(nn, token.End) } -func (p *Printer) printStmtDefault(n ast.Vertex) { - nn := n.(*ast.StmtDefault) - p.printFreeFloating(nn, token.Start) - - io.WriteString(p.w, "default") - p.printFreeFloating(nn, token.Default) - p.printFreeFloating(nn, token.CaseSeparator) - if nn.GetNode().Tokens.IsEmpty() { - io.WriteString(p.w, ":") - } - - if len(nn.Stmts) > 0 { - p.printNodes(nn.Stmts) - } - - p.printFreeFloating(nn, token.End) +func (p *Printer) printStmtDefault(n *ast.StmtDefault) { + p.printToken(n.DefaultTkn, "default") + p.printToken(n.CaseSeparatorTkn, ":") + p.printNodes(n.Stmts) } func (p *Printer) printStmtDo(n *ast.StmtDo) { @@ -2828,31 +2765,32 @@ func (p *Printer) printStmtStmtList(n *ast.StmtStmtList) { p.printToken(n.CloseCurlyBracket, "}") } -func (p *Printer) printStmtSwitch(n ast.Vertex) { - nn := n.(*ast.StmtSwitch) - p.printFreeFloating(nn, token.Start) - - io.WriteString(p.w, "switch") - - if _, ok := nn.Cond.(*ast.ParserBrackets); !ok { - io.WriteString(p.w, "(") +func (p *Printer) printStmtSwitch(n *ast.StmtSwitch) { + if n.Alt { + p.printStmtAltSwitch(n) + return } - p.Print(nn.Cond) + p.printToken(n.SwitchTkn, "switch") + p.printToken(n.OpenParenthesisTkn, "(") + p.Print(n.Cond) + p.printToken(n.CloseParenthesisTkn, ")") + p.printToken(n.OpenCurlyBracketTkn, "{") + p.printToken(n.CaseSeparatorTkn, "") + p.printNodes(n.CaseList) + p.printToken(n.CloseCurlyBracketTkn, "}") +} - if _, ok := nn.Cond.(*ast.ParserBrackets); !ok { - io.WriteString(p.w, ")") - } - - p.printFreeFloating(nn.CaseList, token.Start) - io.WriteString(p.w, "{") - p.printFreeFloating(nn.CaseList, token.CaseListStart) - p.printNodes(nn.CaseList.Cases) - p.printFreeFloating(nn.CaseList, token.CaseListEnd) - io.WriteString(p.w, "}") - p.printFreeFloating(nn.CaseList, token.End) - - p.printFreeFloating(nn, token.End) +func (p *Printer) printStmtAltSwitch(n *ast.StmtSwitch) { + p.printToken(n.SwitchTkn, "switch") + p.printToken(n.OpenParenthesisTkn, "(") + p.Print(n.Cond) + p.printToken(n.CloseParenthesisTkn, ")") + p.printToken(n.ColonTkn, ":") + p.printToken(n.CaseSeparatorTkn, "") + p.printNodes(n.CaseList) + p.printToken(n.EndSwitchTkn, "endswitch") + p.printToken(n.SemiColonTkn, ";") } func (p *Printer) printStmtThrow(n ast.Vertex) { diff --git a/pkg/printer/printer_parsed_php5_test.go b/pkg/printer/printer_parsed_php5_test.go index c607b65..2ea9ea4 100644 --- a/pkg/printer/printer_parsed_php5_test.go +++ b/pkg/printer/printer_parsed_php5_test.go @@ -791,7 +791,8 @@ func TestParseAndPrintPhp5AltForeach(t *testing.T) { } func TestParseAndPrintPhp5AltSwitch(t *testing.T) { - src := `