[refactoring] update ast structure of "Do" node

This commit is contained in:
Vadym Slizov
2020-09-04 10:53:07 +03:00
parent 3b85f5e82b
commit c274c4f92f
12 changed files with 900 additions and 930 deletions

962
internal/php5/php5.go generated

File diff suppressed because it is too large Load Diff

View File

@@ -911,16 +911,18 @@ unticked_statement:
}
| T_DO statement T_WHILE parenthesis_expr ';'
{
$$ = &ast.StmtDo{ast.Node{}, $2, $4}
// save position
$$.GetNode().Position = position.NewTokensPosition($1, $5)
// save comments
yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens)
yylex.(*Parser).setFreeFloating($$, token.Stmts, $3.SkippedTokens)
yylex.(*Parser).setFreeFloating($4, token.End, $5.SkippedTokens)
yylex.(*Parser).setToken($$, token.SemiColon, $5.SkippedTokens)
$$ = &ast.StmtDo{
Node: ast.Node{
Position: position.NewTokensPosition($1, $5),
},
DoTkn: $1,
Stmt: $2,
WhileTkn: $3,
OpenParenthesisTkn: $4.(*ast.ParserBrackets).OpenBracketTkn,
Cond: $4.(*ast.ParserBrackets).Child,
CloseParenthesisTkn: $4.(*ast.ParserBrackets).CloseBracketTkn,
SemiColonTkn: $5,
}
}
| T_FOR '(' for_expr ';' for_expr ';' for_expr ')' for_statement
{