[refactoring] remove Alt flags

This commit is contained in:
Vadym Slizov 2020-12-11 17:34:29 +02:00
parent 5291529a37
commit c32f5bd29b
No known key found for this signature in database
GPG Key ID: AEA2A9388EF42A4A
5 changed files with 8 additions and 34 deletions

BIN
internal/php5/php5.go generated

Binary file not shown.

View File

@ -798,7 +798,6 @@ unticked_statement:
{
$$ = &ast.StmtIf{
Position: yylex.(*Parser).builder.NewTokensPosition($1, $8),
Alt: true,
IfTkn: $1,
OpenParenthesisTkn: $2.(*ast.ParserBrackets).OpenBracketTkn,
Cond: $2.(*ast.ParserBrackets).Child,
@ -1264,9 +1263,9 @@ unticked_class_declaration_statement:
}
n.Extends = $3
n.Implements = $4
n.OpenCurlyBracket = $5
n.OpenCurlyBracketTkn = $5
n.Stmts = $6
n.CloseCurlyBracket = $7
n.CloseCurlyBracketTkn = $7
case *ast.StmtTrait :
n.Position = yylex.(*Parser).builder.NewNodeTokenPosition($1, $7)
n.TraitName = &ast.Identifier{
@ -1276,9 +1275,9 @@ unticked_class_declaration_statement:
}
n.Extends = $3
n.Implements = $4
n.OpenCurlyBracket = $5
n.OpenCurlyBracketTkn = $5
n.Stmts = $6
n.CloseCurlyBracket = $7
n.CloseCurlyBracketTkn = $7
}
$$ = $1
@ -1476,7 +1475,6 @@ for_statement:
{
$$ = &ast.StmtFor{
Position: yylex.(*Parser).builder.NewTokensPosition($1, $4),
Alt: true,
ColonTkn: $1,
Stmt: &ast.StmtStmtList{
Position: yylex.(*Parser).builder.NewNodeListPosition($2),
@ -1500,7 +1498,6 @@ foreach_statement:
{
$$ = &ast.StmtForeach{
Position: yylex.(*Parser).builder.NewTokensPosition($1, $4),
Alt: true,
ColonTkn: $1,
Stmt: &ast.StmtStmtList{
Position: yylex.(*Parser).builder.NewNodeListPosition($2),
@ -1525,7 +1522,6 @@ declare_statement:
{
$$ = &ast.StmtDeclare{
Position: yylex.(*Parser).builder.NewTokensPosition($1, $4),
Alt: true,
ColonTkn: $1,
Stmt: &ast.StmtStmtList{
Position: yylex.(*Parser).builder.NewNodeListPosition($2),
@ -1602,7 +1598,6 @@ switch_case_list:
{
$$ = &ast.StmtSwitch{
Position: yylex.(*Parser).builder.NewTokensPosition($1, $4),
Alt: true,
ColonTkn: $1,
CaseList: $2,
EndSwitchTkn: $3,
@ -1613,7 +1608,6 @@ switch_case_list:
{
$$ = &ast.StmtSwitch{
Position: yylex.(*Parser).builder.NewTokensPosition($1, $5),
Alt: true,
ColonTkn: $1,
CaseSeparatorTkn: $2,
CaseList: $3,
@ -1675,7 +1669,6 @@ while_statement:
{
$$ = &ast.StmtWhile{
Position: yylex.(*Parser).builder.NewTokensPosition($1, $4),
Alt: true,
ColonTkn: $1,
Stmt: &ast.StmtStmtList{
Position: yylex.(*Parser).builder.NewNodeListPosition($2),
@ -1717,7 +1710,6 @@ new_elseif_list:
{
$$ = append($1, &ast.StmtElseIf{
Position: yylex.(*Parser).builder.NewTokenNodeListPosition($2, $5),
Alt: true,
ElseIfTkn: $2,
OpenParenthesisTkn: $3.(*ast.ParserBrackets).OpenBracketTkn,
Cond: $3.(*ast.ParserBrackets).Child,
@ -1757,7 +1749,6 @@ new_else_single:
{
$$ = &ast.StmtElse{
Position: yylex.(*Parser).builder.NewTokenNodeListPosition($1, $3),
Alt: true,
ElseTkn: $1,
ColonTkn: $2,
Stmt: &ast.StmtStmtList{

BIN
internal/php7/php7.go generated

Binary file not shown.

View File

@ -459,10 +459,10 @@ top_statement:
{
$$ = &ast.StmtNamespace{
Position: yylex.(*Parser).builder.NewTokensPosition($1, $4),
NsTkn: $1,
OpenCurlyBracketTkn: $2,
Stmts: $3,
CloseCurlyBracket: $4,
NsTkn: $1,
OpenCurlyBracketTkn: $2,
Stmts: $3,
CloseCurlyBracketTkn: $4,
}
}
| T_USE mixed_group_use_declaration ';'
@ -1382,7 +1382,6 @@ for_statement:
{
$$ = &ast.StmtFor{
Position: yylex.(*Parser).builder.NewTokensPosition($1, $4),
Alt: true,
ColonTkn: $1,
Stmt: &ast.StmtStmtList{
Position: yylex.(*Parser).builder.NewNodeListPosition($2),
@ -1406,7 +1405,6 @@ foreach_statement:
{
$$ = &ast.StmtForeach{
Position: yylex.(*Parser).builder.NewTokensPosition($1, $4),
Alt: true,
ColonTkn: $1,
Stmt: &ast.StmtStmtList{
Position: yylex.(*Parser).builder.NewNodeListPosition($2),
@ -1430,7 +1428,6 @@ declare_statement:
{
$$ = &ast.StmtDeclare{
Position: yylex.(*Parser).builder.NewTokensPosition($1, $4),
Alt: true,
ColonTkn: $1,
Stmt: &ast.StmtStmtList{
Position: yylex.(*Parser).builder.NewNodeListPosition($2),
@ -1466,7 +1463,6 @@ switch_case_list:
{
$$ = &ast.StmtSwitch{
Position: yylex.(*Parser).builder.NewTokensPosition($1, $4),
Alt: true,
ColonTkn: $1,
CaseList: $2,
EndSwitchTkn: $3,
@ -1477,7 +1473,6 @@ switch_case_list:
{
$$ = &ast.StmtSwitch{
Position: yylex.(*Parser).builder.NewTokensPosition($1, $5),
Alt: true,
ColonTkn: $1,
CaseSeparatorTkn: $2,
CaseList: $3,
@ -1536,7 +1531,6 @@ while_statement:
{
$$ = &ast.StmtWhile{
Position: yylex.(*Parser).builder.NewTokensPosition($1, $4),
Alt: true,
ColonTkn: $1,
Stmt: &ast.StmtStmtList{
Position: yylex.(*Parser).builder.NewNodeListPosition($2),
@ -1601,7 +1595,6 @@ alt_if_stmt_without_else:
{
$$ = &ast.StmtIf{
Position: yylex.(*Parser).builder.NewTokenNodeListPosition($1, $6),
Alt: true,
IfTkn: $1,
OpenParenthesisTkn: $2,
Cond: $3,
@ -1617,7 +1610,6 @@ alt_if_stmt_without_else:
{
$1.(*ast.StmtIf).ElseIf = append($1.(*ast.StmtIf).ElseIf, &ast.StmtElseIf{
Position: yylex.(*Parser).builder.NewTokenNodeListPosition($2, $7),
Alt: true,
ElseIfTkn: $2,
OpenParenthesisTkn: $3,
Cond: $4,
@ -1646,7 +1638,6 @@ alt_if_stmt:
{
$1.(*ast.StmtIf).Else = &ast.StmtElse{
Position: yylex.(*Parser).builder.NewTokenNodeListPosition($2, $4),
Alt: true,
ElseTkn: $2,
ColonTkn: $3,
Stmt: &ast.StmtStmtList{

View File

@ -398,7 +398,6 @@ func (n *StmtContinue) GetPosition() *position.Position {
// StmtDeclare node
type StmtDeclare struct {
Position *position.Position
Alt bool
DeclareTkn *token.Token
OpenParenthesisTkn *token.Token
Consts []Vertex
@ -474,7 +473,6 @@ func (n *StmtEcho) GetPosition() *position.Position {
// StmtElse node
type StmtElse struct {
Position *position.Position
Alt bool
ElseTkn *token.Token
ColonTkn *token.Token
Stmt Vertex
@ -491,7 +489,6 @@ func (n *StmtElse) GetPosition() *position.Position {
// StmtElseIf node
type StmtElseIf struct {
Position *position.Position
Alt bool
ElseIfTkn *token.Token
OpenParenthesisTkn *token.Token
Cond Vertex
@ -543,7 +540,6 @@ func (n *StmtFinally) GetPosition() *position.Position {
// StmtFor node
type StmtFor struct {
Position *position.Position
Alt bool
ForTkn *token.Token
OpenParenthesisTkn *token.Token
Init []Vertex
@ -572,7 +568,6 @@ func (n *StmtFor) GetPosition() *position.Position {
// StmtForeach node
type StmtForeach struct {
Position *position.Position
Alt bool
ForeachTkn *token.Token
OpenParenthesisTkn *token.Token
Expr Vertex
@ -673,7 +668,6 @@ func (n *StmtHaltCompiler) GetPosition() *position.Position {
// StmtIf node
type StmtIf struct {
Position *position.Position
Alt bool
IfTkn *token.Token
OpenParenthesisTkn *token.Token
Cond Vertex
@ -894,7 +888,6 @@ func (n *StmtStmtList) GetPosition() *position.Position {
// StmtSwitch node
type StmtSwitch struct {
Position *position.Position
Alt bool
SwitchTkn *token.Token
OpenParenthesisTkn *token.Token
Cond Vertex
@ -1137,7 +1130,6 @@ func (n *StmtUseDeclaration) GetPosition() *position.Position {
// StmtWhile node
type StmtWhile struct {
Position *position.Position
Alt bool
WhileTkn *token.Token
OpenParenthesisTkn *token.Token
Cond Vertex