dump comment anchor
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"io"
|
||||
"reflect"
|
||||
|
||||
"github.com/z7zmey/php-parser/comment"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/parser"
|
||||
|
||||
@@ -44,7 +45,7 @@ func (d Dumper) EnterNode(w walker.Walkable) bool {
|
||||
if c := d.Comments[n]; len(c) > 0 {
|
||||
fmt.Fprintf(d.Writer, "%v\"Comments\":\n", d.Indent+" ")
|
||||
for _, cc := range c {
|
||||
fmt.Fprintf(d.Writer, "%v%q\n", d.Indent+" ", cc)
|
||||
fmt.Fprintf(d.Writer, "%v%q before %q\n", d.Indent+" ", cc, comment.TokenNames[cc.TokenName()])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ func ExampleDumper() {
|
||||
//| [*expr.Variable]
|
||||
//| "Position": Pos{Line: 8-8 Pos: 124-127};
|
||||
//| "Comments":
|
||||
//| "// some comment\n"
|
||||
//| "// some comment\n" before "VariableToken"
|
||||
//| "VarName":
|
||||
//| [*node.Identifier]
|
||||
//| "Position": Pos{Line: 8-8 Pos: 124-127};
|
||||
|
||||
Reference in New Issue
Block a user