remove nodesWithEndToken type
This commit is contained in:
1286
php5/php5.go
1286
php5/php5.go
File diff suppressed because it is too large
Load Diff
32
php5/php5.y
32
php5/php5.y
@@ -24,7 +24,6 @@ import (
|
||||
boolWithToken boolWithToken
|
||||
list []node.Node
|
||||
foreachVariable foreachVariable
|
||||
nodesWithEndToken *nodesWithEndToken
|
||||
simpleIndirectReference simpleIndirectReference
|
||||
altSyntaxNode altSyntaxNode
|
||||
}
|
||||
@@ -245,6 +244,7 @@ import (
|
||||
%type <node> ctor_arguments function_call_parameter_list
|
||||
%type <node> trait_adaptations
|
||||
%type <node> switch_case_list
|
||||
%type <node> method_body
|
||||
|
||||
%type <list> top_statement_list namespace_name use_declarations use_function_declarations use_const_declarations
|
||||
%type <list> inner_statement_list global_var_list static_var_list encaps_list isset_variables non_empty_array_pair_list
|
||||
@@ -261,7 +261,6 @@ import (
|
||||
|
||||
%type <simpleIndirectReference> simple_indirect_reference
|
||||
%type <foreachVariable> foreach_variable foreach_optional_arg
|
||||
%type <nodesWithEndToken> method_body
|
||||
%type <boolWithToken> is_reference is_variadic
|
||||
%type <altSyntaxNode> while_statement for_statement foreach_statement
|
||||
|
||||
@@ -1574,8 +1573,14 @@ class_statement:
|
||||
yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
|
||||
yylex.(*Parser).comments.AddComments(name, $4.Comments())
|
||||
|
||||
$$ = stmt.NewClassMethod(name, $1, $3.value, $6, nil, $8.nodes, "")
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewOptionalListTokensPosition($1, $2, $8.endToken))
|
||||
$$ = stmt.NewClassMethod(name, $1, $3.value, $6, nil, $8, "")
|
||||
|
||||
if $1 == nil {
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($2, $8))
|
||||
} else {
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListNodePosition($1, $8))
|
||||
}
|
||||
|
||||
yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1))
|
||||
}
|
||||
;
|
||||
@@ -1711,10 +1716,18 @@ trait_modifiers:
|
||||
;
|
||||
|
||||
method_body:
|
||||
';' /* abstract method */
|
||||
{ $$ = &nodesWithEndToken{nil, $1} }
|
||||
';' /* abstract method */
|
||||
{
|
||||
$$ = stmt.NewNop()
|
||||
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
|
||||
}
|
||||
| '{' inner_statement_list '}'
|
||||
{ $$ = &nodesWithEndToken{$2, $3} }
|
||||
{
|
||||
$$ = stmt.NewStmtList($2)
|
||||
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
|
||||
}
|
||||
;
|
||||
|
||||
variable_modifiers:
|
||||
@@ -3926,11 +3939,6 @@ type foreachVariable struct {
|
||||
byRef bool
|
||||
}
|
||||
|
||||
type nodesWithEndToken struct {
|
||||
nodes []node.Node
|
||||
endToken *scanner.Token
|
||||
}
|
||||
|
||||
type boolWithToken struct {
|
||||
value bool
|
||||
token *scanner.Token
|
||||
|
||||
@@ -514,7 +514,9 @@ func TestPhp5(t *testing.T) {
|
||||
MethodName: &node.Identifier{Value: "foo"},
|
||||
Modifiers: []node.Node{&node.Identifier{Value: "public"}},
|
||||
Params: expectedParams,
|
||||
Stmts: []node.Node{},
|
||||
Stmt: &stmt.StmtList{
|
||||
Stmts: []node.Node{},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -776,7 +778,9 @@ func TestPhp5(t *testing.T) {
|
||||
&stmt.ClassMethod{
|
||||
PhpDocComment: "",
|
||||
MethodName: &node.Identifier{Value: "bar"},
|
||||
Stmts: []node.Node{},
|
||||
Stmt: &stmt.StmtList{
|
||||
Stmts: []node.Node{},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -791,7 +795,9 @@ func TestPhp5(t *testing.T) {
|
||||
&node.Identifier{Value: "public"},
|
||||
&node.Identifier{Value: "static"},
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
Stmt: &stmt.StmtList{
|
||||
Stmts: []node.Node{},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -806,7 +812,9 @@ func TestPhp5(t *testing.T) {
|
||||
&node.Identifier{Value: "final"},
|
||||
&node.Identifier{Value: "private"},
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
Stmt: &stmt.StmtList{
|
||||
Stmts: []node.Node{},
|
||||
},
|
||||
},
|
||||
&stmt.ClassMethod{
|
||||
PhpDocComment: "",
|
||||
@@ -815,7 +823,9 @@ func TestPhp5(t *testing.T) {
|
||||
Modifiers: []node.Node{
|
||||
&node.Identifier{Value: "protected"},
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
Stmt: &stmt.StmtList{
|
||||
Stmts: []node.Node{},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -833,6 +843,7 @@ func TestPhp5(t *testing.T) {
|
||||
&node.Identifier{Value: "abstract"},
|
||||
&node.Identifier{Value: "public"},
|
||||
},
|
||||
Stmt: &stmt.Nop{},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user