nitcc: tests prefixes
authorJean Privat <jean@pryen.org>
Thu, 23 Jun 2016 01:33:21 +0000 (21:33 -0400)
committerJean Privat <jean@pryen.org>
Thu, 23 Jun 2016 20:19:07 +0000 (16:19 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

contrib/nitcc/tests/lexer-prefixes.sablecc [new file with mode: 0644]
contrib/nitcc/tests/sav/lexer-prefixes.input.res [new file with mode: 0644]

diff --git a/contrib/nitcc/tests/lexer-prefixes.sablecc b/contrib/nitcc/tests/lexer-prefixes.sablecc
new file mode 100644 (file)
index 0000000..9e38697
--- /dev/null
@@ -0,0 +1,13 @@
+Grammar x;
+
+Lexer
+    m = 'abcd' | 'x'* 'y'+ 'z'?;
+    pm = Prefixes(m) Except '';
+    err = ('a'..'z') Except pm;
+
+blank = #10 | #13 | #32;
+Parser
+Ignored blank;
+
+    s = p+;
+    p = pm | err;
diff --git a/contrib/nitcc/tests/sav/lexer-prefixes.input.res b/contrib/nitcc/tests/sav/lexer-prefixes.input.res
new file mode 100644 (file)
index 0000000..108c10a
--- /dev/null
@@ -0,0 +1,52 @@
+Start
+  s
+    Nodes[Np]
+      p_0
+        pm@(1:1-1:2)='a'
+      p_1
+        err@(1:3-1:4)='b'
+      p_0
+        pm@(1:5-1:7)='ab'
+      p_0
+        pm@(1:8-1:11)='abc'
+      p_0
+        pm@(1:12-1:16)='abcd'
+      p_0
+        pm@(1:17-1:21)='abcd'
+      p_1
+        err@(1:21-1:22)='e'
+      p_0
+        pm@(1:23-1:24)='a'
+      p_0
+        pm@(1:24-1:26)='ab'
+      p_1
+        err@(1:26-1:27)='b'
+      p_1
+        err@(1:27-1:28)='c'
+      p_1
+        err@(1:28-1:29)='c'
+      p_1
+        err@(1:29-1:30)='d'
+      p_1
+        err@(1:30-1:31)='d'
+      p_0
+        pm@(2:1-2:2)='x'
+      p_0
+        pm@(2:3-2:4)='y'
+      p_1
+        err@(2:5-2:6)='z'
+      p_0
+        pm@(2:7-2:10)='xyz'
+      p_0
+        pm@(2:11-2:12)='x'
+      p_1
+        err@(2:12-2:13)='z'
+      p_0
+        pm@(2:14-2:16)='xy'
+      p_0
+        pm@(2:17-2:19)='yz'
+      p_0
+        pm@(2:20-2:25)='xxyyz'
+      p_1
+        err@(2:25-2:26)='z'
+  Eof@(3:1-3:1)=''