From 2f4dfe7170ee75a9bfbd1adc140f8a80703e3ee6 Mon Sep 17 00:00:00 2001 From: helly Date: Sun, 9 Apr 2006 00:06:34 +0000 Subject: [PATCH] - Added configuration 'state:abort'. - Changed to not generate yyNext unless configuration 'state:nextlabel' is used. - Add tests for the new configurations and adapt old tests. --- CHANGELOG | 6 ++- code.cc | 58 +++++++++++++++++++-------- globals.h | 3 ++ htdocs/manual.html | 6 +++ main.cc | 4 ++ re.h | 5 ++- re2c.1.in | 14 +++++++ test/config4a.f.c | 77 ++++++++++++++++++++++++++++++++++++ test/config4a.f.re | 16 ++++++++ test/config4b.f.c | 78 ++++++++++++++++++++++++++++++++++++ test/config4b.f.re | 16 ++++++++ test/config4c.f.c | 78 ++++++++++++++++++++++++++++++++++++ test/config4c.f.re | 17 ++++++++ test/config4d.f.c | 79 +++++++++++++++++++++++++++++++++++++ test/config4d.f.re | 18 +++++++++ test/config4e.f.c | 78 ++++++++++++++++++++++++++++++++++++ test/config4e.f.re | 18 +++++++++ test/push.f.c | 44 ++++++++++----------- test/push.fb.c | 44 ++++++++++----------- test/push.fs.c | 44 ++++++++++----------- test/scanner.fs.c | 98 +++++++++++++++++++++++----------------------- 21 files changed, 661 insertions(+), 140 deletions(-) create mode 100755 test/config4a.f.c create mode 100755 test/config4a.f.re create mode 100755 test/config4b.f.c create mode 100755 test/config4b.f.re create mode 100755 test/config4c.f.c create mode 100755 test/config4c.f.re create mode 100755 test/config4d.f.c create mode 100755 test/config4d.f.re create mode 100755 test/config4e.f.c create mode 100755 test/config4e.f.re diff --git a/CHANGELOG b/CHANGELOG index 3bab6db3..2145f756 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,9 @@ Version 0.10.2 (????-??-??) --------------------------- -- Change to not generate yyaccept code unless needed. -- Change to use if- instead of switch-expression when yyaccpt has only one case. +- Added configuration 'state:abort'. +- Changed to not generate yyNext unless configuration 'state:nextlabel' is used. +- Changed to not generate yyaccept code unless needed. +- Changed to use if- instead of switch-expression when yyaccpt has only one case. - Added docu, examples and tests to .src.zip package (0.10.1 zip was repackaged). - Fixed #1463639 Missing forward declaration. - Implemented #1187127 savable state support for multiple re2c blocks. diff --git a/code.cc b/code.cc index f695e42b..790051d0 100644 --- a/code.cc +++ b/code.cc @@ -1382,22 +1382,7 @@ void DFA::emit(std::ostream &o, uint ind) o << "\n"; } - if (fFlag && start_label == 0) - { - vUsedLabels.insert(start_label); - o << indent(ind) << "switch(YYGETSTATE())\n"; - o << indent(ind) << "{\n"; - o << indent(ind) << "case -1: goto yy" << start_label << ";\n"; - - for (size_t i=0; inext) @@ -1427,6 +1412,37 @@ void DFA::emit(std::ostream &o, uint ind) bUseStartLabel = false; } +void genGetState(std::ostream &o, uint& ind, uint start_label) +{ + if (fFlag && !bWroteGetState) + { + vUsedLabels.insert(start_label); + o << indent(ind) << "switch(YYGETSTATE())\n"; + o << indent(ind) << "{\n"; + if (bUseStateAbort) + { + o << indent(ind) << "default: abort();\n"; + o << indent(ind) << "case -1: goto yy" << start_label << ";\n"; + } + else + { + o << indent(ind) << "default: goto yy" << start_label << ";\n"; + } + + for (size_t i=0; iyy0 like start label is only being generated if needed. If set to a text value then a label with that text will be generated regardless of whether the normal start label is being used or not. This setting is being reset to 0 after a start label has been generated. +
re2c:state:abort = 0 ;
+
When not zero and switch -f is active then the YYGETSTATE block will +contain a default case that aborts and a -1 case used for initialization.
+
re2c:state:nextlabel = 0 ;
+
Used when -f is active to control whether the YYGETSTATE block is +followed by a yyNext: label line.

A LARGER EXAMPLE

diff --git a/main.cc b/main.cc index 7cc8161f..25d2ee7b 100644 --- a/main.cc +++ b/main.cc @@ -31,6 +31,7 @@ bool wFlag = false; bool bUsedYYAccept = false; bool bUseStartLabel= false; +bool bUseStateNext = false; std::string startLabelName; uint maxFill = 1; uint next_label = 0; @@ -38,6 +39,8 @@ uint next_label = 0; uint topIndent = 0; std::string indString("\t"); bool yybmHexTable = false; +bool bUseStateAbort = false; +bool bWroteGetState = false; uint nRealChars = 256; @@ -262,6 +265,7 @@ int main(int argc, char *argv[]) next_label = 0; next_fill_index = 0; Symbol::ClearTable(); + bWroteGetState = false; } parse(scanner, output); diff --git a/re.h b/re.h index 60698f81..d3a0c26a 100644 --- a/re.h +++ b/re.h @@ -414,9 +414,10 @@ private: }; extern void genCode(std::ostream&, RegExp*); -extern void genCode(std::ostream&, uint ind, RegExp*); +extern void genCode(std::ostream&, uint, RegExp*); +extern void genGetState(std::ostream&, uint&, uint); extern RegExp *mkDiff(RegExp*, RegExp*); -extern RegExp *mkAlt(RegExp *e1, RegExp *e2); +extern RegExp *mkAlt(RegExp*, RegExp*); } // end namespace re2c diff --git a/re2c.1.in b/re2c.1.in index eca42680..6ed71175 100644 --- a/re2c.1.in +++ b/re2c.1.in @@ -7,6 +7,12 @@ .ds rx regular expression .ds lx \fIl\fP-expression \"$Log$ +\"Revision 1.43 2006/04/09 00:06:33 helly +\"- Added configuration 'state:abort'. +\"- Changed to not generate yyNext unless configuration 'state:nextlabel' is +\" used. +\"- Add tests for the new configurations and adapt old tests. +\" \"Revision 1.42 2006/04/08 21:33:02 helly \"- Update docu \" @@ -540,6 +546,14 @@ will be generated even if not used by the scanner itself. Otherwise the normal value then a label with that text will be generated regardless of whether the normal start label is being used or not. This setting is being reset to \fB0\fP after a start label has been generated. +.TP +\fIre2c:state:abort\fP \fB=\fP 0 \fB;\fP +When not zero and switch -f is active then the \fCYYGETSTATE\fP block will +contain a default case that aborts and a -1 case used for initialization. +.TP +\fIre2c:state:nextlabel\fP \fB=\fP 0 \fB;\fP +Used when -f is active to control whether the \fCYYGETSTATE\fP block is +followed by a \fCyyNext:\fP label line. .SH "A LARGER EXAMPLE" .LP diff --git a/test/config4a.f.c b/test/config4a.f.c new file mode 100755 index 00000000..312f198d --- /dev/null +++ b/test/config4a.f.c @@ -0,0 +1,77 @@ +/* Generated by re2c */ +#line 1 "config4a.f.re" +#define NULL ((char*) 0) +#define YYCTYPE char +#define YYCURSOR p +#define YYLIMIT p +#define YYMARKER q +#define YYFILL(n) + +char *scan(char *p) +{ + char *q; + +#line 15 "" +{ + + switch(YYGETSTATE()) + { + default: goto yy0; + case 0: goto yyFillLabel0; + case 1: goto yyFillLabel1; + } +yy0: + YYSETSTATE(0); + if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); +yyFillLabel0: + yych = *YYCURSOR; + switch(yych){ + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy2; + default: goto yy4; + } +yy2: + ++YYCURSOR; + yych = *YYCURSOR; + goto yy7; +yy3: +#line 13 "config4a.f.re" + { return YYCURSOR; } +#line 49 "" +yy4: + ++YYCURSOR; +#line 14 "config4a.f.re" + { return NULL; } +#line 54 "" +yy6: + ++YYCURSOR; + YYSETSTATE(1); + if(YYLIMIT == YYCURSOR) YYFILL(1); +yyFillLabel1: + yych = *YYCURSOR; +yy7: + switch(yych){ + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy6; + default: goto yy3; + } +} +#line 15 "config4a.f.re" + +} diff --git a/test/config4a.f.re b/test/config4a.f.re new file mode 100755 index 00000000..a09afb3a --- /dev/null +++ b/test/config4a.f.re @@ -0,0 +1,16 @@ +#define NULL ((char*) 0) +#define YYCTYPE char +#define YYCURSOR p +#define YYLIMIT p +#define YYMARKER q +#define YYFILL(n) + +char *scan(char *p) +{ + char *q; +/*!re2c + re2c:state:abort = 0; + [0-9]+ { return YYCURSOR; } + [\000-\377] { return NULL; } +*/ +} diff --git a/test/config4b.f.c b/test/config4b.f.c new file mode 100755 index 00000000..758db641 --- /dev/null +++ b/test/config4b.f.c @@ -0,0 +1,78 @@ +/* Generated by re2c */ +#line 1 "config4b.f.re" +#define NULL ((char*) 0) +#define YYCTYPE char +#define YYCURSOR p +#define YYLIMIT p +#define YYMARKER q +#define YYFILL(n) + +char *scan(char *p) +{ + char *q; + +#line 15 "" +{ + + switch(YYGETSTATE()) + { + default: abort(); + case -1: goto yy0; + case 0: goto yyFillLabel0; + case 1: goto yyFillLabel1; + } +yy0: + YYSETSTATE(0); + if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); +yyFillLabel0: + yych = *YYCURSOR; + switch(yych){ + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy2; + default: goto yy4; + } +yy2: + ++YYCURSOR; + yych = *YYCURSOR; + goto yy7; +yy3: +#line 13 "config4b.f.re" + { return YYCURSOR; } +#line 50 "" +yy4: + ++YYCURSOR; +#line 14 "config4b.f.re" + { return NULL; } +#line 55 "" +yy6: + ++YYCURSOR; + YYSETSTATE(1); + if(YYLIMIT == YYCURSOR) YYFILL(1); +yyFillLabel1: + yych = *YYCURSOR; +yy7: + switch(yych){ + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy6; + default: goto yy3; + } +} +#line 15 "config4b.f.re" + +} diff --git a/test/config4b.f.re b/test/config4b.f.re new file mode 100755 index 00000000..b6360392 --- /dev/null +++ b/test/config4b.f.re @@ -0,0 +1,16 @@ +#define NULL ((char*) 0) +#define YYCTYPE char +#define YYCURSOR p +#define YYLIMIT p +#define YYMARKER q +#define YYFILL(n) + +char *scan(char *p) +{ + char *q; +/*!re2c + re2c:state:abort = 1; + [0-9]+ { return YYCURSOR; } + [\000-\377] { return NULL; } +*/ +} diff --git a/test/config4c.f.c b/test/config4c.f.c new file mode 100755 index 00000000..8f7c50a0 --- /dev/null +++ b/test/config4c.f.c @@ -0,0 +1,78 @@ +/* Generated by re2c */ +#line 1 "config4c.f.re" +#define NULL ((char*) 0) +#define YYCTYPE char +#define YYCURSOR p +#define YYLIMIT p +#define YYMARKER q +#define YYFILL(n) + +char *scan(char *p) +{ + char *q; + +#line 15 "" +{ + + switch(YYGETSTATE()) + { + default: goto yy0; + case 0: goto yyFillLabel0; + case 1: goto yyFillLabel1; + } +start: +yy0: + YYSETSTATE(0); + if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); +yyFillLabel0: + yych = *YYCURSOR; + switch(yych){ + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy2; + default: goto yy4; + } +yy2: + ++YYCURSOR; + yych = *YYCURSOR; + goto yy7; +yy3: +#line 14 "config4c.f.re" + { return YYCURSOR; } +#line 50 "" +yy4: + ++YYCURSOR; +#line 15 "config4c.f.re" + { return NULL; } +#line 55 "" +yy6: + ++YYCURSOR; + YYSETSTATE(1); + if(YYLIMIT == YYCURSOR) YYFILL(1); +yyFillLabel1: + yych = *YYCURSOR; +yy7: + switch(yych){ + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy6; + default: goto yy3; + } +} +#line 16 "config4c.f.re" + +} diff --git a/test/config4c.f.re b/test/config4c.f.re new file mode 100755 index 00000000..cc10e369 --- /dev/null +++ b/test/config4c.f.re @@ -0,0 +1,17 @@ +#define NULL ((char*) 0) +#define YYCTYPE char +#define YYCURSOR p +#define YYLIMIT p +#define YYMARKER q +#define YYFILL(n) + +char *scan(char *p) +{ + char *q; +/*!re2c + re2c:startlabel = "start"; + re2c:state:abort = 0; + [0-9]+ { return YYCURSOR; } + [\000-\377] { return NULL; } +*/ +} diff --git a/test/config4d.f.c b/test/config4d.f.c new file mode 100755 index 00000000..b40b71b4 --- /dev/null +++ b/test/config4d.f.c @@ -0,0 +1,79 @@ +/* Generated by re2c */ +#line 1 "config4d.f.re" +#define NULL ((char*) 0) +#define YYCTYPE char +#define YYCURSOR p +#define YYLIMIT p +#define YYMARKER q +#define YYFILL(n) + +char *scan(char *p) +{ + char *q; + +#line 15 "" +{ + + switch(YYGETSTATE()) + { + default: goto yy0; + case 0: goto yyFillLabel0; + case 1: goto yyFillLabel1; + } +yyNext: +start: +yy0: + YYSETSTATE(0); + if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); +yyFillLabel0: + yych = *YYCURSOR; + switch(yych){ + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy2; + default: goto yy4; + } +yy2: + ++YYCURSOR; + yych = *YYCURSOR; + goto yy7; +yy3: +#line 15 "config4d.f.re" + { return YYCURSOR; } +#line 51 "" +yy4: + ++YYCURSOR; +#line 16 "config4d.f.re" + { return NULL; } +#line 56 "" +yy6: + ++YYCURSOR; + YYSETSTATE(1); + if(YYLIMIT == YYCURSOR) YYFILL(1); +yyFillLabel1: + yych = *YYCURSOR; +yy7: + switch(yych){ + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy6; + default: goto yy3; + } +} +#line 17 "config4d.f.re" + +} diff --git a/test/config4d.f.re b/test/config4d.f.re new file mode 100755 index 00000000..23415cf1 --- /dev/null +++ b/test/config4d.f.re @@ -0,0 +1,18 @@ +#define NULL ((char*) 0) +#define YYCTYPE char +#define YYCURSOR p +#define YYLIMIT p +#define YYMARKER q +#define YYFILL(n) + +char *scan(char *p) +{ + char *q; +/*!re2c + re2c:startlabel = "start"; + re2c:state:abort = 0; + re2c:state:nextlabel = 1; + [0-9]+ { return YYCURSOR; } + [\000-\377] { return NULL; } +*/ +} diff --git a/test/config4e.f.c b/test/config4e.f.c new file mode 100755 index 00000000..17d6af53 --- /dev/null +++ b/test/config4e.f.c @@ -0,0 +1,78 @@ +/* Generated by re2c */ +#line 1 "config4e.f.re" +#define NULL ((char*) 0) +#define YYCTYPE char +#define YYCURSOR p +#define YYLIMIT p +#define YYMARKER q +#define YYFILL(n) + +char *scan(char *p) +{ + char *q; + +#line 15 "" +{ + + switch(YYGETSTATE()) + { + default: goto yy0; + case 0: goto yyFillLabel0; + case 1: goto yyFillLabel1; + } +yyNext: +yy0: + YYSETSTATE(0); + if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); +yyFillLabel0: + yych = *YYCURSOR; + switch(yych){ + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy2; + default: goto yy4; + } +yy2: + ++YYCURSOR; + yych = *YYCURSOR; + goto yy7; +yy3: +#line 15 "config4e.f.re" + { return YYCURSOR; } +#line 50 "" +yy4: + ++YYCURSOR; +#line 16 "config4e.f.re" + { return NULL; } +#line 55 "" +yy6: + ++YYCURSOR; + YYSETSTATE(1); + if(YYLIMIT == YYCURSOR) YYFILL(1); +yyFillLabel1: + yych = *YYCURSOR; +yy7: + switch(yych){ + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy6; + default: goto yy3; + } +} +#line 17 "config4e.f.re" + +} diff --git a/test/config4e.f.re b/test/config4e.f.re new file mode 100755 index 00000000..48958651 --- /dev/null +++ b/test/config4e.f.re @@ -0,0 +1,18 @@ +#define NULL ((char*) 0) +#define YYCTYPE char +#define YYCURSOR p +#define YYLIMIT p +#define YYMARKER q +#define YYFILL(n) + +char *scan(char *p) +{ + char *q; +/*!re2c + re2c:startlabel = "yyNext"; + re2c:state:abort = 0; + re2c:state:nextlabel = 0; + [0-9]+ { return YYCURSOR; } + [\000-\377] { return NULL; } +*/ +} diff --git a/test/push.f.c b/test/push.f.c index ce2cdbbf..d248cd4c 100755 --- a/test/push.f.c +++ b/test/push.f.c @@ -234,13 +234,11 @@ public: switch(YYGETSTATE()) { - case -1: goto yy0; + default: goto yy0; case 0: goto yyFillLabel0; case 1: goto yyFillLabel1; case 2: goto yyFillLabel2; - default: /* abort() */; } -yyNext: yy0: YYSETSTATE(0); if((YYLIMIT - YYCURSOR) < 7) YYFILL(7); @@ -335,7 +333,7 @@ yy2: yy3: #line 246 "push.f.re" { SEND(kIdentifier); } -#line 339 "" +#line 337 "" yy4: yych = *++YYCURSOR; switch(yych){ @@ -385,62 +383,62 @@ yy12: yy13: #line 247 "push.f.re" { SEND(kDecimalConstant);} -#line 389 "" +#line 387 "" yy14: ++YYCURSOR; #line 249 "push.f.re" { SEND(kEqual); } -#line 394 "" +#line 392 "" yy16: ++YYCURSOR; #line 250 "push.f.re" { SEND(kLeftParen); } -#line 399 "" +#line 397 "" yy18: ++YYCURSOR; #line 251 "push.f.re" { SEND(kRightParen); } -#line 404 "" +#line 402 "" yy20: ++YYCURSOR; #line 252 "push.f.re" { SEND(kMinus); } -#line 409 "" +#line 407 "" yy22: ++YYCURSOR; #line 253 "push.f.re" { SEND(kPlus); } -#line 414 "" +#line 412 "" yy24: ++YYCURSOR; #line 254 "push.f.re" { SEND(kStar); } -#line 419 "" +#line 417 "" yy26: ++YYCURSOR; #line 255 "push.f.re" { SEND(kSlash); } -#line 424 "" +#line 422 "" yy28: ++YYCURSOR; #line 257 "push.f.re" { SKIP(); } -#line 429 "" +#line 427 "" yy30: ++YYCURSOR; #line 258 "push.f.re" { SKIP(); } -#line 434 "" +#line 432 "" yy32: ++YYCURSOR; #line 259 "push.f.re" { send(kEOF); return 1; } -#line 439 "" +#line 437 "" yy34: ++YYCURSOR; #line 260 "push.f.re" { SEND(kUnknown); } -#line 444 "" +#line 442 "" yy36: ++YYCURSOR; YYSETSTATE(1); @@ -629,7 +627,7 @@ yy44: yy45: #line 245 "push.f.re" { SEND(kReturn); } -#line 633 "" +#line 631 "" yy46: yych = *++YYCURSOR; switch(yych){ @@ -719,7 +717,7 @@ yy49: yy50: #line 244 "push.f.re" { SEND(kWhile); } -#line 723 "" +#line 721 "" yy51: yych = *++YYCURSOR; switch(yych){ @@ -809,7 +807,7 @@ yy54: yy55: #line 243 "push.f.re" { SEND(kBreak); } -#line 813 "" +#line 811 "" yy56: yych = *++YYCURSOR; switch(yych){ @@ -893,7 +891,7 @@ yy58: yy59: #line 242 "push.f.re" { SEND(kGoto); } -#line 897 "" +#line 895 "" yy60: yych = *++YYCURSOR; switch(yych){ @@ -977,7 +975,7 @@ yy62: yy63: #line 241 "push.f.re" { SEND(kElse); } -#line 981 "" +#line 979 "" yy64: yych = *++YYCURSOR; switch(yych){ @@ -1055,7 +1053,7 @@ yy65: yy66: #line 240 "push.f.re" { SEND(kFor); } -#line 1059 "" +#line 1057 "" yy67: ++YYCURSOR; switch((yych = *YYCURSOR)) { @@ -1127,7 +1125,7 @@ yy67: yy68: #line 239 "push.f.re" { SEND(kIf); } -#line 1131 "" +#line 1129 "" } #line 261 "push.f.re" diff --git a/test/push.fb.c b/test/push.fb.c index 502e04a8..a2b25ebe 100755 --- a/test/push.fb.c +++ b/test/push.fb.c @@ -269,13 +269,11 @@ public: switch(YYGETSTATE()) { - case -1: goto yy0; + default: goto yy0; case 0: goto yyFillLabel0; case 1: goto yyFillLabel1; case 2: goto yyFillLabel2; - default: /* abort() */; } -yyNext: yy0: YYSETSTATE(0); if((YYLIMIT - YYCURSOR) < 7) YYFILL(7); @@ -363,7 +361,7 @@ yyFillLabel0: yy3: #line 246 "push.fb.re" { SEND(kIdentifier); } -#line 367 "" +#line 365 "" yy4: yych = *++YYCURSOR; if(yych == 'o') goto yy64; @@ -401,62 +399,62 @@ yy12: yy13: #line 247 "push.fb.re" { SEND(kDecimalConstant);} -#line 405 "" +#line 403 "" yy14: ++YYCURSOR; #line 249 "push.fb.re" { SEND(kEqual); } -#line 410 "" +#line 408 "" yy16: ++YYCURSOR; #line 250 "push.fb.re" { SEND(kLeftParen); } -#line 415 "" +#line 413 "" yy18: ++YYCURSOR; #line 251 "push.fb.re" { SEND(kRightParen); } -#line 420 "" +#line 418 "" yy20: ++YYCURSOR; #line 252 "push.fb.re" { SEND(kMinus); } -#line 425 "" +#line 423 "" yy22: ++YYCURSOR; #line 253 "push.fb.re" { SEND(kPlus); } -#line 430 "" +#line 428 "" yy24: ++YYCURSOR; #line 254 "push.fb.re" { SEND(kStar); } -#line 435 "" +#line 433 "" yy26: ++YYCURSOR; #line 255 "push.fb.re" { SEND(kSlash); } -#line 440 "" +#line 438 "" yy28: ++YYCURSOR; #line 257 "push.fb.re" { SKIP(); } -#line 445 "" +#line 443 "" yy30: ++YYCURSOR; #line 258 "push.fb.re" { SKIP(); } -#line 450 "" +#line 448 "" yy32: ++YYCURSOR; #line 259 "push.fb.re" { send(kEOF); return 1; } -#line 455 "" +#line 453 "" yy34: ++YYCURSOR; #line 260 "push.fb.re" { SEND(kUnknown); } -#line 460 "" +#line 458 "" yy36: ++YYCURSOR; YYSETSTATE(1); @@ -494,7 +492,7 @@ yy40: } #line 245 "push.fb.re" { SEND(kReturn); } -#line 498 "" +#line 496 "" yy46: yych = *++YYCURSOR; if(yych != 'i') goto yy39; @@ -508,7 +506,7 @@ yy46: } #line 244 "push.fb.re" { SEND(kWhile); } -#line 512 "" +#line 510 "" yy51: yych = *++YYCURSOR; if(yych != 'e') goto yy39; @@ -522,7 +520,7 @@ yy51: } #line 243 "push.fb.re" { SEND(kBreak); } -#line 526 "" +#line 524 "" yy56: yych = *++YYCURSOR; if(yych != 't') goto yy39; @@ -534,7 +532,7 @@ yy56: } #line 242 "push.fb.re" { SEND(kGoto); } -#line 538 "" +#line 536 "" yy60: yych = *++YYCURSOR; if(yych != 's') goto yy39; @@ -546,7 +544,7 @@ yy60: } #line 241 "push.fb.re" { SEND(kElse); } -#line 550 "" +#line 548 "" yy64: yych = *++YYCURSOR; if(yych != 'r') goto yy39; @@ -556,7 +554,7 @@ yy64: } #line 240 "push.fb.re" { SEND(kFor); } -#line 560 "" +#line 558 "" yy67: ++YYCURSOR; if(yybm[0+(yych = *YYCURSOR)] & 128) { @@ -564,7 +562,7 @@ yy67: } #line 239 "push.fb.re" { SEND(kIf); } -#line 568 "" +#line 566 "" } } #line 261 "push.fb.re" diff --git a/test/push.fs.c b/test/push.fs.c index 725d6b92..287bef9d 100755 --- a/test/push.fs.c +++ b/test/push.fs.c @@ -23,13 +23,11 @@ start: switch(YYGETSTATE()) { - case -1: goto yy0; + default: goto yy0; case 0: goto yyFillLabel0; case 1: goto yyFillLabel1; case 2: goto yyFillLabel2; - default: /* abort() */; } -yyNext: yy0: YYSETSTATE(0); if((YYLIMIT - YYCURSOR) < 7) YYFILL(7); @@ -117,7 +115,7 @@ yyFillLabel0: yy3: #line 35 "push.fs.re" { SEND(kIdentifier); } -#line 121 "" +#line 119 "" yy4: yych = *++YYCURSOR; if(yych == 'o') goto yy64; @@ -155,62 +153,62 @@ yy12: yy13: #line 36 "push.fs.re" { SEND(kDecimalConstant);} -#line 159 "" +#line 157 "" yy14: ++YYCURSOR; #line 38 "push.fs.re" { SEND(kEqual); } -#line 164 "" +#line 162 "" yy16: ++YYCURSOR; #line 39 "push.fs.re" { SEND(kLeftParen); } -#line 169 "" +#line 167 "" yy18: ++YYCURSOR; #line 40 "push.fs.re" { SEND(kRightParen); } -#line 174 "" +#line 172 "" yy20: ++YYCURSOR; #line 41 "push.fs.re" { SEND(kMinus); } -#line 179 "" +#line 177 "" yy22: ++YYCURSOR; #line 42 "push.fs.re" { SEND(kPlus); } -#line 184 "" +#line 182 "" yy24: ++YYCURSOR; #line 43 "push.fs.re" { SEND(kStar); } -#line 189 "" +#line 187 "" yy26: ++YYCURSOR; #line 44 "push.fs.re" { SEND(kSlash); } -#line 194 "" +#line 192 "" yy28: ++YYCURSOR; #line 46 "push.fs.re" { SKIP(); } -#line 199 "" +#line 197 "" yy30: ++YYCURSOR; #line 47 "push.fs.re" { SKIP(); } -#line 204 "" +#line 202 "" yy32: ++YYCURSOR; #line 48 "push.fs.re" { send(kEOF); return 1; } -#line 209 "" +#line 207 "" yy34: ++YYCURSOR; #line 49 "push.fs.re" { SEND(kUnknown); } -#line 214 "" +#line 212 "" yy36: ++YYCURSOR; YYSETSTATE(1); @@ -268,7 +266,7 @@ yy40: yy45: #line 34 "push.fs.re" { SEND(kReturn); } -#line 272 "" +#line 270 "" yy46: yych = *++YYCURSOR; if(yych != 'i') goto yy39; @@ -292,7 +290,7 @@ yy46: yy50: #line 33 "push.fs.re" { SEND(kWhile); } -#line 296 "" +#line 294 "" yy51: yych = *++YYCURSOR; if(yych != 'e') goto yy39; @@ -316,7 +314,7 @@ yy51: yy55: #line 32 "push.fs.re" { SEND(kBreak); } -#line 320 "" +#line 318 "" yy56: yych = *++YYCURSOR; if(yych != 't') goto yy39; @@ -338,7 +336,7 @@ yy56: yy59: #line 31 "push.fs.re" { SEND(kGoto); } -#line 342 "" +#line 340 "" yy60: yych = *++YYCURSOR; if(yych != 's') goto yy39; @@ -360,7 +358,7 @@ yy60: yy63: #line 30 "push.fs.re" { SEND(kElse); } -#line 364 "" +#line 362 "" yy64: yych = *++YYCURSOR; if(yych != 'r') goto yy39; @@ -380,7 +378,7 @@ yy64: yy66: #line 29 "push.fs.re" { SEND(kFor); } -#line 384 "" +#line 382 "" yy67: ++YYCURSOR; if((yych = *YYCURSOR) <= 'Z') { @@ -398,7 +396,7 @@ yy67: yy68: #line 28 "push.fs.re" { SEND(kIf); } -#line 402 "" +#line 400 "" } #line 50 "push.fs.re" diff --git a/test/scanner.fs.c b/test/scanner.fs.c index 511bed64..fbaa8a02 100755 --- a/test/scanner.fs.c +++ b/test/scanner.fs.c @@ -97,7 +97,7 @@ echo: switch(YYGETSTATE()) { - case -1: goto yy0; + default: goto yy0; case 0: goto yyFillLabel0; case 1: goto yyFillLabel1; case 2: goto yyFillLabel2; @@ -134,9 +134,7 @@ echo: case 33: goto yyFillLabel33; case 34: goto yyFillLabel34; case 35: goto yyFillLabel35; - default: /* abort() */; } -yyNext: yy0: YYSETSTATE(0); if((YYLIMIT - YYCURSOR) < 11) YYFILL(11); @@ -157,7 +155,7 @@ yy3: { goto echo; } -#line 161 "" +#line 159 "" yy4: yych = *++YYCURSOR; if(yych == '/') goto yy10; @@ -170,7 +168,7 @@ yy5: tok = pos = cursor; cline++; goto echo; } -#line 174 "" +#line 172 "" yy7: ++YYCURSOR; #line 135 "scanner.fs.re" @@ -180,7 +178,7 @@ yy7: RETURN(0); } } -#line 184 "" +#line 182 "" yy9: yych = *++YYCURSOR; goto yy3; @@ -196,7 +194,7 @@ yy10: tok = pos = cursor; goto echo; } -#line 200 "" +#line 198 "" yy12: yych = *++YYCURSOR; if(yych == '!') goto yy14; @@ -226,7 +224,7 @@ yy16: tok = cursor; RETURN(1); } -#line 230 "" +#line 228 "" yy21: yych = *++YYCURSOR; if(yych != 'x') goto yy13; @@ -248,7 +246,7 @@ yy21: ignore_eoc = true; goto echo; } -#line 252 "" +#line 250 "" } #line 144 "scanner.fs.re" @@ -273,7 +271,7 @@ scan: goto value; } -#line 277 "" +#line 275 "" { YYSETSTATE(1); @@ -352,14 +350,14 @@ yy32: { depth = 1; goto code; } -#line 356 "" +#line 354 "" yy33: ++YYCURSOR; if((yych = *YYCURSOR) == '*') goto yy92; yy34: #line 196 "scanner.fs.re" { RETURN(*tok); } -#line 363 "" +#line 361 "" yy35: ++YYCURSOR; if((yych = *YYCURSOR) == '/') goto yy90; @@ -367,7 +365,7 @@ yy36: #line 198 "scanner.fs.re" { yylval.op = *tok; RETURN(CLOSE); } -#line 371 "" +#line 369 "" yy37: yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); @@ -375,7 +373,7 @@ yy37: yy38: #line 183 "scanner.fs.re" { fatal("unterminated string constant (missing \")"); } -#line 379 "" +#line 377 "" yy39: yyaccept = 2; yych = *(YYMARKER = ++YYCURSOR); @@ -383,7 +381,7 @@ yy39: yy40: #line 184 "scanner.fs.re" { fatal("unterminated string constant (missing ')"); } -#line 387 "" +#line 385 "" yy41: yyaccept = 3; yych = *(YYMARKER = ++YYCURSOR); @@ -393,7 +391,7 @@ yy41: yy42: #line 194 "scanner.fs.re" { fatal("unterminated range (missing ])"); } -#line 397 "" +#line 395 "" yy43: yych = *++YYCURSOR; goto yy34; @@ -409,7 +407,7 @@ yy46: { cur = cursor; yylval.symbol = Symbol::find(token()); return ID; } -#line 413 "" +#line 411 "" yy47: yych = *++YYCURSOR; goto yy61; @@ -420,7 +418,7 @@ yy48: yylval.regexp = mkDot(); return RANGE; } -#line 424 "" +#line 422 "" yy50: ++YYCURSOR; yych = *YYCURSOR; @@ -428,7 +426,7 @@ yy50: yy51: #line 234 "scanner.fs.re" { goto scan; } -#line 432 "" +#line 430 "" yy52: ++YYCURSOR; yy53: @@ -437,7 +435,7 @@ yy53: pos = cursor; cline++; goto scan; } -#line 441 "" +#line 439 "" yy54: ++YYCURSOR; if((yych = *YYCURSOR) == 0x0A) goto yy57; @@ -449,7 +447,7 @@ yy55: fatal(msg.str().c_str()); goto scan; } -#line 453 "" +#line 451 "" yy56: yych = *++YYCURSOR; goto yy55; @@ -542,7 +540,7 @@ yy69: yylval.str = new Str(token()); return CONFIG; } -#line 546 "" +#line 544 "" yy70: ++YYCURSOR; YYSETSTATE(6); @@ -586,7 +584,7 @@ yy75: { cur = cursor; yylval.regexp = ranToRE(token()); return RANGE; } -#line 590 "" +#line 588 "" yy77: ++YYCURSOR; YYSETSTATE(9); @@ -601,7 +599,7 @@ yy78: { cur = cursor; yylval.regexp = invToRE(token()); return RANGE; } -#line 605 "" +#line 603 "" yy80: ++YYCURSOR; YYSETSTATE(10); @@ -629,7 +627,7 @@ yy83: { cur = cursor; yylval.regexp = strToCaseInsensitiveRE(token()); return STRING; } -#line 633 "" +#line 631 "" yy85: ++YYCURSOR; YYSETSTATE(12); @@ -657,19 +655,19 @@ yy88: { cur = cursor; yylval.regexp = strToRE(token()); return STRING; } -#line 661 "" +#line 659 "" yy90: ++YYCURSOR; #line 172 "scanner.fs.re" { tok = cursor; RETURN(0); } -#line 667 "" +#line 665 "" yy92: ++YYCURSOR; #line 169 "scanner.fs.re" { depth = 1; goto comment; } -#line 673 "" +#line 671 "" yy94: yych = *++YYCURSOR; if(yych == ',') goto yy108; @@ -694,14 +692,14 @@ yy97: yy98: #line 216 "scanner.fs.re" { fatal("illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers"); } -#line 698 "" +#line 696 "" yy99: ++YYCURSOR; #line 204 "scanner.fs.re" { yylval.extop.minsize = atoi((char *)tok+1); yylval.extop.maxsize = atoi((char *)tok+1); RETURN(CLOSESIZE); } -#line 705 "" +#line 703 "" yy101: yyaccept = 6; yych = *(YYMARKER = ++YYCURSOR); @@ -713,7 +711,7 @@ yy101: { yylval.extop.minsize = atoi((char *)tok+1); yylval.extop.maxsize = -1; RETURN(CLOSESIZE); } -#line 717 "" +#line 715 "" yy104: ++YYCURSOR; YYSETSTATE(15); @@ -728,7 +726,7 @@ yyFillLabel15: { yylval.extop.minsize = atoi((char *)tok+1); yylval.extop.maxsize = MAX(yylval.extop.minsize,atoi(strchr((char *)tok, ',')+1)); RETURN(CLOSESIZE); } -#line 732 "" +#line 730 "" yy108: yyaccept = 6; yych = *(YYMARKER = ++YYCURSOR); @@ -739,14 +737,14 @@ yy108: #line 201 "scanner.fs.re" { yylval.op = '*'; RETURN(CLOSE); } -#line 743 "" +#line 741 "" } #line 247 "scanner.fs.re" code: -#line 750 "" +#line 748 "" { YYSETSTATE(16); @@ -778,13 +776,13 @@ yyFillLabel16: return CODE; } goto code; } -#line 782 "" +#line 780 "" yy115: ++YYCURSOR; #line 257 "scanner.fs.re" { ++depth; goto code; } -#line 788 "" +#line 786 "" yy117: ++YYCURSOR; #line 259 "scanner.fs.re" @@ -792,13 +790,13 @@ yy117: pos = cursor; cline++; goto code; } -#line 796 "" +#line 794 "" yy119: ++YYCURSOR; yy120: #line 263 "scanner.fs.re" { goto code; } -#line 802 "" +#line 800 "" yy121: yych = *(YYMARKER = ++YYCURSOR); if(yych == 0x0A) goto yy120; @@ -859,7 +857,7 @@ yyFillLabel20: comment: -#line 863 "" +#line 861 "" { YYSETSTATE(21); @@ -881,7 +879,7 @@ yy133: #line 279 "scanner.fs.re" { if(cursor == eof) RETURN(0); goto comment; } -#line 885 "" +#line 883 "" yy134: yych = *++YYCURSOR; if(yych == '*') goto yy138; @@ -893,7 +891,7 @@ yy135: tok = pos = cursor; cline++; goto comment; } -#line 897 "" +#line 895 "" yy137: yych = *++YYCURSOR; goto yy133; @@ -903,7 +901,7 @@ yy138: { ++depth; fatal("ambiguous /* found"); goto comment; } -#line 907 "" +#line 905 "" yy140: ++YYCURSOR; #line 268 "scanner.fs.re" @@ -911,14 +909,14 @@ yy140: goto scan; else goto comment; } -#line 915 "" +#line 913 "" } #line 281 "scanner.fs.re" config: -#line 922 "" +#line 920 "" { YYSETSTATE(22); @@ -939,7 +937,7 @@ yy144: yy145: #line 285 "scanner.fs.re" { goto config; } -#line 943 "" +#line 941 "" yy146: ++YYCURSOR; yych = *YYCURSOR; @@ -950,12 +948,12 @@ yy147: cur = cursor; RETURN('='); } -#line 954 "" +#line 952 "" yy148: ++YYCURSOR; #line 290 "scanner.fs.re" { fatal("missing '='"); } -#line 959 "" +#line 957 "" yy150: ++YYCURSOR; YYSETSTATE(23); @@ -982,7 +980,7 @@ yy153: value: -#line 986 "" +#line 984 "" { YYSETSTATE(25); @@ -1023,7 +1021,7 @@ yy156: iscfg = 0; return VALUE; } -#line 1027 "" +#line 1025 "" yy157: ++YYCURSOR; if((yych = *YYCURSOR) <= 0x0D) { @@ -1044,7 +1042,7 @@ yy158: iscfg = 0; return NUMBER; } -#line 1048 "" +#line 1046 "" yy159: yych = *++YYCURSOR; if(yych <= '0') goto yy163; -- 2.40.0