[refactoring] update ast structure of "BitwiseNot", "BooleanNot", "ClassConstFetch" and "Clone" nodes
This commit is contained in:
parent
4b8d431767
commit
b90400d993
BIN
internal/php5/php5.go
generated
BIN
internal/php5/php5.go
generated
Binary file not shown.
@ -3220,13 +3220,13 @@ expr_without_variable:
|
|||||||
}
|
}
|
||||||
| T_CLONE expr
|
| T_CLONE expr
|
||||||
{
|
{
|
||||||
$$ = &ast.ExprClone{ast.Node{}, $2}
|
$$ = &ast.ExprClone{
|
||||||
|
Node: ast.Node{
|
||||||
// save position
|
Position: position.NewTokenNodePosition($1, $2),
|
||||||
$$.GetNode().Position = position.NewTokenNodePosition($1, $2)
|
},
|
||||||
|
CloneTkn: $1,
|
||||||
// save comments
|
Expr: $2,
|
||||||
yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens)
|
}
|
||||||
}
|
}
|
||||||
| variable T_PLUS_EQUAL expr
|
| variable T_PLUS_EQUAL expr
|
||||||
{
|
{
|
||||||
@ -3609,23 +3609,23 @@ expr_without_variable:
|
|||||||
}
|
}
|
||||||
| '!' expr
|
| '!' expr
|
||||||
{
|
{
|
||||||
$$ = &ast.ExprBooleanNot{ast.Node{}, $2}
|
$$ = &ast.ExprBooleanNot{
|
||||||
|
Node: ast.Node{
|
||||||
// save position
|
Position: position.NewTokenNodePosition($1, $2),
|
||||||
$$.GetNode().Position = position.NewTokenNodePosition($1, $2)
|
},
|
||||||
|
ExclamationTkn: $1,
|
||||||
// save comments
|
Expr: $2,
|
||||||
yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens)
|
}
|
||||||
}
|
}
|
||||||
| '~' expr
|
| '~' expr
|
||||||
{
|
{
|
||||||
$$ = &ast.ExprBitwiseNot{ast.Node{}, $2}
|
$$ = &ast.ExprBitwiseNot{
|
||||||
|
Node: ast.Node{
|
||||||
// save position
|
Position: position.NewTokenNodePosition($1, $2),
|
||||||
$$.GetNode().Position = position.NewTokenNodePosition($1, $2)
|
},
|
||||||
|
TildaTkn: $1,
|
||||||
// save comments
|
Expr: $2,
|
||||||
yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens)
|
}
|
||||||
}
|
}
|
||||||
| expr T_IS_IDENTICAL expr
|
| expr T_IS_IDENTICAL expr
|
||||||
{
|
{
|
||||||
@ -4665,21 +4665,20 @@ common_scalar:
|
|||||||
static_class_constant:
|
static_class_constant:
|
||||||
class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING
|
class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING
|
||||||
{
|
{
|
||||||
target := &ast.Identifier{
|
$$ = &ast.ExprClassConstFetch{
|
||||||
Node: ast.Node{
|
Node: ast.Node{
|
||||||
Position: position.NewTokenPosition($3),
|
Position: position.NewNodeTokenPosition($1, $3),
|
||||||
|
},
|
||||||
|
Class: $1,
|
||||||
|
DoubleColonTkn: $2,
|
||||||
|
ConstantName: &ast.Identifier{
|
||||||
|
Node: ast.Node{
|
||||||
|
Position: position.NewTokenPosition($3),
|
||||||
|
},
|
||||||
|
IdentifierTkn: $3,
|
||||||
|
Value: $3.Value,
|
||||||
},
|
},
|
||||||
IdentifierTkn: $3,
|
|
||||||
Value: $3.Value,
|
|
||||||
}
|
}
|
||||||
$$ = &ast.ExprClassConstFetch{ast.Node{}, $1, target}
|
|
||||||
|
|
||||||
// save position
|
|
||||||
$$.GetNode().Position = position.NewNodeTokenPosition($1, $3)
|
|
||||||
|
|
||||||
// save comments
|
|
||||||
yylex.(*Parser).MoveFreeFloating($1, $$)
|
|
||||||
yylex.(*Parser).setFreeFloating($$, token.Name, $2.SkippedTokens)
|
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -4867,23 +4866,23 @@ static_operation:
|
|||||||
}
|
}
|
||||||
| '!' static_scalar_value
|
| '!' static_scalar_value
|
||||||
{
|
{
|
||||||
$$ = &ast.ExprBooleanNot{ast.Node{}, $2}
|
$$ = &ast.ExprBooleanNot{
|
||||||
|
Node: ast.Node{
|
||||||
// save position
|
Position: position.NewTokenNodePosition($1, $2),
|
||||||
$$.GetNode().Position = position.NewTokenNodePosition($1, $2)
|
},
|
||||||
|
ExclamationTkn: $1,
|
||||||
// save comments
|
Expr: $2,
|
||||||
yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens)
|
}
|
||||||
}
|
}
|
||||||
| '~' static_scalar_value
|
| '~' static_scalar_value
|
||||||
{
|
{
|
||||||
$$ = &ast.ExprBitwiseNot{ast.Node{}, $2}
|
$$ = &ast.ExprBitwiseNot{
|
||||||
|
Node: ast.Node{
|
||||||
// save position
|
Position: position.NewTokenNodePosition($1, $2),
|
||||||
$$.GetNode().Position = position.NewTokenNodePosition($1, $2)
|
},
|
||||||
|
TildaTkn: $1,
|
||||||
// save comments
|
Expr: $2,
|
||||||
yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens)
|
}
|
||||||
}
|
}
|
||||||
| static_scalar_value '|' static_scalar_value
|
| static_scalar_value '|' static_scalar_value
|
||||||
{
|
{
|
||||||
@ -6445,81 +6444,77 @@ isset_variable:
|
|||||||
class_constant:
|
class_constant:
|
||||||
class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING
|
class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING
|
||||||
{
|
{
|
||||||
target := &ast.Identifier{
|
$$ = &ast.ExprClassConstFetch{
|
||||||
Node: ast.Node{
|
Node: ast.Node{
|
||||||
Position: position.NewTokenPosition($3),
|
Position: position.NewNodeTokenPosition($1, $3),
|
||||||
|
},
|
||||||
|
Class: $1,
|
||||||
|
DoubleColonTkn: $2,
|
||||||
|
ConstantName: &ast.Identifier{
|
||||||
|
Node: ast.Node{
|
||||||
|
Position: position.NewTokenPosition($3),
|
||||||
|
},
|
||||||
|
IdentifierTkn: $3,
|
||||||
|
Value: $3.Value,
|
||||||
},
|
},
|
||||||
IdentifierTkn: $3,
|
|
||||||
Value: $3.Value,
|
|
||||||
}
|
}
|
||||||
$$ = &ast.ExprClassConstFetch{ast.Node{}, $1, target}
|
|
||||||
|
|
||||||
// save position
|
|
||||||
$$.GetNode().Position = position.NewNodeTokenPosition($1, $3)
|
|
||||||
|
|
||||||
// save comments
|
|
||||||
yylex.(*Parser).MoveFreeFloating($1, $$)
|
|
||||||
yylex.(*Parser).setFreeFloating($$, token.Name, $2.SkippedTokens)
|
|
||||||
}
|
}
|
||||||
| variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING
|
| variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING
|
||||||
{
|
{
|
||||||
target := &ast.Identifier{
|
$$ = &ast.ExprClassConstFetch{
|
||||||
Node: ast.Node{
|
Node: ast.Node{
|
||||||
Position: position.NewTokenPosition($3),
|
Position: position.NewNodeTokenPosition($1, $3),
|
||||||
|
},
|
||||||
|
Class: $1,
|
||||||
|
DoubleColonTkn: $2,
|
||||||
|
ConstantName: &ast.Identifier{
|
||||||
|
Node: ast.Node{
|
||||||
|
Position: position.NewTokenPosition($3),
|
||||||
|
},
|
||||||
|
IdentifierTkn: $3,
|
||||||
|
Value: $3.Value,
|
||||||
},
|
},
|
||||||
IdentifierTkn: $3,
|
|
||||||
Value: $3.Value,
|
|
||||||
}
|
}
|
||||||
$$ = &ast.ExprClassConstFetch{ast.Node{}, $1, target}
|
|
||||||
|
|
||||||
// save position
|
|
||||||
$$.GetNode().Position = position.NewNodeTokenPosition($1, $3)
|
|
||||||
|
|
||||||
// save comments
|
|
||||||
yylex.(*Parser).MoveFreeFloating($1, $$)
|
|
||||||
yylex.(*Parser).setFreeFloating($$, token.Name, $2.SkippedTokens)
|
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
static_class_name_scalar:
|
static_class_name_scalar:
|
||||||
class_name T_PAAMAYIM_NEKUDOTAYIM T_CLASS
|
class_name T_PAAMAYIM_NEKUDOTAYIM T_CLASS
|
||||||
{
|
{
|
||||||
target := &ast.Identifier{
|
$$ = &ast.ExprClassConstFetch{
|
||||||
Node: ast.Node{
|
Node: ast.Node{
|
||||||
Position: position.NewTokenPosition($3),
|
Position: position.NewNodeTokenPosition($1, $3),
|
||||||
|
},
|
||||||
|
Class: $1,
|
||||||
|
DoubleColonTkn: $2,
|
||||||
|
ConstantName: &ast.Identifier{
|
||||||
|
Node: ast.Node{
|
||||||
|
Position: position.NewTokenPosition($3),
|
||||||
|
},
|
||||||
|
IdentifierTkn: $3,
|
||||||
|
Value: $3.Value,
|
||||||
},
|
},
|
||||||
IdentifierTkn: $3,
|
|
||||||
Value: $3.Value,
|
|
||||||
}
|
}
|
||||||
$$ = &ast.ExprClassConstFetch{ast.Node{}, $1, target}
|
|
||||||
|
|
||||||
// save position
|
|
||||||
$$.GetNode().Position = position.NewNodeTokenPosition($1, $3)
|
|
||||||
|
|
||||||
// save comments
|
|
||||||
yylex.(*Parser).MoveFreeFloating($1, $$)
|
|
||||||
yylex.(*Parser).setFreeFloating($$, token.Name, $2.SkippedTokens)
|
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
class_name_scalar:
|
class_name_scalar:
|
||||||
class_name T_PAAMAYIM_NEKUDOTAYIM T_CLASS
|
class_name T_PAAMAYIM_NEKUDOTAYIM T_CLASS
|
||||||
{
|
{
|
||||||
target := &ast.Identifier{
|
$$ = &ast.ExprClassConstFetch{
|
||||||
Node: ast.Node{
|
Node: ast.Node{
|
||||||
Position: position.NewTokenPosition($3),
|
Position: position.NewNodeTokenPosition($1, $3),
|
||||||
|
},
|
||||||
|
Class: $1,
|
||||||
|
DoubleColonTkn: $2,
|
||||||
|
ConstantName: &ast.Identifier{
|
||||||
|
Node: ast.Node{
|
||||||
|
Position: position.NewTokenPosition($3),
|
||||||
|
},
|
||||||
|
IdentifierTkn: $3,
|
||||||
|
Value: $3.Value,
|
||||||
},
|
},
|
||||||
IdentifierTkn: $3,
|
|
||||||
Value: $3.Value,
|
|
||||||
}
|
}
|
||||||
$$ = &ast.ExprClassConstFetch{ast.Node{}, $1, target}
|
|
||||||
|
|
||||||
// save position
|
|
||||||
$$.GetNode().Position = position.NewNodeTokenPosition($1, $3)
|
|
||||||
|
|
||||||
// save comments
|
|
||||||
yylex.(*Parser).MoveFreeFloating($1, $$)
|
|
||||||
yylex.(*Parser).setFreeFloating($$, token.Name, $2.SkippedTokens)
|
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
BIN
internal/php7/php7.go
generated
BIN
internal/php7/php7.go
generated
Binary file not shown.
@ -2866,13 +2866,13 @@ expr_without_variable:
|
|||||||
}
|
}
|
||||||
| T_CLONE expr
|
| T_CLONE expr
|
||||||
{
|
{
|
||||||
$$ = &ast.ExprClone{ast.Node{}, $2}
|
$$ = &ast.ExprClone{
|
||||||
|
Node: ast.Node{
|
||||||
// save position
|
Position: position.NewTokenNodePosition($1, $2),
|
||||||
$$.GetNode().Position = position.NewTokenNodePosition($1, $2)
|
},
|
||||||
|
CloneTkn: $1,
|
||||||
// save comments
|
Expr: $2,
|
||||||
yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens)
|
}
|
||||||
}
|
}
|
||||||
| variable T_PLUS_EQUAL expr
|
| variable T_PLUS_EQUAL expr
|
||||||
{
|
{
|
||||||
@ -3267,23 +3267,23 @@ expr_without_variable:
|
|||||||
}
|
}
|
||||||
| '!' expr
|
| '!' expr
|
||||||
{
|
{
|
||||||
$$ = &ast.ExprBooleanNot{ast.Node{}, $2}
|
$$ = &ast.ExprBooleanNot{
|
||||||
|
Node: ast.Node{
|
||||||
// save position
|
Position: position.NewTokenNodePosition($1, $2),
|
||||||
$$.GetNode().Position = position.NewTokenNodePosition($1, $2)
|
},
|
||||||
|
ExclamationTkn: $1,
|
||||||
// save comments
|
Expr: $2,
|
||||||
yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens)
|
}
|
||||||
}
|
}
|
||||||
| '~' expr
|
| '~' expr
|
||||||
{
|
{
|
||||||
$$ = &ast.ExprBitwiseNot{ast.Node{}, $2}
|
$$ = &ast.ExprBitwiseNot{
|
||||||
|
Node: ast.Node{
|
||||||
// save position
|
Position: position.NewTokenNodePosition($1, $2),
|
||||||
$$.GetNode().Position = position.NewTokenNodePosition($1, $2)
|
},
|
||||||
|
TildaTkn: $1,
|
||||||
// save comments
|
Expr: $2,
|
||||||
yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens)
|
}
|
||||||
}
|
}
|
||||||
| expr T_IS_IDENTICAL expr
|
| expr T_IS_IDENTICAL expr
|
||||||
{
|
{
|
||||||
@ -4112,39 +4112,37 @@ constant:
|
|||||||
}
|
}
|
||||||
| class_name T_PAAMAYIM_NEKUDOTAYIM identifier
|
| class_name T_PAAMAYIM_NEKUDOTAYIM identifier
|
||||||
{
|
{
|
||||||
target := &ast.Identifier{
|
$$ = &ast.ExprClassConstFetch{
|
||||||
Node: ast.Node{
|
Node: ast.Node{
|
||||||
Position: position.NewTokenPosition($3),
|
Position: position.NewNodeTokenPosition($1, $3),
|
||||||
|
},
|
||||||
|
Class: $1,
|
||||||
|
DoubleColonTkn: $2,
|
||||||
|
ConstantName: &ast.Identifier{
|
||||||
|
Node: ast.Node{
|
||||||
|
Position: position.NewTokenPosition($3),
|
||||||
|
},
|
||||||
|
IdentifierTkn: $3,
|
||||||
|
Value: $3.Value,
|
||||||
},
|
},
|
||||||
IdentifierTkn: $3,
|
|
||||||
Value: $3.Value,
|
|
||||||
}
|
}
|
||||||
$$ = &ast.ExprClassConstFetch{ast.Node{}, $1, target}
|
|
||||||
|
|
||||||
// save position
|
|
||||||
$$.GetNode().Position = position.NewNodeTokenPosition($1, $3)
|
|
||||||
|
|
||||||
// save comments
|
|
||||||
yylex.(*Parser).MoveFreeFloating($1, $$)
|
|
||||||
yylex.(*Parser).setFreeFloating($$, token.Name, $2.SkippedTokens)
|
|
||||||
}
|
}
|
||||||
| variable_class_name T_PAAMAYIM_NEKUDOTAYIM identifier
|
| variable_class_name T_PAAMAYIM_NEKUDOTAYIM identifier
|
||||||
{
|
{
|
||||||
target := &ast.Identifier{
|
$$ = &ast.ExprClassConstFetch{
|
||||||
Node: ast.Node{
|
Node: ast.Node{
|
||||||
Position: position.NewTokenPosition($3),
|
Position: position.NewNodeTokenPosition($1, $3),
|
||||||
|
},
|
||||||
|
Class: $1,
|
||||||
|
DoubleColonTkn: $2,
|
||||||
|
ConstantName: &ast.Identifier{
|
||||||
|
Node: ast.Node{
|
||||||
|
Position: position.NewTokenPosition($3),
|
||||||
|
},
|
||||||
|
IdentifierTkn: $3,
|
||||||
|
Value: $3.Value,
|
||||||
},
|
},
|
||||||
IdentifierTkn: $3,
|
|
||||||
Value: $3.Value,
|
|
||||||
}
|
}
|
||||||
$$ = &ast.ExprClassConstFetch{ast.Node{}, $1, target}
|
|
||||||
|
|
||||||
// save position
|
|
||||||
$$.GetNode().Position = position.NewNodeTokenPosition($1, $3)
|
|
||||||
|
|
||||||
// save comments
|
|
||||||
yylex.(*Parser).MoveFreeFloating($1, $$)
|
|
||||||
yylex.(*Parser).setFreeFloating($$, token.Name, $2.SkippedTokens)
|
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -1000,7 +1000,8 @@ func (n *ExprArrowFunction) Accept(v NodeVisitor) {
|
|||||||
// ExprBitwiseNot node
|
// ExprBitwiseNot node
|
||||||
type ExprBitwiseNot struct {
|
type ExprBitwiseNot struct {
|
||||||
Node
|
Node
|
||||||
Expr Vertex
|
TildaTkn *token.Token
|
||||||
|
Expr Vertex
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *ExprBitwiseNot) Accept(v NodeVisitor) {
|
func (n *ExprBitwiseNot) Accept(v NodeVisitor) {
|
||||||
@ -1010,7 +1011,8 @@ func (n *ExprBitwiseNot) Accept(v NodeVisitor) {
|
|||||||
// ExprBooleanNot node
|
// ExprBooleanNot node
|
||||||
type ExprBooleanNot struct {
|
type ExprBooleanNot struct {
|
||||||
Node
|
Node
|
||||||
Expr Vertex
|
ExclamationTkn *token.Token
|
||||||
|
Expr Vertex
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *ExprBooleanNot) Accept(v NodeVisitor) {
|
func (n *ExprBooleanNot) Accept(v NodeVisitor) {
|
||||||
@ -1020,8 +1022,9 @@ func (n *ExprBooleanNot) Accept(v NodeVisitor) {
|
|||||||
// ExprClassConstFetch node
|
// ExprClassConstFetch node
|
||||||
type ExprClassConstFetch struct {
|
type ExprClassConstFetch struct {
|
||||||
Node
|
Node
|
||||||
Class Vertex
|
Class Vertex
|
||||||
ConstantName Vertex
|
DoubleColonTkn *token.Token
|
||||||
|
ConstantName Vertex
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *ExprClassConstFetch) Accept(v NodeVisitor) {
|
func (n *ExprClassConstFetch) Accept(v NodeVisitor) {
|
||||||
@ -1031,7 +1034,8 @@ func (n *ExprClassConstFetch) Accept(v NodeVisitor) {
|
|||||||
// ExprClone node
|
// ExprClone node
|
||||||
type ExprClone struct {
|
type ExprClone struct {
|
||||||
Node
|
Node
|
||||||
Expr Vertex
|
CloneTkn *token.Token
|
||||||
|
Expr Vertex
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *ExprClone) Accept(v NodeVisitor) {
|
func (n *ExprClone) Accept(v NodeVisitor) {
|
||||||
|
Loading…
Reference in New Issue
Block a user