#70: [php7] inherit meta.Data at stmt.Property, stmt.Constant, stmt.Class, expr.PostDec, expr.PostInc, expr.Ternary and assign, binary nodes

This commit is contained in:
z7zmey 2018-12-31 17:13:05 +02:00
parent efbc5b2291
commit a0dda154bf
2 changed files with 399 additions and 215 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2954,7 +2954,7 @@ property:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
// save comments
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
@ -2971,7 +2971,7 @@ property:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3))
// save comments
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
$2.Meta.SetTokenName(meta.EqualToken).AppendTo($$.GetMeta())
@ -3008,7 +3008,7 @@ class_const_decl:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3))
// save comments
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(name.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
$2.Meta.SetTokenName(meta.EqualToken).AppendTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
@ -3026,7 +3026,7 @@ const_decl:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3))
// save comments
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(name.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
$2.Meta.SetTokenName(meta.EqualToken).AppendTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
@ -3106,7 +3106,7 @@ anonymous_class:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $8))
// save comments
$1.Meta.SetTokenName(meta.ClassToken).AppendTo($$.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
$6.Meta.SetTokenName(meta.OpenCurlyBracesToken).AppendTo($$.GetMeta())
$8.Meta.SetTokenName(meta.CloseCurlyBracesToken).AppendTo($$.GetMeta())
@ -3155,7 +3155,7 @@ expr_without_variable:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $6))
// save comments
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(list.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
$2.Meta.SetTokenName(meta.OpenParenthesisToken).AppendTo(list.GetMeta())
$4.Meta.SetTokenName(meta.CloseParenthesisToken).AppendTo(list.GetMeta())
$5.Meta.SetTokenName(meta.EqualToken).AppendTo($$.GetMeta())
@ -3172,7 +3172,7 @@ expr_without_variable:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $5))
// save comments
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(shortList.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
$3.Meta.SetTokenName(meta.CloseSquareBracket).AppendTo(shortList.GetMeta())
$4.Meta.SetTokenName(meta.EqualToken).AppendTo($$.GetMeta())
@ -3188,6 +3188,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.EqualToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| variable '=' '&' expr
@ -3201,6 +3203,8 @@ expr_without_variable:
$2.Meta.SetTokenName(meta.EqualToken).AppendTo($$.GetMeta())
$3.Meta.SetTokenName(meta.AmpersandToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| T_CLONE expr
@ -3225,6 +3229,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.PlusEqualToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| variable T_MINUS_EQUAL expr
@ -3237,6 +3243,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.MinusEqualToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| variable T_MUL_EQUAL expr
@ -3249,6 +3257,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.MulEqualToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| variable T_POW_EQUAL expr
@ -3261,6 +3271,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.PowEqualToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| variable T_DIV_EQUAL expr
@ -3273,6 +3285,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.DivEqualToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| variable T_CONCAT_EQUAL expr
@ -3285,6 +3299,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.ConcatEqualToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| variable T_MOD_EQUAL expr
@ -3297,6 +3313,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.ModEqualToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| variable T_AND_EQUAL expr
@ -3309,6 +3327,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.AndEqualToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| variable T_OR_EQUAL expr
@ -3321,6 +3341,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.OrEqualToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| variable T_XOR_EQUAL expr
@ -3333,6 +3355,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.XorEqualToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| variable T_SL_EQUAL expr
@ -3345,6 +3369,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.SlEqualToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| variable T_SR_EQUAL expr
@ -3357,6 +3383,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.SrEqualToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| variable T_INC
@ -3369,6 +3397,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.IncToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| T_INC variable
@ -3393,6 +3423,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.DecToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| T_DEC variable
@ -3417,6 +3449,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.BooleanOrToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr T_BOOLEAN_AND expr
@ -3429,6 +3463,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.BooleanAndToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr T_LOGICAL_OR expr
@ -3441,6 +3477,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.LogicalOrToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr T_LOGICAL_AND expr
@ -3453,6 +3491,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.LogicalAndToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr T_LOGICAL_XOR expr
@ -3465,6 +3505,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.LogicalXorToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr '|' expr
@ -3477,6 +3519,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.VerticalBarToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr '&' expr
@ -3489,6 +3533,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.AmpersandToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr '^' expr
@ -3501,6 +3547,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.CaretToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr '.' expr
@ -3513,6 +3561,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.DotToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr '+' expr
@ -3525,6 +3575,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.PlusToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr '-' expr
@ -3537,6 +3589,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.MinusToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr '*' expr
@ -3549,6 +3603,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.AsteriskToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr T_POW expr
@ -3561,6 +3617,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.PowToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr '/' expr
@ -3573,6 +3631,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.SlashToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr '%' expr
@ -3585,6 +3645,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.PercentToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr T_SL expr
@ -3597,6 +3659,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.SlToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr T_SR expr
@ -3609,6 +3673,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.SrToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| '+' expr %prec T_INC
@ -3669,6 +3735,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.IsIdenticalToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr T_IS_NOT_IDENTICAL expr
@ -3681,6 +3749,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.IsNotIdenticalToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr T_IS_EQUAL expr
@ -3693,6 +3763,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.IsEqualToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr T_IS_NOT_EQUAL expr
@ -3706,6 +3778,8 @@ expr_without_variable:
$2.Meta.SetTokenName(meta.IsNotEqualToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $2, meta.IsNotEqualToken)
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr '<' expr
@ -3718,6 +3792,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.LessToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr T_IS_SMALLER_OR_EQUAL expr
@ -3730,6 +3806,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.IsSmallerOrEqualToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr '>' expr
@ -3742,6 +3820,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.GreaterToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr T_IS_GREATER_OR_EQUAL expr
@ -3754,6 +3834,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.IsGreaterOrEqualToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr T_SPACESHIP expr
@ -3766,6 +3848,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.SpaceshipToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr T_INSTANCEOF class_name_reference
@ -3778,6 +3862,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.InstanceofToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| '(' expr ')'
@ -3809,6 +3895,8 @@ expr_without_variable:
$2.Meta.SetTokenName(meta.QuestionMarkToken).AppendTo($$.GetMeta())
$4.Meta.SetTokenName(meta.ColonToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr '?' ':' expr
@ -3822,6 +3910,8 @@ expr_without_variable:
$2.Meta.SetTokenName(meta.QuestionMarkToken).AppendTo($$.GetMeta())
$3.Meta.SetTokenName(meta.ColonToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr T_COALESCE expr
@ -3834,6 +3924,8 @@ expr_without_variable:
// save comments
$2.Meta.SetTokenName(meta.CoalesceToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| internal_functions_in_yacc
@ -4960,8 +5052,8 @@ member_name:
$$ = $2;
// save comments
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.NodeStart)
yylex.(*Parser).prependMetaToken($$, $1, meta.NodeStart)
$1.Meta.SetTokenName(meta.NodeStart).PrependTo($$.GetMeta())
$3.Meta.SetTokenName(meta.NodeEnd).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $3, meta.NodeEnd)
@ -4993,8 +5085,8 @@ property_name:
$$ = $2;
// save comments
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.NodeStart)
yylex.(*Parser).prependMetaToken($$, $1, meta.NodeStart)
$1.Meta.SetTokenName(meta.NodeStart).PrependTo($$.GetMeta())
$3.Meta.SetTokenName(meta.NodeEnd).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $3, meta.NodeEnd)