Merge pull request #72 from z7zmey/issue-70

Attaching meta.Data to top-level nodes
This commit is contained in:
Vadym Slizov 2019-01-03 19:11:36 +02:00 committed by GitHub
commit 61be88381e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 2180 additions and 1230 deletions

View File

@ -24,7 +24,6 @@ const (
ImplementsToken
DoubleArrowToken
PaamayimNekudotayimToken
UseLeadingNsSeparatorToken
NsSeparatorToken
EllipsisToken
LogicalOrToken

View File

@ -4,9 +4,9 @@ package meta
import "strconv"
const _TokenName_name = "NodeStartNodeEndWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenEndforTokenEndforeachTokenEnddeclareTokenAsTokenEndswitchTokenFunctionTokenConstTokenInsteadofTokenClassTokenExtendsTokenImplementsTokenDoubleArrowTokenPaamayimNekudotayimTokenUseLeadingNsSeparatorTokenNsSeparatorTokenEllipsisTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenEndifTokenIncTokenDecTokenObjectOperatorTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenCaseSeparatorTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken"
const _TokenName_name = "NodeStartNodeEndWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenEndforTokenEndforeachTokenEnddeclareTokenAsTokenEndswitchTokenFunctionTokenConstTokenInsteadofTokenClassTokenExtendsTokenImplementsTokenDoubleArrowTokenPaamayimNekudotayimTokenNsSeparatorTokenEllipsisTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenEndifTokenIncTokenDecTokenObjectOperatorTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenCaseSeparatorTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken"
var _TokenName_index = [...]uint16{0, 9, 16, 26, 39, 60, 81, 92, 107, 122, 129, 143, 156, 166, 180, 190, 202, 217, 233, 257, 283, 299, 312, 326, 341, 356, 371, 381, 389, 397, 416, 429, 443, 457, 472, 485, 498, 511, 527, 540, 553, 565, 578, 590, 602, 616, 631, 639, 646, 653, 669, 688, 700, 715, 736, 757, 775, 795, 816, 830, 840, 860, 881, 898, 916, 933, 947, 957, 966, 976, 992, 1002, 1012, 1025, 1035, 1047, 1056, 1068, 1076}
var _TokenName_index = [...]uint16{0, 9, 16, 26, 39, 60, 81, 92, 107, 122, 129, 143, 156, 166, 180, 190, 202, 217, 233, 257, 273, 286, 300, 315, 330, 345, 355, 363, 371, 390, 403, 417, 431, 446, 459, 472, 485, 501, 514, 527, 539, 552, 564, 576, 590, 605, 613, 620, 627, 643, 662, 674, 689, 710, 731, 749, 769, 790, 804, 814, 834, 855, 872, 890, 907, 921, 931, 940, 950, 966, 976, 986, 999, 1009, 1021, 1030, 1042, 1050}
func (i TokenName) String() string {
if i < 0 || i >= TokenName(len(_TokenName_index)-1) {

View File

@ -113,6 +113,18 @@ func isDollar(r rune) bool {
return r == '$'
}
func newInheritMetaFilter() meta.Filter {
return meta.StopOnFailureFilter(
meta.AndFilter(
meta.TokenNameFilter(meta.NodeStart),
meta.OrFilter(
meta.TypeFilter(meta.CommentType, meta.WhiteSpaceType),
meta.ValueFilter("<?php", "<?"),
),
),
)
}
func (l *Parser) appendMetaToken(n node.Node, t *scanner.Token, tn meta.TokenName) {
if !l.Lexer.WithMeta {
return

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -105,6 +105,18 @@ func isDollar(r rune) bool {
return r == '$'
}
func newInheritMetaFilter() meta.Filter {
return meta.StopOnFailureFilter(
meta.AndFilter(
meta.TokenNameFilter(meta.NodeStart),
meta.OrFilter(
meta.TypeFilter(meta.CommentType, meta.WhiteSpaceType),
meta.ValueFilter("<?php", "<?"),
),
),
)
}
func (l *Parser) appendMetaToken(n node.Node, t *scanner.Token, tn meta.TokenName) {
if !l.Lexer.WithMeta {
return

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2293,7 +2293,6 @@ func (p *Printer) printStmtGroupUse(n node.Node) {
p.Print(nn.UseType)
}
p.printMeta(nn, meta.UseLeadingNsSeparatorToken)
p.Print(nn.Prefix)
p.printMeta(nn, meta.NsSeparatorToken)
io.WriteString(p.w, "\\")
@ -2675,8 +2674,6 @@ func (p *Printer) printStmtUse(n node.Node) {
p.Print(nn.UseType)
}
p.printMeta(nn, meta.UseLeadingNsSeparatorToken)
p.Print(nn.Use)
if nn.Alias != nil {

View File

@ -61,7 +61,7 @@ func ExampleDumper() {
// | "Position": Pos{Line: 4-10 Pos: 29-139}
// | "NamespacedName": "Foo\\Bar"
// | "Meta":
// | "\n\t\t\t" before "ClassToken"
// | "\n\t\t\t" before "NodeStart"
// | " " before "OpenCurlyBracesToken"
// | "\n\t\t\t" before "CloseCurlyBracesToken"
// | "PhpDocComment": ""
@ -75,6 +75,7 @@ func ExampleDumper() {
// | [*stmt.ClassMethod]
// | "Position": Pos{Line: 5-9 Pos: 45-134}
// | "Meta":
// | "\n\t\t\t\t" before "NodeStart"
// | " " before "FunctionToken"
// | "ReturnsRef": false
// | "PhpDocComment": ""
@ -87,8 +88,6 @@ func ExampleDumper() {
// | "Modifiers":
// | [*node.Identifier]
// | "Position": Pos{Line: 5-5 Pos: 45-50}
// | "Meta":
// | "\n\t\t\t\t" before "NodeStart"
// | "Value": "public"
// | "Params":
// | [*node.Parameter]
@ -118,6 +117,8 @@ func ExampleDumper() {
// | "DefaultValue":
// | [*expr.ConstFetch]
// | "Position": Pos{Line: 5-5 Pos: 86-89}
// | "Meta":
// | " " before "NodeStart"
// | "Constant":
// | [*name.Name]
// | "Position": Pos{Line: 5-5 Pos: 86-89}
@ -125,8 +126,6 @@ func ExampleDumper() {
// | "Parts":
// | [*name.NamePart]
// | "Position": Pos{Line: 5-5 Pos: 86-89}
// | "Meta":
// | " " before "NodeStart"
// | "Value": "null"
// | "Stmt":
// | [*stmt.StmtList]
@ -138,14 +137,14 @@ func ExampleDumper() {
// | [*stmt.Expression]
// | "Position": Pos{Line: 8-8 Pos: 124-128}
// | "Meta":
// | "\n\t\t\t\t\t" before "NodeStart"
// | "// some comment\n" before "NodeStart"
// | "\t\t\t\t\t" before "NodeStart"
// | ";" before "SemiColonToken"
// | "Expr":
// | [*expr.Variable]
// | "Position": Pos{Line: 8-8 Pos: 124-127}
// | "Meta":
// | "\n\t\t\t\t\t" before "NodeStart"
// | "// some comment\n" before "NodeStart"
// | "\t\t\t\t\t" before "NodeStart"
// | "$" before "NodeStart"
// | "VarName":
// | [*node.Identifier]

View File

@ -146,7 +146,7 @@ func ExampleGoDumper() {
// EndPos: 28,
// },
// Value: "\n\t\t\t",
// TokenName: meta.ClassToken,
// TokenName: meta.NodeStart,
// },
// &meta.Data{
// Type: meta.WhiteSpaceType,
@ -206,6 +206,17 @@ func ExampleGoDumper() {
// &meta.Data{
// Type: meta.WhiteSpaceType,
// Position: &position.Position{
// StartLine: 4,
// EndLine: 5,
// StartPos: 40,
// EndPos: 44,
// },
// Value: "\n\t\t\t\t",
// TokenName: meta.NodeStart,
// },
// &meta.Data{
// Type: meta.WhiteSpaceType,
// Position: &position.Position{
// StartLine: 5,
// EndLine: 5,
// StartPos: 51,
@ -247,19 +258,6 @@ func ExampleGoDumper() {
// StartPos: 45,
// EndPos: 50,
// },
// Meta: meta.Collection{
// &meta.Data{
// Type: meta.WhiteSpaceType,
// Position: &position.Position{
// StartLine: 4,
// EndLine: 5,
// StartPos: 40,
// EndPos: 44,
// },
// Value: "\n\t\t\t\t",
// TokenName: meta.NodeStart,
// },
// },
// Value: "public",
// },
// },
@ -348,6 +346,19 @@ func ExampleGoDumper() {
// StartPos: 86,
// EndPos: 89,
// },
// Meta: meta.Collection{
// &meta.Data{
// Type: meta.WhiteSpaceType,
// Position: &position.Position{
// StartLine: 5,
// EndLine: 5,
// StartPos: 85,
// EndPos: 85,
// },
// Value: " ",
// TokenName: meta.NodeStart,
// },
// },
// Constant: &name.Name{
// Position: &position.Position{
// StartLine: 5,
@ -363,19 +374,6 @@ func ExampleGoDumper() {
// StartPos: 86,
// EndPos: 89,
// },
// Meta: meta.Collection{
// &meta.Data{
// Type: meta.WhiteSpaceType,
// Position: &position.Position{
// StartLine: 5,
// EndLine: 5,
// StartPos: 85,
// EndPos: 85,
// },
// Value: " ",
// TokenName: meta.NodeStart,
// },
// },
// Value: "null",
// },
// },
@ -424,6 +422,39 @@ func ExampleGoDumper() {
// },
// Meta: meta.Collection{
// &meta.Data{
// Type: meta.WhiteSpaceType,
// Position: &position.Position{
// StartLine: 6,
// EndLine: 7,
// StartPos: 97,
// EndPos: 102,
// },
// Value: "\n\t\t\t\t\t",
// TokenName: meta.NodeStart,
// },
// &meta.Data{
// Type: meta.CommentType,
// Position: &position.Position{
// StartLine: 7,
// EndLine: 7,
// StartPos: 103,
// EndPos: 118,
// },
// Value: "// some comment\n",
// TokenName: meta.NodeStart,
// },
// &meta.Data{
// Type: meta.WhiteSpaceType,
// Position: &position.Position{
// StartLine: 8,
// EndLine: 8,
// StartPos: 119,
// EndPos: 123,
// },
// Value: "\t\t\t\t\t",
// TokenName: meta.NodeStart,
// },
// &meta.Data{
// Type: meta.TokenType,
// Position: &position.Position{
// StartLine: 8,
@ -444,39 +475,6 @@ func ExampleGoDumper() {
// },
// Meta: meta.Collection{
// &meta.Data{
// Type: meta.WhiteSpaceType,
// Position: &position.Position{
// StartLine: 6,
// EndLine: 7,
// StartPos: 97,
// EndPos: 102,
// },
// Value: "\n\t\t\t\t\t",
// TokenName: meta.NodeStart,
// },
// &meta.Data{
// Type: meta.CommentType,
// Position: &position.Position{
// StartLine: 7,
// EndLine: 7,
// StartPos: 103,
// EndPos: 118,
// },
// Value: "// some comment\n",
// TokenName: meta.NodeStart,
// },
// &meta.Data{
// Type: meta.WhiteSpaceType,
// Position: &position.Position{
// StartLine: 8,
// EndLine: 8,
// StartPos: 119,
// EndPos: 123,
// },
// Value: "\t\t\t\t\t",
// TokenName: meta.NodeStart,
// },
// &meta.Data{
// Type: meta.TokenType,
// Position: nil,
// Value: "$",

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":"NodeStart"},{"type":"*meta.WhiteSpaceType","value":"\n\n\t\t","tokenName":"NodeStart"},{"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":"NodeStart"},{"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":"NodeStart"},{"type":"*meta.WhiteSpaceType","value":"\n\n\t\t","tokenName":"NodeStart"},{"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":"NodeStart"},{"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":"\n\t\t\t\t","tokenName":"NodeStart"},{"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},"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},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"NodeStart"}],"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},"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":"NodeStart"},{"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.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":"SemiColonToken"}],"Expr":{"type":"*expr.Variable","position":{"startPos":147,"endPos":150,"startLine":9,"endLine":9},"meta":[{"type":"*meta.TokenType","value":"$","tokenName":"NodeStart"}],"VarName":{"type":"*node.Identifier","position":{"startPos":147,"endPos":150,"startLine":9,"endLine":9},"Value":"var"}}}]}}]}]}]}
}

View File

@ -127,7 +127,7 @@ func ExamplePrettyJsonDumper() {
// {
// "type": "*meta.WhiteSpaceType",
// "value": "\n\t\t\t",
// "tokenName": "ClassToken"
// "tokenName": "NodeStart"
// },
// {
// "type": "*meta.WhiteSpaceType",
@ -170,6 +170,11 @@ func ExamplePrettyJsonDumper() {
// "meta": [
// {
// "type": "*meta.WhiteSpaceType",
// "value": "\n\t\t\t\t",
// "tokenName": "NodeStart"
// },
// {
// "type": "*meta.WhiteSpaceType",
// "value": " ",
// "tokenName": "FunctionToken"
// }
@ -202,13 +207,6 @@ func ExamplePrettyJsonDumper() {
// "startLine": 5,
// "endLine": 5
// },
// "meta": [
// {
// "type": "*meta.WhiteSpaceType",
// "value": "\n\t\t\t\t",
// "tokenName": "NodeStart"
// }
// ],
// "Value": "public"
// }
// ],
@ -291,6 +289,13 @@ func ExamplePrettyJsonDumper() {
// "startLine": 5,
// "endLine": 5
// },
// "meta": [
// {
// "type": "*meta.WhiteSpaceType",
// "value": " ",
// "tokenName": "NodeStart"
// }
// ],
// "Constant": {
// "type": "*name.Name",
// "position": {
@ -309,13 +314,6 @@ func ExamplePrettyJsonDumper() {
// "startLine": 5,
// "endLine": 5
// },
// "meta": [
// {
// "type": "*meta.WhiteSpaceType",
// "value": " ",
// "tokenName": "NodeStart"
// }
// ],
// "Value": "null"
// }
// ]
@ -354,6 +352,31 @@ func ExamplePrettyJsonDumper() {
// },
// "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": "SemiColonToken"
@ -369,31 +392,6 @@ func ExamplePrettyJsonDumper() {
// },
// "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"