[refactoring] dumper: print node position and tokens
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -4,11 +4,29 @@ import (
|
||||
"github.com/z7zmey/php-parser/pkg/ast"
|
||||
"github.com/z7zmey/php-parser/pkg/ast/traverser"
|
||||
"github.com/z7zmey/php-parser/pkg/ast/visitor"
|
||||
"github.com/z7zmey/php-parser/pkg/position"
|
||||
"github.com/z7zmey/php-parser/pkg/token"
|
||||
"os"
|
||||
)
|
||||
|
||||
func ExampleDump() {
|
||||
stxTree := &ast.Root{
|
||||
Node: ast.Node{
|
||||
Tokens: token.Collection{
|
||||
token.Start: []token.Token{
|
||||
{
|
||||
ID: token.T_WHITESPACE,
|
||||
Value: []byte(" "),
|
||||
},
|
||||
},
|
||||
},
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 0,
|
||||
EndPos: 1,
|
||||
},
|
||||
},
|
||||
Stmts: []ast.Vertex{
|
||||
&ast.Identifier{},
|
||||
&ast.Parameter{
|
||||
@@ -25,6 +43,22 @@ func ExampleDump() {
|
||||
|
||||
//output:
|
||||
//&ast.Root{
|
||||
// Node: ast.Node{
|
||||
// Tokens: token.Collection{
|
||||
// token.Start: []token.Token{
|
||||
// {
|
||||
// ID: token.T_WHITESPACE,
|
||||
// Value: []byte(" "),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// Position: &position.Position{
|
||||
// StartLine: 1,
|
||||
// EndLine: 1,
|
||||
// StartPos: 0,
|
||||
// EndPos: 1,
|
||||
// },
|
||||
// },
|
||||
// Stmts: []ast.Vertex{
|
||||
// &ast.Identifier{
|
||||
// Value: "",
|
||||
|
||||
Reference in New Issue
Block a user