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

BIN
internal/php7/php7.go generated

Binary file not shown.

View File

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

View File

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