aboutsummaryrefslogtreecommitdiff
path: root/spec/parser_test.go
diff options
context:
space:
mode:
authorRyo Nihei <nihei.dev@gmail.com>2021-07-22 20:30:23 +0900
committerRyo Nihei <nihei.dev@gmail.com>2021-07-22 20:30:23 +0900
commit0baa69676ca83dbb4fe7241478a6ecf6c85418a9 (patch)
treef337b96c1d2c4742647b9e4570d34788014333d3 /spec/parser_test.go
parentWrite a description file (diff)
downloadcotia-0baa69676ca83dbb4fe7241478a6ecf6c85418a9.tar.gz
cotia-0baa69676ca83dbb4fe7241478a6ecf6c85418a9.tar.xz
Add literal pattern syntax and change tree structure syntax
- Literal patterns don't interpret the special characters of regular expressions. In other words, 'abc|def' matches only `abc|def`, not `abc` or `def`. - Change tree structure syntax from '(...) to #(...).
Diffstat (limited to 'spec/parser_test.go')
-rw-r--r--spec/parser_test.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/spec/parser_test.go b/spec/parser_test.go
index d7ca30f..1c99716 100644
--- a/spec/parser_test.go
+++ b/spec/parser_test.go
@@ -319,11 +319,11 @@ s: foo; foo: "foo";
caption: "a grammar can contain 'ast' directives",
src: `
s
- : foo bar_list #ast '(s $1 $2)
+ : foo bar_list #ast #(s $1 $2)
;
bar_list
- : bar_list bar #ast '(bar_list $1... $2)
- | bar #ast '(bar_list $1)
+ : bar_list bar #ast #(bar_list $1... $2)
+ | bar #ast #(bar_list $1)
;
foo: "foo";
bar: "bar";
@@ -361,7 +361,7 @@ bar: "bar";
caption: "the first element of a tree structure must be an ID",
src: `
s
- : foo #ast '($1)
+ : foo #ast #($1)
;
foo: "foo";
`,
@@ -371,7 +371,7 @@ foo: "foo";
caption: "a tree structure must be closed by ')'",
src: `
s
- : foo #ast '(s $1
+ : foo #ast #(s $1
;
foo: "foo";
`,
@@ -382,7 +382,7 @@ foo: "foo";
src: `
#mode default
exp
- : exp "\+" id #ast '(exp $1 $2)
+ : exp "\+" id #ast #(exp $1 $2)
| id
;
whitespace: "\u{0020}+" #skip;