aboutsummaryrefslogtreecommitdiff
path: root/driver/parser_test.go
diff options
context:
space:
mode:
authorRyo Nihei <nihei.dev@gmail.com>2022-03-28 01:30:49 +0900
committerRyo Nihei <nihei.dev@gmail.com>2022-03-28 01:45:11 +0900
commit1746609e248151d575f6e3913ad5023fd421bfff (patch)
tree9312ac986191b3798125e2d3cc41518601d9b9e2 /driver/parser_test.go
parentFollow golangci-lint (diff)
downloadurubu-1746609e248151d575f6e3913ad5023fd421bfff.tar.gz
urubu-1746609e248151d575f6e3913ad5023fd421bfff.tar.xz
Simplify the syntax of #ast directive
This change allows using the simple syntax of the directive like `#ast $1 $3...` instead of `#ast #(foo $1 $3...)`.
Diffstat (limited to 'driver/parser_test.go')
-rw-r--r--driver/parser_test.go23
1 files changed, 4 insertions, 19 deletions
diff --git a/driver/parser_test.go b/driver/parser_test.go
index 89d0e79..3f67bf2 100644
--- a/driver/parser_test.go
+++ b/driver/parser_test.go
@@ -322,10 +322,10 @@ fragment words: "[A-Za-z\u{0020}]+";
%name test
list
- : "\[" elems "]" #ast #(list $2...)
+ : "\[" elems "]" #ast $2...
;
elems
- : elems "," id #ast #(elems $1... $3)
+ : elems "," id #ast $1... $3
| id
;
whitespace: "\u{0020}+" #skip;
@@ -353,21 +353,6 @@ id: "[A-Za-z]+";
termNode("id", "Langly"),
),
},
- // The first element of a tree structure must be the same ID as an LHS of a production.
- {
- specSrc: `
-%name test
-
-s
- : foo #ast #(start $1)
- ;
-foo
- : bar
- ;
-bar: "bar";
-`,
- specErr: true,
- },
// An ast action cannot be applied to a terminal symbol.
{
specSrc: `
@@ -377,7 +362,7 @@ s
: foo
;
foo
- : "foo" #ast #(s $1...)
+ : "foo" #ast $1...
;
`,
specErr: true,
@@ -388,7 +373,7 @@ foo
%name test
s
- : foo #ast #(s $1...)
+ : foo #ast $1...
;
foo: "foo";
`,