diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2021-08-19 19:46:33 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2021-08-19 19:46:33 +0900 |
commit | 6c2036e86fc37a5361d6daf64b914f1af66559ef (patch) | |
tree | 0b1a51a0ee8834918bbcd0f5fe189787fd649a1e | |
parent | Make the functions that test the automaton common (diff) | |
download | cotia-6c2036e86fc37a5361d6daf64b914f1af66559ef.tar.gz cotia-6c2036e86fc37a5361d6daf64b914f1af66559ef.tar.xz |
Fix indents of a tree
-rw-r--r-- | README.md | 24 | ||||
-rw-r--r-- | driver/parser.go | 2 |
2 files changed, 13 insertions, 13 deletions
@@ -56,20 +56,20 @@ $ echo -n 'foo + bar * baz * 100' | vartan parse expr.json expr ├─ expr │ └─ term -│ └─ factor -│ └─ id "foo" +│ └─ factor +│ └─ id "foo" ├─ add_op "+" └─ term - ├─ term - │ ├─ term - │ │ └─ factor - │ │ └─ id "bar" - │ ├─ mul_op "*" - │ └─ factor - │ └─ id "baz" - ├─ mul_op "*" - └─ factor - └─ number "100" + ├─ term + │ ├─ term + │ │ └─ factor + │ │ └─ id "bar" + │ ├─ mul_op "*" + │ └─ factor + │ └─ id "baz" + ├─ mul_op "*" + └─ factor + └─ number "100" ``` When `vartan parse` command successfully parses the input data, it prints a CST or an AST (if any). diff --git a/driver/parser.go b/driver/parser.go index 1e46606..e8201c1 100644 --- a/driver/parser.go +++ b/driver/parser.go @@ -42,7 +42,7 @@ func printTree(w io.Writer, node *Node, ruledLine string, childRuledLinePrefix s var prefix string if i >= num-1 { - prefix = " " + prefix = " " } else { prefix = "│ " } |