remove meta.TraitToken

This commit is contained in:
z7zmey 2018-10-29 15:03:41 +02:00
parent 5382ec090c
commit f7a0038307
8 changed files with 7 additions and 9 deletions

View File

@ -25,7 +25,6 @@ const (
VarToken
UnsetToken
ClassToken
TraitToken
ExtendsToken
ImplementsToken
DoubleArrowToken

View File

@ -4,9 +4,9 @@ package meta
import "strconv"
const _TokenName_name = "NodeStartNodeEndStringVarnameTokenNumStringTokenWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenEndforTokenEndforeachTokenEnddeclareTokenAsTokenEndswitchTokenFunctionTokenConstTokenTryTokenInsteadofTokenVarTokenUnsetTokenClassTokenTraitTokenExtendsTokenImplementsTokenDoubleArrowTokenCallableTokenCurlyOpenTokenPaamayimNekudotayimTokenUseLeadingNsSeparatorTokenNsSeparatorTokenEllipsisTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenEndifTokenAbstractTokenFinalTokenPrivateTokenProtectedTokenPublicTokenIncTokenDecTokenObjectOperatorTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenCaseSeparatorTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken"
const _TokenName_name = "NodeStartNodeEndStringVarnameTokenNumStringTokenWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenEndforTokenEndforeachTokenEnddeclareTokenAsTokenEndswitchTokenFunctionTokenConstTokenTryTokenInsteadofTokenVarTokenUnsetTokenClassTokenExtendsTokenImplementsTokenDoubleArrowTokenCallableTokenCurlyOpenTokenPaamayimNekudotayimTokenUseLeadingNsSeparatorTokenNsSeparatorTokenEllipsisTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenEndifTokenAbstractTokenFinalTokenPrivateTokenProtectedTokenPublicTokenIncTokenDecTokenObjectOperatorTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenCaseSeparatorTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken"
var _TokenName_index = [...]uint16{0, 9, 16, 34, 48, 58, 71, 92, 113, 124, 139, 154, 161, 175, 188, 198, 206, 220, 228, 238, 248, 258, 270, 285, 301, 314, 328, 352, 378, 394, 407, 421, 436, 451, 466, 476, 489, 499, 511, 525, 536, 544, 552, 571, 584, 598, 612, 627, 640, 653, 666, 682, 695, 708, 720, 733, 745, 757, 771, 786, 794, 801, 808, 824, 843, 855, 870, 891, 912, 930, 950, 971, 985, 995, 1015, 1036, 1053, 1071, 1088, 1102, 1112, 1121, 1131, 1147, 1157, 1167, 1180, 1190, 1202, 1211, 1223, 1231}
var _TokenName_index = [...]uint16{0, 9, 16, 34, 48, 58, 71, 92, 113, 124, 139, 154, 161, 175, 188, 198, 206, 220, 228, 238, 248, 260, 275, 291, 304, 318, 342, 368, 384, 397, 411, 426, 441, 456, 466, 479, 489, 501, 515, 526, 534, 542, 561, 574, 588, 602, 617, 630, 643, 656, 672, 685, 698, 710, 723, 735, 747, 761, 776, 784, 791, 798, 814, 833, 845, 860, 881, 902, 920, 940, 961, 975, 985, 1005, 1026, 1043, 1061, 1078, 1092, 1102, 1111, 1121, 1137, 1147, 1157, 1170, 1180, 1192, 1201, 1213, 1221}
func (i TokenName) String() string {
if i < 0 || i >= TokenName(len(_TokenName_index)-1) {

View File

@ -3809,7 +3809,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.TraitToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}

View File

@ -1652,7 +1652,7 @@ class_entry_type:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
// save comments
$1.Meta.SetTokenName(meta.TraitToken).AppendTo($$.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}

View File

@ -3914,7 +3914,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[6].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.TraitToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yyDollar[2].token.Meta.SetTokenName(meta.NodeStart).AppendTo(name.GetMeta())
yyDollar[4].token.Meta.SetTokenName(meta.OpenCurlyBracesToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[6].token.Meta.SetTokenName(meta.CloseCurlyBracesToken).AppendTo(yyVAL.node.GetMeta())

View File

@ -1559,7 +1559,7 @@ trait_declaration_statement:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $6))
// save comments
$1.Meta.SetTokenName(meta.TraitToken).AppendTo($$.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
$2.Meta.SetTokenName(meta.NodeStart).AppendTo(name.GetMeta())
$4.Meta.SetTokenName(meta.OpenCurlyBracesToken).AppendTo($$.GetMeta())
$6.Meta.SetTokenName(meta.CloseCurlyBracesToken).AppendTo($$.GetMeta())

View File

@ -2601,7 +2601,6 @@ func (p *Printer) printStmtTrait(n node.Node) {
nn := n.(*stmt.Trait)
p.printMeta(nn, meta.NodeStart)
p.printMeta(nn, meta.TraitToken)
io.WriteString(p.w, "trait")
p.Print(nn.TraitName)

View File

@ -8332,7 +8332,7 @@ func TestPrinterPrintTrait(t *testing.T) {
&meta.Data{
Type: meta.WhiteSpaceType,
Value: " ",
TokenName: meta.TraitToken,
TokenName: meta.NodeStart,
},
&meta.Data{
Type: meta.WhiteSpaceType,