[refactoring] remove scanner token
This commit is contained in:
@@ -16,6 +16,10 @@ func (n *Node) GetNode() *Node {
|
||||
return n
|
||||
}
|
||||
|
||||
func (n *Node) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
// Root node
|
||||
type Root struct {
|
||||
Node
|
||||
|
||||
@@ -121,7 +121,7 @@ func (v *Dump) printNode(n *ast.Node) {
|
||||
key := token.Position(k)
|
||||
|
||||
v.printIndent(v.indent + 2)
|
||||
v.print("token." + key.String() + ": []token.Token{\n")
|
||||
v.print("token." + key.String() + ": []*token.Token{\n")
|
||||
|
||||
for _, tkn := range n.Tokens[key] {
|
||||
v.printIndent(v.indent + 3)
|
||||
|
||||
@@ -13,7 +13,7 @@ func ExampleDump() {
|
||||
stxTree := &ast.Root{
|
||||
Node: ast.Node{
|
||||
Tokens: token.Collection{
|
||||
token.Start: []token.Token{
|
||||
token.Start: []*token.Token{
|
||||
{
|
||||
ID: token.T_WHITESPACE,
|
||||
Value: []byte(" "),
|
||||
@@ -44,7 +44,7 @@ func ExampleDump() {
|
||||
//&ast.Root{
|
||||
// Node: ast.Node{
|
||||
// Tokens: token.Collection{
|
||||
// token.Start: []token.Token{
|
||||
// token.Start: []*token.Token{
|
||||
// {
|
||||
// ID: token.T_WHITESPACE,
|
||||
// Value: []byte(" "),
|
||||
|
||||
14
pkg/ast/visitor/filter_tokens.go
Normal file
14
pkg/ast/visitor/filter_tokens.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package visitor
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/pkg/ast"
|
||||
)
|
||||
|
||||
type FilterTokens struct {
|
||||
Null
|
||||
}
|
||||
|
||||
func (v *FilterTokens) EnterNode(n ast.Vertex) bool {
|
||||
n.GetNode().Tokens = nil
|
||||
return true
|
||||
}
|
||||
Reference in New Issue
Block a user