#70: [php7] inherit meta.Data at expr.FunctionCall, expr.StaticCall, expr.ConstFetch, expr.ArrayDimFetch, expr.MethodCall, expr.PropertyFetch, expr.StaticPropertyFetch, expr.ArrayItem

This commit is contained in:
z7zmey 2018-12-31 18:27:46 +02:00
parent a0dda154bf
commit 4abd14d2a6
6 changed files with 274 additions and 190 deletions

File diff suppressed because it is too large Load Diff

View File

@ -4290,6 +4290,9 @@ function_call:
// save position
$$.SetPosition(yylex.(*Parser).positionBuilder.NewNodesPosition($1, $2))
// save comments
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| class_name T_PAAMAYIM_NEKUDOTAYIM member_name argument_list
@ -4301,6 +4304,7 @@ function_call:
// save comments
$2.Meta.SetTokenName(meta.PaamayimNekudotayimToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -4313,6 +4317,7 @@ function_call:
// save comments
$2.Meta.SetTokenName(meta.PaamayimNekudotayimToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -4322,6 +4327,7 @@ function_call:
// save position
$$.SetPosition(yylex.(*Parser).positionBuilder.NewNodesPosition($1, $2))
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -4378,8 +4384,8 @@ exit_expr:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
// save comments
$1.Meta.SetTokenName(meta.OpenParenthesisToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.OpenParenthesisToken)
yylex.(*Parser).prependMetaToken($$, $1, meta.OpenParenthesisToken)
$1.Meta.SetTokenName(meta.OpenParenthesisToken).PrependTo($$.GetMeta())
$3.Meta.SetTokenName(meta.CloseParenthesisToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $3, meta.CloseParenthesisToken)
@ -4658,6 +4664,9 @@ constant:
// save position
$$.SetPosition(yylex.(*Parser).positionBuilder.NewNodePosition($1))
// save comments
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| class_name T_PAAMAYIM_NEKUDOTAYIM identifier
@ -4673,6 +4682,8 @@ constant:
$2.Meta.SetTokenName(meta.PaamayimNekudotayimToken).AppendTo($$.GetMeta())
$3.Meta.SetTokenName(meta.NodeStart).AppendTo(target.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| variable_class_name T_PAAMAYIM_NEKUDOTAYIM identifier
@ -4688,6 +4699,8 @@ constant:
$2.Meta.SetTokenName(meta.PaamayimNekudotayimToken).AppendTo($$.GetMeta())
$3.Meta.SetTokenName(meta.NodeStart).AppendTo(target.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
;
@ -4770,8 +4783,8 @@ callable_expr:
$$ = $2;
// save comments
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.NodeStart)
yylex.(*Parser).prependMetaToken($$, $1, meta.NodeStart)
$1.Meta.SetTokenName(meta.NodeStart).PrependTo($$.GetMeta())
$3.Meta.SetTokenName(meta.NodeEnd).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $3, meta.NodeEnd)
@ -4800,11 +4813,13 @@ callable_variable:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
// save comments
$2.Meta.SetTokenName(meta.OpenSquareBracket).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $2, meta.OpenSquareBracket)
yylex.(*Parser).prependMetaToken($$, $2, meta.OpenSquareBracket)
$2.Meta.SetTokenName(meta.OpenSquareBracket).PrependTo($$.GetMeta())
$4.Meta.SetTokenName(meta.CloseSquareBracket).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $4, meta.CloseSquareBracket)
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| constant '[' optional_expr ']'
@ -4815,11 +4830,13 @@ callable_variable:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
// save comments
$2.Meta.SetTokenName(meta.OpenSquareBracket).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $2, meta.OpenSquareBracket)
yylex.(*Parser).prependMetaToken($$, $2, meta.OpenSquareBracket)
$2.Meta.SetTokenName(meta.OpenSquareBracket).PrependTo($$.GetMeta())
$4.Meta.SetTokenName(meta.CloseSquareBracket).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $4, meta.CloseSquareBracket)
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| dereferencable '{' expr '}'
@ -4830,11 +4847,13 @@ callable_variable:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
// save comments
$2.Meta.SetTokenName(meta.OpenCurlyBracesToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $2, meta.OpenCurlyBracesToken)
yylex.(*Parser).prependMetaToken($$, $2, meta.OpenCurlyBracesToken)
$2.Meta.SetTokenName(meta.OpenCurlyBracesToken).PrependTo($$.GetMeta())
$4.Meta.SetTokenName(meta.CloseCurlyBracesToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $4, meta.CloseCurlyBracesToken)
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| dereferencable T_OBJECT_OPERATOR property_name argument_list
@ -4847,6 +4866,8 @@ callable_variable:
// save comments
$2.Meta.SetTokenName(meta.ObjectOperatorToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| function_call
@ -4880,6 +4901,8 @@ variable:
// save comments
$2.Meta.SetTokenName(meta.ObjectOperatorToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
;
@ -4943,6 +4966,8 @@ static_member:
// save comments
$2.Meta.SetTokenName(meta.PaamayimNekudotayimToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| variable_class_name T_PAAMAYIM_NEKUDOTAYIM simple_variable
@ -4955,6 +4980,8 @@ static_member:
// save comments
$2.Meta.SetTokenName(meta.PaamayimNekudotayimToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
;
@ -4974,11 +5001,13 @@ new_variable:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
// save comments
$2.Meta.SetTokenName(meta.OpenSquareBracket).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $2, meta.OpenSquareBracket)
yylex.(*Parser).prependMetaToken($$, $2, meta.OpenSquareBracket)
$2.Meta.SetTokenName(meta.OpenSquareBracket).PrependTo($$.GetMeta())
$4.Meta.SetTokenName(meta.CloseSquareBracket).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $4, meta.CloseSquareBracket)
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| new_variable '{' expr '}'
@ -4989,11 +5018,13 @@ new_variable:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
// save comments
$2.Meta.SetTokenName(meta.OpenCurlyBracesToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $2, meta.OpenCurlyBracesToken)
yylex.(*Parser).prependMetaToken($$, $2, meta.OpenCurlyBracesToken)
$2.Meta.SetTokenName(meta.OpenCurlyBracesToken).PrependTo($$.GetMeta())
$4.Meta.SetTokenName(meta.CloseCurlyBracesToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $4, meta.CloseCurlyBracesToken)
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| new_variable T_OBJECT_OPERATOR property_name
@ -5006,6 +5037,8 @@ new_variable:
// save comments
$2.Meta.SetTokenName(meta.ObjectOperatorToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| class_name T_PAAMAYIM_NEKUDOTAYIM simple_variable
@ -5018,6 +5051,8 @@ new_variable:
// save comments
$2.Meta.SetTokenName(meta.PaamayimNekudotayimToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| new_variable T_PAAMAYIM_NEKUDOTAYIM simple_variable
@ -5030,6 +5065,8 @@ new_variable:
// save comments
$2.Meta.SetTokenName(meta.PaamayimNekudotayimToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
;
@ -5161,6 +5198,8 @@ array_pair:
// save comments
$2.Meta.SetTokenName(meta.DoubleArrowToken).AppendTo($$.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr
@ -5170,6 +5209,8 @@ array_pair:
// save position
$$.SetPosition(yylex.(*Parser).positionBuilder.NewNodePosition($1))
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| expr T_DOUBLE_ARROW '&' variable
@ -5185,6 +5226,8 @@ array_pair:
$2.Meta.SetTokenName(meta.DoubleArrowToken).AppendTo($$.GetMeta())
$3.Meta.SetTokenName(meta.NodeStart).AppendTo(reference.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| '&' variable
@ -5197,7 +5240,7 @@ array_pair:
reference.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
// save comments
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(reference.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -5217,6 +5260,8 @@ array_pair:
$4.Meta.SetTokenName(meta.OpenParenthesisToken).AppendTo(list.GetMeta())
$6.Meta.SetTokenName(meta.CloseParenthesisToken).AppendTo(list.GetMeta())
$1.GetMeta().Cut(newInheritMetaFilter()).PrependTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| T_LIST '(' array_pair_list ')'
@ -5230,7 +5275,7 @@ array_pair:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
// save comments
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(list.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
$2.Meta.SetTokenName(meta.OpenParenthesisToken).AppendTo(list.GetMeta())
$4.Meta.SetTokenName(meta.CloseParenthesisToken).AppendTo(list.GetMeta())
@ -5307,7 +5352,6 @@ encaps_var:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
// save comments
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
$2.Meta.SetTokenName(meta.OpenSquareBracket).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $2, meta.OpenCurlyBracesToken)
@ -5330,7 +5374,6 @@ encaps_var:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
// save comments
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
$2.Meta.SetTokenName(meta.ObjectOperatorToken).AppendTo($$.GetMeta())
$3.Meta.SetTokenName(meta.NodeStart).AppendTo(fetch.GetMeta())
@ -5347,7 +5390,6 @@ encaps_var:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
// save comments
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.NodeStart)
$3.Meta.SetTokenName(meta.NodeEnd).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $3, meta.NodeEnd)
@ -5366,7 +5408,6 @@ encaps_var:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
// save comments
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.NodeStart)
$2.Meta.SetTokenName(meta.NodeStart).AppendTo(name.GetMeta())
$3.Meta.SetTokenName(meta.NodeEnd).AppendTo($$.GetMeta())
@ -5386,7 +5427,6 @@ encaps_var:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $6))
// save comments
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.NodeStart)
$3.Meta.SetTokenName(meta.OpenSquareBracket).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $3, meta.OpenSquareBracket)
@ -5402,7 +5442,6 @@ encaps_var:
$$ = $2;
// save comments
$1.Meta.SetTokenName(meta.NodeStart).PrependTo($$.GetMeta())
yylex.(*Parser).prependMetaToken($$, $1, meta.NodeStart)
$3.Meta.SetTokenName(meta.NodeEnd).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $3, meta.NodeEnd)
@ -5436,6 +5475,9 @@ encaps_var_offset:
// save position
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
// save comments
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
| '-' T_NUM_STRING

View File

@ -117,12 +117,12 @@ 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}
// | "NamespacedName": "null"
// | "Meta":
// | " " before "NodeStart"
// | "Parts":
// | [*name.NamePart]
// | "Position": Pos{Line: 5-5 Pos: 86-89}

View File

@ -346,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,
@ -353,19 +366,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,
// },
// },
// Parts: []node.Node{
// &name.NamePart{
// Position: &position.Position{

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":"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},"Constant":{"type":"*name.Name","position":{"startPos":86,"endPos":89,"startLine":5,"endLine":5},"namespacedName":"null","meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"NodeStart"}],"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"}}}]}}]}]}]}
// {"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

@ -289,6 +289,13 @@ func ExamplePrettyJsonDumper() {
// "startLine": 5,
// "endLine": 5
// },
// "meta": [
// {
// "type": "*meta.WhiteSpaceType",
// "value": " ",
// "tokenName": "NodeStart"
// }
// ],
// "Constant": {
// "type": "*name.Name",
// "position": {
@ -298,13 +305,6 @@ func ExamplePrettyJsonDumper() {
// "endLine": 5
// },
// "namespacedName": "null",
// "meta": [
// {
// "type": "*meta.WhiteSpaceType",
// "value": " ",
// "tokenName": "NodeStart"
// }
// ],
// "Parts": [
// {
// "type": "*name.NamePart",