aboutsummaryrefslogtreecommitdiff
path: root/driver/syntax_error_test.go
diff options
context:
space:
mode:
authorRyo Nihei <nihei.dev@gmail.com>2022-11-05 16:52:37 +0900
committerRyo Nihei <nihei.dev@gmail.com>2022-11-05 16:52:37 +0900
commita6001b32cf805c4e72e05adc37ee60272a600bf1 (patch)
treebcee870f1008689adfa104fb1e97e6414201eb94 /driver/syntax_error_test.go
parentRemove alias system (diff)
downloadurubu-a6001b32cf805c4e72e05adc37ee60272a600bf1.tar.gz
urubu-a6001b32cf805c4e72e05adc37ee60272a600bf1.tar.xz
Remove anonymous symbol system
Remove unimportant features to tidy up the specification.
Diffstat (limited to 'driver/syntax_error_test.go')
-rw-r--r--driver/syntax_error_test.go47
1 files changed, 19 insertions, 28 deletions
diff --git a/driver/syntax_error_test.go b/driver/syntax_error_test.go
index ada1fb0..683e355 100644
--- a/driver/syntax_error_test.go
+++ b/driver/syntax_error_test.go
@@ -26,7 +26,8 @@ s
: foo
;
-foo: 'foo';
+foo
+ : 'foo';
`,
src: `bar`,
synErrCount: 1,
@@ -37,9 +38,9 @@ foo: 'foo';
#name test;
seq
- : seq elem ';'
- | elem ';'
- | error ';' #recover
+ : seq elem semi_colon
+ | elem semi_colon
+ | error semi_colon #recover
;
elem
: a b c
@@ -47,6 +48,8 @@ elem
ws #skip
: "[\u{0009}\u{0020}]+";
+semi_colon
+ : ';';
a
: 'a';
b
@@ -63,9 +66,9 @@ c
#name test;
seq
- : seq elem ';'
- | elem ';'
- | error ';' #recover
+ : seq elem semi_colon
+ | elem semi_colon
+ | error semi_colon #recover
;
elem
: a b c
@@ -73,6 +76,8 @@ elem
ws #skip
: "[\u{0009}\u{0020}]+";
+semi_colon
+ : ';';
a
: 'a';
b
@@ -91,9 +96,9 @@ c
#name test;
seq
- : seq elem ';'
- | elem ';'
- | error '*' '*' ';'
+ : seq elem semi_colon
+ | elem semi_colon
+ | error star star semi_colon
;
elem
: a b c
@@ -101,6 +106,10 @@ elem
ws #skip
: "[\u{0009}\u{0020}]+";
+semi_colon
+ : ';';
+star
+ : '*';
a
: 'a';
b
@@ -241,24 +250,6 @@ foo
"<eof>",
},
},
- {
- caption: "when an anonymous symbol is expected, an expected symbol list contains an auto-generated name with the prefix `x_`",
- specSrc: `
-#name test;
-
-s
- : foo 'bar'
- ;
-
-foo
- : 'foo';
-`,
- src: `foobaz`,
- cause: `baz`,
- expected: []string{
- "x_1",
- },
- },
}
for i, tt := range tests {
t.Run(fmt.Sprintf("#%v", i), func(t *testing.T) {