From 0a4cea6e3513b12059e5faf3a1ac91636fcedc04 Mon Sep 17 00:00:00 2001 From: helly Date: Sun, 7 May 2006 18:37:48 +0000 Subject: [PATCH] - Changed to use nested if's instead of "switch(yyaccept)" in -s mode. --- CHANGELOG | 1 + code.cc | 83 ++++++++++-------- dfa.h | 6 ++ test/bug1479044.b.c | 23 +++-- test/bug1479044.c | 8 +- test/bug1479044.s.c | 23 +++-- test/c.c | 8 +- test/cmmap.c | 8 +- test/cnokw.c | 8 +- test/cunroll.c | 8 +- test/input8.c | 4 +- test/modula.c | 10 +-- test/parse_date.b.c | 198 ++++++++++++++++++++++++++++++------------- test/parse_date.c | 54 ++++++------ test/parse_date.db.c | 198 ++++++++++++++++++++++++++++++------------- test/parse_date.s.c | 198 ++++++++++++++++++++++++++++++------------- test/repeater.c | 4 +- test/scanner.c | 14 +-- test/scanner.fs.c | 90 ++++++++++++-------- test/scanner.s.c | 90 ++++++++++++-------- 20 files changed, 667 insertions(+), 369 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 18c1bff6..a00975d5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,6 @@ Version 0.10.3 (????-??-??) --------------------------- +- Changed to use nested if's instead of "switch(yyaccept)" in -s mode. Version 0.10.2 (2006-05-01) --------------------------- diff --git a/code.cc b/code.cc index fee804b6..c9a89fe2 100644 --- a/code.cc +++ b/code.cc @@ -485,57 +485,68 @@ Accept::Accept(State *x, uint n, uint *s, State **r) ; } -void Accept::emit(std::ostream &o, uint ind, bool &readCh) const +void Accept::genRuleMap() { - bool first = true; - uint cases = 0; - for (uint i = 0; i < nRules; ++i) { if (saves[i] != ~0u) { - cases++; - bUsedYYAccept |= saves[i] != 0; + mapRules[saves[i]] = rules[i]; } } +} - for (uint i = 0; i < nRules; ++i) +void Accept::emitBinary(std::ostream &o, uint ind, uint l, uint r, bool &readCh) const +{ + if (l < r) { - if (saves[i] != ~0u) - { - if (first) - { - first = false; - bUsedYYMarker = true; - o << indent(ind) << "YYCURSOR = YYMARKER;\n"; - if (bUsedYYAccept && cases > 1) - { - o << indent(ind) << "switch(yyaccept) {\n"; - } - } + uint m = (l + r) >> 1; - if (cases > 1) + o << indent(ind) << "if(yyaccept <= " << m << ") {\n"; + emitBinary(o, ++ind, l, m, readCh); + o << indent(--ind) << "} else {\n"; + emitBinary(o, ++ind, m + 1, r, readCh); + o << indent(--ind) << "}\n"; + } + else + { + genGoTo(o, ind, state, mapRules.find(l)->second, readCh); + } +} + +void Accept::emit(std::ostream &o, uint ind, bool &readCh) const +{ + if (mapRules.size() > 0) + { + bUsedYYMarker = true; + o << indent(ind) << "YYCURSOR = YYMARKER;\n"; + + if (mapRules.size() > 1) + { + bUsedYYAccept = true; + + if (sFlag) { - o << indent(ind) << "case " << saves[i] << ":\t"; - genGoTo(o, 0, state, rules[i], readCh); + emitBinary(o, ind, 0, mapRules.size() - 1, readCh); } else { - if (bUsedYYAccept) { - o << indent(ind++) << "if (yyaccept == " << saves[i] << ") {\n"; + o << indent(ind) << "switch(yyaccept) {\n"; + + for (RuleMap::const_iterator it = mapRules.begin(); it != mapRules.end(); ++it) + { + o << indent(ind) << "case " << it->first << ": \t"; + genGoTo(o, 0, state, it->second, readCh); } - genGoTo(o, ind, state, rules[i], readCh); + + o << indent(ind) << "}\n"; } } - } - - if (!first && bUsedYYAccept) - { - if (cases == 1) + else { - ind--; + // no need to write if statement here since there is only case 0. + genGoTo(o, ind, state, mapRules.find(0)->second, readCh); } - o << indent(ind) << "}\n"; } } @@ -1315,6 +1326,7 @@ void DFA::emit(std::ostream &o, uint ind) memset(rules, 0, (nRules)*sizeof(*rules)); State *accept = NULL; + Accept *accfixup = NULL; for (s = head; s; s = s->next) { @@ -1344,7 +1356,7 @@ void DFA::emit(std::ostream &o, uint ind) if (!ow) { ow = accept = new State; - (void) new Accept(accept, nRules, saves, rules); + accfixup = new Accept(accept, nRules, saves, rules); addState(&s->next, accept); } @@ -1352,6 +1364,11 @@ void DFA::emit(std::ostream &o, uint ind) } } } + + if (accfixup) + { + accfixup->genRuleMap(); + } // split ``base'' states into two parts for (s = head; s; s = s->next) diff --git a/dfa.h b/dfa.h index 57215d2f..32d6644e 100644 --- a/dfa.h +++ b/dfa.h @@ -3,6 +3,7 @@ #define _dfa_h #include +#include #include "re.h" namespace re2c @@ -100,13 +101,18 @@ class Accept: public Action { public: + typedef std::map RuleMap; + uint nRules; uint *saves; State **rules; + RuleMap mapRules; public: Accept(State*, uint, uint*, State**); void emit(std::ostream&, uint, bool&) const; + void emitBinary(std::ostream &o, uint ind, uint l, uint r, bool &readCh) const; + void genRuleMap(); #ifdef PEDANTIC private: diff --git a/test/bug1479044.b.c b/test/bug1479044.b.c index ebb2f587..41530d66 100755 --- a/test/bug1479044.b.c +++ b/test/bug1479044.b.c @@ -224,11 +224,18 @@ yy18: if(yych <= '9') goto yy22; yy19: YYCURSOR = YYMARKER; - switch(yyaccept) { - case 3: goto yy132; - case 2: goto yy107; - case 1: goto yy63; - case 0: goto yy3; + if(yyaccept <= 1) { + if(yyaccept <= 0) { + goto yy3; + } else { + goto yy63; + } + } else { + if(yyaccept <= 2) { + goto yy107; + } else { + goto yy132; + } } yy20: ++YYCURSOR; @@ -596,7 +603,7 @@ yy63: { return "edu"; } -#line 600 "" +#line 607 "" yy64: yych = *++YYCURSOR; if(yych != 't') goto yy33; @@ -932,7 +939,7 @@ yy107: { return "resnet"; } -#line 936 "" +#line 943 "" yy108: yych = *++YYCURSOR; if(yych != 't') goto yy19; @@ -1086,7 +1093,7 @@ yy132: { return "dsl"; } -#line 1090 "" +#line 1097 "" yy133: yych = *++YYCURSOR; if(yych != 's') goto yy19; diff --git a/test/bug1479044.c b/test/bug1479044.c index 64b351d7..3fc92cab 100755 --- a/test/bug1479044.c +++ b/test/bug1479044.c @@ -178,10 +178,10 @@ yy18: yy19: YYCURSOR = YYMARKER; switch(yyaccept) { - case 3: goto yy132; - case 2: goto yy107; - case 1: goto yy63; - case 0: goto yy3; + case 0: goto yy3; + case 1: goto yy63; + case 2: goto yy107; + case 3: goto yy132; } yy20: ++YYCURSOR; diff --git a/test/bug1479044.s.c b/test/bug1479044.s.c index ead37aba..6dc6a025 100755 --- a/test/bug1479044.s.c +++ b/test/bug1479044.s.c @@ -154,11 +154,18 @@ yy18: if(yych <= '9') goto yy22; yy19: YYCURSOR = YYMARKER; - switch(yyaccept) { - case 3: goto yy132; - case 2: goto yy107; - case 1: goto yy63; - case 0: goto yy3; + if(yyaccept <= 1) { + if(yyaccept <= 0) { + goto yy3; + } else { + goto yy63; + } + } else { + if(yyaccept <= 2) { + goto yy107; + } else { + goto yy132; + } } yy20: ++YYCURSOR; @@ -554,7 +561,7 @@ yy63: { return "edu"; } -#line 558 "" +#line 565 "" yy64: yych = *++YYCURSOR; if(yych != 't') goto yy33; @@ -900,7 +907,7 @@ yy107: { return "resnet"; } -#line 904 "" +#line 911 "" yy108: yych = *++YYCURSOR; if(yych != 't') goto yy19; @@ -1055,7 +1062,7 @@ yy132: { return "dsl"; } -#line 1059 "" +#line 1066 "" yy133: yych = *++YYCURSOR; if(yych != 's') goto yy19; diff --git a/test/c.c b/test/c.c index 7baa77e9..b45adbee 100644 --- a/test/c.c +++ b/test/c.c @@ -738,10 +738,10 @@ yy121: yy122: YYCURSOR = YYMARKER; switch(yyaccept) { - case 0: goto yy22; - case 3: goto yy134; - case 2: goto yy27; - case 1: goto yy25; + case 0: goto yy22; + case 1: goto yy25; + case 2: goto yy27; + case 3: goto yy134; } yy123: ++YYCURSOR; diff --git a/test/cmmap.c b/test/cmmap.c index d56fb7d4..94b4cbef 100644 --- a/test/cmmap.c +++ b/test/cmmap.c @@ -721,10 +721,10 @@ yy121: yy122: YYCURSOR = YYMARKER; switch(yyaccept) { - case 0: goto yy22; - case 3: goto yy134; - case 2: goto yy27; - case 1: goto yy25; + case 0: goto yy22; + case 1: goto yy25; + case 2: goto yy27; + case 3: goto yy134; } yy123: ++YYCURSOR; diff --git a/test/cnokw.c b/test/cnokw.c index 3c65222b..87e2711d 100644 --- a/test/cnokw.c +++ b/test/cnokw.c @@ -639,10 +639,10 @@ yy106: yy107: YYCURSOR = YYMARKER; switch(yyaccept) { - case 0: goto yy7; - case 3: goto yy119; - case 2: goto yy12; - case 1: goto yy10; + case 0: goto yy7; + case 1: goto yy10; + case 2: goto yy12; + case 3: goto yy119; } yy108: ++YYCURSOR; diff --git a/test/cunroll.c b/test/cunroll.c index 1db1de25..7b6d35f4 100644 --- a/test/cunroll.c +++ b/test/cunroll.c @@ -703,10 +703,10 @@ yy106: yy107: YYCURSOR = YYMARKER; switch(yyaccept) { - case 0: goto yy7; - case 3: goto yy119; - case 2: goto yy12; - case 1: goto yy10; + case 0: goto yy7; + case 1: goto yy10; + case 2: goto yy12; + case 3: goto yy119; } yy108: ++YYCURSOR; diff --git a/test/input8.c b/test/input8.c index 5aa2ea10..b198d8d0 100755 --- a/test/input8.c +++ b/test/input8.c @@ -51,8 +51,8 @@ yy8: yy9: YYCURSOR = YYMARKER; switch(yyaccept) { - case 1: goto yy7; - case 0: goto yy3; + case 0: goto yy3; + case 1: goto yy7; } yy10: yych = *++YYCURSOR; diff --git a/test/modula.c b/test/modula.c index 88a12c72..d79a852f 100644 --- a/test/modula.c +++ b/test/modula.c @@ -4029,11 +4029,11 @@ yy269: yy270: YYCURSOR = YYMARKER; switch(yyaccept) { - case 0: goto yy5; - case 3: goto yy294; - case 4: goto yy296; - case 2: goto yy276; - case 1: goto yy8; + case 0: goto yy5; + case 1: goto yy8; + case 2: goto yy276; + case 3: goto yy294; + case 4: goto yy296; } yy271: ++YYCURSOR; diff --git a/test/parse_date.b.c b/test/parse_date.b.c index cc3e2abe..6358c699 100755 --- a/test/parse_date.b.c +++ b/test/parse_date.b.c @@ -2178,34 +2178,110 @@ yy51: } yy53: YYCURSOR = YYMARKER; - switch(yyaccept) { - case 26: goto yy1310; - case 24: goto yy1279; - case 25: goto yy1287; - case 23: goto yy1203; - case 22: goto yy1200; - case 11: goto yy634; - case 20: goto yy1146; - case 21: goto yy1154; - case 13: goto yy784; - case 18: goto yy1043; - case 12: goto yy775; - case 8: goto yy420; - case 17: goto yy889; - case 6: goto yy363; - case 10: goto yy620; - case 16: goto yy943; - case 19: goto yy937; - case 15: goto yy916; - case 14: goto yy880; - case 9: goto yy526; - case 5: goto yy341; - case 4: goto yy172; - case 1: goto yy3; - case 7: goto yy385; - case 3: goto yy69; - case 2: goto yy46; - case 0: goto yy12; + if(yyaccept <= 13) { + if(yyaccept <= 6) { + if(yyaccept <= 3) { + if(yyaccept <= 1) { + if(yyaccept <= 0) { + goto yy12; + } else { + goto yy3; + } + } else { + if(yyaccept <= 2) { + goto yy46; + } else { + goto yy69; + } + } + } else { + if(yyaccept <= 5) { + if(yyaccept <= 4) { + goto yy172; + } else { + goto yy341; + } + } else { + goto yy363; + } + } + } else { + if(yyaccept <= 10) { + if(yyaccept <= 8) { + if(yyaccept <= 7) { + goto yy385; + } else { + goto yy420; + } + } else { + if(yyaccept <= 9) { + goto yy526; + } else { + goto yy620; + } + } + } else { + if(yyaccept <= 12) { + if(yyaccept <= 11) { + goto yy634; + } else { + goto yy775; + } + } else { + goto yy784; + } + } + } + } else { + if(yyaccept <= 20) { + if(yyaccept <= 17) { + if(yyaccept <= 15) { + if(yyaccept <= 14) { + goto yy880; + } else { + goto yy916; + } + } else { + if(yyaccept <= 16) { + goto yy943; + } else { + goto yy889; + } + } + } else { + if(yyaccept <= 19) { + if(yyaccept <= 18) { + goto yy1043; + } else { + goto yy937; + } + } else { + goto yy1146; + } + } + } else { + if(yyaccept <= 23) { + if(yyaccept <= 22) { + if(yyaccept <= 21) { + goto yy1154; + } else { + goto yy1200; + } + } else { + goto yy1203; + } + } else { + if(yyaccept <= 25) { + if(yyaccept <= 24) { + goto yy1279; + } else { + goto yy1287; + } + } else { + goto yy1310; + } + } + } } yy54: ++YYCURSOR; @@ -2357,7 +2433,7 @@ yy69: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 2361 "" +#line 2437 "" yy70: yych = *++YYCURSOR; if(yych == 'D') goto yy71; @@ -3210,7 +3286,7 @@ yy172: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 3214 "" +#line 3290 "" yy173: yych = *++YYCURSOR; if(yych == 'D') goto yy174; @@ -4710,7 +4786,7 @@ yy341: TIMELIB_DEINIT; return TIMELIB_WEEKDAY; } -#line 4714 "" +#line 4790 "" yy342: yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); @@ -4947,7 +5023,7 @@ yy363: TIMELIB_DEINIT; return TIMELIB_DATE_TEXT; } -#line 4951 "" +#line 5027 "" yy364: yych = *++YYCURSOR; if(yych <= 'm') { @@ -5156,7 +5232,7 @@ yy385: TIMELIB_DEINIT; return TIMELIB_SHORTDATE_WITH_TIME; } -#line 5160 "" +#line 5236 "" yy386: yyaccept = 7; yych = *(YYMARKER = ++YYCURSOR); @@ -5450,7 +5526,7 @@ yy420: TIMELIB_DEINIT; return TIMELIB_DATE_NO_DAY; } -#line 5454 "" +#line 5530 "" yy421: yyaccept = 6; yych = *(YYMARKER = ++YYCURSOR); @@ -5800,7 +5876,7 @@ yy446: TIMELIB_DEINIT; return TIMELIB_PG_TEXT; } -#line 5804 "" +#line 5880 "" yy447: yych = *++YYCURSOR; if(yych <= '/') goto yy446; @@ -7089,7 +7165,7 @@ yy526: TIMELIB_DEINIT; return TIMELIB_AGO; } -#line 7093 "" +#line 7169 "" yy527: yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); @@ -8975,7 +9051,7 @@ yy620: TIMELIB_DEINIT; return TIMELIB_DATE_TEXT; } -#line 8979 "" +#line 9055 "" yy621: yyaccept = 10; yych = *(YYMARKER = ++YYCURSOR); @@ -9086,7 +9162,7 @@ yy631: TIMELIB_DEINIT; return TIMELIB_TIME12; } -#line 9090 "" +#line 9166 "" yy632: yych = *++YYCURSOR; goto yy631; @@ -9123,7 +9199,7 @@ yy634: TIMELIB_DEINIT; return TIMELIB_TIME24_WITH_ZONE; } -#line 9127 "" +#line 9203 "" yy635: yyaccept = 11; yych = *(YYMARKER = ++YYCURSOR); @@ -9325,7 +9401,7 @@ yy660: TIMELIB_DEINIT; return TIMELIB_DATE_FULL; } -#line 9329 "" +#line 9405 "" yy661: yych = *++YYCURSOR; if(yych == 'M') goto yy662; @@ -9850,7 +9926,7 @@ yy729: TIMELIB_DEINIT; return TIMELIB_DATE_FULL_POINTED; } -#line 9854 "" +#line 9930 "" yy730: yych = *++YYCURSOR; if(yych <= '/') goto yy729; @@ -10378,7 +10454,7 @@ yy775: TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 10382 "" +#line 10458 "" yy776: yyaccept = 12; yych = *(YYMARKER = ++YYCURSOR); @@ -10460,7 +10536,7 @@ yy784: TIMELIB_DEINIT; return TIMELIB_AMERICAN; } -#line 10464 "" +#line 10540 "" yy785: yyaccept = 13; yych = *(YYMARKER = ++YYCURSOR); @@ -10663,7 +10739,7 @@ yy817: TIMELIB_DEINIT; return TIMELIB_CLF; } -#line 10667 "" +#line 10743 "" yy818: yych = *++YYCURSOR; if(yych <= '5') { @@ -10996,7 +11072,7 @@ yy867: TIMELIB_DEINIT; return TIMELIB_PG_TEXT; } -#line 11000 "" +#line 11076 "" yy869: yych = *++YYCURSOR; if(yych == 'V') goto yy862; @@ -11140,7 +11216,7 @@ yy880: TIMELIB_DEINIT; return TIMELIB_CLF; } -#line 11144 "" +#line 11220 "" yy881: yych = *++YYCURSOR; switch(yych){ @@ -11299,7 +11375,7 @@ yy889: TIMELIB_DEINIT; return TIMELIB_DATE_NO_DAY; } -#line 11303 "" +#line 11379 "" yy890: yych = *++YYCURSOR; if(yych == 'I') goto yy1021; @@ -11509,7 +11585,7 @@ yy910: TIMELIB_DEINIT; return TIMELIB_ISO_WEEK; } -#line 11513 "" +#line 11589 "" yy911: ++YYCURSOR; #line 1200 "parse_date.b.re" @@ -11530,7 +11606,7 @@ yy911: TIMELIB_DEINIT; return TIMELIB_ISO_WEEK; } -#line 11534 "" +#line 11610 "" yy913: yych = *++YYCURSOR; if(yych <= '/') goto yy57; @@ -11598,7 +11674,7 @@ yy916: TIMELIB_DEINIT; return TIMELIB_PG_YEARDAY; } -#line 11602 "" +#line 11678 "" yy917: yych = *++YYCURSOR; if(yych <= '/') goto yy57; @@ -11703,7 +11779,7 @@ yy937: TIMELIB_DEINIT; return TIMELIB_XMLRPC_SOAP; } -#line 11707 "" +#line 11783 "" yy938: yych = *++YYCURSOR; if(yych <= '2') { @@ -11851,7 +11927,7 @@ yy943: TIMELIB_DEINIT; return TIMELIB_DATE_NOCOLON; } -#line 11855 "" +#line 11931 "" yy944: yych = *++YYCURSOR; if(yych <= 'H') { @@ -12412,7 +12488,7 @@ yy1043: TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 12416 "" +#line 12492 "" yy1044: yyaccept = 18; yych = *(YYMARKER = ++YYCURSOR); @@ -13395,7 +13471,7 @@ yy1146: TIMELIB_DEINIT; return TIMELIB_GNU_NOCOLON; } -#line 13399 "" +#line 13475 "" yy1147: yych = *++YYCURSOR; if(yych <= '/') goto yy57; @@ -13492,7 +13568,7 @@ yy1154: TIMELIB_DEINIT; return TIMELIB_ISO_NOCOLON; } -#line 13496 "" +#line 13572 "" yy1155: yyaccept = 21; yych = *(YYMARKER = ++YYCURSOR); @@ -13881,7 +13957,7 @@ yy1179: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 13885 "" +#line 13961 "" yy1180: yych = *++YYCURSOR; if(yych <= 'N') { @@ -14146,7 +14222,7 @@ yy1200: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 14150 "" +#line 14226 "" yy1201: yych = *++YYCURSOR; if(yych <= 'X') { @@ -14168,7 +14244,7 @@ yy1203: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 14172 "" +#line 14248 "" yy1204: yych = *++YYCURSOR; if(yych <= 'R') { @@ -15468,7 +15544,7 @@ yy1279: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 15472 "" +#line 15548 "" yy1280: yych = *++YYCURSOR; if(yych <= 'N') { @@ -15557,7 +15633,7 @@ yy1287: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 15561 "" +#line 15637 "" yy1288: yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); @@ -15953,7 +16029,7 @@ yy1310: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 15957 "" +#line 16033 "" yy1311: yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); diff --git a/test/parse_date.c b/test/parse_date.c index 02fccb0f..7dde83f2 100755 --- a/test/parse_date.c +++ b/test/parse_date.c @@ -3306,33 +3306,33 @@ yy51: yy53: YYCURSOR = YYMARKER; switch(yyaccept) { - case 26: goto yy1310; - case 24: goto yy1279; - case 25: goto yy1287; - case 23: goto yy1203; - case 22: goto yy1200; - case 11: goto yy634; - case 20: goto yy1146; - case 21: goto yy1154; - case 13: goto yy784; - case 18: goto yy1043; - case 12: goto yy775; - case 8: goto yy420; - case 17: goto yy889; - case 6: goto yy363; - case 10: goto yy620; - case 16: goto yy943; - case 19: goto yy937; - case 15: goto yy916; - case 14: goto yy880; - case 9: goto yy526; - case 5: goto yy341; - case 4: goto yy172; - case 1: goto yy3; - case 7: goto yy385; - case 3: goto yy69; - case 2: goto yy46; - case 0: goto yy12; + case 0: goto yy12; + case 1: goto yy3; + case 2: goto yy46; + case 3: goto yy69; + case 4: goto yy172; + case 5: goto yy341; + case 6: goto yy363; + case 7: goto yy385; + case 8: goto yy420; + case 9: goto yy526; + case 10: goto yy620; + case 11: goto yy634; + case 12: goto yy775; + case 13: goto yy784; + case 14: goto yy880; + case 15: goto yy916; + case 16: goto yy943; + case 17: goto yy889; + case 18: goto yy1043; + case 19: goto yy937; + case 20: goto yy1146; + case 21: goto yy1154; + case 22: goto yy1200; + case 23: goto yy1203; + case 24: goto yy1279; + case 25: goto yy1287; + case 26: goto yy1310; } yy54: ++YYCURSOR; diff --git a/test/parse_date.db.c b/test/parse_date.db.c index 3b178973..0f253223 100755 --- a/test/parse_date.db.c +++ b/test/parse_date.db.c @@ -2308,34 +2308,110 @@ yy51: yy53: YYDEBUG(53, *YYCURSOR); YYCURSOR = YYMARKER; - switch(yyaccept) { - case 26: goto yy1413; - case 24: goto yy1382; - case 25: goto yy1390; - case 23: goto yy1304; - case 22: goto yy1301; - case 11: goto yy713; - case 20: goto yy1238; - case 21: goto yy1246; - case 13: goto yy870; - case 18: goto yy1134; - case 12: goto yy860; - case 8: goto yy491; - case 17: goto yy978; - case 6: goto yy426; - case 10: goto yy698; - case 16: goto yy1032; - case 19: goto yy1026; - case 15: goto yy1005; - case 14: goto yy971; - case 9: goto yy601; - case 5: goto yy405; - case 4: goto yy176; - case 0: goto yy3; - case 7: goto yy448; - case 3: goto yy69; - case 2: goto yy46; - case 1: goto yy12; + if(yyaccept <= 13) { + if(yyaccept <= 6) { + if(yyaccept <= 3) { + if(yyaccept <= 1) { + if(yyaccept <= 0) { + goto yy3; + } else { + goto yy12; + } + } else { + if(yyaccept <= 2) { + goto yy46; + } else { + goto yy69; + } + } + } else { + if(yyaccept <= 5) { + if(yyaccept <= 4) { + goto yy176; + } else { + goto yy405; + } + } else { + goto yy426; + } + } + } else { + if(yyaccept <= 10) { + if(yyaccept <= 8) { + if(yyaccept <= 7) { + goto yy448; + } else { + goto yy491; + } + } else { + if(yyaccept <= 9) { + goto yy601; + } else { + goto yy698; + } + } + } else { + if(yyaccept <= 12) { + if(yyaccept <= 11) { + goto yy713; + } else { + goto yy860; + } + } else { + goto yy870; + } + } + } + } else { + if(yyaccept <= 20) { + if(yyaccept <= 17) { + if(yyaccept <= 15) { + if(yyaccept <= 14) { + goto yy971; + } else { + goto yy1005; + } + } else { + if(yyaccept <= 16) { + goto yy1032; + } else { + goto yy978; + } + } + } else { + if(yyaccept <= 19) { + if(yyaccept <= 18) { + goto yy1134; + } else { + goto yy1026; + } + } else { + goto yy1238; + } + } + } else { + if(yyaccept <= 23) { + if(yyaccept <= 22) { + if(yyaccept <= 21) { + goto yy1246; + } else { + goto yy1301; + } + } else { + goto yy1304; + } + } else { + if(yyaccept <= 25) { + if(yyaccept <= 24) { + goto yy1382; + } else { + goto yy1390; + } + } else { + goto yy1413; + } + } + } } yy54: YYDEBUG(54, *YYCURSOR); @@ -2540,7 +2616,7 @@ yy69: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 2544 "" +#line 2620 "" yy70: YYDEBUG(70, *YYCURSOR); yych = *++YYCURSOR; @@ -3774,7 +3850,7 @@ yy176: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 3778 "" +#line 3854 "" yy177: YYDEBUG(177, *YYCURSOR); yych = *++YYCURSOR; @@ -7035,7 +7111,7 @@ yy405: TIMELIB_DEINIT; return TIMELIB_WEEKDAY; } -#line 7039 "" +#line 7115 "" yy406: YYDEBUG(406, *YYCURSOR); yych = *++YYCURSOR; @@ -7376,7 +7452,7 @@ yy426: TIMELIB_DEINIT; return TIMELIB_DATE_TEXT; } -#line 7380 "" +#line 7456 "" yy427: YYDEBUG(427, *YYCURSOR); yyaccept = 6; @@ -7644,7 +7720,7 @@ yy448: TIMELIB_DEINIT; return TIMELIB_SHORTDATE_WITH_TIME; } -#line 7648 "" +#line 7724 "" yy449: YYDEBUG(449, *YYCURSOR); yyaccept = 7; @@ -8082,7 +8158,7 @@ yy491: TIMELIB_DEINIT; return TIMELIB_DATE_NO_DAY; } -#line 8086 "" +#line 8162 "" yy492: YYDEBUG(492, *YYCURSOR); yyaccept = 6; @@ -8471,7 +8547,7 @@ yy517: TIMELIB_DEINIT; return TIMELIB_PG_TEXT; } -#line 8475 "" +#line 8551 "" yy518: YYDEBUG(518, *YYCURSOR); yych = *++YYCURSOR; @@ -10431,7 +10507,7 @@ yy601: TIMELIB_DEINIT; return TIMELIB_AGO; } -#line 10435 "" +#line 10511 "" yy602: YYDEBUG(602, *YYCURSOR); yyaccept = 0; @@ -12894,7 +12970,7 @@ yy698: TIMELIB_DEINIT; return TIMELIB_DATE_TEXT; } -#line 12898 "" +#line 12974 "" yy699: YYDEBUG(699, *YYCURSOR); yyaccept = 10; @@ -13051,7 +13127,7 @@ yy710: TIMELIB_DEINIT; return TIMELIB_TIME12; } -#line 13055 "" +#line 13131 "" yy712: YYDEBUG(712, *YYCURSOR); yyaccept = 11; @@ -13089,7 +13165,7 @@ yy713: TIMELIB_DEINIT; return TIMELIB_TIME24_WITH_ZONE; } -#line 13093 "" +#line 13169 "" yy714: YYDEBUG(714, *YYCURSOR); yyaccept = 11; @@ -13370,7 +13446,7 @@ yy741: TIMELIB_DEINIT; return TIMELIB_DATE_FULL; } -#line 13374 "" +#line 13450 "" yy742: YYDEBUG(742, *YYCURSOR); yych = *++YYCURSOR; @@ -14137,7 +14213,7 @@ yy813: TIMELIB_DEINIT; return TIMELIB_DATE_FULL_POINTED; } -#line 14141 "" +#line 14217 "" yy814: YYDEBUG(814, *YYCURSOR); yych = *++YYCURSOR; @@ -14776,7 +14852,7 @@ yy860: TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 14780 "" +#line 14856 "" yy861: YYDEBUG(861, *YYCURSOR); yyaccept = 12; @@ -14896,7 +14972,7 @@ yy870: TIMELIB_DEINIT; return TIMELIB_AMERICAN; } -#line 14900 "" +#line 14976 "" yy871: YYDEBUG(871, *YYCURSOR); yyaccept = 13; @@ -15139,7 +15215,7 @@ yy903: TIMELIB_DEINIT; return TIMELIB_CLF; } -#line 15143 "" +#line 15219 "" yy904: YYDEBUG(904, *YYCURSOR); yych = *++YYCURSOR; @@ -15600,7 +15676,7 @@ yy958: TIMELIB_DEINIT; return TIMELIB_PG_TEXT; } -#line 15604 "" +#line 15680 "" yy960: YYDEBUG(960, *YYCURSOR); yych = *++YYCURSOR; @@ -15746,7 +15822,7 @@ yy971: TIMELIB_DEINIT; return TIMELIB_CLF; } -#line 15750 "" +#line 15826 "" yy972: YYDEBUG(972, *YYCURSOR); yych = *++YYCURSOR; @@ -15861,7 +15937,7 @@ yy978: TIMELIB_DEINIT; return TIMELIB_DATE_NO_DAY; } -#line 15865 "" +#line 15941 "" yy979: YYDEBUG(979, *YYCURSOR); yych = *++YYCURSOR; @@ -16092,7 +16168,7 @@ yy999: TIMELIB_DEINIT; return TIMELIB_ISO_WEEK; } -#line 16096 "" +#line 16172 "" yy1000: YYDEBUG(1000, *YYCURSOR); ++YYCURSOR; @@ -16115,7 +16191,7 @@ yy1000: TIMELIB_DEINIT; return TIMELIB_ISO_WEEK; } -#line 16119 "" +#line 16195 "" yy1002: YYDEBUG(1002, *YYCURSOR); yych = *++YYCURSOR; @@ -16191,7 +16267,7 @@ yy1005: TIMELIB_DEINIT; return TIMELIB_PG_YEARDAY; } -#line 16195 "" +#line 16271 "" yy1006: YYDEBUG(1006, *YYCURSOR); yych = *++YYCURSOR; @@ -16319,7 +16395,7 @@ yy1026: TIMELIB_DEINIT; return TIMELIB_XMLRPC_SOAP; } -#line 16323 "" +#line 16399 "" yy1027: YYDEBUG(1027, *YYCURSOR); yych = *++YYCURSOR; @@ -16596,7 +16672,7 @@ yy1032: TIMELIB_DEINIT; return TIMELIB_DATE_NOCOLON; } -#line 16600 "" +#line 16676 "" yy1033: YYDEBUG(1033, *YYCURSOR); yych = *++YYCURSOR; @@ -17291,7 +17367,7 @@ yy1134: TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 17295 "" +#line 17371 "" yy1135: YYDEBUG(1135, *YYCURSOR); yyaccept = 18; @@ -18375,7 +18451,7 @@ yy1238: TIMELIB_DEINIT; return TIMELIB_GNU_NOCOLON; } -#line 18379 "" +#line 18455 "" yy1239: YYDEBUG(1239, *YYCURSOR); yych = *++YYCURSOR; @@ -18486,7 +18562,7 @@ yy1246: TIMELIB_DEINIT; return TIMELIB_ISO_NOCOLON; } -#line 18490 "" +#line 18566 "" yy1247: YYDEBUG(1247, *YYCURSOR); yyaccept = 21; @@ -19120,7 +19196,7 @@ yy1271: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 19124 "" +#line 19200 "" yy1272: YYDEBUG(1272, *YYCURSOR); yych = *++YYCURSOR; @@ -19567,7 +19643,7 @@ yy1301: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 19571 "" +#line 19647 "" yy1302: YYDEBUG(1302, *YYCURSOR); yych = *++YYCURSOR; @@ -19611,7 +19687,7 @@ yy1304: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 19615 "" +#line 19691 "" yy1305: YYDEBUG(1305, *YYCURSOR); yych = *++YYCURSOR; @@ -21392,7 +21468,7 @@ yy1382: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 21396 "" +#line 21472 "" yy1383: YYDEBUG(1383, *YYCURSOR); yych = *++YYCURSOR; @@ -21542,7 +21618,7 @@ yy1390: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 21546 "" +#line 21622 "" yy1391: YYDEBUG(1391, *YYCURSOR); yyaccept = 0; @@ -22049,7 +22125,7 @@ yy1413: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 22053 "" +#line 22129 "" yy1414: YYDEBUG(1414, *YYCURSOR); yyaccept = 0; diff --git a/test/parse_date.s.c b/test/parse_date.s.c index a4114b1a..29161327 100755 --- a/test/parse_date.s.c +++ b/test/parse_date.s.c @@ -2149,34 +2149,110 @@ yy51: } yy53: YYCURSOR = YYMARKER; - switch(yyaccept) { - case 26: goto yy1310; - case 24: goto yy1279; - case 25: goto yy1287; - case 23: goto yy1203; - case 22: goto yy1200; - case 11: goto yy634; - case 20: goto yy1146; - case 21: goto yy1154; - case 13: goto yy784; - case 18: goto yy1043; - case 12: goto yy775; - case 8: goto yy420; - case 17: goto yy889; - case 6: goto yy363; - case 10: goto yy620; - case 16: goto yy943; - case 19: goto yy937; - case 15: goto yy916; - case 14: goto yy880; - case 9: goto yy526; - case 5: goto yy341; - case 4: goto yy172; - case 1: goto yy3; - case 7: goto yy385; - case 3: goto yy69; - case 2: goto yy46; - case 0: goto yy12; + if(yyaccept <= 13) { + if(yyaccept <= 6) { + if(yyaccept <= 3) { + if(yyaccept <= 1) { + if(yyaccept <= 0) { + goto yy12; + } else { + goto yy3; + } + } else { + if(yyaccept <= 2) { + goto yy46; + } else { + goto yy69; + } + } + } else { + if(yyaccept <= 5) { + if(yyaccept <= 4) { + goto yy172; + } else { + goto yy341; + } + } else { + goto yy363; + } + } + } else { + if(yyaccept <= 10) { + if(yyaccept <= 8) { + if(yyaccept <= 7) { + goto yy385; + } else { + goto yy420; + } + } else { + if(yyaccept <= 9) { + goto yy526; + } else { + goto yy620; + } + } + } else { + if(yyaccept <= 12) { + if(yyaccept <= 11) { + goto yy634; + } else { + goto yy775; + } + } else { + goto yy784; + } + } + } + } else { + if(yyaccept <= 20) { + if(yyaccept <= 17) { + if(yyaccept <= 15) { + if(yyaccept <= 14) { + goto yy880; + } else { + goto yy916; + } + } else { + if(yyaccept <= 16) { + goto yy943; + } else { + goto yy889; + } + } + } else { + if(yyaccept <= 19) { + if(yyaccept <= 18) { + goto yy1043; + } else { + goto yy937; + } + } else { + goto yy1146; + } + } + } else { + if(yyaccept <= 23) { + if(yyaccept <= 22) { + if(yyaccept <= 21) { + goto yy1154; + } else { + goto yy1200; + } + } else { + goto yy1203; + } + } else { + if(yyaccept <= 25) { + if(yyaccept <= 24) { + goto yy1279; + } else { + goto yy1287; + } + } else { + goto yy1310; + } + } + } } yy54: ++YYCURSOR; @@ -2326,7 +2402,7 @@ yy69: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 2330 "" +#line 2406 "" yy70: yych = *++YYCURSOR; if(yych == 'D') goto yy71; @@ -3162,7 +3238,7 @@ yy172: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 3166 "" +#line 3242 "" yy173: yych = *++YYCURSOR; if(yych == 'D') goto yy174; @@ -4662,7 +4738,7 @@ yy341: TIMELIB_DEINIT; return TIMELIB_WEEKDAY; } -#line 4666 "" +#line 4742 "" yy342: yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); @@ -4901,7 +4977,7 @@ yy363: TIMELIB_DEINIT; return TIMELIB_DATE_TEXT; } -#line 4905 "" +#line 4981 "" yy364: yych = *++YYCURSOR; if(yych <= 'm') { @@ -5136,7 +5212,7 @@ yy385: TIMELIB_DEINIT; return TIMELIB_SHORTDATE_WITH_TIME; } -#line 5140 "" +#line 5216 "" yy386: yyaccept = 7; yych = *(YYMARKER = ++YYCURSOR); @@ -5430,7 +5506,7 @@ yy420: TIMELIB_DEINIT; return TIMELIB_DATE_NO_DAY; } -#line 5434 "" +#line 5510 "" yy421: yyaccept = 6; yych = *(YYMARKER = ++YYCURSOR); @@ -5780,7 +5856,7 @@ yy446: TIMELIB_DEINIT; return TIMELIB_PG_TEXT; } -#line 5784 "" +#line 5860 "" yy447: yych = *++YYCURSOR; if(yych <= '/') goto yy446; @@ -7069,7 +7145,7 @@ yy526: TIMELIB_DEINIT; return TIMELIB_AGO; } -#line 7073 "" +#line 7149 "" yy527: yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); @@ -8955,7 +9031,7 @@ yy620: TIMELIB_DEINIT; return TIMELIB_DATE_TEXT; } -#line 8959 "" +#line 9035 "" yy621: yyaccept = 10; yych = *(YYMARKER = ++YYCURSOR); @@ -9066,7 +9142,7 @@ yy631: TIMELIB_DEINIT; return TIMELIB_TIME12; } -#line 9070 "" +#line 9146 "" yy632: yych = *++YYCURSOR; goto yy631; @@ -9103,7 +9179,7 @@ yy634: TIMELIB_DEINIT; return TIMELIB_TIME24_WITH_ZONE; } -#line 9107 "" +#line 9183 "" yy635: yyaccept = 11; yych = *(YYMARKER = ++YYCURSOR); @@ -9305,7 +9381,7 @@ yy660: TIMELIB_DEINIT; return TIMELIB_DATE_FULL; } -#line 9309 "" +#line 9385 "" yy661: yych = *++YYCURSOR; if(yych == 'M') goto yy662; @@ -9830,7 +9906,7 @@ yy729: TIMELIB_DEINIT; return TIMELIB_DATE_FULL_POINTED; } -#line 9834 "" +#line 9910 "" yy730: yych = *++YYCURSOR; if(yych <= '/') goto yy729; @@ -10358,7 +10434,7 @@ yy775: TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 10362 "" +#line 10438 "" yy776: yyaccept = 12; yych = *(YYMARKER = ++YYCURSOR); @@ -10440,7 +10516,7 @@ yy784: TIMELIB_DEINIT; return TIMELIB_AMERICAN; } -#line 10444 "" +#line 10520 "" yy785: yyaccept = 13; yych = *(YYMARKER = ++YYCURSOR); @@ -10643,7 +10719,7 @@ yy817: TIMELIB_DEINIT; return TIMELIB_CLF; } -#line 10647 "" +#line 10723 "" yy818: yych = *++YYCURSOR; if(yych <= '5') { @@ -10976,7 +11052,7 @@ yy867: TIMELIB_DEINIT; return TIMELIB_PG_TEXT; } -#line 10980 "" +#line 11056 "" yy869: yych = *++YYCURSOR; if(yych == 'V') goto yy862; @@ -11120,7 +11196,7 @@ yy880: TIMELIB_DEINIT; return TIMELIB_CLF; } -#line 11124 "" +#line 11200 "" yy881: yych = *++YYCURSOR; switch(yych){ @@ -11279,7 +11355,7 @@ yy889: TIMELIB_DEINIT; return TIMELIB_DATE_NO_DAY; } -#line 11283 "" +#line 11359 "" yy890: yych = *++YYCURSOR; if(yych == 'I') goto yy1021; @@ -11489,7 +11565,7 @@ yy910: TIMELIB_DEINIT; return TIMELIB_ISO_WEEK; } -#line 11493 "" +#line 11569 "" yy911: ++YYCURSOR; #line 1200 "parse_date.s.re" @@ -11510,7 +11586,7 @@ yy911: TIMELIB_DEINIT; return TIMELIB_ISO_WEEK; } -#line 11514 "" +#line 11590 "" yy913: yych = *++YYCURSOR; if(yych <= '/') goto yy57; @@ -11568,7 +11644,7 @@ yy916: TIMELIB_DEINIT; return TIMELIB_PG_YEARDAY; } -#line 11572 "" +#line 11648 "" yy917: yych = *++YYCURSOR; if(yych <= '/') goto yy57; @@ -11673,7 +11749,7 @@ yy937: TIMELIB_DEINIT; return TIMELIB_XMLRPC_SOAP; } -#line 11677 "" +#line 11753 "" yy938: yych = *++YYCURSOR; if(yych <= '2') { @@ -11828,7 +11904,7 @@ yy943: TIMELIB_DEINIT; return TIMELIB_DATE_NOCOLON; } -#line 11832 "" +#line 11908 "" yy944: yych = *++YYCURSOR; if(yych <= 'H') { @@ -12389,7 +12465,7 @@ yy1043: TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 12393 "" +#line 12469 "" yy1044: yyaccept = 18; yych = *(YYMARKER = ++YYCURSOR); @@ -13372,7 +13448,7 @@ yy1146: TIMELIB_DEINIT; return TIMELIB_GNU_NOCOLON; } -#line 13376 "" +#line 13452 "" yy1147: yych = *++YYCURSOR; if(yych <= '/') goto yy57; @@ -13459,7 +13535,7 @@ yy1154: TIMELIB_DEINIT; return TIMELIB_ISO_NOCOLON; } -#line 13463 "" +#line 13539 "" yy1155: yyaccept = 21; yych = *(YYMARKER = ++YYCURSOR); @@ -13848,7 +13924,7 @@ yy1179: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 13852 "" +#line 13928 "" yy1180: yych = *++YYCURSOR; if(yych <= 'N') { @@ -14113,7 +14189,7 @@ yy1200: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 14117 "" +#line 14193 "" yy1201: yych = *++YYCURSOR; if(yych <= 'X') { @@ -14135,7 +14211,7 @@ yy1203: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 14139 "" +#line 14215 "" yy1204: yych = *++YYCURSOR; if(yych <= 'R') { @@ -15435,7 +15511,7 @@ yy1279: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 15439 "" +#line 15515 "" yy1280: yych = *++YYCURSOR; if(yych <= 'N') { @@ -15524,7 +15600,7 @@ yy1287: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 15528 "" +#line 15604 "" yy1288: yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); @@ -15920,7 +15996,7 @@ yy1310: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 15924 "" +#line 16000 "" yy1311: yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); diff --git a/test/repeater.c b/test/repeater.c index 0181d16f..5a0bb307 100644 --- a/test/repeater.c +++ b/test/repeater.c @@ -72,8 +72,8 @@ yy8: yy9: YYCURSOR = YYMARKER; switch(yyaccept) { - case 0: goto yy3; - case 1: goto yy5; + case 0: goto yy3; + case 1: goto yy5; } yy10: ++YYCURSOR; diff --git a/test/scanner.c b/test/scanner.c index 92e86130..71b0e30e 100644 --- a/test/scanner.c +++ b/test/scanner.c @@ -663,13 +663,13 @@ yy65: yy66: YYCURSOR = YYMARKER; switch(yyaccept) { - case 0: goto yy32; - case 1: goto yy38; - case 2: goto yy40; - case 3: goto yy42; - case 6: goto yy98; - case 5: goto yy69; - case 4: goto yy46; + case 0: goto yy32; + case 1: goto yy38; + case 2: goto yy40; + case 3: goto yy42; + case 4: goto yy46; + case 5: goto yy69; + case 6: goto yy98; } yy67: yyaccept = 5; diff --git a/test/scanner.fs.c b/test/scanner.fs.c index fbaa8a02..cf928481 100755 --- a/test/scanner.fs.c +++ b/test/scanner.fs.c @@ -501,14 +501,30 @@ yyFillLabel4: if(yych <= 'z') goto yy67; yy66: YYCURSOR = YYMARKER; - switch(yyaccept) { - case 0: goto yy32; - case 1: goto yy38; - case 2: goto yy40; - case 3: goto yy42; - case 6: goto yy98; - case 5: goto yy69; - case 4: goto yy46; + if(yyaccept <= 3) { + if(yyaccept <= 1) { + if(yyaccept <= 0) { + goto yy32; + } else { + goto yy38; + } + } else { + if(yyaccept <= 2) { + goto yy40; + } else { + goto yy42; + } + } + } else { + if(yyaccept <= 5) { + if(yyaccept <= 4) { + goto yy46; + } else { + goto yy69; + } + } else { + goto yy98; + } } yy67: yyaccept = 5; @@ -540,7 +556,7 @@ yy69: yylval.str = new Str(token()); return CONFIG; } -#line 544 "" +#line 560 "" yy70: ++YYCURSOR; YYSETSTATE(6); @@ -584,7 +600,7 @@ yy75: { cur = cursor; yylval.regexp = ranToRE(token()); return RANGE; } -#line 588 "" +#line 604 "" yy77: ++YYCURSOR; YYSETSTATE(9); @@ -599,7 +615,7 @@ yy78: { cur = cursor; yylval.regexp = invToRE(token()); return RANGE; } -#line 603 "" +#line 619 "" yy80: ++YYCURSOR; YYSETSTATE(10); @@ -627,7 +643,7 @@ yy83: { cur = cursor; yylval.regexp = strToCaseInsensitiveRE(token()); return STRING; } -#line 631 "" +#line 647 "" yy85: ++YYCURSOR; YYSETSTATE(12); @@ -655,19 +671,19 @@ yy88: { cur = cursor; yylval.regexp = strToRE(token()); return STRING; } -#line 659 "" +#line 675 "" yy90: ++YYCURSOR; #line 172 "scanner.fs.re" { tok = cursor; RETURN(0); } -#line 665 "" +#line 681 "" yy92: ++YYCURSOR; #line 169 "scanner.fs.re" { depth = 1; goto comment; } -#line 671 "" +#line 687 "" yy94: yych = *++YYCURSOR; if(yych == ',') goto yy108; @@ -692,14 +708,14 @@ yy97: yy98: #line 216 "scanner.fs.re" { fatal("illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers"); } -#line 696 "" +#line 712 "" yy99: ++YYCURSOR; #line 204 "scanner.fs.re" { yylval.extop.minsize = atoi((char *)tok+1); yylval.extop.maxsize = atoi((char *)tok+1); RETURN(CLOSESIZE); } -#line 703 "" +#line 719 "" yy101: yyaccept = 6; yych = *(YYMARKER = ++YYCURSOR); @@ -711,7 +727,7 @@ yy101: { yylval.extop.minsize = atoi((char *)tok+1); yylval.extop.maxsize = -1; RETURN(CLOSESIZE); } -#line 715 "" +#line 731 "" yy104: ++YYCURSOR; YYSETSTATE(15); @@ -726,7 +742,7 @@ yyFillLabel15: { yylval.extop.minsize = atoi((char *)tok+1); yylval.extop.maxsize = MAX(yylval.extop.minsize,atoi(strchr((char *)tok, ',')+1)); RETURN(CLOSESIZE); } -#line 730 "" +#line 746 "" yy108: yyaccept = 6; yych = *(YYMARKER = ++YYCURSOR); @@ -737,14 +753,14 @@ yy108: #line 201 "scanner.fs.re" { yylval.op = '*'; RETURN(CLOSE); } -#line 741 "" +#line 757 "" } #line 247 "scanner.fs.re" code: -#line 748 "" +#line 764 "" { YYSETSTATE(16); @@ -776,13 +792,13 @@ yyFillLabel16: return CODE; } goto code; } -#line 780 "" +#line 796 "" yy115: ++YYCURSOR; #line 257 "scanner.fs.re" { ++depth; goto code; } -#line 786 "" +#line 802 "" yy117: ++YYCURSOR; #line 259 "scanner.fs.re" @@ -790,13 +806,13 @@ yy117: pos = cursor; cline++; goto code; } -#line 794 "" +#line 810 "" yy119: ++YYCURSOR; yy120: #line 263 "scanner.fs.re" { goto code; } -#line 800 "" +#line 816 "" yy121: yych = *(YYMARKER = ++YYCURSOR); if(yych == 0x0A) goto yy120; @@ -857,7 +873,7 @@ yyFillLabel20: comment: -#line 861 "" +#line 877 "" { YYSETSTATE(21); @@ -879,7 +895,7 @@ yy133: #line 279 "scanner.fs.re" { if(cursor == eof) RETURN(0); goto comment; } -#line 883 "" +#line 899 "" yy134: yych = *++YYCURSOR; if(yych == '*') goto yy138; @@ -891,7 +907,7 @@ yy135: tok = pos = cursor; cline++; goto comment; } -#line 895 "" +#line 911 "" yy137: yych = *++YYCURSOR; goto yy133; @@ -901,7 +917,7 @@ yy138: { ++depth; fatal("ambiguous /* found"); goto comment; } -#line 905 "" +#line 921 "" yy140: ++YYCURSOR; #line 268 "scanner.fs.re" @@ -909,14 +925,14 @@ yy140: goto scan; else goto comment; } -#line 913 "" +#line 929 "" } #line 281 "scanner.fs.re" config: -#line 920 "" +#line 936 "" { YYSETSTATE(22); @@ -937,7 +953,7 @@ yy144: yy145: #line 285 "scanner.fs.re" { goto config; } -#line 941 "" +#line 957 "" yy146: ++YYCURSOR; yych = *YYCURSOR; @@ -948,12 +964,12 @@ yy147: cur = cursor; RETURN('='); } -#line 952 "" +#line 968 "" yy148: ++YYCURSOR; #line 290 "scanner.fs.re" { fatal("missing '='"); } -#line 957 "" +#line 973 "" yy150: ++YYCURSOR; YYSETSTATE(23); @@ -980,7 +996,7 @@ yy153: value: -#line 984 "" +#line 1000 "" { YYSETSTATE(25); @@ -1021,7 +1037,7 @@ yy156: iscfg = 0; return VALUE; } -#line 1025 "" +#line 1041 "" yy157: ++YYCURSOR; if((yych = *YYCURSOR) <= 0x0D) { @@ -1042,7 +1058,7 @@ yy158: iscfg = 0; return NUMBER; } -#line 1046 "" +#line 1062 "" yy159: yych = *++YYCURSOR; if(yych <= '0') goto yy163; diff --git a/test/scanner.s.c b/test/scanner.s.c index e4417a3a..5c5091ab 100755 --- a/test/scanner.s.c +++ b/test/scanner.s.c @@ -452,14 +452,30 @@ yy65: if(yych <= 'z') goto yy67; yy66: YYCURSOR = YYMARKER; - switch(yyaccept) { - case 0: goto yy32; - case 1: goto yy38; - case 2: goto yy40; - case 3: goto yy42; - case 6: goto yy98; - case 5: goto yy69; - case 4: goto yy46; + if(yyaccept <= 3) { + if(yyaccept <= 1) { + if(yyaccept <= 0) { + goto yy32; + } else { + goto yy38; + } + } else { + if(yyaccept <= 2) { + goto yy40; + } else { + goto yy42; + } + } + } else { + if(yyaccept <= 5) { + if(yyaccept <= 4) { + goto yy46; + } else { + goto yy69; + } + } else { + goto yy98; + } } yy67: yyaccept = 5; @@ -489,7 +505,7 @@ yy69: yylval.str = new Str(token()); return CONFIG; } -#line 493 "" +#line 509 "" yy70: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -527,7 +543,7 @@ yy75: { cur = cursor; yylval.regexp = ranToRE(token()); return RANGE; } -#line 531 "" +#line 547 "" yy77: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -540,7 +556,7 @@ yy78: { cur = cursor; yylval.regexp = invToRE(token()); return RANGE; } -#line 544 "" +#line 560 "" yy80: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -564,7 +580,7 @@ yy83: { cur = cursor; yylval.regexp = strToCaseInsensitiveRE(token()); return STRING; } -#line 568 "" +#line 584 "" yy85: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -588,19 +604,19 @@ yy88: { cur = cursor; yylval.regexp = strToRE(token()); return STRING; } -#line 592 "" +#line 608 "" yy90: ++YYCURSOR; #line 172 "scanner.s.re" { tok = cursor; RETURN(0); } -#line 598 "" +#line 614 "" yy92: ++YYCURSOR; #line 169 "scanner.s.re" { depth = 1; goto comment; } -#line 604 "" +#line 620 "" yy94: yych = *++YYCURSOR; if(yych == ',') goto yy108; @@ -623,14 +639,14 @@ yy97: yy98: #line 216 "scanner.s.re" { fatal("illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers"); } -#line 627 "" +#line 643 "" yy99: ++YYCURSOR; #line 204 "scanner.s.re" { yylval.extop.minsize = atoi((char *)tok+1); yylval.extop.maxsize = atoi((char *)tok+1); RETURN(CLOSESIZE); } -#line 634 "" +#line 650 "" yy101: yyaccept = 6; yych = *(YYMARKER = ++YYCURSOR); @@ -642,7 +658,7 @@ yy101: { yylval.extop.minsize = atoi((char *)tok+1); yylval.extop.maxsize = -1; RETURN(CLOSESIZE); } -#line 646 "" +#line 662 "" yy104: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -655,7 +671,7 @@ yy104: { yylval.extop.minsize = atoi((char *)tok+1); yylval.extop.maxsize = MAX(yylval.extop.minsize,atoi(strchr((char *)tok, ',')+1)); RETURN(CLOSESIZE); } -#line 659 "" +#line 675 "" yy108: yyaccept = 6; yych = *(YYMARKER = ++YYCURSOR); @@ -666,14 +682,14 @@ yy108: #line 201 "scanner.s.re" { yylval.op = '*'; RETURN(CLOSE); } -#line 670 "" +#line 686 "" } #line 247 "scanner.s.re" code: -#line 677 "" +#line 693 "" { YYCTYPE yych; if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -703,13 +719,13 @@ code: return CODE; } goto code; } -#line 707 "" +#line 723 "" yy115: ++YYCURSOR; #line 257 "scanner.s.re" { ++depth; goto code; } -#line 713 "" +#line 729 "" yy117: ++YYCURSOR; #line 259 "scanner.s.re" @@ -717,13 +733,13 @@ yy117: pos = cursor; cline++; goto code; } -#line 721 "" +#line 737 "" yy119: ++YYCURSOR; yy120: #line 263 "scanner.s.re" { goto code; } -#line 727 "" +#line 743 "" yy121: yych = *(YYMARKER = ++YYCURSOR); if(yych == 0x0A) goto yy120; @@ -776,7 +792,7 @@ yy128: comment: -#line 780 "" +#line 796 "" { YYCTYPE yych; if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -796,7 +812,7 @@ yy133: #line 279 "scanner.s.re" { if(cursor == eof) RETURN(0); goto comment; } -#line 800 "" +#line 816 "" yy134: yych = *++YYCURSOR; if(yych == '*') goto yy138; @@ -808,7 +824,7 @@ yy135: tok = pos = cursor; cline++; goto comment; } -#line 812 "" +#line 828 "" yy137: yych = *++YYCURSOR; goto yy133; @@ -818,7 +834,7 @@ yy138: { ++depth; fatal("ambiguous /* found"); goto comment; } -#line 822 "" +#line 838 "" yy140: ++YYCURSOR; #line 268 "scanner.s.re" @@ -826,14 +842,14 @@ yy140: goto scan; else goto comment; } -#line 830 "" +#line 846 "" } #line 281 "scanner.s.re" config: -#line 837 "" +#line 853 "" { YYCTYPE yych; if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -852,7 +868,7 @@ yy144: yy145: #line 285 "scanner.s.re" { goto config; } -#line 856 "" +#line 872 "" yy146: ++YYCURSOR; yych = *YYCURSOR; @@ -863,12 +879,12 @@ yy147: cur = cursor; RETURN('='); } -#line 867 "" +#line 883 "" yy148: ++YYCURSOR; #line 290 "scanner.s.re" { fatal("missing '='"); } -#line 872 "" +#line 888 "" yy150: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -891,7 +907,7 @@ yy153: value: -#line 895 "" +#line 911 "" { YYCTYPE yych; if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -930,7 +946,7 @@ yy156: iscfg = 0; return VALUE; } -#line 934 "" +#line 950 "" yy157: ++YYCURSOR; if((yych = *YYCURSOR) <= 0x0D) { @@ -951,7 +967,7 @@ yy158: iscfg = 0; return NUMBER; } -#line 955 "" +#line 971 "" yy159: yych = *++YYCURSOR; if(yych <= '0') goto yy163; -- 2.40.0