]> granicus.if.org Git - re2c/commitdiff
Added some tests for 're2c:sentinel' configuration.
authorUlya Trofimovich <skvadrik@gmail.com>
Sun, 25 Aug 2019 09:41:58 +0000 (10:41 +0100)
committerUlya Trofimovich <skvadrik@gmail.com>
Sun, 25 Aug 2019 09:41:58 +0000 (10:41 +0100)
test/eof/sentinel_01.i.c [new file with mode: 0644]
test/eof/sentinel_01.i.re [new file with mode: 0644]
test/eof/sentinel_02.i.c [new file with mode: 0644]
test/eof/sentinel_02.i.re [new file with mode: 0644]

diff --git a/test/eof/sentinel_01.i.c b/test/eof/sentinel_01.i.c
new file mode 100644 (file)
index 0000000..8b7f6d0
--- /dev/null
@@ -0,0 +1,5 @@
+eof/sentinel_01.i.re:7:8: warning: sentinel symbol 0 occurs in the middle of the rule (note: if a different sentinel symbol is used, specify it with 're2c:sentinel' configuration) [-Wsentinel-in-midrule]
+eof/sentinel_01.i.re:13:8: error: sentinel symbol 0 occurs in the middle of the rule [-Werror-sentinel-in-midrule]
+eof/sentinel_01.i.re:19:8: warning: sentinel symbol 0 occurs in the middle of the rule (note: if a different sentinel symbol is used, specify it with 're2c:sentinel' configuration) [-Wsentinel-in-midrule]
+eof/sentinel_01.i.re:25:8: error: sentinel symbol 39 occurs in the middle of the rule [-Werror-sentinel-in-midrule]
+eof/sentinel_01.i.re:37:8: error: sentinel symbol 255 occurs in the middle of the rule [-Werror-sentinel-in-midrule]
diff --git a/test/eof/sentinel_01.i.re b/test/eof/sentinel_01.i.re
new file mode 100644 (file)
index 0000000..a45e6c0
--- /dev/null
@@ -0,0 +1,39 @@
+/*!re2c
+    re2c:yyfill:enable = 0;
+    str = ['] [^'\xFE]* ['];
+*/
+
+/*!re2c
+    str {}
+    * {}
+*/
+
+/*!re2c
+    re2c:sentinel = 0;
+    str {}
+    * {}
+*/
+
+/*!re2c
+    re2c:sentinel = -1;
+    str {}
+    * {}
+*/
+
+/*!re2c
+    re2c:sentinel = 39; // single quote
+    str {}
+    * {}
+*/
+
+/*!re2c
+    re2c:sentinel = 254; // \xFE
+    str {}
+    * {}
+*/
+
+/*!re2c
+    re2c:sentinel = 255;
+    str {}
+    * {}
+*/
diff --git a/test/eof/sentinel_02.i.c b/test/eof/sentinel_02.i.c
new file mode 100644 (file)
index 0000000..0ba886b
--- /dev/null
@@ -0,0 +1 @@
+re2c: error: sentinel exceeds maximum code unit value for given encoding
diff --git a/test/eof/sentinel_02.i.re b/test/eof/sentinel_02.i.re
new file mode 100644 (file)
index 0000000..51e88b5
--- /dev/null
@@ -0,0 +1,9 @@
+/*!re2c
+    re2c:yyfill:enable = 0;
+    re2c:sentinel = 256;
+
+    str = ['] [^']* ['];
+
+    str {}
+    * {}
+*/