remove meta.CatchToken

This commit is contained in:
z7zmey 2018-10-29 13:10:41 +02:00
parent 2c1c25de58
commit db3058a72f
8 changed files with 9 additions and 11 deletions

View File

@ -29,7 +29,6 @@ const (
ConstToken
ReturnToken
TryToken
CatchToken
FinallyToken
ThrowToken
InsteadofToken

View File

@ -4,9 +4,9 @@ package meta
import "strconv"
const _TokenName_name = "NodeStartNodeEndStringVarnameTokenNumStringTokenInlineHTMLTokenEchoTokenDoTokenWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenEndforTokenEndforeachTokenDeclareTokenEnddeclareTokenAsTokenEndswitchTokenDefaultTokenContinueTokenGotoTokenFunctionTokenConstTokenReturnTokenTryTokenCatchTokenFinallyTokenThrowTokenInsteadofTokenGlobalTokenVarTokenUnsetTokenClassTokenTraitTokenInterfaceTokenExtendsTokenImplementsTokenDoubleArrowTokenCallableTokenCurlyOpenTokenPaamayimNekudotayimTokenUseLeadingNsSeparatorTokenNsSeparatorTokenEllipsisTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenEndifTokenAbstractTokenFinalTokenPrivateTokenProtectedTokenPublicTokenIncTokenDecTokenObjectOperatorTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenHaltCompilerTokenCaseSeparatorTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken"
const _TokenName_name = "NodeStartNodeEndStringVarnameTokenNumStringTokenInlineHTMLTokenEchoTokenDoTokenWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenEndforTokenEndforeachTokenDeclareTokenEnddeclareTokenAsTokenEndswitchTokenDefaultTokenContinueTokenGotoTokenFunctionTokenConstTokenReturnTokenTryTokenFinallyTokenThrowTokenInsteadofTokenGlobalTokenVarTokenUnsetTokenClassTokenTraitTokenInterfaceTokenExtendsTokenImplementsTokenDoubleArrowTokenCallableTokenCurlyOpenTokenPaamayimNekudotayimTokenUseLeadingNsSeparatorTokenNsSeparatorTokenEllipsisTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenEndifTokenAbstractTokenFinalTokenPrivateTokenProtectedTokenPublicTokenIncTokenDecTokenObjectOperatorTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenHaltCompilerTokenCaseSeparatorTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken"
var _TokenName_index = [...]uint16{0, 9, 16, 34, 48, 63, 72, 79, 89, 102, 123, 144, 155, 170, 182, 197, 204, 218, 230, 243, 252, 265, 275, 286, 294, 304, 316, 326, 340, 351, 359, 369, 379, 389, 403, 415, 430, 446, 459, 473, 497, 523, 539, 552, 566, 581, 596, 611, 621, 634, 644, 656, 670, 681, 689, 697, 716, 729, 743, 757, 772, 785, 798, 811, 827, 840, 853, 865, 878, 890, 902, 916, 931, 939, 946, 953, 969, 988, 1000, 1015, 1036, 1057, 1074, 1092, 1112, 1133, 1147, 1157, 1177, 1198, 1215, 1233, 1250, 1264, 1274, 1283, 1293, 1309, 1319, 1329, 1342, 1352, 1364, 1373, 1385, 1393}
var _TokenName_index = [...]uint16{0, 9, 16, 34, 48, 63, 72, 79, 89, 102, 123, 144, 155, 170, 182, 197, 204, 218, 230, 243, 252, 265, 275, 286, 294, 306, 316, 330, 341, 349, 359, 369, 379, 393, 405, 420, 436, 449, 463, 487, 513, 529, 542, 556, 571, 586, 601, 611, 624, 634, 646, 660, 671, 679, 687, 706, 719, 733, 747, 762, 775, 788, 801, 817, 830, 843, 855, 868, 880, 892, 906, 921, 929, 936, 943, 959, 978, 990, 1005, 1026, 1047, 1064, 1082, 1102, 1123, 1137, 1147, 1167, 1188, 1205, 1223, 1240, 1254, 1264, 1273, 1283, 1299, 1309, 1319, 1332, 1342, 1354, 1363, 1375, 1383}
func (i TokenName) String() string {
if i < 0 || i >= TokenName(len(_TokenName_index)-1) {

View File

@ -3538,7 +3538,7 @@ yydefault:
catch.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[8].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.CatchToken).AppendTo(catch.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(catch.GetMeta())
yyDollar[2].token.Meta.SetTokenName(meta.OpenParenthesisToken).AppendTo(catch.GetMeta())
yyDollar[4].token.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
@ -3618,7 +3618,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[8].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.CatchToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yyDollar[2].token.Meta.SetTokenName(meta.OpenParenthesisToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[4].token.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)

View File

@ -1385,7 +1385,7 @@ catch_statement:
catch.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $8))
// save comments
$1.Meta.SetTokenName(meta.CatchToken).AppendTo(catch.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(catch.GetMeta())
$2.Meta.SetTokenName(meta.OpenParenthesisToken).AppendTo(catch.GetMeta())
$4.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
@ -1463,7 +1463,7 @@ additional_catch:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $8))
// save comments
$1.Meta.SetTokenName(meta.CatchToken).AppendTo($$.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
$2.Meta.SetTokenName(meta.OpenParenthesisToken).AppendTo($$.GetMeta())
$4.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)

View File

@ -3692,7 +3692,7 @@ yydefault:
catch.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[2].token, yyDollar[9].token))
// save comments
yyDollar[2].token.Meta.SetTokenName(meta.CatchToken).AppendTo(catch.GetMeta())
yyDollar[2].token.Meta.SetTokenName(meta.NodeStart).AppendTo(catch.GetMeta())
yyDollar[3].token.Meta.SetTokenName(meta.OpenParenthesisToken).AppendTo(catch.GetMeta())
yyDollar[5].token.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)

View File

@ -1342,7 +1342,7 @@ catch_list:
catch.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($2, $9))
// save comments
$2.Meta.SetTokenName(meta.CatchToken).AppendTo(catch.GetMeta())
$2.Meta.SetTokenName(meta.NodeStart).AppendTo(catch.GetMeta())
$3.Meta.SetTokenName(meta.OpenParenthesisToken).AppendTo(catch.GetMeta())
$5.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)

View File

@ -1897,7 +1897,6 @@ func (p *Printer) printStmtCatch(n node.Node) {
nn := n.(*stmt.Catch)
p.printMeta(nn, meta.NodeStart)
p.printMeta(nn, meta.CatchToken)
io.WriteString(p.w, "catch")
p.printMeta(nn, meta.OpenParenthesisToken)
io.WriteString(p.w, "(")

View File

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