remove meta.ConstantEncapsedStringToken and meta.StringToken

This commit is contained in:
z7zmey 2018-10-25 13:08:39 +03:00
parent aa9fb90138
commit 16de29a2a3
12 changed files with 36 additions and 44 deletions

View File

@ -14,12 +14,10 @@ const (
IfToken
LnumberToken
DnumberToken
StringToken
StringVarnameToken
NumStringToken
InlineHTMLToken
EncapsedAndWhitespaceToken
ConstantEncapsedStringToken
EchoToken
DoToken
WhileToken

View File

@ -4,9 +4,9 @@ package meta
import "strconv"
const _TokenName_name = "NodeStartNodeEndMagicConstantTokenIncludeTokenIncludeOnceTokenExitTokenIfTokenLnumberTokenDnumberTokenStringTokenStringVarnameTokenNumStringTokenInlineHTMLTokenEncapsedAndWhitespaceTokenConstantEncapsedStringTokenEchoTokenDoTokenWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenForTokenEndforTokenForeachTokenEndforeachTokenDeclareTokenEnddeclareTokenAsTokenSwitchTokenEndswitchTokenCaseTokenDefaultTokenBreakTokenContinueTokenGotoTokenFunctionTokenConstTokenReturnTokenTryTokenCatchTokenFinallyTokenThrowTokenUseTokenInsteadofTokenGlobalTokenVarTokenUnsetTokenIssetTokenEmptyTokenClassTokenTraitTokenInterfaceTokenExtendsTokenImplementsTokenDoubleArrowTokenListTokenArrayTokenCallableTokenStartHeredocTokenCurlyOpenTokenPaamayimNekudotayimTokenNamespaceTokenUseLeadingNsSeparatorTokenNsSeparatorTokenEllipsisTokenEvalTokenRequireTokenRequireOnceTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenNewAnchorCloneTokenElseifTokenElseTokenEndifTokenPrintTokenYieldTokenStaticTokenAbstractTokenFinalTokenPrivateTokenProtectedTokenPublicTokenIncTokenDecTokenYieldFromTokenObjectOperatorTokenIntCastTokenDoubleCastTokenStringCastTokenArrayCastTokenObjectCastTokenBoolCastTokenUnsetCastTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenHaltCompilerTokenCaseSeparatorTokenDoubleQuoteTokenBackquoteTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenExclamationMarkTokenTildeTokenAtTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken"
const _TokenName_name = "NodeStartNodeEndMagicConstantTokenIncludeTokenIncludeOnceTokenExitTokenIfTokenLnumberTokenDnumberTokenStringVarnameTokenNumStringTokenInlineHTMLTokenEncapsedAndWhitespaceTokenEchoTokenDoTokenWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenForTokenEndforTokenForeachTokenEndforeachTokenDeclareTokenEnddeclareTokenAsTokenSwitchTokenEndswitchTokenCaseTokenDefaultTokenBreakTokenContinueTokenGotoTokenFunctionTokenConstTokenReturnTokenTryTokenCatchTokenFinallyTokenThrowTokenUseTokenInsteadofTokenGlobalTokenVarTokenUnsetTokenIssetTokenEmptyTokenClassTokenTraitTokenInterfaceTokenExtendsTokenImplementsTokenDoubleArrowTokenListTokenArrayTokenCallableTokenStartHeredocTokenCurlyOpenTokenPaamayimNekudotayimTokenNamespaceTokenUseLeadingNsSeparatorTokenNsSeparatorTokenEllipsisTokenEvalTokenRequireTokenRequireOnceTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenNewAnchorCloneTokenElseifTokenElseTokenEndifTokenPrintTokenYieldTokenStaticTokenAbstractTokenFinalTokenPrivateTokenProtectedTokenPublicTokenIncTokenDecTokenYieldFromTokenObjectOperatorTokenIntCastTokenDoubleCastTokenStringCastTokenArrayCastTokenObjectCastTokenBoolCastTokenUnsetCastTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenHaltCompilerTokenCaseSeparatorTokenDoubleQuoteTokenBackquoteTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenExclamationMarkTokenTildeTokenAtTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken"
var _TokenName_index = [...]uint16{0, 9, 16, 34, 46, 62, 71, 78, 90, 102, 113, 131, 145, 160, 186, 213, 222, 229, 239, 252, 273, 294, 302, 313, 325, 340, 352, 367, 374, 385, 399, 408, 420, 430, 443, 452, 465, 475, 486, 494, 504, 516, 526, 534, 548, 559, 567, 577, 587, 597, 607, 617, 631, 643, 658, 674, 683, 693, 706, 723, 737, 761, 775, 801, 817, 830, 839, 851, 867, 881, 896, 911, 926, 935, 945, 956, 965, 975, 985, 995, 1006, 1019, 1029, 1041, 1055, 1066, 1074, 1082, 1096, 1115, 1127, 1142, 1157, 1171, 1186, 1199, 1213, 1226, 1240, 1254, 1269, 1282, 1295, 1308, 1324, 1337, 1350, 1362, 1375, 1387, 1399, 1413, 1428, 1436, 1443, 1450, 1466, 1485, 1497, 1512, 1533, 1554, 1571, 1589, 1605, 1619, 1639, 1660, 1674, 1684, 1704, 1725, 1742, 1760, 1777, 1791, 1801, 1810, 1830, 1840, 1847, 1857, 1873, 1883, 1893, 1906, 1916, 1928, 1937, 1949, 1957}
var _TokenName_index = [...]uint16{0, 9, 16, 34, 46, 62, 71, 78, 90, 102, 120, 134, 149, 175, 184, 191, 201, 214, 235, 256, 264, 275, 287, 302, 314, 329, 336, 347, 361, 370, 382, 392, 405, 414, 427, 437, 448, 456, 466, 478, 488, 496, 510, 521, 529, 539, 549, 559, 569, 579, 593, 605, 620, 636, 645, 655, 668, 685, 699, 723, 737, 763, 779, 792, 801, 813, 829, 843, 858, 873, 888, 897, 907, 918, 927, 937, 947, 957, 968, 981, 991, 1003, 1017, 1028, 1036, 1044, 1058, 1077, 1089, 1104, 1119, 1133, 1148, 1161, 1175, 1188, 1202, 1216, 1231, 1244, 1257, 1270, 1286, 1299, 1312, 1324, 1337, 1349, 1361, 1375, 1390, 1398, 1405, 1412, 1428, 1447, 1459, 1474, 1495, 1516, 1533, 1551, 1567, 1581, 1601, 1622, 1636, 1646, 1666, 1687, 1704, 1722, 1739, 1753, 1763, 1772, 1792, 1802, 1809, 1819, 1835, 1845, 1855, 1868, 1878, 1890, 1899, 1911, 1919}
func (i TokenName) String() string {
if i < 0 || i >= TokenName(len(_TokenName_index)-1) {

View File

@ -2367,7 +2367,7 @@ yydefault:
namePart.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.StringToken).AppendTo(namePart.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(namePart.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -2383,7 +2383,7 @@ yydefault:
// save comments
yyDollar[2].token.Meta.SetTokenName(meta.NodeEnd).AppendTo(lastNode(yyDollar[1].list).GetMeta())
yyDollar[3].token.Meta.SetTokenName(meta.StringToken).AppendTo(namePart.GetMeta())
yyDollar[3].token.Meta.SetTokenName(meta.NodeStart).AppendTo(namePart.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -7330,7 +7330,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.ConstantEncapsedStringToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -9329,7 +9329,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.StringToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}

View File

@ -317,7 +317,7 @@ namespace_name:
namePart.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
// save comments
$1.Meta.SetTokenName(meta.StringToken).AppendTo(namePart.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(namePart.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -331,7 +331,7 @@ namespace_name:
// save comments
$2.Meta.SetTokenName(meta.NodeEnd).AppendTo(lastNode($1).GetMeta())
$3.Meta.SetTokenName(meta.StringToken).AppendTo(namePart.GetMeta())
$3.Meta.SetTokenName(meta.NodeStart).AppendTo(namePart.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -4910,7 +4910,7 @@ common_scalar:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
// save comments
$1.Meta.SetTokenName(meta.ConstantEncapsedStringToken).AppendTo($$.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -6743,7 +6743,7 @@ encaps_var_offset:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
// save comments
$1.Meta.SetTokenName(meta.StringToken).AppendTo($$.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}

View File

@ -2614,7 +2614,7 @@ yydefault:
namePart.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.StringToken).AppendTo(namePart.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(namePart.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -2630,7 +2630,7 @@ yydefault:
// save comments
yyDollar[2].token.Meta.SetTokenName(meta.NodeEnd).AppendTo(lastNode(yyDollar[1].list).GetMeta())
yyDollar[3].token.Meta.SetTokenName(meta.StringToken).AppendTo(namePart.GetMeta())
yyDollar[3].token.Meta.SetTokenName(meta.NodeStart).AppendTo(namePart.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -6897,7 +6897,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.ConstantEncapsedStringToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -7954,7 +7954,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.StringToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}

View File

@ -367,7 +367,7 @@ namespace_name:
namePart.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
// save comments
$1.Meta.SetTokenName(meta.StringToken).AppendTo(namePart.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(namePart.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -381,7 +381,7 @@ namespace_name:
// save comments
$2.Meta.SetTokenName(meta.NodeEnd).AppendTo(lastNode($1).GetMeta())
$3.Meta.SetTokenName(meta.StringToken).AppendTo(namePart.GetMeta())
$3.Meta.SetTokenName(meta.NodeStart).AppendTo(namePart.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -4306,7 +4306,7 @@ dereferencable_scalar:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
// save comments
$1.Meta.SetTokenName(meta.ConstantEncapsedStringToken).AppendTo($$.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -5268,7 +5268,7 @@ encaps_var_offset:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
// save comments
$1.Meta.SetTokenName(meta.StringToken).AppendTo($$.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}

View File

@ -496,8 +496,6 @@ func (p *Printer) printNameNamePart(n node.Node) {
nn := n.(*name.NamePart)
p.printMeta(nn, meta.NodeStart)
p.printMeta(nn, meta.StringToken)
io.WriteString(p.w, nn.Value)
p.printMeta(nn, meta.NsSeparatorToken)
@ -509,8 +507,6 @@ func (p *Printer) printNameName(n node.Node) {
nn := n.(*name.Name)
p.printMeta(nn, meta.NodeStart)
p.printMeta(nn, meta.StringToken)
for k, part := range nn.Parts {
if k > 0 {
io.WriteString(p.w, "\\")
@ -581,8 +577,6 @@ func (p *Printer) printScalarString(n node.Node) {
nn := n.(*scalar.String)
p.printMeta(nn, meta.NodeStart)
p.printMeta(nn, meta.ConstantEncapsedStringToken)
io.WriteString(p.w, nn.Value)
p.printMeta(nn, meta.NodeEnd)

View File

@ -171,7 +171,7 @@ func TestPrinterPrintParameter(t *testing.T) {
&meta.Data{
Type: meta.WhiteSpaceType,
Value: " ",
TokenName: meta.StringToken,
TokenName: meta.NodeStart,
},
},
Value: "Foo",
@ -193,7 +193,7 @@ func TestPrinterPrintParameter(t *testing.T) {
&meta.Data{
Type: meta.WhiteSpaceType,
Value: " ",
TokenName: meta.ConstantEncapsedStringToken,
TokenName: meta.NodeStart,
},
},
Value: "'default'",
@ -271,7 +271,7 @@ func TestPrinterPrintNullable(t *testing.T) {
&meta.Data{
Type: meta.WhiteSpaceType,
Value: " ",
TokenName: meta.ConstantEncapsedStringToken,
TokenName: meta.NodeStart,
},
},
Value: "'default'",
@ -379,17 +379,17 @@ func TestPrinterPrintNameNamePart(t *testing.T) {
&meta.Data{
Type: meta.WhiteSpaceType,
Value: " ",
TokenName: meta.StringToken,
TokenName: meta.NodeStart,
},
&meta.Data{
Type: meta.CommentType,
Value: "/*comment*/",
TokenName: meta.StringToken,
TokenName: meta.NodeStart,
},
&meta.Data{
Type: meta.WhiteSpaceType,
Value: " ",
TokenName: meta.StringToken,
TokenName: meta.NodeStart,
},
&meta.Data{
Type: meta.WhiteSpaceType,
@ -417,7 +417,7 @@ func TestPrinterPrintNameName(t *testing.T) {
&meta.Data{
Type: meta.WhiteSpaceType,
Value: " ",
TokenName: meta.StringToken,
TokenName: meta.NodeStart,
},
},
Parts: []node.Node{
@ -426,12 +426,12 @@ func TestPrinterPrintNameName(t *testing.T) {
&meta.Data{
Type: meta.CommentType,
Value: "/*comment*/",
TokenName: meta.StringToken,
TokenName: meta.NodeStart,
},
&meta.Data{
Type: meta.WhiteSpaceType,
Value: " ",
TokenName: meta.StringToken,
TokenName: meta.NodeStart,
},
&meta.Data{
Type: meta.WhiteSpaceType,
@ -577,7 +577,7 @@ func TestPrinterPrintScalarString(t *testing.T) {
&meta.Data{
Type: meta.WhiteSpaceType,
Value: " ",
TokenName: meta.ConstantEncapsedStringToken,
TokenName: meta.NodeStart,
},
},
Value: "'hello world'",
@ -3833,7 +3833,7 @@ func TestPrinterPrintNew(t *testing.T) {
&meta.Data{
Type: meta.WhiteSpaceType,
Value: " ",
TokenName: meta.StringToken,
TokenName: meta.NodeStart,
},
},
Value: "Foo",

View File

@ -54,7 +54,7 @@ func ExampleDumper() {
// | [*name.NamePart]
// | "Position": Pos{Line: 3-3 Pos: 20-22}
// | "Meta":
// | " " before "StringToken"
// | " " before "NodeStart"
// | "Value": "Foo"
// | "Stmts":
// | [*stmt.Class]
@ -126,7 +126,7 @@ func ExampleDumper() {
// | [*name.NamePart]
// | "Position": Pos{Line: 5-5 Pos: 86-89}
// | "Meta":
// | " " before "StringToken"
// | " " before "NodeStart"
// | "Value": "null"
// | "Stmt":
// | [*stmt.StmtList]

View File

@ -121,7 +121,7 @@ func ExampleGoDumper() {
// EndPos: 19,
// },
// Value: " ",
// TokenName: meta.StringToken,
// TokenName: meta.NodeStart,
// },
// },
// Value: "Foo",
@ -373,7 +373,7 @@ func ExampleGoDumper() {
// EndPos: 85,
// },
// Value: " ",
// TokenName: meta.StringToken,
// TokenName: meta.NodeStart,
// },
// },
// Value: "null",

View File

@ -37,5 +37,5 @@ func ExampleJsonDumper() {
nodes.Walk(dumper)
// Output:
// {"type":"*node.Root","position":{"startPos":10,"endPos":166,"startLine":3,"endLine":12},"Stmts":[{"type":"*stmt.Namespace","position":{"startPos":10,"endPos":166,"startLine":3,"endLine":12},"meta":[{"type":"*meta.TokenType","value":"<?php","tokenName":"NamespaceToken"},{"type":"*meta.WhiteSpaceType","value":"\n\n\t\t","tokenName":"NamespaceToken"},{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"OpenCurlyBracesToken"},{"type":"*meta.WhiteSpaceType","value":"\n\t\t","tokenName":"CloseCurlyBracesToken"}],"NamespaceName":{"type":"*name.Name","position":{"startPos":20,"endPos":22,"startLine":3,"endLine":3},"Parts":[{"type":"*name.NamePart","position":{"startPos":20,"endPos":22,"startLine":3,"endLine":3},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"StringToken"}],"Value":"Foo"}]},"Stmts":[{"type":"*stmt.Class","position":{"startPos":29,"endPos":162,"startLine":4,"endLine":11},"namespacedName":"Foo\\Bar","meta":[{"type":"*meta.WhiteSpaceType","value":"\n\t\t\t","tokenName":"ClassToken"},{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"OpenCurlyBracesToken"},{"type":"*meta.WhiteSpaceType","value":"\n\t\t\t","tokenName":"CloseCurlyBracesToken"}],"PhpDocComment":"","ClassName":{"type":"*node.Identifier","position":{"startPos":35,"endPos":37,"startLine":4,"endLine":4},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"NodeStart"}],"Value":"Bar"},"Stmts":[{"type":"*stmt.ClassMethod","position":{"startPos":45,"endPos":157,"startLine":5,"endLine":10},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"FunctionToken"}],"PhpDocComment":"","ReturnsRef":false,"MethodName":{"type":"*node.Identifier","position":{"startPos":61,"endPos":72,"startLine":5,"endLine":5},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"NodeStart"}],"Value":"FunctionName"},"Modifiers":[{"type":"*node.Identifier","position":{"startPos":45,"endPos":50,"startLine":5,"endLine":5},"meta":[{"type":"*meta.WhiteSpaceType","value":"\n\t\t\t\t","tokenName":"NodeStart"}],"Value":"public"}],"Params":[{"type":"*node.Parameter","position":{"startPos":74,"endPos":89,"startLine":5,"endLine":5},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"EqualToken"}],"ByRef":false,"Variadic":false,"VariableType":{"type":"*name.Name","position":{"startPos":74,"endPos":77,"startLine":5,"endLine":5},"namespacedName":"Foo\\Type","Parts":[{"type":"*name.NamePart","position":{"startPos":74,"endPos":77,"startLine":5,"endLine":5},"Value":"Type"}]},"Variable":{"type":"*expr.Variable","position":{"startPos":79,"endPos":82,"startLine":5,"endLine":5},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"NodeStart"},{"type":"*meta.TokenType","value":"$","tokenName":"NodeStart"}],"VarName":{"type":"*node.Identifier","position":{"startPos":79,"endPos":82,"startLine":5,"endLine":5},"Value":"var"}},"DefaultValue":{"type":"*expr.ConstFetch","position":{"startPos":86,"endPos":89,"startLine":5,"endLine":5},"Constant":{"type":"*name.Name","position":{"startPos":86,"endPos":89,"startLine":5,"endLine":5},"namespacedName":"null","Parts":[{"type":"*name.NamePart","position":{"startPos":86,"endPos":89,"startLine":5,"endLine":5},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"StringToken"}],"Value":"null"}]}}}],"Stmt":{"type":"*stmt.StmtList","position":{"startPos":96,"endPos":157,"startLine":6,"endLine":10},"meta":[{"type":"*meta.WhiteSpaceType","value":"\n\t\t\t\t","tokenName":"OpenCurlyBracesToken"},{"type":"*meta.WhiteSpaceType","value":"\n\t\t\t\t","tokenName":"CloseCurlyBracesToken"}],"Stmts":[{"type":"*stmt.Expression","position":{"startPos":147,"endPos":151,"startLine":9,"endLine":9},"meta":[{"type":"*meta.TokenType","value":";","tokenName":"SemiColonToken"}],"Expr":{"type":"*expr.Variable","position":{"startPos":147,"endPos":150,"startLine":9,"endLine":9},"meta":[{"type":"*meta.WhiteSpaceType","value":"\n\t\t\t\t\t","tokenName":"NodeStart"},{"type":"*meta.CommentType","value":"// some comment\n","tokenName":"NodeStart"},{"type":"*meta.WhiteSpaceType","value":"\t\t\t\t\t","tokenName":"NodeStart"},{"type":"*meta.CommentType","value":"// second comment\n","tokenName":"NodeStart"},{"type":"*meta.WhiteSpaceType","value":"\t\t\t\t\t","tokenName":"NodeStart"},{"type":"*meta.TokenType","value":"$","tokenName":"NodeStart"}],"VarName":{"type":"*node.Identifier","position":{"startPos":147,"endPos":150,"startLine":9,"endLine":9},"Value":"var"}}}]}}]}]}]}
// {"type":"*node.Root","position":{"startPos":10,"endPos":166,"startLine":3,"endLine":12},"Stmts":[{"type":"*stmt.Namespace","position":{"startPos":10,"endPos":166,"startLine":3,"endLine":12},"meta":[{"type":"*meta.TokenType","value":"<?php","tokenName":"NamespaceToken"},{"type":"*meta.WhiteSpaceType","value":"\n\n\t\t","tokenName":"NamespaceToken"},{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"OpenCurlyBracesToken"},{"type":"*meta.WhiteSpaceType","value":"\n\t\t","tokenName":"CloseCurlyBracesToken"}],"NamespaceName":{"type":"*name.Name","position":{"startPos":20,"endPos":22,"startLine":3,"endLine":3},"Parts":[{"type":"*name.NamePart","position":{"startPos":20,"endPos":22,"startLine":3,"endLine":3},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"NodeStart"}],"Value":"Foo"}]},"Stmts":[{"type":"*stmt.Class","position":{"startPos":29,"endPos":162,"startLine":4,"endLine":11},"namespacedName":"Foo\\Bar","meta":[{"type":"*meta.WhiteSpaceType","value":"\n\t\t\t","tokenName":"ClassToken"},{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"OpenCurlyBracesToken"},{"type":"*meta.WhiteSpaceType","value":"\n\t\t\t","tokenName":"CloseCurlyBracesToken"}],"PhpDocComment":"","ClassName":{"type":"*node.Identifier","position":{"startPos":35,"endPos":37,"startLine":4,"endLine":4},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"NodeStart"}],"Value":"Bar"},"Stmts":[{"type":"*stmt.ClassMethod","position":{"startPos":45,"endPos":157,"startLine":5,"endLine":10},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"FunctionToken"}],"PhpDocComment":"","ReturnsRef":false,"MethodName":{"type":"*node.Identifier","position":{"startPos":61,"endPos":72,"startLine":5,"endLine":5},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"NodeStart"}],"Value":"FunctionName"},"Modifiers":[{"type":"*node.Identifier","position":{"startPos":45,"endPos":50,"startLine":5,"endLine":5},"meta":[{"type":"*meta.WhiteSpaceType","value":"\n\t\t\t\t","tokenName":"NodeStart"}],"Value":"public"}],"Params":[{"type":"*node.Parameter","position":{"startPos":74,"endPos":89,"startLine":5,"endLine":5},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"EqualToken"}],"ByRef":false,"Variadic":false,"VariableType":{"type":"*name.Name","position":{"startPos":74,"endPos":77,"startLine":5,"endLine":5},"namespacedName":"Foo\\Type","Parts":[{"type":"*name.NamePart","position":{"startPos":74,"endPos":77,"startLine":5,"endLine":5},"Value":"Type"}]},"Variable":{"type":"*expr.Variable","position":{"startPos":79,"endPos":82,"startLine":5,"endLine":5},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"NodeStart"},{"type":"*meta.TokenType","value":"$","tokenName":"NodeStart"}],"VarName":{"type":"*node.Identifier","position":{"startPos":79,"endPos":82,"startLine":5,"endLine":5},"Value":"var"}},"DefaultValue":{"type":"*expr.ConstFetch","position":{"startPos":86,"endPos":89,"startLine":5,"endLine":5},"Constant":{"type":"*name.Name","position":{"startPos":86,"endPos":89,"startLine":5,"endLine":5},"namespacedName":"null","Parts":[{"type":"*name.NamePart","position":{"startPos":86,"endPos":89,"startLine":5,"endLine":5},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"NodeStart"}],"Value":"null"}]}}}],"Stmt":{"type":"*stmt.StmtList","position":{"startPos":96,"endPos":157,"startLine":6,"endLine":10},"meta":[{"type":"*meta.WhiteSpaceType","value":"\n\t\t\t\t","tokenName":"OpenCurlyBracesToken"},{"type":"*meta.WhiteSpaceType","value":"\n\t\t\t\t","tokenName":"CloseCurlyBracesToken"}],"Stmts":[{"type":"*stmt.Expression","position":{"startPos":147,"endPos":151,"startLine":9,"endLine":9},"meta":[{"type":"*meta.TokenType","value":";","tokenName":"SemiColonToken"}],"Expr":{"type":"*expr.Variable","position":{"startPos":147,"endPos":150,"startLine":9,"endLine":9},"meta":[{"type":"*meta.WhiteSpaceType","value":"\n\t\t\t\t\t","tokenName":"NodeStart"},{"type":"*meta.CommentType","value":"// some comment\n","tokenName":"NodeStart"},{"type":"*meta.WhiteSpaceType","value":"\t\t\t\t\t","tokenName":"NodeStart"},{"type":"*meta.CommentType","value":"// second comment\n","tokenName":"NodeStart"},{"type":"*meta.WhiteSpaceType","value":"\t\t\t\t\t","tokenName":"NodeStart"},{"type":"*meta.TokenType","value":"$","tokenName":"NodeStart"}],"VarName":{"type":"*node.Identifier","position":{"startPos":147,"endPos":150,"startLine":9,"endLine":9},"Value":"var"}}}]}}]}]}]}
}

View File

@ -106,7 +106,7 @@ func ExamplePrettyJsonDumper() {
// {
// "type": "*meta.WhiteSpaceType",
// "value": " ",
// "tokenName": "StringToken"
// "tokenName": "NodeStart"
// }
// ],
// "Value": "Foo"
@ -313,7 +313,7 @@ func ExamplePrettyJsonDumper() {
// {
// "type": "*meta.WhiteSpaceType",
// "value": " ",
// "tokenName": "StringToken"
// "tokenName": "NodeStart"
// }
// ],
// "Value": "null"