From f45e60bb2f40c2a3781960aae1420189a797c749 Mon Sep 17 00:00:00 2001 From: helly Date: Sat, 9 Jul 2005 18:28:47 +0000 Subject: [PATCH] - Make expression "[^]" work --- actions.cc | 8 +++++++- test/input4.c | 25 +++++++++++++++++++++++++ test/input4.re | 7 +++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100755 test/input4.c create mode 100755 test/input4.re diff --git a/actions.cc b/actions.cc index 14f787a2..29a4d160 100644 --- a/actions.cc +++ b/actions.cc @@ -677,8 +677,14 @@ RegExp *invToRE(SubStr s) { s.len--; s.str++; - + RegExp * any = ranToRE(SubStr("[\\000-\\377]")); + + if (s.len <= 2) + { + return any; + } + RegExp * ran = ranToRE(s); RegExp * inv = mkDiff(any, ran); diff --git a/test/input4.c b/test/input4.c new file mode 100755 index 00000000..53bcb0be --- /dev/null +++ b/test/input4.c @@ -0,0 +1,25 @@ +/* Generated by re2c */ +#line 1 "input4.re" + +#line 5 "" +{ + YYCTYPE yych; + goto yy0; + ++YYCURSOR; +yy0: + if(YYLIMIT == YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + goto yy3; + +#line 3 "input4.re" +{ return 0; } +#line 17 "" +yy3: ++YYCURSOR; + goto yy4; +yy4: +#line 4 "input4.re" +{ return 1; } +#line 23 "" +} +#line 7 "input4.re" + diff --git a/test/input4.re b/test/input4.re new file mode 100755 index 00000000..9b6ca087 --- /dev/null +++ b/test/input4.re @@ -0,0 +1,7 @@ +/*!re2c + +[] { return 0; } +[^] { return 1; } +[\000-\377] { return 2; } + +*/ -- 2.40.0