remove meta.InlineHTMLToken

This commit is contained in:
z7zmey 2018-10-29 14:18:43 +02:00
parent a8295f8f72
commit 67e222a88f
8 changed files with 7 additions and 11 deletions

View File

@ -9,7 +9,6 @@ const (
NodeEnd
StringVarnameToken
NumStringToken
InlineHTMLToken
WhileToken
EndwhileToken
ForInitSemicolonToken

View File

@ -4,9 +4,9 @@ package meta
import "strconv"
const _TokenName_name = "NodeStartNodeEndStringVarnameTokenNumStringTokenInlineHTMLTokenWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenEndforTokenEndforeachTokenEnddeclareTokenAsTokenEndswitchTokenFunctionTokenConstTokenReturnTokenTryTokenThrowTokenInsteadofTokenVarTokenUnsetTokenClassTokenTraitTokenInterfaceTokenExtendsTokenImplementsTokenDoubleArrowTokenCallableTokenCurlyOpenTokenPaamayimNekudotayimTokenUseLeadingNsSeparatorTokenNsSeparatorTokenEllipsisTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenEndifTokenAbstractTokenFinalTokenPrivateTokenProtectedTokenPublicTokenIncTokenDecTokenObjectOperatorTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenCaseSeparatorTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken"
const _TokenName_name = "NodeStartNodeEndStringVarnameTokenNumStringTokenWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenEndforTokenEndforeachTokenEnddeclareTokenAsTokenEndswitchTokenFunctionTokenConstTokenReturnTokenTryTokenThrowTokenInsteadofTokenVarTokenUnsetTokenClassTokenTraitTokenInterfaceTokenExtendsTokenImplementsTokenDoubleArrowTokenCallableTokenCurlyOpenTokenPaamayimNekudotayimTokenUseLeadingNsSeparatorTokenNsSeparatorTokenEllipsisTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenEndifTokenAbstractTokenFinalTokenPrivateTokenProtectedTokenPublicTokenIncTokenDecTokenObjectOperatorTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenCaseSeparatorTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken"
var _TokenName_index = [...]uint16{0, 9, 16, 34, 48, 63, 73, 86, 107, 128, 139, 154, 169, 176, 190, 203, 213, 224, 232, 242, 256, 264, 274, 284, 294, 308, 320, 335, 351, 364, 378, 402, 428, 444, 457, 471, 486, 501, 516, 526, 539, 549, 561, 575, 586, 594, 602, 621, 634, 648, 662, 677, 690, 703, 716, 732, 745, 758, 770, 783, 795, 807, 821, 836, 844, 851, 858, 874, 893, 905, 920, 941, 962, 980, 1000, 1021, 1035, 1045, 1065, 1086, 1103, 1121, 1138, 1152, 1162, 1171, 1181, 1197, 1207, 1217, 1230, 1240, 1252, 1261, 1273, 1281}
var _TokenName_index = [...]uint16{0, 9, 16, 34, 48, 58, 71, 92, 113, 124, 139, 154, 161, 175, 188, 198, 209, 217, 227, 241, 249, 259, 269, 279, 293, 305, 320, 336, 349, 363, 387, 413, 429, 442, 456, 471, 486, 501, 511, 524, 534, 546, 560, 571, 579, 587, 606, 619, 633, 647, 662, 675, 688, 701, 717, 730, 743, 755, 768, 780, 792, 806, 821, 829, 836, 843, 859, 878, 890, 905, 926, 947, 965, 985, 1006, 1020, 1030, 1050, 1071, 1088, 1106, 1123, 1137, 1147, 1156, 1166, 1182, 1192, 1202, 1215, 1225, 1237, 1246, 1258, 1266}
func (i TokenName) String() string {
if i < 0 || i >= TokenName(len(_TokenName_index)-1) {

View File

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

View File

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

View File

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

View File

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

View File

@ -2348,10 +2348,7 @@ func (p *Printer) printStmtInlineHTML(n node.Node) {
nn := n.(*stmt.InlineHtml)
p.printMeta(nn, meta.NodeStart)
p.printMeta(n, meta.InlineHTMLToken)
// io.WriteString(p.w, "?>")
io.WriteString(p.w, nn.Value)
// io.WriteString(p.w, "<?php")
p.printMeta(nn, meta.NodeEnd)
}

View File

@ -7411,7 +7411,7 @@ func TestPrinterPrintInlineHtml(t *testing.T) {
&meta.Data{
Type: meta.WhiteSpaceType,
Value: " ",
TokenName: meta.InlineHTMLToken,
TokenName: meta.NodeStart,
},
},
Value: "test",