[refactoring] update ast structure of "ClassConstList", "Constant", "Use", "GroupUse", "UseDeclaration", "Closure", "Name", "FullyQualified", "Relative" and "NamePart" nodes
This commit is contained in:
1673
internal/php5/php5.go
generated
1673
internal/php5/php5.go
generated
File diff suppressed because it is too large
Load Diff
@@ -15,8 +15,6 @@ import (
|
||||
node ast.Vertex
|
||||
token *token.Token
|
||||
list []ast.Vertex
|
||||
|
||||
ClosureUse *ast.ExprClosureUse
|
||||
}
|
||||
|
||||
%token <token> T_INCLUDE
|
||||
@@ -219,6 +217,7 @@ import (
|
||||
%type <token> function interface_entry
|
||||
%type <token> possible_comma
|
||||
%type <token> case_separator
|
||||
%type <token> is_reference is_variadic
|
||||
|
||||
%type <node> top_statement use_declaration use_function_declaration use_const_declaration common_scalar
|
||||
%type <node> static_class_constant compound_variable reference_variable class_name variable_class_name
|
||||
@@ -241,12 +240,12 @@ import (
|
||||
%type <node> method_body trait_reference_list static_array_pair_list non_empty_static_array_pair_list
|
||||
%type <node> foreach_statement for_statement while_statement isset_variables
|
||||
%type <node> foreach_variable foreach_optional_arg for_expr non_empty_for_expr
|
||||
%type <node> extends_from interface_list trait_list
|
||||
%type <node> implements_list
|
||||
%type <node> extends_from interface_list trait_list namespace_name
|
||||
%type <node> implements_list use_declarations use_function_declarations use_const_declarations
|
||||
%type <node> interface_extends_list
|
||||
%type <ClosureUse> lexical_vars
|
||||
%type <node> lexical_vars
|
||||
|
||||
%type <list> top_statement_list namespace_name use_declarations use_function_declarations use_const_declarations
|
||||
%type <list> top_statement_list
|
||||
%type <list> inner_statement_list encaps_list
|
||||
%type <list> elseif_list new_elseif_list
|
||||
%type <list> case_list catch_statement additional_catches
|
||||
@@ -260,7 +259,6 @@ import (
|
||||
%type <list> dynamic_class_name_variable_properties variable_properties
|
||||
|
||||
%type <list> simple_indirect_reference
|
||||
%type <token> is_reference is_variadic
|
||||
|
||||
%%
|
||||
|
||||
@@ -293,26 +291,32 @@ top_statement_list:
|
||||
namespace_name:
|
||||
T_STRING
|
||||
{
|
||||
$$ = []ast.Vertex{
|
||||
&ast.NameNamePart{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenPosition($1),
|
||||
$$ = &ast.ParserSeparatedList{
|
||||
Items: []ast.Vertex{
|
||||
&ast.NameNamePart{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenPosition($1),
|
||||
},
|
||||
StringTkn: $1,
|
||||
Value: $1.Value,
|
||||
},
|
||||
StringTkn: $1,
|
||||
Value: $1.Value,
|
||||
},
|
||||
}
|
||||
}
|
||||
| namespace_name T_NS_SEPARATOR T_STRING
|
||||
{
|
||||
$$ = append($1, &ast.NameNamePart{
|
||||
part := &ast.NameNamePart{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokensPosition($2, $3),
|
||||
Position: position.NewTokenPosition($3),
|
||||
},
|
||||
NsSeparatorTkn: $2,
|
||||
StringTkn: $3,
|
||||
Value: $3.Value,
|
||||
})
|
||||
}
|
||||
|
||||
$1.(*ast.ParserSeparatedList).SeparatorTkns = append($1.(*ast.ParserSeparatedList).SeparatorTkns, $2)
|
||||
$1.(*ast.ParserSeparatedList).Items = append($1.(*ast.ParserSeparatedList).Items, part)
|
||||
|
||||
$$ = $1
|
||||
}
|
||||
;
|
||||
|
||||
@@ -355,9 +359,10 @@ top_statement:
|
||||
NsTkn: $1,
|
||||
Name: &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($2),
|
||||
Position: position.NewNodeListPosition($2.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $2,
|
||||
Parts: $2.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
SemiColonTkn: $3,
|
||||
}
|
||||
@@ -371,9 +376,10 @@ top_statement:
|
||||
NsTkn: $1,
|
||||
Name: &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($2),
|
||||
Position: position.NewNodeListPosition($2.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $2,
|
||||
Parts: $2.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
OpenCurlyBracket: $3,
|
||||
Stmts: $4,
|
||||
@@ -399,7 +405,8 @@ top_statement:
|
||||
Position: position.NewTokensPosition($1, $3),
|
||||
},
|
||||
UseTkn: $1,
|
||||
UseDeclarations: $2,
|
||||
UseDeclarations: $2.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
SemiColonTkn: $3,
|
||||
}
|
||||
}
|
||||
@@ -417,7 +424,8 @@ top_statement:
|
||||
IdentifierTkn: $2,
|
||||
Value: $2.Value,
|
||||
},
|
||||
UseDeclarations: $3,
|
||||
UseDeclarations: $3.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $3.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
SemiColonTkn: $4,
|
||||
}
|
||||
}
|
||||
@@ -435,7 +443,8 @@ top_statement:
|
||||
IdentifierTkn: $2,
|
||||
Value: $2.Value,
|
||||
},
|
||||
UseDeclarations: $3,
|
||||
UseDeclarations: $3.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $3.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
SemiColonTkn: $4,
|
||||
}
|
||||
}
|
||||
@@ -450,13 +459,16 @@ top_statement:
|
||||
use_declarations:
|
||||
use_declarations ',' use_declaration
|
||||
{
|
||||
$1[len($1)-1].(*ast.StmtUseDeclaration).CommaTkn = $2
|
||||
$1.(*ast.ParserSeparatedList).SeparatorTkns = append($1.(*ast.ParserSeparatedList).SeparatorTkns, $2)
|
||||
$1.(*ast.ParserSeparatedList).Items = append($1.(*ast.ParserSeparatedList).Items, $3)
|
||||
|
||||
$$ = append($1, $3)
|
||||
$$ = $1
|
||||
}
|
||||
| use_declaration
|
||||
{
|
||||
$$ = []ast.Vertex{$1}
|
||||
$$ = &ast.ParserSeparatedList{
|
||||
Items: []ast.Vertex{$1},
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
@@ -465,13 +477,14 @@ use_declaration:
|
||||
{
|
||||
$$ = &ast.StmtUseDeclaration{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($1),
|
||||
Position: position.NewNodeListPosition($1.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Use: &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($1),
|
||||
Position: position.NewNodeListPosition($1.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $1,
|
||||
Parts: $1.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $1.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -479,13 +492,14 @@ use_declaration:
|
||||
{
|
||||
$$ = &ast.StmtUseDeclaration{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListTokenPosition($1, $3),
|
||||
Position: position.NewNodeListTokenPosition($1.(*ast.ParserSeparatedList).Items, $3),
|
||||
},
|
||||
Use: &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($1),
|
||||
Position: position.NewNodeListPosition($1.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $1,
|
||||
Parts: $1.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $1.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
AsTkn: $2,
|
||||
Alias: &ast.Identifier{
|
||||
@@ -501,14 +515,15 @@ use_declaration:
|
||||
{
|
||||
$$ = &ast.StmtUseDeclaration{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodeListPosition($1, $2),
|
||||
Position: position.NewTokenNodeListPosition($1, $2.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
NsSeparatorTkn: $1,
|
||||
Use: &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($2),
|
||||
Position: position.NewNodeListPosition($2.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $2,
|
||||
Parts: $2.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -521,9 +536,10 @@ use_declaration:
|
||||
NsSeparatorTkn: $1,
|
||||
Use: &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($2),
|
||||
Position: position.NewNodeListPosition($2.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $2,
|
||||
Parts: $2.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
AsTkn: $3,
|
||||
Alias: &ast.Identifier{
|
||||
@@ -540,13 +556,16 @@ use_declaration:
|
||||
use_function_declarations:
|
||||
use_function_declarations ',' use_function_declaration
|
||||
{
|
||||
$1[len($1)-1].(*ast.StmtUseDeclaration).CommaTkn = $2
|
||||
$1.(*ast.ParserSeparatedList).SeparatorTkns = append($1.(*ast.ParserSeparatedList).SeparatorTkns, $2)
|
||||
$1.(*ast.ParserSeparatedList).Items = append($1.(*ast.ParserSeparatedList).Items, $3)
|
||||
|
||||
$$ = append($1, $3)
|
||||
$$ = $1
|
||||
}
|
||||
| use_function_declaration
|
||||
{
|
||||
$$ = []ast.Vertex{$1}
|
||||
$$ = &ast.ParserSeparatedList{
|
||||
Items: []ast.Vertex{$1},
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
@@ -555,13 +574,14 @@ use_function_declaration:
|
||||
{
|
||||
$$ = &ast.StmtUseDeclaration{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($1),
|
||||
Position: position.NewNodeListPosition($1.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Use: &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($1),
|
||||
Position: position.NewNodeListPosition($1.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $1,
|
||||
Parts: $1.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $1.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -569,13 +589,14 @@ use_function_declaration:
|
||||
{
|
||||
$$ = &ast.StmtUseDeclaration{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListTokenPosition($1, $3),
|
||||
Position: position.NewNodeListTokenPosition($1.(*ast.ParserSeparatedList).Items, $3),
|
||||
},
|
||||
Use: &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($1),
|
||||
Position: position.NewNodeListPosition($1.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $1,
|
||||
Parts: $1.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $1.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
AsTkn: $2,
|
||||
Alias: &ast.Identifier{
|
||||
@@ -591,14 +612,15 @@ use_function_declaration:
|
||||
{
|
||||
$$ = &ast.StmtUseDeclaration{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodeListPosition($1, $2),
|
||||
Position: position.NewTokenNodeListPosition($1, $2.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
NsSeparatorTkn: $1,
|
||||
Use: &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($2),
|
||||
Position: position.NewNodeListPosition($2.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $2,
|
||||
Parts: $2.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -611,9 +633,10 @@ use_function_declaration:
|
||||
NsSeparatorTkn: $1,
|
||||
Use: &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($2),
|
||||
Position: position.NewNodeListPosition($2.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $2,
|
||||
Parts: $2.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
AsTkn: $3,
|
||||
Alias: &ast.Identifier{
|
||||
@@ -630,13 +653,16 @@ use_function_declaration:
|
||||
use_const_declarations:
|
||||
use_const_declarations ',' use_const_declaration
|
||||
{
|
||||
$1[len($1)-1].(*ast.StmtUseDeclaration).CommaTkn = $2
|
||||
$1.(*ast.ParserSeparatedList).SeparatorTkns = append($1.(*ast.ParserSeparatedList).SeparatorTkns, $2)
|
||||
$1.(*ast.ParserSeparatedList).Items = append($1.(*ast.ParserSeparatedList).Items, $3)
|
||||
|
||||
$$ = append($1, $3)
|
||||
$$ = $1
|
||||
}
|
||||
| use_const_declaration
|
||||
{
|
||||
$$ = []ast.Vertex{$1}
|
||||
$$ = &ast.ParserSeparatedList{
|
||||
Items: []ast.Vertex{$1},
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
@@ -645,13 +671,14 @@ use_const_declaration:
|
||||
{
|
||||
$$ = &ast.StmtUseDeclaration{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($1),
|
||||
Position: position.NewNodeListPosition($1.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Use: &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($1),
|
||||
Position: position.NewNodeListPosition($1.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $1,
|
||||
Parts: $1.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $1.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -659,13 +686,14 @@ use_const_declaration:
|
||||
{
|
||||
$$ = &ast.StmtUseDeclaration{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListTokenPosition($1, $3),
|
||||
Position: position.NewNodeListTokenPosition($1.(*ast.ParserSeparatedList).Items, $3),
|
||||
},
|
||||
Use: &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($1),
|
||||
Position: position.NewNodeListPosition($1.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $1,
|
||||
Parts: $1.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $1.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
AsTkn: $2,
|
||||
Alias: &ast.Identifier{
|
||||
@@ -681,14 +709,15 @@ use_const_declaration:
|
||||
{
|
||||
$$ = &ast.StmtUseDeclaration{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodeListPosition($1, $2),
|
||||
Position: position.NewTokenNodeListPosition($1, $2.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
NsSeparatorTkn: $1,
|
||||
Use: &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($2),
|
||||
Position: position.NewNodeListPosition($2.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $2,
|
||||
Parts: $2.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -701,9 +730,10 @@ use_const_declaration:
|
||||
NsSeparatorTkn: $1,
|
||||
Use: &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($2),
|
||||
Position: position.NewNodeListPosition($2.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $2,
|
||||
Parts: $2.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
AsTkn: $3,
|
||||
Alias: &ast.Identifier{
|
||||
@@ -2888,7 +2918,7 @@ class_constant_declaration:
|
||||
{
|
||||
constList := $1.(*ast.StmtClassConstList)
|
||||
constList.Node.Position = position.NewNodesPosition($1, $5)
|
||||
lastNode($$.(*ast.StmtClassConstList).Consts).(*ast.StmtConstant).CommaTkn = $2
|
||||
constList.SeparatorTkns = append(constList.SeparatorTkns, $2)
|
||||
constList.Consts = append(constList.Consts, &ast.StmtConstant{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodePosition($3, $5),
|
||||
@@ -4165,13 +4195,14 @@ function_call:
|
||||
{
|
||||
$$ = &ast.ExprFunctionCall{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListNodePosition($1, $2),
|
||||
Position: position.NewNodeListNodePosition($1.(*ast.ParserSeparatedList).Items, $2),
|
||||
},
|
||||
Function: &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($1),
|
||||
Position: position.NewNodeListPosition($1.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $1,
|
||||
Parts: $1.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $1.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
OpenParenthesisTkn: $2.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||
Arguments: $2.(*ast.ArgumentList).Arguments,
|
||||
@@ -4187,11 +4218,12 @@ function_call:
|
||||
},
|
||||
Function: &ast.NameRelative{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodeListPosition($1, $3),
|
||||
Position: position.NewTokenNodeListPosition($1, $3.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
NsTkn: $1,
|
||||
NsSeparatorTkn: $2,
|
||||
Parts: $3,
|
||||
Parts: $3.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $3.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
OpenParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||
Arguments: $4.(*ast.ArgumentList).Arguments,
|
||||
@@ -4207,10 +4239,11 @@ function_call:
|
||||
},
|
||||
Function: &ast.NameFullyQualified{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodeListPosition($1, $2),
|
||||
Position: position.NewTokenNodeListPosition($1, $2.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
NsSeparatorTkn: $1,
|
||||
Parts: $2,
|
||||
Parts: $2.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
OpenParenthesisTkn: $3.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||
Arguments: $3.(*ast.ArgumentList).Arguments,
|
||||
@@ -4308,30 +4341,33 @@ class_name:
|
||||
{
|
||||
$$ = &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($1),
|
||||
Position: position.NewNodeListPosition($1.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $1,
|
||||
Parts: $1.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $1.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
}
|
||||
}
|
||||
| T_NAMESPACE T_NS_SEPARATOR namespace_name
|
||||
{
|
||||
$$ = &ast.NameRelative{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodeListPosition($1, $3),
|
||||
Position: position.NewTokenNodeListPosition($1, $3.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
NsTkn: $1,
|
||||
NsSeparatorTkn: $2,
|
||||
Parts: $3,
|
||||
Parts: $3.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $3.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
}
|
||||
}
|
||||
| T_NS_SEPARATOR namespace_name
|
||||
{
|
||||
$$ = &ast.NameFullyQualified{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodeListPosition($1, $2),
|
||||
Position: position.NewTokenNodeListPosition($1, $2.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
NsSeparatorTkn: $1,
|
||||
Parts: $2,
|
||||
Parts: $2.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
}
|
||||
}
|
||||
;
|
||||
@@ -4341,30 +4377,33 @@ fully_qualified_class_name:
|
||||
{
|
||||
$$ = &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($1),
|
||||
Position: position.NewNodeListPosition($1.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $1,
|
||||
Parts: $1.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $1.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
}
|
||||
}
|
||||
| T_NAMESPACE T_NS_SEPARATOR namespace_name
|
||||
{
|
||||
$$ = &ast.NameRelative{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodeListPosition($1, $3),
|
||||
Position: position.NewTokenNodeListPosition($1, $3.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
NsTkn: $1,
|
||||
NsSeparatorTkn: $2,
|
||||
Parts: $3,
|
||||
Parts: $3.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $3.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
}
|
||||
}
|
||||
| T_NS_SEPARATOR namespace_name
|
||||
{
|
||||
$$ = &ast.NameFullyQualified{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodeListPosition($1, $2),
|
||||
Position: position.NewTokenNodeListPosition($1, $2.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
NsSeparatorTkn: $1,
|
||||
Parts: $2,
|
||||
Parts: $2.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
}
|
||||
}
|
||||
;
|
||||
@@ -4670,13 +4709,14 @@ static_scalar_value:
|
||||
{
|
||||
$$ = &ast.ExprConstFetch{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($1),
|
||||
Position: position.NewNodeListPosition($1.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Const: &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($1),
|
||||
Position: position.NewNodeListPosition($1.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $1,
|
||||
Parts: $1.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $1.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -4684,15 +4724,16 @@ static_scalar_value:
|
||||
{
|
||||
$$ = &ast.ExprConstFetch{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodeListPosition($1, $3),
|
||||
Position: position.NewTokenNodeListPosition($1, $3.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Const: &ast.NameRelative{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodeListPosition($1, $3),
|
||||
Position: position.NewTokenNodeListPosition($1, $3.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
NsTkn: $1,
|
||||
NsSeparatorTkn: $2,
|
||||
Parts: $3,
|
||||
Parts: $3.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $3.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -4700,14 +4741,15 @@ static_scalar_value:
|
||||
{
|
||||
$$ = &ast.ExprConstFetch{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodeListPosition($1, $2),
|
||||
Position: position.NewTokenNodeListPosition($1, $2.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Const: &ast.NameFullyQualified{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodeListPosition($1, $2),
|
||||
Position: position.NewTokenNodeListPosition($1, $2.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
NsSeparatorTkn: $1,
|
||||
Parts: $2,
|
||||
Parts: $2.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -5131,13 +5173,14 @@ general_constant:
|
||||
{
|
||||
$$ = &ast.ExprConstFetch{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($1),
|
||||
Position: position.NewNodeListPosition($1.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Const: &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($1),
|
||||
Position: position.NewNodeListPosition($1.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $1,
|
||||
Parts: $1.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $1.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -5145,15 +5188,16 @@ general_constant:
|
||||
{
|
||||
$$ = &ast.ExprConstFetch{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodeListPosition($1, $3),
|
||||
Position: position.NewTokenNodeListPosition($1, $3.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Const: &ast.NameRelative{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodeListPosition($1, $3),
|
||||
Position: position.NewTokenNodeListPosition($1, $3.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
NsTkn: $1,
|
||||
NsSeparatorTkn: $2,
|
||||
Parts: $3,
|
||||
Parts: $3.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $3.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -5161,14 +5205,15 @@ general_constant:
|
||||
{
|
||||
$$ = &ast.ExprConstFetch{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodeListPosition($1, $2),
|
||||
Position: position.NewTokenNodeListPosition($1, $2.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Const: &ast.NameFullyQualified{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodeListPosition($1, $2),
|
||||
Position: position.NewTokenNodeListPosition($1, $2.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
NsSeparatorTkn: $1,
|
||||
Parts: $2,
|
||||
Parts: $2.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
1307
internal/php7/php7.go
generated
1307
internal/php7/php7.go
generated
File diff suppressed because it is too large
Load Diff
@@ -14,10 +14,7 @@ import (
|
||||
%union{
|
||||
node ast.Vertex
|
||||
token *token.Token
|
||||
tkn *token.Token
|
||||
list []ast.Vertex
|
||||
|
||||
ClosureUse *ast.ExprClosureUse
|
||||
}
|
||||
|
||||
%token <token> T_INCLUDE
|
||||
@@ -247,9 +244,9 @@ import (
|
||||
%type <node> callable_expr callable_variable static_member new_variable
|
||||
%type <node> encaps_var encaps_var_offset echo_expr_list catch_name_list name_list
|
||||
%type <node> if_stmt const_list non_empty_argument_list property_list
|
||||
%type <node> alt_if_stmt lexical_var_list isset_variables
|
||||
%type <node> if_stmt_without_else
|
||||
%type <node> class_const_decl
|
||||
%type <node> alt_if_stmt lexical_var_list isset_variables class_const_list
|
||||
%type <node> if_stmt_without_else unprefixed_use_declarations inline_use_declarations use_declarations
|
||||
%type <node> class_const_decl namespace_name
|
||||
%type <node> alt_if_stmt_without_else
|
||||
%type <node> array_pair possible_array_pair
|
||||
%type <node> isset_variable type return_type type_expr
|
||||
@@ -264,17 +261,15 @@ import (
|
||||
%type <node> extends_from
|
||||
%type <node> implements_list
|
||||
%type <node> interface_extends_list
|
||||
%type <ClosureUse> lexical_vars
|
||||
%type <node> lexical_vars
|
||||
|
||||
%type <node> member_modifier
|
||||
%type <node> use_type
|
||||
%type <node> foreach_variable
|
||||
|
||||
|
||||
%type <list> encaps_list backticks_expr namespace_name catch_list class_const_list
|
||||
%type <list> unprefixed_use_declarations inline_use_declarations
|
||||
%type <list> encaps_list backticks_expr catch_list
|
||||
%type <list> case_list trait_adaptation_list
|
||||
%type <list> use_declarations
|
||||
%type <list> top_statement_list
|
||||
%type <list> inner_statement_list class_statement_list
|
||||
%type <list> method_modifiers variable_modifiers
|
||||
@@ -342,26 +337,32 @@ top_statement_list:
|
||||
namespace_name:
|
||||
T_STRING
|
||||
{
|
||||
$$ = []ast.Vertex{
|
||||
&ast.NameNamePart{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenPosition($1),
|
||||
$$ = &ast.ParserSeparatedList{
|
||||
Items: []ast.Vertex{
|
||||
&ast.NameNamePart{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenPosition($1),
|
||||
},
|
||||
StringTkn: $1,
|
||||
Value: $1.Value,
|
||||
},
|
||||
StringTkn: $1,
|
||||
Value: $1.Value,
|
||||
},
|
||||
}
|
||||
}
|
||||
| namespace_name T_NS_SEPARATOR T_STRING
|
||||
{
|
||||
$$ = append($1, &ast.NameNamePart{
|
||||
part := &ast.NameNamePart{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokensPosition($2, $3),
|
||||
Position: position.NewTokenPosition($3),
|
||||
},
|
||||
NsSeparatorTkn: $2,
|
||||
StringTkn: $3,
|
||||
Value: $3.Value,
|
||||
})
|
||||
}
|
||||
|
||||
$1.(*ast.ParserSeparatedList).SeparatorTkns = append($1.(*ast.ParserSeparatedList).SeparatorTkns, $2)
|
||||
$1.(*ast.ParserSeparatedList).Items = append($1.(*ast.ParserSeparatedList).Items, part)
|
||||
|
||||
$$ = $1
|
||||
}
|
||||
;
|
||||
|
||||
@@ -370,30 +371,33 @@ name:
|
||||
{
|
||||
$$ = &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($1),
|
||||
Position: position.NewNodeListPosition($1.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $1,
|
||||
Parts: $1.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $1.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
}
|
||||
}
|
||||
| T_NAMESPACE T_NS_SEPARATOR namespace_name
|
||||
{
|
||||
$$ = &ast.NameRelative{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodeListPosition($1, $3),
|
||||
Position: position.NewTokenNodeListPosition($1, $3.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
NsTkn: $1,
|
||||
NsSeparatorTkn: $2,
|
||||
Parts: $3,
|
||||
Parts: $3.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $3.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
}
|
||||
}
|
||||
| T_NS_SEPARATOR namespace_name
|
||||
{
|
||||
$$ = &ast.NameFullyQualified{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodeListPosition($1, $2),
|
||||
Position: position.NewTokenNodeListPosition($1, $2.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
NsSeparatorTkn: $1,
|
||||
Parts: $2,
|
||||
Parts: $2.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
}
|
||||
}
|
||||
;
|
||||
@@ -445,9 +449,10 @@ top_statement:
|
||||
NsTkn: $1,
|
||||
Name: &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($2),
|
||||
Position: position.NewNodeListPosition($2.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $2,
|
||||
Parts: $2.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
SemiColonTkn: $3,
|
||||
}
|
||||
@@ -461,9 +466,10 @@ top_statement:
|
||||
NsTkn: $1,
|
||||
Name: &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($2),
|
||||
Position: position.NewNodeListPosition($2.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $2,
|
||||
Parts: $2.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
OpenCurlyBracket: $3,
|
||||
Stmts: $4,
|
||||
@@ -510,7 +516,8 @@ top_statement:
|
||||
Position: position.NewTokensPosition($1, $3),
|
||||
},
|
||||
UseTkn: $1,
|
||||
UseDeclarations: $2,
|
||||
UseDeclarations: $2.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
SemiColonTkn: $3,
|
||||
}
|
||||
}
|
||||
@@ -522,7 +529,8 @@ top_statement:
|
||||
},
|
||||
UseTkn: $1,
|
||||
Type: $2,
|
||||
UseDeclarations: $3,
|
||||
UseDeclarations: $3.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $3.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
SemiColonTkn: $4,
|
||||
}
|
||||
}
|
||||
@@ -566,29 +574,29 @@ use_type:
|
||||
group_use_declaration:
|
||||
namespace_name T_NS_SEPARATOR '{' unprefixed_use_declarations possible_comma '}'
|
||||
{
|
||||
if len($4) > 0 {
|
||||
$4[len($4)-1].(*ast.StmtUseDeclaration).CommaTkn = $5
|
||||
}
|
||||
$4.(*ast.ParserSeparatedList).SeparatorTkns = append($4.(*ast.ParserSeparatedList).SeparatorTkns, $5)
|
||||
|
||||
$$ = &ast.StmtGroupUse{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListTokenPosition($1, $6),
|
||||
Position: position.NewNodeListTokenPosition($1.(*ast.ParserSeparatedList).Items, $6),
|
||||
},
|
||||
Prefix: &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($1),
|
||||
Position: position.NewNodeListPosition($1.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $1,
|
||||
Parts: $1.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $1.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
NsSeparatorTkn: $2,
|
||||
OpenCurlyBracketTkn: $3,
|
||||
UseDeclarations: $4,
|
||||
UseDeclarations: $4.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $4.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
CloseCurlyBracketTkn: $6,
|
||||
}
|
||||
}
|
||||
| T_NS_SEPARATOR namespace_name T_NS_SEPARATOR '{' unprefixed_use_declarations possible_comma '}'
|
||||
{
|
||||
$5[len($5)-1].(*ast.StmtUseDeclaration).CommaTkn = $6
|
||||
$5.(*ast.ParserSeparatedList).SeparatorTkns = append($5.(*ast.ParserSeparatedList).SeparatorTkns, $6)
|
||||
|
||||
$$ = &ast.StmtGroupUse{
|
||||
Node: ast.Node{
|
||||
@@ -597,13 +605,15 @@ group_use_declaration:
|
||||
LeadingNsSeparatorTkn: $1,
|
||||
Prefix: &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($2),
|
||||
Position: position.NewNodeListPosition($2.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $2,
|
||||
Parts: $2.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
NsSeparatorTkn: $3,
|
||||
OpenCurlyBracketTkn: $4,
|
||||
UseDeclarations: $5,
|
||||
UseDeclarations: $5.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $5.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
CloseCurlyBracketTkn: $7,
|
||||
}
|
||||
}
|
||||
@@ -612,27 +622,29 @@ group_use_declaration:
|
||||
mixed_group_use_declaration:
|
||||
namespace_name T_NS_SEPARATOR '{' inline_use_declarations possible_comma '}'
|
||||
{
|
||||
$4[len($4)-1].(*ast.StmtUseDeclaration).CommaTkn = $5
|
||||
$4.(*ast.ParserSeparatedList).SeparatorTkns = append($4.(*ast.ParserSeparatedList).SeparatorTkns, $5)
|
||||
|
||||
$$ = &ast.StmtGroupUse{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListTokenPosition($1, $6),
|
||||
Position: position.NewNodeListTokenPosition($1.(*ast.ParserSeparatedList).Items, $6),
|
||||
},
|
||||
Prefix: &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($1),
|
||||
Position: position.NewNodeListPosition($1.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $1,
|
||||
Parts: $1.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $1.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
NsSeparatorTkn: $2,
|
||||
OpenCurlyBracketTkn: $3,
|
||||
UseDeclarations: $4,
|
||||
UseDeclarations: $4.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $4.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
CloseCurlyBracketTkn: $6,
|
||||
}
|
||||
}
|
||||
| T_NS_SEPARATOR namespace_name T_NS_SEPARATOR '{' inline_use_declarations possible_comma '}'
|
||||
{
|
||||
$5[len($5)-1].(*ast.StmtUseDeclaration).CommaTkn = $6
|
||||
$5.(*ast.ParserSeparatedList).SeparatorTkns = append($5.(*ast.ParserSeparatedList).SeparatorTkns, $6)
|
||||
|
||||
$$ = &ast.StmtGroupUse{
|
||||
Node: ast.Node{
|
||||
@@ -641,13 +653,15 @@ mixed_group_use_declaration:
|
||||
LeadingNsSeparatorTkn: $1,
|
||||
Prefix: &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($2),
|
||||
Position: position.NewNodeListPosition($2.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $2,
|
||||
Parts: $2.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
NsSeparatorTkn: $3,
|
||||
OpenCurlyBracketTkn: $4,
|
||||
UseDeclarations: $5,
|
||||
UseDeclarations: $5.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $5.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
CloseCurlyBracketTkn: $7,
|
||||
}
|
||||
}
|
||||
@@ -667,39 +681,48 @@ possible_comma:
|
||||
inline_use_declarations:
|
||||
inline_use_declarations ',' inline_use_declaration
|
||||
{
|
||||
$1[len($1)-1].(*ast.StmtUseDeclaration).CommaTkn = $2
|
||||
$1.(*ast.ParserSeparatedList).SeparatorTkns = append($1.(*ast.ParserSeparatedList).SeparatorTkns, $2)
|
||||
$1.(*ast.ParserSeparatedList).Items = append($1.(*ast.ParserSeparatedList).Items, $3)
|
||||
|
||||
$$ = append($1, $3)
|
||||
$$ = $1
|
||||
}
|
||||
| inline_use_declaration
|
||||
{
|
||||
$$ = []ast.Vertex{$1}
|
||||
$$ = &ast.ParserSeparatedList{
|
||||
Items: []ast.Vertex{$1},
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
unprefixed_use_declarations:
|
||||
unprefixed_use_declarations ',' unprefixed_use_declaration
|
||||
{
|
||||
$1[len($1)-1].(*ast.StmtUseDeclaration).CommaTkn = $2
|
||||
$1.(*ast.ParserSeparatedList).SeparatorTkns = append($1.(*ast.ParserSeparatedList).SeparatorTkns, $2)
|
||||
$1.(*ast.ParserSeparatedList).Items = append($1.(*ast.ParserSeparatedList).Items, $3)
|
||||
|
||||
$$ = append($1, $3)
|
||||
$$ = $1
|
||||
}
|
||||
| unprefixed_use_declaration
|
||||
{
|
||||
$$ = []ast.Vertex{$1}
|
||||
$$ = &ast.ParserSeparatedList{
|
||||
Items: []ast.Vertex{$1},
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
use_declarations:
|
||||
use_declarations ',' use_declaration
|
||||
{
|
||||
$1[len($1)-1].(*ast.StmtUseDeclaration).CommaTkn = $2
|
||||
$1.(*ast.ParserSeparatedList).SeparatorTkns = append($1.(*ast.ParserSeparatedList).SeparatorTkns, $2)
|
||||
$1.(*ast.ParserSeparatedList).Items = append($1.(*ast.ParserSeparatedList).Items, $3)
|
||||
|
||||
$$ = append($1, $3)
|
||||
$$ = $1
|
||||
}
|
||||
| use_declaration
|
||||
{
|
||||
$$ = []ast.Vertex{$1}
|
||||
$$ = &ast.ParserSeparatedList{
|
||||
Items: []ast.Vertex{$1},
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
@@ -723,13 +746,14 @@ unprefixed_use_declaration:
|
||||
{
|
||||
$$ = &ast.StmtUseDeclaration{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($1),
|
||||
Position: position.NewNodeListPosition($1.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Use: &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($1),
|
||||
Position: position.NewNodeListPosition($1.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $1,
|
||||
Parts: $1.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $1.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -737,13 +761,14 @@ unprefixed_use_declaration:
|
||||
{
|
||||
$$ = &ast.StmtUseDeclaration{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListTokenPosition($1, $3),
|
||||
Position: position.NewNodeListTokenPosition($1.(*ast.ParserSeparatedList).Items, $3),
|
||||
},
|
||||
Use: &ast.NameName{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeListPosition($1),
|
||||
Position: position.NewNodeListPosition($1.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Parts: $1,
|
||||
Parts: $1.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $1.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
},
|
||||
AsTkn: $2,
|
||||
Alias: &ast.Identifier{
|
||||
@@ -2156,10 +2181,11 @@ class_statement:
|
||||
Node: ast.Node{
|
||||
Position: position.NewOptionalListTokensPosition($1, $2, $4),
|
||||
},
|
||||
Modifiers: $1,
|
||||
ConstTkn: $2,
|
||||
Consts: $3,
|
||||
SemiColonTkn: $4,
|
||||
Modifiers: $1,
|
||||
ConstTkn: $2,
|
||||
Consts: $3.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $3.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
SemiColonTkn: $4,
|
||||
}
|
||||
}
|
||||
| T_USE name_list trait_adaptations
|
||||
@@ -2596,13 +2622,16 @@ property:
|
||||
class_const_list:
|
||||
class_const_list ',' class_const_decl
|
||||
{
|
||||
lastNode($1).(*ast.StmtConstant).CommaTkn = $2
|
||||
$1.(*ast.ParserSeparatedList).SeparatorTkns = append($1.(*ast.ParserSeparatedList).SeparatorTkns, $2)
|
||||
$1.(*ast.ParserSeparatedList).Items = append($1.(*ast.ParserSeparatedList).Items, $3)
|
||||
|
||||
$$ = append($1, $3)
|
||||
$$ = $1
|
||||
}
|
||||
| class_const_decl
|
||||
{
|
||||
$$ = []ast.Vertex{$1}
|
||||
$$ = &ast.ParserSeparatedList{
|
||||
Items: []ast.Vertex{$1},
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user