Version 0.10.3 (????-??-??)
---------------------------
+- Added -g switch to support gcc's computed goto's.
- Changed to use nested if's instead of "switch(yyaccept)" in -s mode.
Version 0.10.2 (2006-05-01)
if (mapRules.size() > 1)
{
bUsedYYAccept = true;
-
- if (sFlag)
+
+ if (gFlag)
+ {
+ o << indent(ind++) << "{\n";
+ o << indent(ind++) << "static void *yytarget[" << mapRules.size() << "] = {\n";
+ for (RuleMap::const_iterator it = mapRules.begin(); it != mapRules.end(); ++it)
+ {
+ o << indent(ind) << "&&yy" << it->second->label << ",\n";
+ vUsedLabels.insert(it->second->label);
+ }
+ o << indent(--ind) << "};\n";
+ o << indent(ind) << "goto *yytarget[yyaccept];\n";
+ o << indent(--ind) << "}\n";
+ }
+ else if (sFlag)
{
emitBinary(o, ind, 0, mapRules.size() - 1, readCh);
}
extern bool dFlag;
extern bool eFlag;
extern bool fFlag;
+extern bool gFlag;
extern bool iFlag;
extern bool sFlag;
extern bool wFlag;
bool dFlag = false;
bool eFlag = false;
bool fFlag = false;
+bool gFlag = false;
bool iFlag = false;
bool sFlag = false;
bool wFlag = false;
mbo_opt_struct('d', 0, "debug-output"),
mbo_opt_struct('e', 0, "ecb"),
mbo_opt_struct('f', 0, "storable-state"),
+ mbo_opt_struct('g', 0, "computed-gotos"),
mbo_opt_struct('h', 0, "help"),
mbo_opt_struct('i', 0, "no-debug-info"),
mbo_opt_struct('o', 1, "output"),
"\n"
"-f --storable-state Generate a scanner that supports storable states.\n"
"\n"
+ "-g --computed-gotos Implies -b. Generate computed goto code (only useable \n"
+ " with gcc).\n"
+ "\n"
"-i --no-debug-info Do not generate '#line' info (usefull for versioning).\n"
"\n"
"-o --output=output Specify the output file instead of stdout\n"
{
case 'b':
- sFlag = true;
bFlag = true;
+ sFlag = true;
break;
case 'e':
}
break;
+ case 'g':
+ gFlag = true;
+ bFlag = true;
+ sFlag = true;
+ break;
+
case 'i':
iFlag = true;
break;
--- /dev/null
+/* Generated by re2c */
+#line 1 "input8.b.re"
+{
+
+#line 6 "<stdout>"
+ {
+ YYCTYPE yych;
+ unsigned int yyaccept = 0;
+
+ if((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
+ yych = *YYCURSOR;
+ if(yych == 0x0A) goto yy4;
+ yyaccept = 0;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if(yych <= 0x00) goto yy6;
+ if(yych != 0x0A) goto yy8;
+yy3:
+#line 6 "input8.b.re"
+ { return 1; }
+#line 21 "<stdout>"
+yy4:
+ ++YYCURSOR;
+#line 7 "input8.b.re"
+ { return 2; }
+#line 26 "<stdout>"
+yy6:
+ yyaccept = 1;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if(yych <= 0x00) goto yy10;
+ if(yych != 0x0A) goto yy11;
+yy7:
+#line 5 "input8.b.re"
+ { return 0; }
+#line 35 "<stdout>"
+yy8:
+ yych = *++YYCURSOR;
+ if(yych <= 0x00) goto yy10;
+ if(yych != 0x0A) goto yy11;
+yy9:
+ YYCURSOR = YYMARKER;
+ if(yyaccept <= 0) {
+ goto yy3;
+ } else {
+ goto yy7;
+ }
+yy10:
+ yych = *++YYCURSOR;
+ if(yych <= 0x00) goto yy12;
+ goto yy7;
+yy11:
+ yych = *++YYCURSOR;
+ if(yych >= 0x01) goto yy9;
+yy12:
+ ++YYCURSOR;
+ yych = *YYCURSOR;
+ goto yy7;
+ }
+}
+#line 9 "input8.b.re"
+
--- /dev/null
+/*!re2c
+
+any = [\000-\377];
+
+.{1,3}"\000" { return 0; }
+. { return 1; }
+any { return 2; }
+
+*/
--- /dev/null
+/* Generated by re2c */
+#line 1 "input8.g.re"
+{
+
+#line 6 "<stdout>"
+ {
+ YYCTYPE yych;
+ unsigned int yyaccept = 0;
+
+ if((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
+ yych = *YYCURSOR;
+ if(yych == 0x0A) goto yy4;
+ yyaccept = 0;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if(yych <= 0x00) goto yy6;
+ if(yych != 0x0A) goto yy8;
+yy3:
+#line 6 "input8.g.re"
+ { return 1; }
+#line 21 "<stdout>"
+yy4:
+ ++YYCURSOR;
+#line 7 "input8.g.re"
+ { return 2; }
+#line 26 "<stdout>"
+yy6:
+ yyaccept = 1;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if(yych <= 0x00) goto yy10;
+ if(yych != 0x0A) goto yy11;
+yy7:
+#line 5 "input8.g.re"
+ { return 0; }
+#line 35 "<stdout>"
+yy8:
+ yych = *++YYCURSOR;
+ if(yych <= 0x00) goto yy10;
+ if(yych != 0x0A) goto yy11;
+yy9:
+ YYCURSOR = YYMARKER;
+ {
+ static void *yytarget[2] = {
+ &&yy3,
+ &&yy7,
+ };
+ goto *yytarget[yyaccept];
+ }
+yy10:
+ yych = *++YYCURSOR;
+ if(yych <= 0x00) goto yy12;
+ goto yy7;
+yy11:
+ yych = *++YYCURSOR;
+ if(yych >= 0x01) goto yy9;
+yy12:
+ ++YYCURSOR;
+ yych = *YYCURSOR;
+ goto yy7;
+ }
+}
+#line 9 "input8.g.re"
+
--- /dev/null
+/*!re2c
+
+any = [\000-\377];
+
+.{1,3}"\000" { return 0; }
+. { return 1; }
+any { return 2; }
+
+*/