diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2021-10-28 01:41:21 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2021-10-28 01:41:21 +0900 |
commit | 83bc2b1307d0e73424437649d26b804f20a83c38 (patch) | |
tree | 1abb5a6067a66548917fb6cb38335aafc5cd4fe1 /driver/conflict_test.go | |
parent | Use maleeni v0.5.1 (diff) | |
download | cotia-83bc2b1307d0e73424437649d26b804f20a83c38.tar.gz cotia-83bc2b1307d0e73424437649d26b804f20a83c38.tar.xz |
Add name directive to specify a grammar name
Diffstat (limited to 'driver/conflict_test.go')
-rw-r--r-- | driver/conflict_test.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/driver/conflict_test.go b/driver/conflict_test.go index 0fa00f6..87b7b17 100644 --- a/driver/conflict_test.go +++ b/driver/conflict_test.go @@ -20,6 +20,8 @@ func TestParserWithConflicts(t *testing.T) { { caption: "when a shift/reduce conflict occurred, we prioritize the shift action", specSrc: ` +%name test + expr : expr assign expr | id @@ -48,6 +50,8 @@ assign: '='; { caption: "when a reduce/reduce conflict occurred, we prioritize the production defined earlier in the grammar", specSrc: ` +%name test + s : a | b @@ -71,6 +75,8 @@ id: "[A-Za-z0-9_]+"; { caption: "left associativities defined earlier in the grammar have higher precedence", specSrc: ` +%name test + %left mul %left add @@ -116,6 +122,8 @@ mul: '*'; { caption: "left associativities defined in the same line have the same precedence", specSrc: ` +%name test + %left add sub expr @@ -160,6 +168,8 @@ sub: '-'; { caption: "right associativities defined earlier in the grammar have higher precedence", specSrc: ` +%name test + %right r1 %right r2 @@ -206,6 +216,8 @@ id: "[A-Za-z0-9_]+"; { caption: "right associativities defined in the same line have the same precedence", specSrc: ` +%name test + %right r1 r2 expr @@ -251,6 +263,8 @@ id: "[A-Za-z0-9_]+"; { caption: "left and right associativities can be mixed", specSrc: ` +%name test + %left mul div %left add sub %right assign |