}
}
-void output_state_goto_sub (std::ostream & o, uint32_t ind, uint32_t start_label, int cMin, int cMax)
-{
- if (cMin == cMax)
- {
- if (cMin == -1)
- {
- o << indent(ind) << "goto " << labelPrefix << start_label << ";\n";
- }
- else
- {
- o << indent(ind) << "goto " << mapCodeName["yyFillLabel"] << cMin << ";\n";
- }
- }
- else
- {
- int cMid = cMin + ((cMax - cMin + 1) / 2);
-
- o << indent(ind) << "if (" << output_get_state() << " < " << cMid << ") {\n";
- output_state_goto_sub (o, ind + 1, start_label, cMin, cMid - 1);
- o << indent(ind) << "} else {\n";
- output_state_goto_sub (o, ind + 1, start_label, cMid, cMax);
- o << indent(ind) << "}\n";
- }
-}
-
void output_state_goto (std::ostream & o, uint32_t ind, uint32_t start_label)
{
- if (gFlag)
+ o << indent(ind) << "switch (" << output_get_state() << ") {\n";
+ if (bUseStateAbort)
{
- o << indent(ind++) << "static void *" << mapCodeName["yystable"] << "[" << "] = {\n";
-
- for (size_t i=0; i<last_fill_index; ++i)
- {
- o << indent(ind) << "&&" << mapCodeName["yyFillLabel"] << i << ",\n";
- }
-
- o << indent(--ind) << "};\n";
- o << "\n";
-
- o << indent(ind) << "if (" << output_get_state();
- if (bUseStateAbort)
- {
- o << " == -1) {\n";
- }
- else
- {
- o << " < 0) {\n";
- }
- o << indent(++ind) << "goto " << labelPrefix << start_label << ";\n";
- if (bUseStateAbort)
- {
- o << indent(--ind) << "} else if (" << output_get_state() << " < -1) {\n";
- o << indent(++ind) << "abort();\n";
- }
- o << indent(--ind) << "}\n";
-
- o << indent(ind) << "goto *" << mapCodeName["yystable"] << "[" << output_get_state() << "];\n";
-
+ o << indent(ind) << "default: abort();\n";
+ o << indent(ind) << "case -1: goto " << labelPrefix << start_label << ";\n";
}
- else if (bFlag)
+ else
{
- output_state_goto_sub (o, ind, start_label, -1, last_fill_index-1);
- if (bUseStateAbort)
- {
- o << indent(ind) << "abort();\n";
- }
+ o << indent(ind) << "default: goto " << labelPrefix << start_label << ";\n";
}
- else
+ for (uint32_t i = 0; i < last_fill_index; ++i)
{
- o << indent(ind) << "switch (" << output_get_state() << ") {\n";
- if (bUseStateAbort)
- {
- o << indent(ind) << "default: abort();\n";
- o << indent(ind) << "case -1: goto " << labelPrefix << start_label << ";\n";
- }
- else
- {
- o << indent(ind) << "default: goto " << labelPrefix << start_label << ";\n";
- }
-
- for (size_t i=0; i<last_fill_index; ++i)
- {
- o << indent(ind) << "case " << i << ": goto " << mapCodeName["yyFillLabel"] << i << ";\n";
- }
-
- o << indent(ind) << "}\n";
+ o << indent(ind) << "case " << i << ": goto " << mapCodeName["yyFillLabel"] << i << ";\n";
}
+ o << indent(ind) << "}\n";
if (bUseStateNext)
{
o << mapCodeName["yyNext"] << ":\n";
void output_yymaxfill (std::ostream &, uint32_t);
// helpers
-void output_state_goto_sub (std::ostream & o, uint32_t ind, uint32_t start_label, int cMin, int cMax);
std::string output_get_state ();
} // namespace re2c
--- /dev/null
+re2c: warning: line 3: rule matches empty string [-Wmatch-empty-string]
+/* Generated by re2c */
+
+
+ switch (YYGETSTATE()) {
+ default: abort();
+ case -1: goto yy0;
+ case 0: goto yyFillLabel0;
+ }
+yy0:
+ YYSETSTATE(0);
+yyFillLabel0:
+ {}
+
--- /dev/null
+/*!re2c
+ re2c:state:abort = 1;
+ "" {}
+*/
--- /dev/null
+re2c: warning: line 3: rule matches empty string [-Wmatch-empty-string]
+/* Generated by re2c */
+
+{
+
+ switch (YYGETSTATE()) {
+ default: abort();
+ case -1: goto yy0;
+ case 0: goto yyFillLabel0;
+ }
+yy0:
+ YYSETSTATE(0);
+yyFillLabel0:
+ {}
+}
+
--- /dev/null
+/*!re2c
+ re2c:state:abort = 1;
+ "" {}
+*/
--- /dev/null
+re2c: warning: line 3: rule matches empty string [-Wmatch-empty-string]
+/* Generated by re2c */
+
+
+ switch (YYGETSTATE()) {
+ default: abort();
+ case -1: goto yy0;
+ case 0: goto yyFillLabel0;
+ }
+yy0:
+ YYSETSTATE(0);
+yyFillLabel0:
+ {}
+
--- /dev/null
+/*!re2c
+ re2c:state:abort = 1;
+ "" {}
+*/
--- /dev/null
+re2c: warning: line 3: rule matches empty string [-Wmatch-empty-string]
+/* Generated by re2c */
+
+
+ switch (YYGETSTATE()) {
+ default: abort();
+ case -1: goto yy0;
+ case 0: goto yyFillLabel0;
+ }
+yy0:
+ YYSETSTATE(0);
+yyFillLabel0:
+ {}
+
--- /dev/null
+/*!re2c
+ re2c:state:abort = 1;
+ "" {}
+*/
--- /dev/null
+re2c: warning: line 3: rule matches empty string [-Wmatch-empty-string]
+/* Generated by re2c */
+
+{
+
+ switch (YYGETSTATE()) {
+ default: abort();
+ case -1: goto yy0;
+ case 0: goto yyFillLabel0;
+ }
+yy0:
+ YYSETSTATE(0);
+yyFillLabel0:
+ {}
+}
+
--- /dev/null
+/*!re2c
+ re2c:state:abort = 1;
+ "" {}
+*/
--- /dev/null
+re2c: warning: line 3: rule matches empty string [-Wmatch-empty-string]
+/* Generated by re2c */
+
+
+ switch (YYGETSTATE()) {
+ default: abort();
+ case -1: goto yy0;
+ case 0: goto yyFillLabel0;
+ }
+yy0:
+ YYSETSTATE(0);
+yyFillLabel0:
+ {}
+
--- /dev/null
+/*!re2c
+ re2c:state:abort = 1;
+ "" {}
+*/
s->tok = s->cur;
- if (s->state < 1) {
- if (s->state < 0) {
- goto yy0;
- } else {
- goto yyFillLabel0;
- }
- } else {
- if (s->state < 2) {
- goto yyFillLabel1;
- } else {
- if (s->state < 3) {
- goto yyFillLabel2;
- } else {
- goto yyFillLabel3;
- }
- }
+ switch (s->state) {
+ default: goto yy0;
+ case 0: goto yyFillLabel0;
+ case 1: goto yyFillLabel1;
+ case 2: goto yyFillLabel2;
+ case 3: goto yyFillLabel3;
}
yy0:
if (s->cond < 2) {
{
s->tok = s->cur;
- if (s->state < 1) {
- if (s->state < 0) {
- goto yy0;
- } else {
- goto yyFillLabel0;
- }
- } else {
- if (s->state < 2) {
- goto yyFillLabel1;
- } else {
- if (s->state < 3) {
- goto yyFillLabel2;
- } else {
- goto yyFillLabel3;
- }
- }
+ switch (s->state) {
+ default: goto yy0;
+ case 0: goto yyFillLabel0;
+ case 1: goto yyFillLabel1;
+ case 2: goto yyFillLabel2;
+ case 3: goto yyFillLabel3;
}
for(;;)
{
{
s->tok = s->cur;
- static void *yystable[] = {
- &&yyFillLabel0,
- &&yyFillLabel1,
- &&yyFillLabel2,
- &&yyFillLabel3,
- };
-
- if (s->state < 0) {
- goto yy0;
+ switch (s->state) {
+ default: goto yy0;
+ case 0: goto yyFillLabel0;
+ case 1: goto yyFillLabel1;
+ case 2: goto yyFillLabel2;
+ case 3: goto yyFillLabel3;
}
- goto *yystable[s->state];
for(;;)
{
s->tok = s->cur;
{
s->tok = s->cur;
- static void *yystable[] = {
- &&yyFillLabel0,
- &&yyFillLabel1,
- &&yyFillLabel2,
- &&yyFillLabel3,
- };
-
- if (s->state < 0) {
- goto yy0;
+ switch (s->state) {
+ default: goto yy0;
+ case 0: goto yyFillLabel0;
+ case 1: goto yyFillLabel1;
+ case 2: goto yyFillLabel2;
+ case 3: goto yyFillLabel3;
}
- goto *yystable[s->state];
for(;;)
{
s->tok = s->cur;
{
s->tok = s->cur;
- static void *yystable[] = {
- &&yyFillLabel0,
- &&yyFillLabel1,
- &&yyFillLabel2,
- &&yyFillLabel3,
- };
-
- if (s->state < 0) {
- goto yy0;
+ switch (s->state) {
+ default: goto yy0;
+ case 0: goto yyFillLabel0;
+ case 1: goto yyFillLabel1;
+ case 2: goto yyFillLabel2;
+ case 3: goto yyFillLabel3;
}
- goto *yystable[s->state];
for(;;)
{
s->tok = s->cur;
{
s->tok = s->cur;
- if (s->state < 1) {
- if (s->state < 0) {
- goto yy0;
- } else {
- goto yyFillLabel0;
- }
- } else {
- if (s->state < 2) {
- goto yyFillLabel1;
- } else {
- if (s->state < 3) {
- goto yyFillLabel2;
- } else {
- goto yyFillLabel3;
- }
- }
+ switch (s->state) {
+ default: goto yy0;
+ case 0: goto yyFillLabel0;
+ case 1: goto yyFillLabel1;
+ case 2: goto yyFillLabel2;
+ case 3: goto yyFillLabel3;
}
for(;;)
{
{
s->tok = s->cur;
- static void *yystable[] = {
- &&yyFillLabel0,
- &&yyFillLabel1,
- &&yyFillLabel2,
- &&yyFillLabel3,
- };
-
- if (s->state < 0) {
- goto yy0;
+ switch (s->state) {
+ default: goto yy0;
+ case 0: goto yyFillLabel0;
+ case 1: goto yyFillLabel1;
+ case 2: goto yyFillLabel2;
+ case 3: goto yyFillLabel3;
}
- goto *yystable[s->state];
for(;;)
{
s->tok = s->cur;
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
- if (YYGETSTATE() < 1) {
- if (YYGETSTATE() < 0) {
- goto yy0;
- } else {
- goto yyFillLabel0;
- }
- } else {
- if (YYGETSTATE() < 2) {
- goto yyFillLabel1;
- } else {
- goto yyFillLabel2;
- }
+ switch (YYGETSTATE()) {
+ default: goto yy0;
+ case 0: goto yyFillLabel0;
+ case 1: goto yyFillLabel1;
+ case 2: goto yyFillLabel2;
}
yy0:
YYSETSTATE(0);
yy3:
#line 246 "push.fb.re"
{ SEND(kIdentifier); }
-#line 370 "<stdout>"
+#line 363 "<stdout>"
yy4:
yych = *++YYCURSOR;
if (yych == 'o') goto yy64;
yy13:
#line 247 "push.fb.re"
{ SEND(kDecimalConstant);}
-#line 408 "<stdout>"
+#line 401 "<stdout>"
yy14:
++YYCURSOR;
#line 249 "push.fb.re"
{ SEND(kEqual); }
-#line 413 "<stdout>"
+#line 406 "<stdout>"
yy16:
++YYCURSOR;
#line 250 "push.fb.re"
{ SEND(kLeftParen); }
-#line 418 "<stdout>"
+#line 411 "<stdout>"
yy18:
++YYCURSOR;
#line 251 "push.fb.re"
{ SEND(kRightParen); }
-#line 423 "<stdout>"
+#line 416 "<stdout>"
yy20:
++YYCURSOR;
#line 252 "push.fb.re"
{ SEND(kMinus); }
-#line 428 "<stdout>"
+#line 421 "<stdout>"
yy22:
++YYCURSOR;
#line 253 "push.fb.re"
{ SEND(kPlus); }
-#line 433 "<stdout>"
+#line 426 "<stdout>"
yy24:
++YYCURSOR;
#line 254 "push.fb.re"
{ SEND(kStar); }
-#line 438 "<stdout>"
+#line 431 "<stdout>"
yy26:
++YYCURSOR;
#line 255 "push.fb.re"
{ SEND(kSlash); }
-#line 443 "<stdout>"
+#line 436 "<stdout>"
yy28:
++YYCURSOR;
#line 257 "push.fb.re"
{ SKIP(); }
-#line 448 "<stdout>"
+#line 441 "<stdout>"
yy30:
++YYCURSOR;
#line 258 "push.fb.re"
{ SKIP(); }
-#line 453 "<stdout>"
+#line 446 "<stdout>"
yy32:
++YYCURSOR;
#line 259 "push.fb.re"
{ send(kEOF); return 1; }
-#line 458 "<stdout>"
+#line 451 "<stdout>"
yy34:
++YYCURSOR;
#line 260 "push.fb.re"
{ SEND(kUnknown); }
-#line 463 "<stdout>"
+#line 456 "<stdout>"
yy36:
++YYCURSOR;
YYSETSTATE(1);
}
#line 245 "push.fb.re"
{ SEND(kReturn); }
-#line 501 "<stdout>"
+#line 494 "<stdout>"
yy46:
yych = *++YYCURSOR;
if (yych != 'i') goto yy39;
}
#line 244 "push.fb.re"
{ SEND(kWhile); }
-#line 515 "<stdout>"
+#line 508 "<stdout>"
yy51:
yych = *++YYCURSOR;
if (yych != 'e') goto yy39;
}
#line 243 "push.fb.re"
{ SEND(kBreak); }
-#line 529 "<stdout>"
+#line 522 "<stdout>"
yy56:
yych = *++YYCURSOR;
if (yych != 't') goto yy39;
}
#line 242 "push.fb.re"
{ SEND(kGoto); }
-#line 541 "<stdout>"
+#line 534 "<stdout>"
yy60:
yych = *++YYCURSOR;
if (yych != 's') goto yy39;
}
#line 241 "push.fb.re"
{ SEND(kElse); }
-#line 553 "<stdout>"
+#line 546 "<stdout>"
yy64:
yych = *++YYCURSOR;
if (yych != 'r') goto yy39;
}
#line 240 "push.fb.re"
{ SEND(kFor); }
-#line 563 "<stdout>"
+#line 556 "<stdout>"
yy67:
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 128) {
}
#line 239 "push.fb.re"
{ SEND(kIf); }
-#line 571 "<stdout>"
+#line 564 "<stdout>"
}
#line 261 "push.fb.re"
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
- static void *yystable[] = {
- &&yyFillLabel0,
- &&yyFillLabel1,
- &&yyFillLabel2,
- };
-
- if (YYGETSTATE() < 0) {
- goto yy0;
+ switch (YYGETSTATE()) {
+ default: goto yy0;
+ case 0: goto yyFillLabel0;
+ case 1: goto yyFillLabel1;
+ case 2: goto yyFillLabel2;
}
- goto *yystable[YYGETSTATE()];
yy0:
YYSETSTATE(0);
if ((YYLIMIT - YYCURSOR) < 7) YYFILL(7);
yy3:
#line 246 "push.fg.re"
{ SEND(kIdentifier); }
-#line 329 "<stdout>"
+#line 325 "<stdout>"
yy4:
yych = *++YYCURSOR;
if (yych == 'o') goto yy64;
yy13:
#line 247 "push.fg.re"
{ SEND(kDecimalConstant);}
-#line 367 "<stdout>"
+#line 363 "<stdout>"
yy14:
++YYCURSOR;
#line 249 "push.fg.re"
{ SEND(kEqual); }
-#line 372 "<stdout>"
+#line 368 "<stdout>"
yy16:
++YYCURSOR;
#line 250 "push.fg.re"
{ SEND(kLeftParen); }
-#line 377 "<stdout>"
+#line 373 "<stdout>"
yy18:
++YYCURSOR;
#line 251 "push.fg.re"
{ SEND(kRightParen); }
-#line 382 "<stdout>"
+#line 378 "<stdout>"
yy20:
++YYCURSOR;
#line 252 "push.fg.re"
{ SEND(kMinus); }
-#line 387 "<stdout>"
+#line 383 "<stdout>"
yy22:
++YYCURSOR;
#line 253 "push.fg.re"
{ SEND(kPlus); }
-#line 392 "<stdout>"
+#line 388 "<stdout>"
yy24:
++YYCURSOR;
#line 254 "push.fg.re"
{ SEND(kStar); }
-#line 397 "<stdout>"
+#line 393 "<stdout>"
yy26:
++YYCURSOR;
#line 255 "push.fg.re"
{ SEND(kSlash); }
-#line 402 "<stdout>"
+#line 398 "<stdout>"
yy28:
++YYCURSOR;
#line 257 "push.fg.re"
{ SKIP(); }
-#line 407 "<stdout>"
+#line 403 "<stdout>"
yy30:
++YYCURSOR;
#line 258 "push.fg.re"
{ SKIP(); }
-#line 412 "<stdout>"
+#line 408 "<stdout>"
yy32:
++YYCURSOR;
#line 259 "push.fg.re"
{ send(kEOF); return 1; }
-#line 417 "<stdout>"
+#line 413 "<stdout>"
yy34:
++YYCURSOR;
#line 260 "push.fg.re"
{ SEND(kUnknown); }
-#line 422 "<stdout>"
+#line 418 "<stdout>"
yy36:
++YYCURSOR;
YYSETSTATE(1);
}
#line 245 "push.fg.re"
{ SEND(kReturn); }
-#line 460 "<stdout>"
+#line 456 "<stdout>"
yy46:
yych = *++YYCURSOR;
if (yych != 'i') goto yy39;
}
#line 244 "push.fg.re"
{ SEND(kWhile); }
-#line 474 "<stdout>"
+#line 470 "<stdout>"
yy51:
yych = *++YYCURSOR;
if (yych != 'e') goto yy39;
}
#line 243 "push.fg.re"
{ SEND(kBreak); }
-#line 488 "<stdout>"
+#line 484 "<stdout>"
yy56:
yych = *++YYCURSOR;
if (yych != 't') goto yy39;
}
#line 242 "push.fg.re"
{ SEND(kGoto); }
-#line 500 "<stdout>"
+#line 496 "<stdout>"
yy60:
yych = *++YYCURSOR;
if (yych != 's') goto yy39;
}
#line 241 "push.fg.re"
{ SEND(kElse); }
-#line 512 "<stdout>"
+#line 508 "<stdout>"
yy64:
yych = *++YYCURSOR;
if (yych != 'r') goto yy39;
}
#line 240 "push.fg.re"
{ SEND(kFor); }
-#line 522 "<stdout>"
+#line 518 "<stdout>"
yy67:
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 128) {
}
#line 239 "push.fg.re"
{ SEND(kIf); }
-#line 530 "<stdout>"
+#line 526 "<stdout>"
}
#line 261 "push.fg.re"