remove meta.EncapsedAndWhitespaceToken
This commit is contained in:
parent
0d3a222673
commit
3aa4406a95
@ -15,7 +15,6 @@ const (
|
|||||||
StringVarnameToken
|
StringVarnameToken
|
||||||
NumStringToken
|
NumStringToken
|
||||||
InlineHTMLToken
|
InlineHTMLToken
|
||||||
EncapsedAndWhitespaceToken
|
|
||||||
EchoToken
|
EchoToken
|
||||||
DoToken
|
DoToken
|
||||||
WhileToken
|
WhileToken
|
||||||
|
@ -4,9 +4,9 @@ package meta
|
|||||||
|
|
||||||
import "strconv"
|
import "strconv"
|
||||||
|
|
||||||
const _TokenName_name = "NodeStartNodeEndMagicConstantTokenIncludeTokenIncludeOnceTokenExitTokenIfTokenStringVarnameTokenNumStringTokenInlineHTMLTokenEncapsedAndWhitespaceTokenEchoTokenDoTokenWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenForTokenEndforTokenForeachTokenEndforeachTokenDeclareTokenEnddeclareTokenAsTokenSwitchTokenEndswitchTokenCaseTokenDefaultTokenBreakTokenContinueTokenGotoTokenFunctionTokenConstTokenReturnTokenTryTokenCatchTokenFinallyTokenThrowTokenUseTokenInsteadofTokenGlobalTokenVarTokenUnsetTokenIssetTokenEmptyTokenClassTokenTraitTokenInterfaceTokenExtendsTokenImplementsTokenDoubleArrowTokenListTokenArrayTokenCallableTokenStartHeredocTokenCurlyOpenTokenPaamayimNekudotayimTokenUseLeadingNsSeparatorTokenNsSeparatorTokenEllipsisTokenEvalTokenRequireTokenRequireOnceTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenNewAnchorCloneTokenElseifTokenElseTokenEndifTokenPrintTokenYieldTokenStaticTokenAbstractTokenFinalTokenPrivateTokenProtectedTokenPublicTokenIncTokenDecTokenYieldFromTokenObjectOperatorTokenIntCastTokenDoubleCastTokenStringCastTokenArrayCastTokenObjectCastTokenBoolCastTokenUnsetCastTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenHaltCompilerTokenCaseSeparatorTokenDoubleQuoteTokenBackquoteTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenExclamationMarkTokenTildeTokenAtTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken"
|
const _TokenName_name = "NodeStartNodeEndMagicConstantTokenIncludeTokenIncludeOnceTokenExitTokenIfTokenStringVarnameTokenNumStringTokenInlineHTMLTokenEchoTokenDoTokenWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenForTokenEndforTokenForeachTokenEndforeachTokenDeclareTokenEnddeclareTokenAsTokenSwitchTokenEndswitchTokenCaseTokenDefaultTokenBreakTokenContinueTokenGotoTokenFunctionTokenConstTokenReturnTokenTryTokenCatchTokenFinallyTokenThrowTokenUseTokenInsteadofTokenGlobalTokenVarTokenUnsetTokenIssetTokenEmptyTokenClassTokenTraitTokenInterfaceTokenExtendsTokenImplementsTokenDoubleArrowTokenListTokenArrayTokenCallableTokenStartHeredocTokenCurlyOpenTokenPaamayimNekudotayimTokenUseLeadingNsSeparatorTokenNsSeparatorTokenEllipsisTokenEvalTokenRequireTokenRequireOnceTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenNewAnchorCloneTokenElseifTokenElseTokenEndifTokenPrintTokenYieldTokenStaticTokenAbstractTokenFinalTokenPrivateTokenProtectedTokenPublicTokenIncTokenDecTokenYieldFromTokenObjectOperatorTokenIntCastTokenDoubleCastTokenStringCastTokenArrayCastTokenObjectCastTokenBoolCastTokenUnsetCastTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenHaltCompilerTokenCaseSeparatorTokenDoubleQuoteTokenBackquoteTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenExclamationMarkTokenTildeTokenAtTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken"
|
||||||
|
|
||||||
var _TokenName_index = [...]uint16{0, 9, 16, 34, 46, 62, 71, 78, 96, 110, 125, 151, 160, 167, 177, 190, 211, 232, 240, 251, 263, 278, 290, 305, 312, 323, 337, 346, 358, 368, 381, 390, 403, 413, 424, 432, 442, 454, 464, 472, 486, 497, 505, 515, 525, 535, 545, 555, 569, 581, 596, 612, 621, 631, 644, 661, 675, 699, 725, 741, 754, 763, 775, 791, 805, 820, 835, 850, 859, 869, 880, 889, 899, 909, 919, 930, 943, 953, 965, 979, 990, 998, 1006, 1020, 1039, 1051, 1066, 1081, 1095, 1110, 1123, 1137, 1150, 1164, 1178, 1193, 1206, 1219, 1232, 1248, 1261, 1274, 1286, 1299, 1311, 1323, 1337, 1352, 1360, 1367, 1374, 1390, 1409, 1421, 1436, 1457, 1478, 1495, 1513, 1529, 1543, 1563, 1584, 1598, 1608, 1628, 1649, 1666, 1684, 1701, 1715, 1725, 1734, 1754, 1764, 1771, 1781, 1797, 1807, 1817, 1830, 1840, 1852, 1861, 1873, 1881}
|
var _TokenName_index = [...]uint16{0, 9, 16, 34, 46, 62, 71, 78, 96, 110, 125, 134, 141, 151, 164, 185, 206, 214, 225, 237, 252, 264, 279, 286, 297, 311, 320, 332, 342, 355, 364, 377, 387, 398, 406, 416, 428, 438, 446, 460, 471, 479, 489, 499, 509, 519, 529, 543, 555, 570, 586, 595, 605, 618, 635, 649, 673, 699, 715, 728, 737, 749, 765, 779, 794, 809, 824, 833, 843, 854, 863, 873, 883, 893, 904, 917, 927, 939, 953, 964, 972, 980, 994, 1013, 1025, 1040, 1055, 1069, 1084, 1097, 1111, 1124, 1138, 1152, 1167, 1180, 1193, 1206, 1222, 1235, 1248, 1260, 1273, 1285, 1297, 1311, 1326, 1334, 1341, 1348, 1364, 1383, 1395, 1410, 1431, 1452, 1469, 1487, 1503, 1517, 1537, 1558, 1572, 1582, 1602, 1623, 1640, 1658, 1675, 1689, 1699, 1708, 1728, 1738, 1745, 1755, 1771, 1781, 1791, 1804, 1814, 1826, 1835, 1847, 1855}
|
||||||
|
|
||||||
func (i TokenName) String() string {
|
func (i TokenName) String() string {
|
||||||
if i < 0 || i >= TokenName(len(_TokenName_index)-1) {
|
if i < 0 || i >= TokenName(len(_TokenName_index)-1) {
|
||||||
|
@ -9148,7 +9148,7 @@ yydefault:
|
|||||||
encapsed.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
|
encapsed.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
|
||||||
|
|
||||||
// save comments
|
// save comments
|
||||||
yyDollar[2].token.Meta.SetTokenName(meta.EncapsedAndWhitespaceToken).AppendTo(encapsed.GetMeta())
|
yyDollar[2].token.Meta.SetTokenName(meta.NodeStart).AppendTo(encapsed.GetMeta())
|
||||||
|
|
||||||
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
|
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
|
||||||
}
|
}
|
||||||
@ -9171,7 +9171,7 @@ yydefault:
|
|||||||
encapsed.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
|
encapsed.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
|
||||||
|
|
||||||
// save comments
|
// save comments
|
||||||
yyDollar[1].token.Meta.SetTokenName(meta.EncapsedAndWhitespaceToken).AppendTo(encapsed.GetMeta())
|
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(encapsed.GetMeta())
|
||||||
|
|
||||||
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
|
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
|
||||||
}
|
}
|
||||||
|
@ -6576,7 +6576,7 @@ encaps_list:
|
|||||||
encapsed.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($2))
|
encapsed.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($2))
|
||||||
|
|
||||||
// save comments
|
// save comments
|
||||||
$2.Meta.SetTokenName(meta.EncapsedAndWhitespaceToken).AppendTo(encapsed.GetMeta())
|
$2.Meta.SetTokenName(meta.NodeStart).AppendTo(encapsed.GetMeta())
|
||||||
|
|
||||||
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
|
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
|
||||||
}
|
}
|
||||||
@ -6595,7 +6595,7 @@ encaps_list:
|
|||||||
encapsed.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
|
encapsed.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
|
||||||
|
|
||||||
// save comments
|
// save comments
|
||||||
$1.Meta.SetTokenName(meta.EncapsedAndWhitespaceToken).AppendTo(encapsed.GetMeta())
|
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(encapsed.GetMeta())
|
||||||
|
|
||||||
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
|
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
|
||||||
}
|
}
|
||||||
|
@ -7773,7 +7773,7 @@ yydefault:
|
|||||||
encapsed.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
|
encapsed.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
|
||||||
|
|
||||||
// save comments
|
// save comments
|
||||||
yyDollar[2].token.Meta.SetTokenName(meta.EncapsedAndWhitespaceToken).AppendTo(encapsed.GetMeta())
|
yyDollar[2].token.Meta.SetTokenName(meta.NodeStart).AppendTo(encapsed.GetMeta())
|
||||||
|
|
||||||
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
|
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
|
||||||
}
|
}
|
||||||
@ -7796,7 +7796,7 @@ yydefault:
|
|||||||
encapsed.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
|
encapsed.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
|
||||||
|
|
||||||
// save comments
|
// save comments
|
||||||
yyDollar[1].token.Meta.SetTokenName(meta.EncapsedAndWhitespaceToken).AppendTo(encapsed.GetMeta())
|
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(encapsed.GetMeta())
|
||||||
|
|
||||||
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
|
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
|
||||||
}
|
}
|
||||||
|
@ -5101,7 +5101,7 @@ encaps_list:
|
|||||||
encapsed.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($2))
|
encapsed.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($2))
|
||||||
|
|
||||||
// save comments
|
// save comments
|
||||||
$2.Meta.SetTokenName(meta.EncapsedAndWhitespaceToken).AppendTo(encapsed.GetMeta())
|
$2.Meta.SetTokenName(meta.NodeStart).AppendTo(encapsed.GetMeta())
|
||||||
|
|
||||||
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
|
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
|
||||||
}
|
}
|
||||||
@ -5120,7 +5120,7 @@ encaps_list:
|
|||||||
encapsed.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
|
encapsed.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
|
||||||
|
|
||||||
// save comments
|
// save comments
|
||||||
$1.Meta.SetTokenName(meta.EncapsedAndWhitespaceToken).AppendTo(encapsed.GetMeta())
|
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(encapsed.GetMeta())
|
||||||
|
|
||||||
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
|
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
|
||||||
}
|
}
|
||||||
|
@ -563,20 +563,14 @@ func (p *Printer) printScalarDNumber(n node.Node) {
|
|||||||
func (p *Printer) printScalarString(n node.Node) {
|
func (p *Printer) printScalarString(n node.Node) {
|
||||||
nn := n.(*scalar.String)
|
nn := n.(*scalar.String)
|
||||||
p.printMeta(nn, meta.NodeStart)
|
p.printMeta(nn, meta.NodeStart)
|
||||||
|
|
||||||
io.WriteString(p.w, nn.Value)
|
io.WriteString(p.w, nn.Value)
|
||||||
|
|
||||||
p.printMeta(nn, meta.NodeEnd)
|
p.printMeta(nn, meta.NodeEnd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Printer) printScalarEncapsedStringPart(n node.Node) {
|
func (p *Printer) printScalarEncapsedStringPart(n node.Node) {
|
||||||
nn := n.(*scalar.EncapsedStringPart)
|
nn := n.(*scalar.EncapsedStringPart)
|
||||||
p.printMeta(nn, meta.NodeStart)
|
p.printMeta(nn, meta.NodeStart)
|
||||||
|
|
||||||
p.printMeta(nn, meta.EncapsedAndWhitespaceToken)
|
|
||||||
|
|
||||||
io.WriteString(p.w, nn.Value)
|
io.WriteString(p.w, nn.Value)
|
||||||
|
|
||||||
p.printMeta(nn, meta.NodeEnd)
|
p.printMeta(nn, meta.NodeEnd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -600,7 +600,7 @@ func TestPrinterPrintScalarEncapsedStringPart(t *testing.T) {
|
|||||||
&meta.Data{
|
&meta.Data{
|
||||||
Type: meta.WhiteSpaceType,
|
Type: meta.WhiteSpaceType,
|
||||||
Value: " ",
|
Value: " ",
|
||||||
TokenName: meta.EncapsedAndWhitespaceToken,
|
TokenName: meta.NodeStart,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Value: "hello world",
|
Value: "hello world",
|
||||||
|
Loading…
Reference in New Issue
Block a user