aboutsummaryrefslogtreecommitdiff
path: root/driver/conflict_test.go
diff options
context:
space:
mode:
authorRyo Nihei <nihei.dev@gmail.com>2021-10-28 01:41:21 +0900
committerRyo Nihei <nihei.dev@gmail.com>2021-10-28 01:41:21 +0900
commit83bc2b1307d0e73424437649d26b804f20a83c38 (patch)
tree1abb5a6067a66548917fb6cb38335aafc5cd4fe1 /driver/conflict_test.go
parentUse maleeni v0.5.1 (diff)
downloadurubu-83bc2b1307d0e73424437649d26b804f20a83c38.tar.gz
urubu-83bc2b1307d0e73424437649d26b804f20a83c38.tar.xz
Add name directive to specify a grammar name
Diffstat (limited to 'driver/conflict_test.go')
-rw-r--r--driver/conflict_test.go14
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