diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2021-08-22 15:39:27 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2021-08-22 15:44:03 +0900 |
commit | 4d879b95d5368d578a39baaefba0de743a764105 (patch) | |
tree | a0e78f5c9916405545f1e7b139f9427b1cd190cc /driver/parser_test.go | |
parent | Resolve conflicts by default rules (diff) | |
download | urubu-4d879b95d5368d578a39baaefba0de743a764105.tar.gz urubu-4d879b95d5368d578a39baaefba0de743a764105.tar.xz |
Support %left and %right to specify precedences and associativities
Diffstat (limited to 'driver/parser_test.go')
-rw-r--r-- | driver/parser_test.go | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/driver/parser_test.go b/driver/parser_test.go index d50ee85..9467d6c 100644 --- a/driver/parser_test.go +++ b/driver/parser_test.go @@ -395,6 +395,58 @@ b: "a"; `, specErr: true, }, + // Invalid associativity type + { + specSrc: ` +%foo + +s + : a + ; + +a: 'a'; +`, + specErr: true, + }, + // Associativity needs at least one symbol. + { + specSrc: ` +%left + +s + : a + ; + +a: 'a'; +`, + specErr: true, + }, + // Associativity cannot take an undefined symbol. + { + specSrc: ` +%left b + +s + : a + ; + +a: 'a'; +`, + specErr: true, + }, + // Associativity cannot take a non-terminal symbol. + { + specSrc: ` +%left s + +s + : a + ; + +a: 'a'; +`, + specErr: true, + }, } classes := []grammar.Class{ |