aboutsummaryrefslogtreecommitdiff
path: root/driver/parser_test.go
diff options
context:
space:
mode:
authorRyo Nihei <nihei.dev@gmail.com>2022-06-10 16:41:41 +0900
committerRyo Nihei <nihei.dev@gmail.com>2022-06-11 19:09:19 +0900
commit7403c18fbc04f3045df1e69b63d7ffd5f04d77db (patch)
tree0933a8e875bac01b1b5b385b5069eb069aaad219 /driver/parser_test.go
parentSupport testable tree output in vartan-parse command (diff)
downloadurubu-7403c18fbc04f3045df1e69b63d7ffd5f04d77db.tar.gz
urubu-7403c18fbc04f3045df1e69b63d7ffd5f04d77db.tar.xz
Remove the kind field from a node corresponding to an anonymous terminal symbol
Diffstat (limited to 'driver/parser_test.go')
-rw-r--r--driver/parser_test.go20
1 files changed, 12 insertions, 8 deletions
diff --git a/driver/parser_test.go b/driver/parser_test.go
index 5c7addd..9e232f7 100644
--- a/driver/parser_test.go
+++ b/driver/parser_test.go
@@ -18,6 +18,10 @@ func termNode(kind string, text string, children ...*Node) *Node {
}
}
+func anonTermNode(text string, children ...*Node) *Node {
+ return termNode("", text, children...)
+}
+
func errorNode() *Node {
return &Node{
Type: NodeTypeError,
@@ -65,7 +69,7 @@ id: "[A-Za-z_][0-9A-Za-z_]*";
nonTermNode("term",
nonTermNode("term",
nonTermNode("factor",
- termNode("x_3", "("),
+ anonTermNode("("),
nonTermNode("expr",
nonTermNode("expr",
nonTermNode("term",
@@ -74,10 +78,10 @@ id: "[A-Za-z_][0-9A-Za-z_]*";
),
),
),
- termNode("x_1", "+"),
+ anonTermNode("+"),
nonTermNode("term",
nonTermNode("factor",
- termNode("x_3", "("),
+ anonTermNode("("),
nonTermNode("expr",
nonTermNode("expr",
nonTermNode("term",
@@ -86,27 +90,27 @@ id: "[A-Za-z_][0-9A-Za-z_]*";
),
),
),
- termNode("x_1", "+"),
+ anonTermNode("+"),
nonTermNode("term",
nonTermNode("factor",
termNode("id", "c"),
),
),
),
- termNode("x_4", ")"),
+ anonTermNode(")"),
),
),
),
- termNode("x_4", ")"),
+ anonTermNode(")"),
),
),
- termNode("x_2", "*"),
+ anonTermNode("*"),
nonTermNode("factor",
termNode("id", "d"),
),
),
),
- termNode("x_1", "+"),
+ anonTermNode("+"),
nonTermNode("term",
nonTermNode("factor",
termNode("id", "e"),