From 82d1833970e33aa96dfbb8bc872d34bfe45d1732 Mon Sep 17 00:00:00 2001 From: Ulya Trofimovich Date: Sun, 25 Aug 2019 10:41:58 +0100 Subject: [PATCH] Added some tests for 're2c:sentinel' configuration. --- test/eof/sentinel_01.i.c | 5 +++++ test/eof/sentinel_01.i.re | 39 +++++++++++++++++++++++++++++++++++++++ test/eof/sentinel_02.i.c | 1 + test/eof/sentinel_02.i.re | 9 +++++++++ 4 files changed, 54 insertions(+) create mode 100644 test/eof/sentinel_01.i.c create mode 100644 test/eof/sentinel_01.i.re create mode 100644 test/eof/sentinel_02.i.c create mode 100644 test/eof/sentinel_02.i.re diff --git a/test/eof/sentinel_01.i.c b/test/eof/sentinel_01.i.c new file mode 100644 index 00000000..8b7f6d02 --- /dev/null +++ b/test/eof/sentinel_01.i.c @@ -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 index 00000000..a45e6c03 --- /dev/null +++ b/test/eof/sentinel_01.i.re @@ -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 index 00000000..0ba886b3 --- /dev/null +++ b/test/eof/sentinel_02.i.c @@ -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 index 00000000..51e88b5e --- /dev/null +++ b/test/eof/sentinel_02.i.re @@ -0,0 +1,9 @@ +/*!re2c + re2c:yyfill:enable = 0; + re2c:sentinel = 256; + + str = ['] [^']* [']; + + str {} + * {} +*/ -- 2.40.0