diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2021-07-15 00:48:15 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2021-07-15 00:48:15 +0900 |
commit | 6a18024f4fa3b96044d50e6308dad5e78128a9c3 (patch) | |
tree | 84f91a26abee8df1083a94cb5aa9b55f75e13486 /driver/parser_test.go | |
parent | Allow directives to take multiple parameters (diff) | |
download | cotia-6a18024f4fa3b96044d50e6308dad5e78128a9c3.tar.gz cotia-6a18024f4fa3b96044d50e6308dad5e78128a9c3.tar.xz |
Add testing for the driver
The driver can reduce productions that have the empty alternative and can generate a CST (and AST) node.
Diffstat (limited to 'driver/parser_test.go')
-rw-r--r-- | driver/parser_test.go | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/driver/parser_test.go b/driver/parser_test.go index 8713893..3dec508 100644 --- a/driver/parser_test.go +++ b/driver/parser_test.go @@ -104,6 +104,50 @@ id: "[A-Za-z_][0-9A-Za-z_]*"; ), ), }, + // The driver can reduce productions that have the empty alternative and can generate a CST (and AST) node. + { + specSrc: ` +s + : foo bar + ; +foo + : + ; +bar + : bar_text + | + ; +bar_text: "bar"; +`, + src: ``, + cst: nonTermNode("s", + termNode("foo", ""), + termNode("bar", ""), + ), + }, + // The driver can reduce productions that have the empty alternative and can generate a CST (and AST) node. + { + specSrc: ` +s + : foo bar + ; +foo + : + ; +bar + : bar_text + | + ; +bar_text: "bar"; +`, + src: `bar`, + cst: nonTermNode("s", + termNode("foo", ""), + nonTermNode("bar", + termNode("bar_text", "bar"), + ), + ), + }, { specSrc: ` mode_tran_seq |