]> granicus.if.org Git - re2c/commitdiff
- . must not include \n
authorhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Sat, 9 Jul 2005 23:33:40 +0000 (23:33 +0000)
committerhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Sat, 9 Jul 2005 23:33:40 +0000 (23:33 +0000)
actions.cc
bootstrap/scanner.cc
re.h
scanner.re
test/input7.c
test/input7.re
test/input8.c
test/input8.re

index 29a4d16012f9be2145709a8530e6623c7a505d40..334da2b204df786fef74b5f1e625e0e370676eb1 100644 (file)
@@ -694,6 +694,18 @@ RegExp *invToRE(SubStr s)
        return inv;
 }
 
+RegExp *mkDot()
+{
+       RegExp * any = ranToRE(SubStr("[\\000-\\377]"));
+       RegExp * ran = matchChar('\n');
+       RegExp * inv = mkDiff(any, ran);
+       
+       delete ran;
+       delete any;
+       
+       return inv;
+}
+
 char *RuleOp::type = "RuleOp";
 
 RuleOp::RuleOp(RegExp *e, RegExp *c, Token *t, uint a)
index 32ae6fa575b06688827976451cc91b9ec70fed20..f8a3373de7cc7bbe288103b91fdd72c62d86d841 100644 (file)
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.9.9.dev on Sat Jul  9 20:41:37 2005 */
+/* Generated by re2c 0.9.9.dev on Sun Jul 10 01:26:44 2005 */
 #line 1 "scanner.re"
 /* $Id$ */
 #include <stdlib.h>
@@ -368,7 +368,7 @@ yy51:       ++YYCURSOR;
 yy52:
 #line 197 "scanner.re"
 { cur = cursor;
-                                 yylval.regexp = ranToRE("[\\000-\\377]");
+                                 yylval.regexp = mkDot();
                                  return RANGE;
                                }
 #line 375 "scanner.cc"
diff --git a/re.h b/re.h
index 22015823c5f8f0f4b43ffd0c0e6209230ccf456b..1bfc2c624d132e4e4ec3f2a24154e5b9b8a84d39 100644 (file)
--- a/re.h
+++ b/re.h
@@ -292,6 +292,7 @@ public:
 
 extern void genCode(std::ostream&, RegExp*);
 extern RegExp *mkDiff(RegExp*, RegExp*);
+extern RegExp *mkDot();
 extern RegExp *strToRE(SubStr);
 extern RegExp *ranToRE(SubStr);
 extern RegExp *invToRE(SubStr);
index 1086e20629e50a680ac85566dfc020ec2cb776ab..5d9fd3cc355421bfefa2e168945733ac3ddc743a 100644 (file)
@@ -195,7 +195,7 @@ scan:
                                }
 
        "."                     { cur = cursor;
-                                 yylval.regexp = ranToRE("[\\000-\\377]");
+                                 yylval.regexp = mkDot();
                                  return RANGE;
                                }
 
index 300284c302d3db7c64230e75f907fcfe3d8d7112..61df86c9c40423ebbb467a0b40fbe532ecbc179b 100755 (executable)
@@ -9,13 +9,22 @@
 yy0:
        if(YYLIMIT == YYCURSOR) YYFILL(1);
        yych = *YYCURSOR;
-       goto yy2;
+       switch(yych){
+       case 0x0A:      goto yy4;
+       default:        goto yy2;
+       }
 yy2:   ++YYCURSOR;
        goto yy3;
 yy3:
-#line 3 "input7.re"
+#line 5 "input7.re"
 { return 0; }
-#line 19 "<stdout>"
+#line 22 "<stdout>"
+yy4:   ++YYCURSOR;
+       goto yy5;
+yy5:
+#line 6 "input7.re"
+{ return 1; }
+#line 28 "<stdout>"
 }
-#line 5 "input7.re"
+#line 8 "input7.re"
 
index 4af565dbb9bc26dce2b573199ee84c8fc5bb8ceb..2f4f41713570cd3f25892ef12a7f2bd607c9b4c7 100755 (executable)
@@ -1,5 +1,8 @@
 /*!re2c
 
+any = [\000-\377];
+
 .       { return 0; }
+any     { return 1; }
 
 */
index a3296dcc7fd2e8bc9c0809638468336ed5d34e80..293089a6c2fb68eba7900abccbd27891c63e29e4 100755 (executable)
 yy0:
        if((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
        yych = *YYCURSOR;
-       goto yy2;
+       switch(yych){
+       case 0x0A:      goto yy4;
+       default:        goto yy2;
+       }
 yy2:   yyaccept = 0;
        yych = *(YYMARKER = ++YYCURSOR);
-       if(yych <= 0x00)        goto yy4;
-       goto yy6;
+       switch(yych){
+       case 0x00:      goto yy6;
+       case 0x0A:      goto yy3;
+       default:        goto yy8;
+       }
 yy3:
-#line 4 "input8.re"
+#line 6 "input8.re"
 { return 1; }
-#line 22 "<stdout>"
-yy4:   yyaccept = 1;
-       yych = *(YYMARKER = ++YYCURSOR);
-       if(yych <= 0x00)        goto yy7;
-       goto yy8;
+#line 28 "<stdout>"
+yy4:   ++YYCURSOR;
+       goto yy5;
 yy5:
-#line 3 "input8.re"
+#line 7 "input8.re"
+{ return 2; }
+#line 34 "<stdout>"
+yy6:   yyaccept = 1;
+       yych = *(YYMARKER = ++YYCURSOR);
+       switch(yych){
+       case 0x00:      goto yy10;
+       case 0x0A:      goto yy7;
+       default:        goto yy11;
+       }
+yy7:
+#line 5 "input8.re"
 { return 0; }
-#line 30 "<stdout>"
-yy6:   yych = *++YYCURSOR;
-       if(yych >= 0x01)        goto yy8;
-       goto yy7;
-yy7:   yych = *++YYCURSOR;
-       if(yych <= 0x00)        goto yy10;
-       goto yy5;
+#line 45 "<stdout>"
 yy8:   yych = *++YYCURSOR;
-       if(yych <= 0x00)        goto yy10;
-       goto yy9;
+       switch(yych){
+       case 0x00:      goto yy10;
+       case 0x0A:      goto yy9;
+       default:        goto yy11;
+       }
 yy9:   YYCURSOR = YYMARKER;
        switch(yyaccept){
-       case 1: goto yy5;
+       case 1: goto yy7;
        case 0: goto yy3;
        }
-yy10:  ++YYCURSOR;
+yy10:  yych = *++YYCURSOR;
+       if(yych <= 0x00)        goto yy12;
+       goto yy7;
+yy11:  yych = *++YYCURSOR;
+       if(yych >= 0x01)        goto yy9;
+       goto yy12;
+yy12:  ++YYCURSOR;
        yych = *YYCURSOR;
-       goto yy5;
+       goto yy7;
 }
-#line 6 "input8.re"
+#line 9 "input8.re"
 
index 9d62783ef6d1f4ef6d93afa8cdece1197628afce..2a57f414478e0b01710e47f20c1d7cf738e90581 100755 (executable)
@@ -1,6 +1,9 @@
 /*!re2c
 
+any = [\000-\377];
+
 .{1,3}"\000"       { return 0; }
 .                  { return 1; }
+any                { return 2; }
 
 */