]> granicus.if.org Git - re2c/commitdiff
- Make expression "[^]" work
authorhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Sat, 9 Jul 2005 18:28:47 +0000 (18:28 +0000)
committerhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Sat, 9 Jul 2005 18:28:47 +0000 (18:28 +0000)
actions.cc
test/input4.c [new file with mode: 0755]
test/input4.re [new file with mode: 0755]

index 14f787a2d0b7e02fb73d3360d8b7abed8ef6d65b..29a4d16012f9be2145709a8530e6623c7a505d40 100644 (file)
@@ -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 (executable)
index 0000000..53bcb0b
--- /dev/null
@@ -0,0 +1,25 @@
+/* Generated by re2c */
+#line 1 "input4.re"
+
+#line 5 "<stdout>"
+{
+       YYCTYPE yych;
+       goto yy0;
+       ++YYCURSOR;
+yy0:
+       if(YYLIMIT == YYCURSOR) YYFILL(1);
+       yych = *YYCURSOR;
+       goto yy3;
+
+#line 3 "input4.re"
+{ return 0; }
+#line 17 "<stdout>"
+yy3:   ++YYCURSOR;
+       goto yy4;
+yy4:
+#line 4 "input4.re"
+{ return 1; }
+#line 23 "<stdout>"
+}
+#line 7 "input4.re"
+
diff --git a/test/input4.re b/test/input4.re
new file mode 100755 (executable)
index 0000000..9b6ca08
--- /dev/null
@@ -0,0 +1,7 @@
+/*!re2c
+
+[]   { return 0; }
+[^]  { return 1; }
+[\000-\377] { return 2; }
+
+*/