[refactoring] update ast structure of "Parameter", "Class", "FunctionCall", "MethodCall", "New" and "StaticCall" nodes
This commit is contained in:
parent
df1626b7dc
commit
f3203c0b5f
BIN
internal/php5/php5.go
generated
BIN
internal/php5/php5.go
generated
Binary file not shown.
@ -2028,40 +2028,6 @@ non_empty_parameter_list:
|
|||||||
parameter:
|
parameter:
|
||||||
optional_class_type is_reference is_variadic T_VARIABLE
|
optional_class_type is_reference is_variadic T_VARIABLE
|
||||||
{
|
{
|
||||||
var variable ast.Vertex
|
|
||||||
variable = &ast.ExprVariable{
|
|
||||||
Node: ast.Node{
|
|
||||||
Position: position.NewTokenPosition($4),
|
|
||||||
},
|
|
||||||
VarName: &ast.Identifier{
|
|
||||||
Node: ast.Node{
|
|
||||||
Position: position.NewTokenPosition($4),
|
|
||||||
},
|
|
||||||
IdentifierTkn: $4,
|
|
||||||
Value: $4.Value,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
if $3 != nil {
|
|
||||||
variable = &ast.Variadic{
|
|
||||||
Node: ast.Node{
|
|
||||||
Position: position.NewTokensPosition($3, $4),
|
|
||||||
},
|
|
||||||
VariadicTkn: $3,
|
|
||||||
Var: variable,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if $2 != nil {
|
|
||||||
variable = &ast.Reference{
|
|
||||||
Node: ast.Node{
|
|
||||||
Position: position.NewTokensPosition($2, $4),
|
|
||||||
},
|
|
||||||
AmpersandTkn: $2,
|
|
||||||
Var: variable,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pos := position.NewTokenPosition($4)
|
pos := position.NewTokenPosition($4)
|
||||||
if $1 != nil {
|
if $1 != nil {
|
||||||
pos = position.NewNodeTokenPosition($1, $4)
|
pos = position.NewNodeTokenPosition($1, $4)
|
||||||
@ -2076,13 +2042,9 @@ parameter:
|
|||||||
Position: pos,
|
Position: pos,
|
||||||
},
|
},
|
||||||
Type: $1,
|
Type: $1,
|
||||||
Var: variable,
|
AmpersandTkn: $2,
|
||||||
}
|
VariadicTkn: $3,
|
||||||
}
|
Var: &ast.ExprVariable{
|
||||||
| optional_class_type is_reference is_variadic T_VARIABLE '=' expr
|
|
||||||
{
|
|
||||||
var variable ast.Vertex
|
|
||||||
variable = &ast.ExprVariable{
|
|
||||||
Node: ast.Node{
|
Node: ast.Node{
|
||||||
Position: position.NewTokenPosition($4),
|
Position: position.NewTokenPosition($4),
|
||||||
},
|
},
|
||||||
@ -2093,28 +2055,11 @@ parameter:
|
|||||||
IdentifierTkn: $4,
|
IdentifierTkn: $4,
|
||||||
Value: $4.Value,
|
Value: $4.Value,
|
||||||
},
|
},
|
||||||
}
|
|
||||||
|
|
||||||
if $3 != nil {
|
|
||||||
variable = &ast.Variadic{
|
|
||||||
Node: ast.Node{
|
|
||||||
Position: position.NewTokensPosition($3, $4),
|
|
||||||
},
|
},
|
||||||
VariadicTkn: $3,
|
|
||||||
Var: variable,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
| optional_class_type is_reference is_variadic T_VARIABLE '=' expr
|
||||||
if $2 != nil {
|
{
|
||||||
variable = &ast.Reference{
|
|
||||||
Node: ast.Node{
|
|
||||||
Position: position.NewTokensPosition($2, $4),
|
|
||||||
},
|
|
||||||
AmpersandTkn: $2,
|
|
||||||
Var: variable,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pos := position.NewTokenNodePosition($4, $6)
|
pos := position.NewTokenNodePosition($4, $6)
|
||||||
if $1 != nil {
|
if $1 != nil {
|
||||||
pos = position.NewNodesPosition($1, $6)
|
pos = position.NewNodesPosition($1, $6)
|
||||||
@ -2129,7 +2074,20 @@ parameter:
|
|||||||
Position: pos,
|
Position: pos,
|
||||||
},
|
},
|
||||||
Type: $1,
|
Type: $1,
|
||||||
Var: variable,
|
AmpersandTkn: $2,
|
||||||
|
VariadicTkn: $3,
|
||||||
|
Var: &ast.ExprVariable{
|
||||||
|
Node: ast.Node{
|
||||||
|
Position: position.NewTokenPosition($4),
|
||||||
|
},
|
||||||
|
VarName: &ast.Identifier{
|
||||||
|
Node: ast.Node{
|
||||||
|
Position: position.NewTokenPosition($4),
|
||||||
|
},
|
||||||
|
IdentifierTkn: $4,
|
||||||
|
Value: $4.Value,
|
||||||
|
},
|
||||||
|
},
|
||||||
EqualTkn: $5,
|
EqualTkn: $5,
|
||||||
DefaultValue: $6,
|
DefaultValue: $6,
|
||||||
}
|
}
|
||||||
@ -3116,6 +3074,7 @@ new_expr:
|
|||||||
Class: $2,
|
Class: $2,
|
||||||
OpenParenthesisTkn: $3.(*ast.ArgumentList).OpenParenthesisTkn,
|
OpenParenthesisTkn: $3.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
Arguments: $3.(*ast.ArgumentList).Arguments,
|
Arguments: $3.(*ast.ArgumentList).Arguments,
|
||||||
|
SeparatorTkns: $3.(*ast.ArgumentList).SeparatorTkns,
|
||||||
CloseParenthesisTkn: $3.(*ast.ArgumentList).OpenParenthesisTkn,
|
CloseParenthesisTkn: $3.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -3185,6 +3144,7 @@ expr_without_variable:
|
|||||||
Class: $5,
|
Class: $5,
|
||||||
OpenParenthesisTkn: $6.(*ast.ArgumentList).OpenParenthesisTkn,
|
OpenParenthesisTkn: $6.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
Arguments: $6.(*ast.ArgumentList).Arguments,
|
Arguments: $6.(*ast.ArgumentList).Arguments,
|
||||||
|
SeparatorTkns: $6.(*ast.ArgumentList).SeparatorTkns,
|
||||||
CloseParenthesisTkn: $6.(*ast.ArgumentList).OpenParenthesisTkn,
|
CloseParenthesisTkn: $6.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -4228,6 +4188,7 @@ function_call:
|
|||||||
},
|
},
|
||||||
OpenParenthesisTkn: $2.(*ast.ArgumentList).OpenParenthesisTkn,
|
OpenParenthesisTkn: $2.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
Arguments: $2.(*ast.ArgumentList).Arguments,
|
Arguments: $2.(*ast.ArgumentList).Arguments,
|
||||||
|
SeparatorTkns: $2.(*ast.ArgumentList).SeparatorTkns,
|
||||||
CloseParenthesisTkn: $2.(*ast.ArgumentList).OpenParenthesisTkn,
|
CloseParenthesisTkn: $2.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4247,6 +4208,7 @@ function_call:
|
|||||||
},
|
},
|
||||||
OpenParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
OpenParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
Arguments: $4.(*ast.ArgumentList).Arguments,
|
Arguments: $4.(*ast.ArgumentList).Arguments,
|
||||||
|
SeparatorTkns: $4.(*ast.ArgumentList).SeparatorTkns,
|
||||||
CloseParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
CloseParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4265,6 +4227,7 @@ function_call:
|
|||||||
},
|
},
|
||||||
OpenParenthesisTkn: $3.(*ast.ArgumentList).OpenParenthesisTkn,
|
OpenParenthesisTkn: $3.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
Arguments: $3.(*ast.ArgumentList).Arguments,
|
Arguments: $3.(*ast.ArgumentList).Arguments,
|
||||||
|
SeparatorTkns: $3.(*ast.ArgumentList).SeparatorTkns,
|
||||||
CloseParenthesisTkn: $3.(*ast.ArgumentList).OpenParenthesisTkn,
|
CloseParenthesisTkn: $3.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4279,6 +4242,7 @@ function_call:
|
|||||||
Call: $3,
|
Call: $3,
|
||||||
OpenParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
OpenParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
Arguments: $4.(*ast.ArgumentList).Arguments,
|
Arguments: $4.(*ast.ArgumentList).Arguments,
|
||||||
|
SeparatorTkns: $4.(*ast.ArgumentList).SeparatorTkns,
|
||||||
CloseParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
CloseParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4293,6 +4257,7 @@ function_call:
|
|||||||
Call: $3,
|
Call: $3,
|
||||||
OpenParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
OpenParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
Arguments: $4.(*ast.ArgumentList).Arguments,
|
Arguments: $4.(*ast.ArgumentList).Arguments,
|
||||||
|
SeparatorTkns: $4.(*ast.ArgumentList).SeparatorTkns,
|
||||||
CloseParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
CloseParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4307,6 +4272,7 @@ function_call:
|
|||||||
Call: $3,
|
Call: $3,
|
||||||
OpenParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
OpenParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
Arguments: $4.(*ast.ArgumentList).Arguments,
|
Arguments: $4.(*ast.ArgumentList).Arguments,
|
||||||
|
SeparatorTkns: $4.(*ast.ArgumentList).SeparatorTkns,
|
||||||
CloseParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
CloseParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4321,6 +4287,7 @@ function_call:
|
|||||||
Call: $3,
|
Call: $3,
|
||||||
OpenParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
OpenParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
Arguments: $4.(*ast.ArgumentList).Arguments,
|
Arguments: $4.(*ast.ArgumentList).Arguments,
|
||||||
|
SeparatorTkns: $4.(*ast.ArgumentList).SeparatorTkns,
|
||||||
CloseParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
CloseParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4333,6 +4300,7 @@ function_call:
|
|||||||
Function: $1,
|
Function: $1,
|
||||||
OpenParenthesisTkn: $2.(*ast.ArgumentList).OpenParenthesisTkn,
|
OpenParenthesisTkn: $2.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
Arguments: $2.(*ast.ArgumentList).Arguments,
|
Arguments: $2.(*ast.ArgumentList).Arguments,
|
||||||
|
SeparatorTkns: $2.(*ast.ArgumentList).SeparatorTkns,
|
||||||
CloseParenthesisTkn: $2.(*ast.ArgumentList).OpenParenthesisTkn,
|
CloseParenthesisTkn: $2.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5462,6 +5430,7 @@ variable:
|
|||||||
},
|
},
|
||||||
OpenParenthesisTkn: mc.OpenParenthesisTkn,
|
OpenParenthesisTkn: mc.OpenParenthesisTkn,
|
||||||
Arguments: mc.Arguments,
|
Arguments: mc.Arguments,
|
||||||
|
SeparatorTkns: mc.SeparatorTkns,
|
||||||
CloseParenthesisTkn: mc.OpenParenthesisTkn,
|
CloseParenthesisTkn: mc.OpenParenthesisTkn,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -5555,6 +5524,7 @@ variable_property:
|
|||||||
},
|
},
|
||||||
OpenParenthesisTkn: mc.OpenParenthesisTkn,
|
OpenParenthesisTkn: mc.OpenParenthesisTkn,
|
||||||
Arguments: mc.Arguments,
|
Arguments: mc.Arguments,
|
||||||
|
SeparatorTkns: mc.SeparatorTkns,
|
||||||
CloseParenthesisTkn: mc.OpenParenthesisTkn,
|
CloseParenthesisTkn: mc.OpenParenthesisTkn,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -5610,6 +5580,7 @@ method:
|
|||||||
},
|
},
|
||||||
OpenParenthesisTkn: $1.(*ast.ArgumentList).OpenParenthesisTkn,
|
OpenParenthesisTkn: $1.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
Arguments: $1.(*ast.ArgumentList).Arguments,
|
Arguments: $1.(*ast.ArgumentList).Arguments,
|
||||||
|
SeparatorTkns: $1.(*ast.ArgumentList).SeparatorTkns,
|
||||||
CloseParenthesisTkn: $1.(*ast.ArgumentList).CloseParenthesisTkn,
|
CloseParenthesisTkn: $1.(*ast.ArgumentList).CloseParenthesisTkn,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BIN
internal/php7/php7.go
generated
BIN
internal/php7/php7.go
generated
Binary file not shown.
@ -1849,40 +1849,6 @@ non_empty_parameter_list:
|
|||||||
parameter:
|
parameter:
|
||||||
optional_type is_reference is_variadic T_VARIABLE
|
optional_type is_reference is_variadic T_VARIABLE
|
||||||
{
|
{
|
||||||
var variable ast.Vertex
|
|
||||||
variable = &ast.ExprVariable{
|
|
||||||
Node: ast.Node{
|
|
||||||
Position: position.NewTokenPosition($4),
|
|
||||||
},
|
|
||||||
VarName: &ast.Identifier{
|
|
||||||
Node: ast.Node{
|
|
||||||
Position: position.NewTokenPosition($4),
|
|
||||||
},
|
|
||||||
IdentifierTkn: $4,
|
|
||||||
Value: $4.Value,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
if $3 != nil {
|
|
||||||
variable = &ast.Variadic{
|
|
||||||
Node: ast.Node{
|
|
||||||
Position: position.NewTokensPosition($3, $4),
|
|
||||||
},
|
|
||||||
VariadicTkn: $3,
|
|
||||||
Var: variable,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if $2 != nil {
|
|
||||||
variable = &ast.Reference{
|
|
||||||
Node: ast.Node{
|
|
||||||
Position: position.NewTokensPosition($2, $4),
|
|
||||||
},
|
|
||||||
AmpersandTkn: $2,
|
|
||||||
Var: variable,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pos := position.NewTokenPosition($4)
|
pos := position.NewTokenPosition($4)
|
||||||
if $1 != nil {
|
if $1 != nil {
|
||||||
pos = position.NewNodeTokenPosition($1, $4)
|
pos = position.NewNodeTokenPosition($1, $4)
|
||||||
@ -1897,13 +1863,9 @@ parameter:
|
|||||||
Position: pos,
|
Position: pos,
|
||||||
},
|
},
|
||||||
Type: $1,
|
Type: $1,
|
||||||
Var: variable,
|
AmpersandTkn: $2,
|
||||||
}
|
VariadicTkn: $3,
|
||||||
}
|
Var: &ast.ExprVariable{
|
||||||
| optional_type is_reference is_variadic T_VARIABLE '=' expr
|
|
||||||
{
|
|
||||||
var variable ast.Vertex
|
|
||||||
variable = &ast.ExprVariable{
|
|
||||||
Node: ast.Node{
|
Node: ast.Node{
|
||||||
Position: position.NewTokenPosition($4),
|
Position: position.NewTokenPosition($4),
|
||||||
},
|
},
|
||||||
@ -1914,28 +1876,11 @@ parameter:
|
|||||||
IdentifierTkn: $4,
|
IdentifierTkn: $4,
|
||||||
Value: $4.Value,
|
Value: $4.Value,
|
||||||
},
|
},
|
||||||
}
|
|
||||||
|
|
||||||
if $3 != nil {
|
|
||||||
variable = &ast.Variadic{
|
|
||||||
Node: ast.Node{
|
|
||||||
Position: position.NewTokensPosition($3, $4),
|
|
||||||
},
|
},
|
||||||
VariadicTkn: $3,
|
|
||||||
Var: variable,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
| optional_type is_reference is_variadic T_VARIABLE '=' expr
|
||||||
if $2 != nil {
|
{
|
||||||
variable = &ast.Reference{
|
|
||||||
Node: ast.Node{
|
|
||||||
Position: position.NewTokensPosition($2, $4),
|
|
||||||
},
|
|
||||||
AmpersandTkn: $2,
|
|
||||||
Var: variable,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pos := position.NewTokenNodePosition($4, $6)
|
pos := position.NewTokenNodePosition($4, $6)
|
||||||
if $1 != nil {
|
if $1 != nil {
|
||||||
pos = position.NewNodesPosition($1, $6)
|
pos = position.NewNodesPosition($1, $6)
|
||||||
@ -1950,7 +1895,20 @@ parameter:
|
|||||||
Position: pos,
|
Position: pos,
|
||||||
},
|
},
|
||||||
Type: $1,
|
Type: $1,
|
||||||
Var: variable,
|
AmpersandTkn: $2,
|
||||||
|
VariadicTkn: $3,
|
||||||
|
Var: &ast.ExprVariable{
|
||||||
|
Node: ast.Node{
|
||||||
|
Position: position.NewTokenPosition($4),
|
||||||
|
},
|
||||||
|
VarName: &ast.Identifier{
|
||||||
|
Node: ast.Node{
|
||||||
|
Position: position.NewTokenPosition($4),
|
||||||
|
},
|
||||||
|
IdentifierTkn: $4,
|
||||||
|
Value: $4.Value,
|
||||||
|
},
|
||||||
|
},
|
||||||
EqualTkn: $5,
|
EqualTkn: $5,
|
||||||
DefaultValue: $6,
|
DefaultValue: $6,
|
||||||
}
|
}
|
||||||
@ -2758,6 +2716,7 @@ anonymous_class:
|
|||||||
ClassTkn: $1,
|
ClassTkn: $1,
|
||||||
OpenParenthesisTkn: $2.(*ast.ArgumentList).OpenParenthesisTkn,
|
OpenParenthesisTkn: $2.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
Arguments: $2.(*ast.ArgumentList).Arguments,
|
Arguments: $2.(*ast.ArgumentList).Arguments,
|
||||||
|
SeparatorTkns: $2.(*ast.ArgumentList).SeparatorTkns,
|
||||||
CloseParenthesisTkn: $2.(*ast.ArgumentList).OpenParenthesisTkn,
|
CloseParenthesisTkn: $2.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
Extends: $3,
|
Extends: $3,
|
||||||
Implements: $4,
|
Implements: $4,
|
||||||
@ -2780,6 +2739,7 @@ new_expr:
|
|||||||
Class: $2,
|
Class: $2,
|
||||||
OpenParenthesisTkn: $3.(*ast.ArgumentList).OpenParenthesisTkn,
|
OpenParenthesisTkn: $3.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
Arguments: $3.(*ast.ArgumentList).Arguments,
|
Arguments: $3.(*ast.ArgumentList).Arguments,
|
||||||
|
SeparatorTkns: $3.(*ast.ArgumentList).SeparatorTkns,
|
||||||
CloseParenthesisTkn: $3.(*ast.ArgumentList).OpenParenthesisTkn,
|
CloseParenthesisTkn: $3.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -3777,6 +3737,7 @@ function_call:
|
|||||||
Function: $1,
|
Function: $1,
|
||||||
OpenParenthesisTkn: $2.(*ast.ArgumentList).OpenParenthesisTkn,
|
OpenParenthesisTkn: $2.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
Arguments: $2.(*ast.ArgumentList).Arguments,
|
Arguments: $2.(*ast.ArgumentList).Arguments,
|
||||||
|
SeparatorTkns: $2.(*ast.ArgumentList).SeparatorTkns,
|
||||||
CloseParenthesisTkn: $2.(*ast.ArgumentList).OpenParenthesisTkn,
|
CloseParenthesisTkn: $2.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3791,6 +3752,7 @@ function_call:
|
|||||||
Call: $3,
|
Call: $3,
|
||||||
OpenParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
OpenParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
Arguments: $4.(*ast.ArgumentList).Arguments,
|
Arguments: $4.(*ast.ArgumentList).Arguments,
|
||||||
|
SeparatorTkns: $4.(*ast.ArgumentList).SeparatorTkns,
|
||||||
CloseParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
CloseParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3805,6 +3767,7 @@ function_call:
|
|||||||
Call: $3,
|
Call: $3,
|
||||||
OpenParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
OpenParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
Arguments: $4.(*ast.ArgumentList).Arguments,
|
Arguments: $4.(*ast.ArgumentList).Arguments,
|
||||||
|
SeparatorTkns: $4.(*ast.ArgumentList).SeparatorTkns,
|
||||||
CloseParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
CloseParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3817,6 +3780,7 @@ function_call:
|
|||||||
Function: $1,
|
Function: $1,
|
||||||
OpenParenthesisTkn: $2.(*ast.ArgumentList).OpenParenthesisTkn,
|
OpenParenthesisTkn: $2.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
Arguments: $2.(*ast.ArgumentList).Arguments,
|
Arguments: $2.(*ast.ArgumentList).Arguments,
|
||||||
|
SeparatorTkns: $2.(*ast.ArgumentList).SeparatorTkns,
|
||||||
CloseParenthesisTkn: $2.(*ast.ArgumentList).OpenParenthesisTkn,
|
CloseParenthesisTkn: $2.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4285,6 +4249,7 @@ callable_variable:
|
|||||||
Method: $3,
|
Method: $3,
|
||||||
OpenParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
OpenParenthesisTkn: $4.(*ast.ArgumentList).OpenParenthesisTkn,
|
||||||
Arguments: $4.(*ast.ArgumentList).Arguments,
|
Arguments: $4.(*ast.ArgumentList).Arguments,
|
||||||
|
SeparatorTkns: $4.(*ast.ArgumentList).SeparatorTkns,
|
||||||
CloseParenthesisTkn: $4.(*ast.ArgumentList).CloseParenthesisTkn,
|
CloseParenthesisTkn: $4.(*ast.ArgumentList).CloseParenthesisTkn,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,6 @@ type Visitor interface {
|
|||||||
type NodeVisitor interface {
|
type NodeVisitor interface {
|
||||||
Root(n *Root)
|
Root(n *Root)
|
||||||
Nullable(n *Nullable)
|
Nullable(n *Nullable)
|
||||||
Reference(n *Reference)
|
|
||||||
Variadic(n *Variadic)
|
|
||||||
Parameter(n *Parameter)
|
Parameter(n *Parameter)
|
||||||
Identifier(n *Identifier)
|
Identifier(n *Identifier)
|
||||||
Argument(n *Argument)
|
Argument(n *Argument)
|
||||||
|
@ -42,32 +42,12 @@ func (n *Nullable) Accept(v NodeVisitor) {
|
|||||||
v.Nullable(n)
|
v.Nullable(n)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reference node
|
|
||||||
type Reference struct {
|
|
||||||
Node
|
|
||||||
AmpersandTkn *token.Token
|
|
||||||
Var Vertex
|
|
||||||
}
|
|
||||||
|
|
||||||
func (n *Reference) Accept(v NodeVisitor) {
|
|
||||||
v.Reference(n)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Variadic node
|
|
||||||
type Variadic struct {
|
|
||||||
Node
|
|
||||||
VariadicTkn *token.Token
|
|
||||||
Var Vertex
|
|
||||||
}
|
|
||||||
|
|
||||||
func (n *Variadic) Accept(v NodeVisitor) {
|
|
||||||
v.Variadic(n)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parameter node
|
// Parameter node
|
||||||
type Parameter struct {
|
type Parameter struct {
|
||||||
Node
|
Node
|
||||||
Type Vertex
|
Type Vertex
|
||||||
|
AmpersandTkn *token.Token
|
||||||
|
VariadicTkn *token.Token
|
||||||
Var Vertex
|
Var Vertex
|
||||||
EqualTkn *token.Token
|
EqualTkn *token.Token
|
||||||
DefaultValue Vertex
|
DefaultValue Vertex
|
||||||
@ -231,6 +211,7 @@ type StmtClass struct {
|
|||||||
ClassName Vertex
|
ClassName Vertex
|
||||||
OpenParenthesisTkn *token.Token
|
OpenParenthesisTkn *token.Token
|
||||||
Arguments []Vertex
|
Arguments []Vertex
|
||||||
|
SeparatorTkns []*token.Token
|
||||||
CloseParenthesisTkn *token.Token
|
CloseParenthesisTkn *token.Token
|
||||||
Extends Vertex
|
Extends Vertex
|
||||||
Implements Vertex
|
Implements Vertex
|
||||||
@ -1131,6 +1112,7 @@ type ExprFunctionCall struct {
|
|||||||
Function Vertex
|
Function Vertex
|
||||||
OpenParenthesisTkn *token.Token
|
OpenParenthesisTkn *token.Token
|
||||||
Arguments []Vertex
|
Arguments []Vertex
|
||||||
|
SeparatorTkns []*token.Token
|
||||||
CloseParenthesisTkn *token.Token
|
CloseParenthesisTkn *token.Token
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1208,6 +1190,7 @@ type ExprMethodCall struct {
|
|||||||
Method Vertex
|
Method Vertex
|
||||||
OpenParenthesisTkn *token.Token
|
OpenParenthesisTkn *token.Token
|
||||||
Arguments []Vertex
|
Arguments []Vertex
|
||||||
|
SeparatorTkns []*token.Token
|
||||||
CloseParenthesisTkn *token.Token
|
CloseParenthesisTkn *token.Token
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1222,6 +1205,7 @@ type ExprNew struct {
|
|||||||
Class Vertex
|
Class Vertex
|
||||||
OpenParenthesisTkn *token.Token
|
OpenParenthesisTkn *token.Token
|
||||||
Arguments []Vertex
|
Arguments []Vertex
|
||||||
|
SeparatorTkns []*token.Token
|
||||||
CloseParenthesisTkn *token.Token
|
CloseParenthesisTkn *token.Token
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1349,6 +1333,7 @@ type ExprStaticCall struct {
|
|||||||
Call Vertex
|
Call Vertex
|
||||||
OpenParenthesisTkn *token.Token
|
OpenParenthesisTkn *token.Token
|
||||||
Arguments []Vertex
|
Arguments []Vertex
|
||||||
|
SeparatorTkns []*token.Token
|
||||||
CloseParenthesisTkn *token.Token
|
CloseParenthesisTkn *token.Token
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,30 +40,6 @@ func (t *DFS) Traverse(n ast.Vertex) {
|
|||||||
t.Traverse(nn.Expr)
|
t.Traverse(nn.Expr)
|
||||||
t.visitor.Leave("Expr", true)
|
t.visitor.Leave("Expr", true)
|
||||||
}
|
}
|
||||||
case *ast.Reference:
|
|
||||||
if nn == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if !t.visitor.EnterNode(nn) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if nn.Var != nil {
|
|
||||||
t.visitor.Enter("Var", true)
|
|
||||||
t.Traverse(nn.Var)
|
|
||||||
t.visitor.Leave("Var", true)
|
|
||||||
}
|
|
||||||
case *ast.Variadic:
|
|
||||||
if nn == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if !t.visitor.EnterNode(nn) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if nn.Var != nil {
|
|
||||||
t.visitor.Enter("Var", true)
|
|
||||||
t.Traverse(nn.Var)
|
|
||||||
t.visitor.Leave("Var", true)
|
|
||||||
}
|
|
||||||
case *ast.Parameter:
|
case *ast.Parameter:
|
||||||
if nn == nil {
|
if nn == nil {
|
||||||
return
|
return
|
||||||
|
@ -203,18 +203,6 @@ func (v *Dump) Nullable(n *ast.Nullable) {
|
|||||||
v.printNode(n.GetNode())
|
v.printNode(n.GetNode())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *Dump) Reference(n *ast.Reference) {
|
|
||||||
v.printIndentIfNotSingle(v.indent - 1)
|
|
||||||
v.print("&ast.Reference{\n")
|
|
||||||
v.printNode(n.GetNode())
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v *Dump) Variadic(n *ast.Variadic) {
|
|
||||||
v.printIndentIfNotSingle(v.indent - 1)
|
|
||||||
v.print("&ast.Variadic{\n")
|
|
||||||
v.printNode(n.GetNode())
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v *Dump) Parameter(n *ast.Parameter) {
|
func (v *Dump) Parameter(n *ast.Parameter) {
|
||||||
v.printIndent(v.indent - 1)
|
v.printIndent(v.indent - 1)
|
||||||
v.print("&ast.Parameter{\n")
|
v.print("&ast.Parameter{\n")
|
||||||
|
@ -30,14 +30,6 @@ func (v *Null) Nullable(_ *ast.Nullable) {
|
|||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *Null) Reference(_ *ast.Reference) {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v *Null) Variadic(_ *ast.Variadic) {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v *Null) Parameter(_ *ast.Parameter) {
|
func (v *Null) Parameter(_ *ast.Parameter) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
@ -64,10 +64,6 @@ func (p *PrettyPrinter) printNode(n ast.Vertex) {
|
|||||||
p.printNodeRoot(n)
|
p.printNodeRoot(n)
|
||||||
case *ast.Identifier:
|
case *ast.Identifier:
|
||||||
p.printNodeIdentifier(n)
|
p.printNodeIdentifier(n)
|
||||||
case *ast.Reference:
|
|
||||||
p.printNodeReference(n)
|
|
||||||
case *ast.Variadic:
|
|
||||||
p.printNodeVariadic(n)
|
|
||||||
case *ast.Parameter:
|
case *ast.Parameter:
|
||||||
p.printNodeParameter(n)
|
p.printNodeParameter(n)
|
||||||
case *ast.Nullable:
|
case *ast.Nullable:
|
||||||
@ -421,20 +417,6 @@ func (p *PrettyPrinter) printNodeIdentifier(n ast.Vertex) {
|
|||||||
io.WriteString(p.w, v)
|
io.WriteString(p.w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PrettyPrinter) printNodeReference(n ast.Vertex) {
|
|
||||||
nn := n.(*ast.Reference)
|
|
||||||
|
|
||||||
io.WriteString(p.w, "&")
|
|
||||||
p.Print(nn.Var)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *PrettyPrinter) printNodeVariadic(n ast.Vertex) {
|
|
||||||
nn := n.(*ast.Variadic)
|
|
||||||
|
|
||||||
io.WriteString(p.w, "...")
|
|
||||||
p.Print(nn.Var)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *PrettyPrinter) printNodeParameter(n ast.Vertex) {
|
func (p *PrettyPrinter) printNodeParameter(n ast.Vertex) {
|
||||||
nn := n.(*ast.Parameter)
|
nn := n.(*ast.Parameter)
|
||||||
|
|
||||||
|
@ -149,10 +149,6 @@ func (p *Printer) printNode(n ast.Vertex) {
|
|||||||
p.printNodeRoot(n)
|
p.printNodeRoot(n)
|
||||||
case *ast.Identifier:
|
case *ast.Identifier:
|
||||||
p.printNodeIdentifier(n)
|
p.printNodeIdentifier(n)
|
||||||
case *ast.Reference:
|
|
||||||
p.printNodeReference(n)
|
|
||||||
case *ast.Variadic:
|
|
||||||
p.printNodeVariadic(n)
|
|
||||||
case *ast.Parameter:
|
case *ast.Parameter:
|
||||||
p.printNodeParameter(n)
|
p.printNodeParameter(n)
|
||||||
case *ast.Nullable:
|
case *ast.Nullable:
|
||||||
@ -505,26 +501,6 @@ func (p *Printer) printNodeIdentifier(n ast.Vertex) {
|
|||||||
p.printFreeFloating(nn, token.End)
|
p.printFreeFloating(nn, token.End)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Printer) printNodeReference(n ast.Vertex) {
|
|
||||||
nn := n.(*ast.Reference)
|
|
||||||
p.printFreeFloating(nn, token.Start)
|
|
||||||
|
|
||||||
p.write([]byte("&"))
|
|
||||||
p.Print(nn.Var)
|
|
||||||
|
|
||||||
p.printFreeFloating(nn, token.End)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *Printer) printNodeVariadic(n ast.Vertex) {
|
|
||||||
nn := n.(*ast.Variadic)
|
|
||||||
p.printFreeFloating(nn, token.Start)
|
|
||||||
|
|
||||||
p.write([]byte("..."))
|
|
||||||
p.Print(nn.Var)
|
|
||||||
|
|
||||||
p.printFreeFloating(nn, token.End)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *Printer) printNodeParameter(n ast.Vertex) {
|
func (p *Printer) printNodeParameter(n ast.Vertex) {
|
||||||
nn := n.(*ast.Parameter)
|
nn := n.(*ast.Parameter)
|
||||||
p.printFreeFloating(nn, token.Start)
|
p.printFreeFloating(nn, token.Start)
|
||||||
|
Loading…
Reference in New Issue
Block a user