summaryrefslogtreecommitdiff
path: root/parser/dot.go
diff options
context:
space:
mode:
Diffstat (limited to 'parser/dot.go')
-rw-r--r--parser/dot.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/parser/dot.go b/parser/dot.go
index f486cd5..11d5014 100644
--- a/parser/dot.go
+++ b/parser/dot.go
@@ -50,7 +50,10 @@ func (n *Node) astDot(out io.Writer, label string) {
for _, c := range nod.Child {
anc[c] = nod
}
- name := strings.ReplaceAll(nod.Name(), `"`, `\"`)
+ name := ""
+ if nod.Token != nil {
+ name = strings.ReplaceAll(nod.Name(), `"`, `\"`)
+ }
fmt.Fprintf(out, "%d [label=\"%s\"]; ", index[nod], name)
if anc[nod] != nil {
fmt.Fprintf(out, "%d -> %d; ", index[anc[nod]], index[nod])