]> granicus.if.org Git - re2c/commitdiff
- Changed to allow /* comments with -c switch.
authorhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Mon, 18 Feb 2008 11:33:12 +0000 (11:33 +0000)
committerhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Mon, 18 Feb 2008 11:33:12 +0000 (11:33 +0000)
re2c/CHANGELOG
re2c/bootstrap/scanner.cc
re2c/code.cc
re2c/htdocs/index.html
re2c/test/yyaccept_missing.bci.c [new file with mode: 0755]
re2c/test/yyaccept_missing.bci.re [new file with mode: 0755]

index e719f5b1da64bcc305dedd71aa24fe9f9e313167..e218d26f60c9a6e647b1e877e486384dd429dbe6 100644 (file)
@@ -1,3 +1,7 @@
+Version 0.13.3 (2008-??-??)
+---------------------------
+- Changed to allow /* comments with -c switch.
+
 Version 0.13.2 (2008-02-14)
 ---------------------------
 - Added flag --case-inverted.
index 97d1f05931d930a614fa5138a828dbf6d69c1f07..3e114c850d291b8588054128906392abd4f098c6 100644 (file)
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.2.dev on Thu Feb 14 20:22:44 2008 */
+/* Generated by re2c 0.13.2.dev on Fri Feb 15 01:08:50 2008 */
 /* $Id$ */
 #include <stdlib.h>
 #include <string.h>
index aebe97d3d59afd1b3ea513d0606ad7e12525e405..2add39e04dee403a2ed0e2da88904f27cc7baa27 100644 (file)
@@ -596,6 +596,7 @@ void Accept::emitBinary(std::ostream &o, uint ind, uint l, uint r, bool &readCh)
        {
                uint m = (l + r) >> 1;
 
+               assert(bUsedYYAccept);
                o << indent(ind) << "if (" << mapCodeName["yyaccept"] << " <= " << m << ") {\n";
                emitBinary(o, ++ind, l, m, readCh);
                o << indent(--ind) << "} else {\n";
@@ -1623,7 +1624,10 @@ void DFA::emit(std::ostream &o, uint& ind, const RegExpMap* specMap, const std::
        delete head->action;
        head->action = NULL;
 
-       bUsedYYAccept = false;
+       if (!cFlag)
+       {
+               bUsedYYAccept = false;
+       }
        
        uint start_label = next_label;
 
index f524a3ad141e7bb1b5e98084905bce28070b5066..92094e18507c318a36022de89ad89889a548d444 100755 (executable)
@@ -80,6 +80,10 @@ fixes which were incorporated. <a href=
 </ul>
 <hr />
 <h1>Changelog</h1>
+<h2>2008-??-??: 0.13.3</h2>
+<ul>
+<li>Changed to allow /* comments with -c switch.</li>
+</ul>
 <h2>2008-02-14: 0.13.2</h2>
 <ul>
 <li>Added flag --case-inverted.</li>
diff --git a/re2c/test/yyaccept_missing.bci.c b/re2c/test/yyaccept_missing.bci.c
new file mode 100755 (executable)
index 0000000..df45363
--- /dev/null
@@ -0,0 +1,168 @@
+/* Generated by re2c */
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#define YYGETCONDITION()  yy_state
+#define YYSETCONDITION(s) yy_state = s
+#define YYCTYPE         char
+#define YYCURSOR        p
+#define YYLIMIT         (s+l)
+#define YYMARKER        q
+#define YYFILL(n)
+
+#define STATE(name)  yyc##name
+
+static enum YYCONDTYPE yy_state;
+
+
+enum YYCONDTYPE {
+       yycINITIAL,
+       yycST_VALUE,
+};
+
+
+int scan(char *s, int l)
+{
+       char *p = s;
+       char *q = 0;
+       char *t;
+
+       for(;;)
+       {
+               t = p;
+
+               {
+                       YYCTYPE yych;
+                       unsigned int yyaccept = 0;
+                       if (YYGETCONDITION() < 1) {
+                               goto yyc_INITIAL;
+                       } else {
+                               goto yyc_ST_VALUE;
+                       }
+/* *********************************** */
+yyc_INITIAL:
+
+                       if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
+                       yych = *YYCURSOR;
+                       if (yych <= 0x00) goto yy4;
+                       if (yych != '$') goto yy6;
+                       ++YYCURSOR;
+                       if ((yych = *YYCURSOR) <= '@') goto yy3;
+                       if (yych <= 'Z') goto yy7;
+                       if (yych <= '`') goto yy3;
+                       if (yych <= 'z') goto yy7;
+yy3:
+                       { printf("ERR\n");      return 1; }
+yy4:
+                       ++YYCURSOR;
+                       { printf("EOF\n");      return 0; }
+yy6:
+                       yych = *++YYCURSOR;
+                       goto yy3;
+yy7:
+                       ++YYCURSOR;
+                       {
+               printf("FOUND %s\n", t);
+               continue;
+       }
+/* *********************************** */
+yyc_ST_VALUE:
+                       {
+                               static const unsigned char yybm[] = {
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0, 128,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                       128,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                                         0,   0,   0,   0,   0,   0,   0,   0, 
+                               };
+                               if (YYLIMIT == YYCURSOR) YYFILL(1);
+                               yych = *(YYMARKER = YYCURSOR);
+                               if (yybm[0+yych] & 128) {
+                                       goto yy14;
+                               }
+                               if (yych == '$') goto yy12;
+yy11:
+                               {
+               YYSETCONDITION(STATE(INITIAL));
+               printf("Found spaces\n");
+       }
+yy12:
+                               ++YYCURSOR;
+                               if (YYLIMIT == YYCURSOR) YYFILL(1);
+                               yych = *YYCURSOR;
+                               if (yych <= '@') goto yy13;
+                               if (yych <= 'Z') goto yy16;
+                               if (yych <= '`') goto yy13;
+                               if (yych <= 'z') goto yy16;
+yy13:
+                               YYCURSOR = YYMARKER;
+                               if (yyaccept <= 0) {
+                                       goto yy11;
+                               } else {
+                                       goto yy17;
+                               }
+yy14:
+                               ++YYCURSOR;
+                               if (YYLIMIT == YYCURSOR) YYFILL(1);
+                               yych = *YYCURSOR;
+                               if (yybm[0+yych] & 128) {
+                                       goto yy14;
+                               }
+                               goto yy11;
+yy16:
+                               yyaccept = 1;
+                               YYMARKER = ++YYCURSOR;
+                               if (YYLIMIT == YYCURSOR) YYFILL(1);
+                               yych = *YYCURSOR;
+                               if (yych == '$') goto yy12;
+yy17:
+                               {
+               printf("Found $ or $\\<x>\n");
+               continue;
+       }
+                       }
+               }
+
+       }
+}
+
+int main(int argc, char **argv)
+{
+       if (argc > 1)
+       {
+               return scan(argv[1], strlen(argv[1]));
+       }
+       else
+       {
+               fprintf(stderr, "%s <expr>\n", argv[0]);
+               return 1;
+       }
+}
diff --git a/re2c/test/yyaccept_missing.bci.re b/re2c/test/yyaccept_missing.bci.re
new file mode 100755 (executable)
index 0000000..842a27e
--- /dev/null
@@ -0,0 +1,67 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#define YYGETCONDITION()  yy_state
+#define YYSETCONDITION(s) yy_state = s
+#define YYCTYPE         char
+#define YYCURSOR        p
+#define YYLIMIT         (s+l)
+#define YYMARKER        q
+#define YYFILL(n)
+
+#define STATE(name)  yyc##name
+
+static enum YYCONDTYPE yy_state;
+
+/*!types:re2c */
+
+int scan(char *s, int l)
+{
+       char *p = s;
+       char *q = 0;
+       char *t;
+
+       for(;;)
+       {
+               t = p;
+/*!re2c
+       re2c:indent:top = 2;
+
+       TABS_AND_SPACES = [ \t]*;
+       LITERAL_DOLLAR = "$"[a-zA-Z];
+
+       <INITIAL>LITERAL_DOLLAR {
+               printf("FOUND %s\n", t);
+               continue;
+       }
+
+       <ST_VALUE>LITERAL_DOLLAR+ {
+               printf("Found $ or $\\<x>\n");
+               continue;
+       }
+
+       <ST_VALUE>TABS_AND_SPACES {
+               YYSETCONDITION(STATE(INITIAL));
+               printf("Found spaces\n");
+       }
+
+       <INITIAL>"\000"         { printf("EOF\n");      return 0; }
+       <INITIAL>[^]                    { printf("ERR\n");      return 1; }
+
+*/
+       }
+}
+
+int main(int argc, char **argv)
+{
+       if (argc > 1)
+       {
+               return scan(argv[1], strlen(argv[1]));
+       }
+       else
+       {
+               fprintf(stderr, "%s <expr>\n", argv[0]);
+               return 1;
+       }
+}