From 4472deb050fc4c60d68b5bda4f8530ee63700e65 Mon Sep 17 00:00:00 2001 From: helly Date: Thu, 3 Apr 2008 20:53:44 +0000 Subject: [PATCH] - Added transparent handling of #line directives in input files. --- re2c/CHANGELOG | 1 + re2c/bootstrap/parser.cc | 10 +- re2c/bootstrap/scanner.cc | 1932 +++++++++++++++++++++++++------------ re2c/code.cc | 2 +- re2c/htdocs/index.html | 1 + re2c/main.cc | 1 + re2c/parser.y | 10 +- re2c/scanner.h | 1 + re2c/scanner.re | 56 +- re2c/stream_lc.h | 5 + re2c/test/line-01.c | 59 ++ re2c/test/line-01.re | 27 + re2c/token.h | 39 +- 13 files changed, 1492 insertions(+), 652 deletions(-) create mode 100755 re2c/test/line-01.c create mode 100755 re2c/test/line-01.re diff --git a/re2c/CHANGELOG b/re2c/CHANGELOG index 6fb2ea7c..c1954252 100644 --- a/re2c/CHANGELOG +++ b/re2c/CHANGELOG @@ -1,5 +1,6 @@ Version 0.13.4 (2008-??-??) --------------------------- +- Added transparent handling of #line directives in input files. - Added re2c:yyfill:check inplace configuration. - Added re2c:define:YYSETSTATE:naked inplace configuration. - Added re2c:flags:w and re2c:flags:u inplace configurations. diff --git a/re2c/bootstrap/parser.cc b/re2c/bootstrap/parser.cc index d94b1dbe..ee454249 100644 --- a/re2c/bootstrap/parser.cc +++ b/re2c/bootstrap/parser.cc @@ -186,7 +186,7 @@ void context_rule(CondList *clist, RegExp *expr, RegExp *look, Str *newcond, Tok for(CondList::const_iterator it = clist->begin(); it != clist->end(); ++it) { //Str *condcpy = newcond ? new Str(*newcond) : newcond; - Token *token = new Token(code, in->get_line(), newcond);//condcpy); + Token *token = new Token(code, sourceFileInfo, newcond);//condcpy); RuleOp *rule = new RuleOp(expr, look, token, accept++); RegExpMap::iterator itRE = specMap.find(*it); @@ -1653,7 +1653,7 @@ yyreduce: #line 238 "parser.y" { context_check(NULL); - Token *token = new Token((yyvsp[(7) - (7)].token), (yyvsp[(7) - (7)].token)->line, (yyvsp[(6) - (7)].str)); + Token *token = new Token((yyvsp[(7) - (7)].token), (yyvsp[(7) - (7)].token)->source, (yyvsp[(7) - (7)].token)->line, (yyvsp[(6) - (7)].str)); delete (yyvsp[(7) - (7)].token); delete (yyvsp[(6) - (7)].str); specStar.push_back(new RuleOp((yyvsp[(4) - (7)].regexp), (yyvsp[(5) - (7)].regexp), token, accept++)); @@ -1665,7 +1665,7 @@ yyreduce: { assert((yyvsp[(7) - (7)].str)); context_check(NULL); - Token *token = new Token(NULL, in->get_line(), (yyvsp[(7) - (7)].str)); + Token *token = new Token(NULL, sourceFileInfo, (yyvsp[(7) - (7)].str)); delete (yyvsp[(7) - (7)].str); specStar.push_back(new RuleOp((yyvsp[(4) - (7)].regexp), (yyvsp[(5) - (7)].regexp), token, accept++)); } @@ -1696,7 +1696,7 @@ yyreduce: { in->fatal("code to handle illegal condition already defined"); } - Token *token = new Token((yyvsp[(3) - (3)].token), (yyvsp[(3) - (3)].token)->line, (yyvsp[(2) - (3)].str)); + Token *token = new Token((yyvsp[(3) - (3)].token), (yyvsp[(3) - (3)].token)->source, (yyvsp[(3) - (3)].token)->line, (yyvsp[(2) - (3)].str)); delete (yyvsp[(2) - (3)].str); delete (yyvsp[(3) - (3)].token); (yyval.regexp) = specNone = new RuleOp(new NullOp(), new NullOp(), token, accept++); @@ -1712,7 +1712,7 @@ yyreduce: { in->fatal("code to handle illegal condition already defined"); } - Token *token = new Token(NULL, in->get_line(), (yyvsp[(3) - (3)].str)); + Token *token = new Token(NULL, sourceFileInfo, (yyvsp[(3) - (3)].str)); delete (yyvsp[(3) - (3)].str); (yyval.regexp) = specNone = new RuleOp(new NullOp(), new NullOp(), token, accept++); } diff --git a/re2c/bootstrap/scanner.cc b/re2c/bootstrap/scanner.cc index 93935a0d..a21c4f02 100644 --- a/re2c/bootstrap/scanner.cc +++ b/re2c/bootstrap/scanner.cc @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.4.dev on Mon Mar 24 19:48:49 2008 */ +/* Generated by re2c 0.13.4.dev on Thu Apr 3 22:57:54 2008 */ /* $Id$ */ #include #include @@ -47,6 +47,40 @@ echo: { YYCTYPE yych; unsigned int yyaccept = 0; + static const unsigned char yybm[] = { + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 160, 0, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 160, 128, 0, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 0, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + }; if ((YYLIMIT - YYCURSOR) < 16) YYFILL(16); yych = *YYCURSOR; @@ -60,17 +94,23 @@ echo: } yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); - if (yych == '*') goto yy16; + if (yych == '*') goto yy37; yy3: { goto echo; } yy4: yych = *++YYCURSOR; - if (yych == '/') goto yy10; + if (yych == '/') goto yy32; goto yy3; yy5: - ++YYCURSOR; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy10; + } + if (yych == '#') goto yy13; +yy6: { if (ignore_eoc) { @@ -101,11 +141,123 @@ yy9: yych = *++YYCURSOR; goto yy3; yy10: - yyaccept = 1; + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 32) { + goto yy10; + } + if (yych == '#') goto yy13; +yy12: + YYCURSOR = YYMARKER; + if (yyaccept <= 1) { + if (yyaccept <= 0) { + goto yy3; + } else { + goto yy6; + } + } else { + goto yy33; + } +yy13: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 5) YYFILL(5); + yych = *YYCURSOR; + if (yych <= 0x1F) { + if (yych == '\t') goto yy13; + goto yy12; + } else { + if (yych <= ' ') goto yy13; + if (yych != 'l') goto yy12; + } + yych = *++YYCURSOR; + if (yych != 'i') goto yy12; + yych = *++YYCURSOR; + if (yych != 'n') goto yy12; + yych = *++YYCURSOR; + if (yych != 'e') goto yy12; + yych = *++YYCURSOR; + if (yych <= '0') goto yy20; + if (yych <= '9') goto yy12; + goto yy20; +yy19: + YYCTXMARKER = YYCURSOR + 1; + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; +yy20: + if (yych <= 0x1F) { + if (yych == '\t') goto yy19; + goto yy12; + } else { + if (yych <= ' ') goto yy19; + if (yych <= '0') goto yy12; + if (yych >= ':') goto yy12; + } +yy21: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + if (yybm[0+yych] & 64) { + goto yy21; + } + if (yych <= '\f') { + if (yych <= 0x08) goto yy12; + if (yych <= '\t') goto yy23; + if (yych <= '\n') goto yy25; + goto yy12; + } else { + if (yych <= '\r') goto yy27; + if (yych != ' ') goto yy12; + } +yy23: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= 0x1F) { + if (yych == '\t') goto yy23; + goto yy12; + } else { + if (yych <= ' ') goto yy23; + if (yych == '"') goto yy28; + goto yy12; + } +yy25: + ++YYCURSOR; + YYCURSOR = YYCTXMARKER; + { + set_sourceline(cursor); + goto echo; + } +yy27: + yych = *++YYCURSOR; + if (yych == '\n') goto yy25; + goto yy12; +yy28: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); + yych = *YYCURSOR; + if (yybm[0+yych] & 128) { + goto yy28; + } + if (yych <= '!') goto yy12; + if (yych <= '"') goto yy31; + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych == '\n') goto yy12; + goto yy28; +yy31: + yych = *++YYCURSOR; + if (yych == '\n') goto yy25; + if (yych == '\r') goto yy27; + goto yy12; +yy32: + yyaccept = 2; yych = *(YYMARKER = ++YYCURSOR); - if (yych == '\n') goto yy14; - if (yych == '\r') goto yy12; -yy11: + if (yych == '\n') goto yy35; + if (yych == '\r') goto yy34; +yy33: { if (ignore_eoc) { @@ -123,17 +275,10 @@ yy11: tok = pos = cursor; goto echo; } -yy12: +yy34: yych = *++YYCURSOR; - if (yych == '\n') goto yy14; -yy13: - YYCURSOR = YYMARKER; - if (yyaccept <= 0) { - goto yy3; - } else { - goto yy11; - } -yy14: + if (yych != '\n') goto yy12; +yy35: ++YYCURSOR; { cline++; @@ -153,65 +298,65 @@ yy14: tok = pos = cursor; goto echo; } -yy16: +yy37: yych = *++YYCURSOR; - if (yych != '!') goto yy13; + if (yych != '!') goto yy12; yych = *++YYCURSOR; switch (yych) { - case 'g': goto yy20; - case 'i': goto yy19; - case 'm': goto yy21; - case 'r': goto yy23; - case 't': goto yy18; - case 'u': goto yy22; - default: goto yy13; - } -yy18: - yych = *++YYCURSOR; - if (yych == 'y') goto yy78; - goto yy13; -yy19: + case 'g': goto yy41; + case 'i': goto yy40; + case 'm': goto yy42; + case 'r': goto yy44; + case 't': goto yy39; + case 'u': goto yy43; + default: goto yy12; + } +yy39: yych = *++YYCURSOR; - if (yych == 'g') goto yy67; - goto yy13; -yy20: + if (yych == 'y') goto yy99; + goto yy12; +yy40: yych = *++YYCURSOR; - if (yych == 'e') goto yy54; - goto yy13; -yy21: + if (yych == 'g') goto yy88; + goto yy12; +yy41: yych = *++YYCURSOR; - if (yych == 'a') goto yy46; - goto yy13; -yy22: + if (yych == 'e') goto yy75; + goto yy12; +yy42: yych = *++YYCURSOR; - if (yych == 's') goto yy38; - goto yy13; -yy23: + if (yych == 'a') goto yy67; + goto yy12; +yy43: yych = *++YYCURSOR; - if (yych == 'e') goto yy24; - if (yych == 'u') goto yy25; - goto yy13; -yy24: + if (yych == 's') goto yy59; + goto yy12; +yy44: yych = *++YYCURSOR; - if (yych == '2') goto yy35; - goto yy13; -yy25: + if (yych == 'e') goto yy45; + if (yych == 'u') goto yy46; + goto yy12; +yy45: + yych = *++YYCURSOR; + if (yych == '2') goto yy56; + goto yy12; +yy46: yych = *++YYCURSOR; - if (yych != 'l') goto yy13; + if (yych != 'l') goto yy12; yych = *++YYCURSOR; - if (yych != 'e') goto yy13; + if (yych != 'e') goto yy12; yych = *++YYCURSOR; - if (yych != 's') goto yy13; + if (yych != 's') goto yy12; yych = *++YYCURSOR; - if (yych != ':') goto yy13; + if (yych != ':') goto yy12; yych = *++YYCURSOR; - if (yych != 'r') goto yy13; + if (yych != 'r') goto yy12; yych = *++YYCURSOR; - if (yych != 'e') goto yy13; + if (yych != 'e') goto yy12; yych = *++YYCURSOR; - if (yych != '2') goto yy13; + if (yych != '2') goto yy12; yych = *++YYCURSOR; - if (yych != 'c') goto yy13; + if (yych != 'c') goto yy12; ++YYCURSOR; { if (rFlag) @@ -229,9 +374,9 @@ yy25: tok = cursor; RETURN(Rules); } -yy35: +yy56: yych = *++YYCURSOR; - if (yych != 'c') goto yy13; + if (yych != 'c') goto yy12; ++YYCURSOR; { if (rFlag) @@ -249,19 +394,19 @@ yy35: tok = cursor; RETURN(Parse); } -yy38: +yy59: yych = *++YYCURSOR; - if (yych != 'e') goto yy13; + if (yych != 'e') goto yy12; yych = *++YYCURSOR; - if (yych != ':') goto yy13; + if (yych != ':') goto yy12; yych = *++YYCURSOR; - if (yych != 'r') goto yy13; + if (yych != 'r') goto yy12; yych = *++YYCURSOR; - if (yych != 'e') goto yy13; + if (yych != 'e') goto yy12; yych = *++YYCURSOR; - if (yych != '2') goto yy13; + if (yych != '2') goto yy12; yych = *++YYCURSOR; - if (yych != 'c') goto yy13; + if (yych != 'c') goto yy12; ++YYCURSOR; { if (!rFlag) @@ -280,19 +425,19 @@ yy38: tok = cursor; RETURN(Reuse); } -yy46: +yy67: yych = *++YYCURSOR; - if (yych != 'x') goto yy13; + if (yych != 'x') goto yy12; yych = *++YYCURSOR; - if (yych != ':') goto yy13; + if (yych != ':') goto yy12; yych = *++YYCURSOR; - if (yych != 'r') goto yy13; + if (yych != 'r') goto yy12; yych = *++YYCURSOR; - if (yych != 'e') goto yy13; + if (yych != 'e') goto yy12; yych = *++YYCURSOR; - if (yych != '2') goto yy13; + if (yych != '2') goto yy12; yych = *++YYCURSOR; - if (yych != 'c') goto yy13; + if (yych != 'c') goto yy12; ++YYCURSOR; { if (bUsedYYMaxFill) @@ -308,29 +453,29 @@ yy46: bUsedYYMaxFill = true; goto echo; } -yy54: +yy75: yych = *++YYCURSOR; - if (yych != 't') goto yy13; + if (yych != 't') goto yy12; yych = *++YYCURSOR; - if (yych != 's') goto yy13; + if (yych != 's') goto yy12; yych = *++YYCURSOR; - if (yych != 't') goto yy13; + if (yych != 't') goto yy12; yych = *++YYCURSOR; - if (yych != 'a') goto yy13; + if (yych != 'a') goto yy12; yych = *++YYCURSOR; - if (yych != 't') goto yy13; + if (yych != 't') goto yy12; yych = *++YYCURSOR; - if (yych != 'e') goto yy13; + if (yych != 'e') goto yy12; yych = *++YYCURSOR; - if (yych != ':') goto yy13; + if (yych != ':') goto yy12; yych = *++YYCURSOR; - if (yych != 'r') goto yy13; + if (yych != 'r') goto yy12; yych = *++YYCURSOR; - if (yych != 'e') goto yy13; + if (yych != 'e') goto yy12; yych = *++YYCURSOR; - if (yych != '2') goto yy13; + if (yych != '2') goto yy12; yych = *++YYCURSOR; - if (yych != 'c') goto yy13; + if (yych != 'c') goto yy12; ++YYCURSOR; { tok = pos = cursor; @@ -338,48 +483,48 @@ yy54: ignore_eoc = true; goto echo; } -yy67: +yy88: yych = *++YYCURSOR; - if (yych != 'n') goto yy13; + if (yych != 'n') goto yy12; yych = *++YYCURSOR; - if (yych != 'o') goto yy13; + if (yych != 'o') goto yy12; yych = *++YYCURSOR; - if (yych != 'r') goto yy13; + if (yych != 'r') goto yy12; yych = *++YYCURSOR; - if (yych != 'e') goto yy13; + if (yych != 'e') goto yy12; yych = *++YYCURSOR; - if (yych != ':') goto yy13; + if (yych != ':') goto yy12; yych = *++YYCURSOR; - if (yych != 'r') goto yy13; + if (yych != 'r') goto yy12; yych = *++YYCURSOR; - if (yych != 'e') goto yy13; + if (yych != 'e') goto yy12; yych = *++YYCURSOR; - if (yych != '2') goto yy13; + if (yych != '2') goto yy12; yych = *++YYCURSOR; - if (yych != 'c') goto yy13; + if (yych != 'c') goto yy12; ++YYCURSOR; { tok = pos = cursor; ignore_eoc = true; goto echo; } -yy78: +yy99: yych = *++YYCURSOR; - if (yych != 'p') goto yy13; + if (yych != 'p') goto yy12; yych = *++YYCURSOR; - if (yych != 'e') goto yy13; + if (yych != 'e') goto yy12; yych = *++YYCURSOR; - if (yych != 's') goto yy13; + if (yych != 's') goto yy12; yych = *++YYCURSOR; - if (yych != ':') goto yy13; + if (yych != ':') goto yy12; yych = *++YYCURSOR; - if (yych != 'r') goto yy13; + if (yych != 'r') goto yy12; yych = *++YYCURSOR; - if (yych != 'e') goto yy13; + if (yych != 'e') goto yy12; yych = *++YYCURSOR; - if (yych != '2') goto yy13; + if (yych != '2') goto yy12; yych = *++YYCURSOR; - if (yych != 'c') goto yy13; + if (yych != 'c') goto yy12; ++YYCURSOR; { if (bSinglePass) @@ -424,142 +569,142 @@ scan: YYCTYPE yych; unsigned int yyaccept = 0; static const unsigned char yybm[] = { - 112, 112, 112, 112, 112, 112, 112, 112, - 112, 116, 0, 112, 112, 112, 112, 112, - 112, 112, 112, 112, 112, 112, 112, 112, - 112, 112, 112, 112, 112, 112, 112, 112, - 116, 112, 48, 112, 112, 112, 112, 80, - 112, 112, 112, 112, 112, 112, 112, 112, + 208, 208, 208, 208, 208, 208, 208, 208, + 208, 212, 0, 208, 208, 208, 208, 208, + 208, 208, 208, 208, 208, 208, 208, 208, + 208, 208, 208, 208, 208, 208, 208, 208, + 212, 208, 192, 208, 208, 208, 208, 80, + 208, 208, 208, 208, 208, 208, 208, 208, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 112, 112, 112, 112, 112, 112, - 112, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 112, 0, 96, 112, 120, - 112, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 112, 112, 112, 112, 112, - 112, 112, 112, 112, 112, 112, 112, 112, - 112, 112, 112, 112, 112, 112, 112, 112, - 112, 112, 112, 112, 112, 112, 112, 112, - 112, 112, 112, 112, 112, 112, 112, 112, - 112, 112, 112, 112, 112, 112, 112, 112, - 112, 112, 112, 112, 112, 112, 112, 112, - 112, 112, 112, 112, 112, 112, 112, 112, - 112, 112, 112, 112, 112, 112, 112, 112, - 112, 112, 112, 112, 112, 112, 112, 112, - 112, 112, 112, 112, 112, 112, 112, 112, - 112, 112, 112, 112, 112, 112, 112, 112, - 112, 112, 112, 112, 112, 112, 112, 112, - 112, 112, 112, 112, 112, 112, 112, 112, - 112, 112, 112, 112, 112, 112, 112, 112, - 112, 112, 112, 112, 112, 112, 112, 112, - 112, 112, 112, 112, 112, 112, 112, 112, + 248, 248, 208, 208, 208, 208, 208, 208, + 208, 240, 240, 240, 240, 240, 240, 240, + 240, 240, 240, 240, 240, 240, 240, 240, + 240, 240, 240, 240, 240, 240, 240, 240, + 240, 240, 240, 208, 0, 144, 208, 240, + 208, 240, 240, 240, 240, 240, 240, 240, + 240, 240, 240, 240, 240, 240, 240, 240, + 240, 240, 240, 240, 240, 240, 240, 240, + 240, 240, 240, 208, 208, 208, 208, 208, + 208, 208, 208, 208, 208, 208, 208, 208, + 208, 208, 208, 208, 208, 208, 208, 208, + 208, 208, 208, 208, 208, 208, 208, 208, + 208, 208, 208, 208, 208, 208, 208, 208, + 208, 208, 208, 208, 208, 208, 208, 208, + 208, 208, 208, 208, 208, 208, 208, 208, + 208, 208, 208, 208, 208, 208, 208, 208, + 208, 208, 208, 208, 208, 208, 208, 208, + 208, 208, 208, 208, 208, 208, 208, 208, + 208, 208, 208, 208, 208, 208, 208, 208, + 208, 208, 208, 208, 208, 208, 208, 208, + 208, 208, 208, 208, 208, 208, 208, 208, + 208, 208, 208, 208, 208, 208, 208, 208, + 208, 208, 208, 208, 208, 208, 208, 208, + 208, 208, 208, 208, 208, 208, 208, 208, + 208, 208, 208, 208, 208, 208, 208, 208, }; if ((YYLIMIT - YYCURSOR) < 6) YYFILL(6); yych = *YYCURSOR; if (yych <= '/') { if (yych <= '"') { if (yych <= '\f') { - if (yych <= 0x08) goto yy117; - if (yych <= '\t') goto yy112; - if (yych <= '\n') goto yy114; - goto yy117; + if (yych <= 0x08) goto yy138; + if (yych <= '\t') goto yy133; + if (yych <= '\n') goto yy135; + goto yy138; } else { if (yych <= 0x1F) { - if (yych <= '\r') goto yy116; - goto yy117; + if (yych <= '\r') goto yy137; + goto yy138; } else { - if (yych <= ' ') goto yy112; - if (yych <= '!') goto yy117; - goto yy98; + if (yych <= ' ') goto yy133; + if (yych <= '!') goto yy138; + goto yy119; } } } else { if (yych <= '*') { - if (yych <= '&') goto yy117; - if (yych <= '\'') goto yy100; - if (yych <= ')') goto yy105; - goto yy96; + if (yych <= '&') goto yy138; + if (yych <= '\'') goto yy121; + if (yych <= ')') goto yy126; + goto yy117; } else { if (yych <= ',') { - if (yych <= '+') goto yy106; - goto yy105; + if (yych <= '+') goto yy127; + goto yy126; } else { - if (yych <= '-') goto yy117; - if (yych <= '.') goto yy110; - goto yy94; + if (yych <= '-') goto yy138; + if (yych <= '.') goto yy131; + goto yy115; } } } } else { if (yych <= '[') { if (yych <= '<') { - if (yych <= '9') goto yy117; - if (yych <= ':') goto yy92; - if (yych <= ';') goto yy105; - goto yy104; + if (yych <= '9') goto yy138; + if (yych <= ':') goto yy113; + if (yych <= ';') goto yy126; + goto yy125; } else { if (yych <= '?') { - if (yych <= '>') goto yy105; - goto yy106; + if (yych <= '>') goto yy126; + goto yy127; } else { - if (yych <= '@') goto yy117; - if (yych <= 'Z') goto yy109; - goto yy102; + if (yych <= '@') goto yy138; + if (yych <= 'Z') goto yy130; + goto yy123; } } } else { if (yych <= 'q') { if (yych <= '^') { - if (yych <= '\\') goto yy105; - goto yy117; + if (yych <= '\\') goto yy126; + goto yy138; } else { - if (yych == '`') goto yy117; - goto yy109; + if (yych == '`') goto yy138; + goto yy130; } } else { if (yych <= 'z') { - if (yych <= 'r') goto yy108; - goto yy109; + if (yych <= 'r') goto yy129; + goto yy130; } else { - if (yych <= '{') goto yy90; - if (yych <= '|') goto yy105; - goto yy117; + if (yych <= '{') goto yy111; + if (yych <= '|') goto yy126; + goto yy138; } } } } -yy90: +yy111: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '@') { if (yych <= '/') { - if (yych == ',') goto yy187; + if (yych == ',') goto yy229; } else { - if (yych <= '0') goto yy184; - if (yych <= '9') goto yy185; + if (yych <= '0') goto yy226; + if (yych <= '9') goto yy227; } } else { if (yych <= '_') { - if (yych <= 'Z') goto yy182; - if (yych >= '_') goto yy182; + if (yych <= 'Z') goto yy224; + if (yych >= '_') goto yy224; } else { - if (yych <= '`') goto yy91; - if (yych <= 'z') goto yy182; + if (yych <= '`') goto yy112; + if (yych <= 'z') goto yy224; } } -yy91: +yy112: { depth = 1; goto code; } -yy92: +yy113: YYCTXMARKER = YYCURSOR + 1; ++YYCURSOR; - if ((yych = *YYCURSOR) == '=') goto yy178; -yy93: + if ((yych = *YYCURSOR) == '=') goto yy220; +yy114: { std::ostringstream msg; msg << "unexpected character: "; @@ -567,137 +712,278 @@ yy93: fatal(msg.str().c_str()); goto scan; } -yy94: +yy115: ++YYCURSOR; - if ((yych = *YYCURSOR) == '*') goto yy176; -yy95: + if ((yych = *YYCURSOR) == '*') goto yy218; +yy116: { RETURN(*tok); } -yy96: +yy117: ++YYCURSOR; - if ((yych = *YYCURSOR) == '/') goto yy174; + if ((yych = *YYCURSOR) == '/') goto yy216; { yylval.op = *tok; RETURN(STAR); } -yy98: +yy119: yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); - if (yych != '\n') goto yy170; -yy99: + if (yych != '\n') goto yy212; +yy120: { fatal("unterminated string constant (missing \")"); } -yy100: +yy121: yyaccept = 2; yych = *(YYMARKER = ++YYCURSOR); - if (yych != '\n') goto yy165; -yy101: + if (yych != '\n') goto yy207; +yy122: { fatal("unterminated string constant (missing ')"); } -yy102: +yy123: yyaccept = 3; yych = *(YYMARKER = ++YYCURSOR); - if (yych == '\n') goto yy103; - if (yych == '^') goto yy156; - goto yy155; -yy103: + if (yych == '\n') goto yy124; + if (yych == '^') goto yy198; + goto yy197; +yy124: { fatal("unterminated range (missing ])"); } -yy104: +yy125: yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); - if (yych == '!') goto yy145; - if (yych == '>') goto yy147; - goto yy95; -yy105: + if (yych == '!') goto yy187; + if (yych == '>') goto yy189; + goto yy116; +yy126: yych = *++YYCURSOR; - goto yy95; -yy106: + goto yy116; +yy127: ++YYCURSOR; { yylval.op = *tok; RETURN(CLOSE); } -yy108: +yy129: YYCTXMARKER = YYCURSOR + 1; yych = *++YYCURSOR; - if (yych == 'e') goto yy133; - goto yy122; -yy109: + if (yych == 'e') goto yy176; + goto yy165; +yy130: YYCTXMARKER = YYCURSOR + 1; yych = *++YYCURSOR; - goto yy122; -yy110: + goto yy165; +yy131: ++YYCURSOR; { cur = cursor; yylval.regexp = mkDot(); return RANGE; } -yy112: +yy133: ++YYCURSOR; yych = *YYCURSOR; - goto yy120; -yy113: + goto yy163; +yy134: { goto scan; } -yy114: - ++YYCURSOR; -yy115: +yy135: + yyaccept = 5; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy140; + } + if (yych == '#') goto yy143; +yy136: { if (cursor == eof) RETURN(0); pos = cursor; cline++; goto scan; } -yy116: - yych = *++YYCURSOR; - if (yych == '\n') goto yy118; - goto yy93; -yy117: +yy137: yych = *++YYCURSOR; - goto yy93; -yy118: + if (yych == '\n') goto yy139; + goto yy114; +yy138: yych = *++YYCURSOR; - goto yy115; -yy119: + goto yy114; +yy139: + yyaccept = 5; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy140; + } + if (yych == '#') goto yy143; + goto yy136; +yy140: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; -yy120: if (yybm[0+yych] & 4) { - goto yy119; + goto yy140; } - goto yy113; -yy121: + if (yych == '#') goto yy143; +yy142: + YYCURSOR = YYMARKER; + if (yyaccept <= 3) { + if (yyaccept <= 1) { + if (yyaccept <= 0) { + goto yy112; + } else { + goto yy120; + } + } else { + if (yyaccept <= 2) { + goto yy122; + } else { + goto yy124; + } + } + } else { + if (yyaccept <= 5) { + if (yyaccept <= 4) { + goto yy116; + } else { + goto yy136; + } + } else { + if (yyaccept <= 6) { + goto yy182; + } else { + goto yy230; + } + } + } +yy143: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 5) YYFILL(5); + yych = *YYCURSOR; + if (yych <= 0x1F) { + if (yych == '\t') goto yy143; + goto yy142; + } else { + if (yych <= ' ') goto yy143; + if (yych != 'l') goto yy142; + } + yych = *++YYCURSOR; + if (yych != 'i') goto yy142; + yych = *++YYCURSOR; + if (yych != 'n') goto yy142; + yych = *++YYCURSOR; + if (yych != 'e') goto yy142; + yych = *++YYCURSOR; + if (yych <= '0') goto yy150; + if (yych <= '9') goto yy142; + goto yy150; +yy149: YYCTXMARKER = YYCURSOR + 1; + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; +yy150: + if (yych <= 0x1F) { + if (yych == '\t') goto yy149; + goto yy142; + } else { + if (yych <= ' ') goto yy149; + if (yych <= '0') goto yy142; + if (yych >= ':') goto yy142; + } +yy151: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; -yy122: if (yybm[0+yych] & 8) { - goto yy121; + goto yy151; + } + if (yych <= '\f') { + if (yych <= 0x08) goto yy142; + if (yych <= '\t') goto yy153; + if (yych <= '\n') goto yy155; + goto yy142; + } else { + if (yych <= '\r') goto yy157; + if (yych != ' ') goto yy142; + } +yy153: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= 0x1F) { + if (yych == '\t') goto yy153; + goto yy142; + } else { + if (yych <= ' ') goto yy153; + if (yych == '"') goto yy158; + goto yy142; + } +yy155: + ++YYCURSOR; + YYCURSOR = YYCTXMARKER; + { + set_sourceline(cursor); + goto scan; + } +yy157: + yych = *++YYCURSOR; + if (yych == '\n') goto yy155; + goto yy142; +yy158: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); + yych = *YYCURSOR; + if (yybm[0+yych] & 16) { + goto yy158; + } + if (yych <= '!') goto yy142; + if (yych <= '"') goto yy161; + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych == '\n') goto yy142; + goto yy158; +yy161: + yych = *++YYCURSOR; + if (yych == '\n') goto yy155; + if (yych == '\r') goto yy157; + goto yy142; +yy162: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; +yy163: + if (yych == '\t') goto yy162; + if (yych == ' ') goto yy162; + goto yy134; +yy164: + YYCTXMARKER = YYCURSOR + 1; + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; +yy165: + if (yybm[0+yych] & 32) { + goto yy164; } if (yych <= ' ') { - if (yych == '\t') goto yy125; - if (yych <= 0x1F) goto yy124; - goto yy125; + if (yych == '\t') goto yy168; + if (yych <= 0x1F) goto yy167; + goto yy168; } else { if (yych <= ',') { - if (yych <= '+') goto yy124; - goto yy126; + if (yych <= '+') goto yy167; + goto yy169; } else { - if (yych <= '<') goto yy124; - if (yych <= '>') goto yy126; - goto yy124; + if (yych <= '<') goto yy167; + if (yych <= '>') goto yy169; + goto yy167; } } -yy123: +yy166: YYCURSOR = YYCTXMARKER; { if (!FFlag) { @@ -718,22 +1004,22 @@ yy123: return STRING; } } -yy124: +yy167: yych = *++YYCURSOR; - goto yy123; -yy125: + goto yy166; +yy168: yych = *++YYCURSOR; - goto yy131; -yy126: + goto yy174; +yy169: ++YYCURSOR; -yy127: +yy170: YYCURSOR = YYCTXMARKER; { cur = ptr > tok ? ptr - 1 : cursor; yylval.symbol = Symbol::find(token()); return ID; } -yy128: +yy171: ++YYCURSOR; YYCURSOR = YYCTXMARKER; { @@ -741,65 +1027,65 @@ yy128: yylval.symbol = Symbol::find(token()); return FFlag ? FID : ID; } -yy130: +yy173: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; -yy131: +yy174: if (yych <= ' ') { - if (yych == '\t') goto yy130; - if (yych <= 0x1F) goto yy128; - goto yy130; + if (yych == '\t') goto yy173; + if (yych <= 0x1F) goto yy171; + goto yy173; } else { if (yych <= ',') { - if (yych <= '+') goto yy128; + if (yych <= '+') goto yy171; } else { - if (yych <= '<') goto yy128; - if (yych >= '?') goto yy128; + if (yych <= '<') goto yy171; + if (yych >= '?') goto yy171; } } yych = *++YYCURSOR; - goto yy127; -yy133: + goto yy170; +yy176: YYCTXMARKER = YYCURSOR + 1; yych = *++YYCURSOR; - if (yych != '2') goto yy122; + if (yych != '2') goto yy165; YYCTXMARKER = YYCURSOR + 1; yych = *++YYCURSOR; - if (yych != 'c') goto yy122; + if (yych != 'c') goto yy165; YYCTXMARKER = YYCURSOR + 1; yych = *++YYCURSOR; - if (yych != ':') goto yy122; + if (yych != ':') goto yy165; yych = *++YYCURSOR; if (yych <= '^') { - if (yych <= '@') goto yy123; - if (yych >= '[') goto yy123; + if (yych <= '@') goto yy166; + if (yych >= '[') goto yy166; } else { - if (yych == '`') goto yy123; - if (yych >= '{') goto yy123; + if (yych == '`') goto yy166; + if (yych >= '{') goto yy166; } -yy137: - yyaccept = 5; +yy180: + yyaccept = 6; YYMARKER = ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; if (yych <= '@') { if (yych <= '9') { - if (yych >= '0') goto yy137; + if (yych >= '0') goto yy180; } else { - if (yych <= ':') goto yy142; - if (yych >= '@') goto yy140; + if (yych <= ':') goto yy184; + if (yych >= '@') goto yy183; } } else { if (yych <= '_') { - if (yych <= 'Z') goto yy137; - if (yych >= '_') goto yy137; + if (yych <= 'Z') goto yy180; + if (yych >= '_') goto yy180; } else { - if (yych <= '`') goto yy139; - if (yych <= 'z') goto yy137; + if (yych <= '`') goto yy182; + if (yych <= 'z') goto yy180; } } -yy139: +yy182: { cur = cursor; tok += 5; /* skip "re2c:" */ @@ -807,184 +1093,159 @@ yy139: yylval.str = new Str(token()); return CONFIG; } -yy140: +yy183: yych = *++YYCURSOR; if (yych <= '^') { - if (yych <= '@') goto yy141; - if (yych <= 'Z') goto yy143; - } else { - if (yych == '`') goto yy141; - if (yych <= 'z') goto yy143; - } -yy141: - YYCURSOR = YYMARKER; - if (yyaccept <= 3) { - if (yyaccept <= 1) { - if (yyaccept <= 0) { - goto yy91; - } else { - goto yy99; - } - } else { - if (yyaccept <= 2) { - goto yy101; - } else { - goto yy103; - } - } + if (yych <= '@') goto yy142; + if (yych <= 'Z') goto yy185; + goto yy142; } else { - if (yyaccept <= 5) { - if (yyaccept <= 4) { - goto yy95; - } else { - goto yy139; - } - } else { - goto yy188; - } + if (yych == '`') goto yy142; + if (yych <= 'z') goto yy185; + goto yy142; } -yy142: +yy184: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych <= '^') { - if (yych <= '@') goto yy141; - if (yych <= 'Z') goto yy137; - goto yy141; + if (yych <= '@') goto yy142; + if (yych <= 'Z') goto yy180; + goto yy142; } else { - if (yych == '`') goto yy141; - if (yych <= 'z') goto yy137; - goto yy141; + if (yych == '`') goto yy142; + if (yych <= 'z') goto yy180; + goto yy142; } -yy143: +yy185: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych <= 'Z') { - if (yych <= '/') goto yy139; - if (yych <= '9') goto yy143; - if (yych <= '@') goto yy139; - goto yy143; + if (yych <= '/') goto yy182; + if (yych <= '9') goto yy185; + if (yych <= '@') goto yy182; + goto yy185; } else { if (yych <= '_') { - if (yych <= '^') goto yy139; - goto yy143; + if (yych <= '^') goto yy182; + goto yy185; } else { - if (yych <= '`') goto yy139; - if (yych <= 'z') goto yy143; - goto yy139; + if (yych <= '`') goto yy182; + if (yych <= 'z') goto yy185; + goto yy182; } } -yy145: +yy187: ++YYCURSOR; { RETURN(SETUP); } -yy147: +yy189: YYCTXMARKER = YYCURSOR + 1; yych = *++YYCURSOR; - goto yy149; -yy148: + goto yy191; +yy190: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; -yy149: +yy191: if (yych <= '9') { if (yych <= '\t') { - if (yych <= 0x08) goto yy141; - goto yy148; + if (yych <= 0x08) goto yy142; + goto yy190; } else { - if (yych == ' ') goto yy148; - goto yy141; + if (yych == ' ') goto yy190; + goto yy142; } } else { if (yych <= '=') { - if (yych <= ':') goto yy153; - if (yych <= '<') goto yy141; - goto yy152; + if (yych <= ':') goto yy195; + if (yych <= '<') goto yy142; + goto yy194; } else { - if (yych != '{') goto yy141; + if (yych != '{') goto yy142; } } -yy150: +yy192: ++YYCURSOR; YYCURSOR = YYCTXMARKER; { RETURN(NOCOND); } -yy152: +yy194: yych = *++YYCURSOR; - if (yych == '>') goto yy150; - goto yy141; -yy153: + if (yych == '>') goto yy192; + goto yy142; +yy195: yych = *++YYCURSOR; - if (yych == '=') goto yy150; - goto yy141; -yy154: + if (yych == '=') goto yy192; + goto yy142; +yy196: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; -yy155: - if (yybm[0+yych] & 16) { - goto yy154; +yy197: + if (yybm[0+yych] & 64) { + goto yy196; } - if (yych <= '[') goto yy141; - if (yych <= '\\') goto yy158; - goto yy159; -yy156: + if (yych <= '[') goto yy142; + if (yych <= '\\') goto yy200; + goto yy201; +yy198: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych <= '[') { - if (yych == '\n') goto yy141; - goto yy156; + if (yych == '\n') goto yy142; + goto yy198; } else { - if (yych <= '\\') goto yy161; - if (yych <= ']') goto yy162; - goto yy156; + if (yych <= '\\') goto yy203; + if (yych <= ']') goto yy204; + goto yy198; } -yy158: +yy200: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; - if (yych == '\n') goto yy141; - goto yy154; -yy159: + if (yych == '\n') goto yy142; + goto yy196; +yy201: ++YYCURSOR; { cur = cursor; yylval.regexp = ranToRE(token()); return RANGE; } -yy161: +yy203: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; - if (yych == '\n') goto yy141; - goto yy156; -yy162: + if (yych == '\n') goto yy142; + goto yy198; +yy204: ++YYCURSOR; { cur = cursor; yylval.regexp = invToRE(token()); return RANGE; } -yy164: +yy206: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; -yy165: - if (yybm[0+yych] & 32) { - goto yy164; +yy207: + if (yybm[0+yych] & 128) { + goto yy206; } - if (yych <= '&') goto yy141; - if (yych <= '\'') goto yy167; + if (yych <= '&') goto yy142; + if (yych <= '\'') goto yy209; ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; - if (yych == '\n') goto yy141; - goto yy164; -yy167: + if (yych == '\n') goto yy142; + goto yy206; +yy209: ++YYCURSOR; { cur = cursor; @@ -998,22 +1259,24 @@ yy167: } return STRING; } -yy169: +yy211: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; -yy170: - if (yybm[0+yych] & 64) { - goto yy169; +yy212: + if (yych <= '!') { + if (yych == '\n') goto yy142; + goto yy211; + } else { + if (yych <= '"') goto yy214; + if (yych != '\\') goto yy211; } - if (yych <= '!') goto yy141; - if (yych <= '"') goto yy172; ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; - if (yych == '\n') goto yy141; - goto yy169; -yy172: + if (yych == '\n') goto yy142; + goto yy211; +yy214: ++YYCURSOR; { cur = cursor; @@ -1027,120 +1290,122 @@ yy172: } return STRING; } -yy174: +yy216: ++YYCURSOR; { tok = cursor; RETURN(0); } -yy176: +yy218: ++YYCURSOR; { depth = 1; goto comment; } -yy178: +yy220: ++YYCURSOR; - if ((yych = *YYCURSOR) == '>') goto yy180; + if ((yych = *YYCURSOR) == '>') goto yy222; { cur = cursor; tok += 2; /* skip ":=" */ depth = 0; goto code; } -yy180: +yy222: ++YYCURSOR; YYCURSOR = YYCTXMARKER; { RETURN(*tok); } -yy182: +yy224: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych <= '^') { if (yych <= '9') { - if (yych <= '/') goto yy141; - goto yy182; + if (yych <= '/') goto yy142; + goto yy224; } else { - if (yych <= '@') goto yy141; - if (yych <= 'Z') goto yy182; - goto yy141; + if (yych <= '@') goto yy142; + if (yych <= 'Z') goto yy224; + goto yy142; } } else { if (yych <= 'z') { - if (yych == '`') goto yy141; - goto yy182; + if (yych == '`') goto yy142; + goto yy224; } else { - if (yych == '}') goto yy201; - goto yy141; + if (yych == '}') goto yy243; + goto yy142; } } -yy184: +yy226: yych = *++YYCURSOR; - if (yych == ',') goto yy198; - goto yy186; -yy185: + if (yych == ',') goto yy240; + goto yy228; +yy227: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; -yy186: - if (yybm[0+yych] & 128) { - goto yy185; +yy228: + if (yych <= '/') { + if (yych == ',') goto yy233; + goto yy142; + } else { + if (yych <= '9') goto yy227; + if (yych == '}') goto yy231; + goto yy142; } - if (yych == ',') goto yy191; - if (yych == '}') goto yy189; - goto yy141; -yy187: +yy229: ++YYCURSOR; -yy188: +yy230: { fatal("illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers"); } -yy189: +yy231: ++YYCURSOR; { yylval.extop.minsize = atoi((char *)tok+1); yylval.extop.maxsize = atoi((char *)tok+1); RETURN(CLOSESIZE); } -yy191: - yyaccept = 6; +yy233: + yyaccept = 7; yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy188; - if (yych <= '9') goto yy194; - if (yych != '}') goto yy188; + if (yych <= '/') goto yy230; + if (yych <= '9') goto yy236; + if (yych != '}') goto yy230; ++YYCURSOR; { yylval.extop.minsize = atoi((char *)tok+1); yylval.extop.maxsize = -1; RETURN(CLOSESIZE); } -yy194: +yy236: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; - if (yych <= '/') goto yy141; - if (yych <= '9') goto yy194; - if (yych != '}') goto yy141; + if (yych <= '/') goto yy142; + if (yych <= '9') goto yy236; + if (yych != '}') goto yy142; ++YYCURSOR; { yylval.extop.minsize = atoi((char *)tok+1); yylval.extop.maxsize = MAX(yylval.extop.minsize,atoi(strchr((char *)tok, ',')+1)); RETURN(CLOSESIZE); } -yy198: - yyaccept = 6; +yy240: + yyaccept = 7; yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy188; - if (yych <= '9') goto yy194; - if (yych != '}') goto yy188; + if (yych <= '/') goto yy230; + if (yych <= '9') goto yy236; + if (yych != '}') goto yy230; ++YYCURSOR; { yylval.op = '*'; RETURN(CLOSE); } -yy201: +yy243: ++YYCURSOR; { if (!FFlag) { @@ -1157,58 +1422,59 @@ code: { YYCTYPE yych; + unsigned int yyaccept = 0; static const unsigned char yybm[] = { - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 0, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 64, 192, 192, 192, 192, 128, - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 0, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 112, 0, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 112, 48, 16, 48, 48, 48, 48, 32, + 48, 48, 48, 48, 48, 48, 48, 48, + 176, 176, 176, 176, 176, 176, 176, 176, + 176, 176, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 0, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, }; - if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; if (yych <= '&') { if (yych <= '\n') { - if (yych <= 0x00) goto yy211; - if (yych <= '\t') goto yy213; - goto yy209; + if (yych <= 0x00) goto yy253; + if (yych <= '\t') goto yy255; + goto yy251; } else { - if (yych == '"') goto yy215; - goto yy213; + if (yych == '"') goto yy257; + goto yy255; } } else { if (yych <= '{') { - if (yych <= '\'') goto yy216; - if (yych <= 'z') goto yy213; - goto yy207; + if (yych <= '\'') goto yy258; + if (yych <= 'z') goto yy255; + goto yy249; } else { - if (yych != '}') goto yy213; + if (yych != '}') goto yy255; } } ++YYCURSOR; @@ -1220,12 +1486,12 @@ code: else if (--depth == 0) { cur = cursor; - yylval.token = new Token(token(), tline); + yylval.token = new Token(token(), sourceFileInfo.fname, tline); return CODE; } goto code; } -yy207: +yy249: ++YYCURSOR; { if (depth == 0) @@ -1238,17 +1504,25 @@ yy207: } goto code; } -yy209: +yy251: YYCTXMARKER = YYCURSOR + 1; - ++YYCURSOR; - if ((yych = *YYCURSOR) <= '\f') { - if (yych <= 0x08) goto yy210; - if (yych <= '\n') goto yy224; + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '\r') { + if (yych <= '\t') { + if (yych >= '\t') goto yy266; + } else { + if (yych <= '\n') goto yy268; + if (yych >= '\r') goto yy268; + } } else { - if (yych <= '\r') goto yy224; - if (yych == ' ') goto yy224; + if (yych <= ' ') { + if (yych >= ' ') goto yy266; + } else { + if (yych == '#') goto yy269; + } } -yy210: +yy252: { if (depth == 0) { @@ -1258,7 +1532,7 @@ yy210: { --cur; } - yylval.token = new Token(token(), tline); + yylval.token = new Token(token(), sourceFileInfo.fname, tline); return CODE; } else if (cursor == eof) @@ -1269,7 +1543,7 @@ yy210: cline++; goto code; } -yy211: +yy253: ++YYCURSOR; { if (cursor == eof) @@ -1282,57 +1556,75 @@ yy211: } goto code; } -yy213: +yy255: ++YYCURSOR; -yy214: +yy256: { goto code; } -yy215: +yy257: + yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); - if (yych == '\n') goto yy214; - goto yy222; -yy216: + if (yych == '\n') goto yy256; + goto yy264; +yy258: + yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); - if (yych == '\n') goto yy214; - goto yy218; -yy217: + if (yych == '\n') goto yy256; + goto yy260; +yy259: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; -yy218: - if (yybm[0+yych] & 64) { - goto yy217; +yy260: + if (yybm[0+yych] & 16) { + goto yy259; } - if (yych <= '&') goto yy219; - if (yych <= '\'') goto yy213; - goto yy220; -yy219: + if (yych <= '&') goto yy261; + if (yych <= '\'') goto yy255; + goto yy262; +yy261: YYCURSOR = YYMARKER; - goto yy214; -yy220: + if (yyaccept <= 1) { + if (yyaccept <= 0) { + goto yy252; + } else { + goto yy256; + } + } else { + goto yy267; + } +yy262: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; - if (yych == '\n') goto yy219; - goto yy217; -yy221: + if (yych == '\n') goto yy261; + goto yy259; +yy263: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; -yy222: - if (yybm[0+yych] & 128) { - goto yy221; +yy264: + if (yybm[0+yych] & 32) { + goto yy263; } - if (yych <= '!') goto yy219; - if (yych <= '"') goto yy213; + if (yych <= '!') goto yy261; + if (yych <= '"') goto yy255; ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; - if (yych == '\n') goto yy219; - goto yy221; -yy224: - ++YYCURSOR; + if (yych == '\n') goto yy261; + goto yy263; +yy266: + yyaccept = 2; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 0x1F) { + if (yych == '\t') goto yy288; + } else { + if (yych <= ' ') goto yy288; + if (yych == '#') goto yy269; + } +yy267: YYCURSOR = YYCTXMARKER; { if (depth == 0) @@ -1347,6 +1639,113 @@ yy224: cline++; goto code; } +yy268: + yych = *++YYCURSOR; + goto yy267; +yy269: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 5) YYFILL(5); + yych = *YYCURSOR; + if (yybm[0+yych] & 64) { + goto yy269; + } + if (yych != 'l') goto yy261; + yych = *++YYCURSOR; + if (yych != 'i') goto yy261; + yych = *++YYCURSOR; + if (yych != 'n') goto yy261; + yych = *++YYCURSOR; + if (yych != 'e') goto yy261; + yych = *++YYCURSOR; + if (yych <= '0') goto yy276; + if (yych <= '9') goto yy261; + goto yy276; +yy275: + YYCTXMARKER = YYCURSOR + 1; + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; +yy276: + if (yych <= 0x1F) { + if (yych == '\t') goto yy275; + goto yy261; + } else { + if (yych <= ' ') goto yy275; + if (yych <= '0') goto yy261; + if (yych >= ':') goto yy261; + } +yy277: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + if (yybm[0+yych] & 128) { + goto yy277; + } + if (yych <= '\f') { + if (yych <= 0x08) goto yy261; + if (yych <= '\t') goto yy279; + if (yych <= '\n') goto yy281; + goto yy261; + } else { + if (yych <= '\r') goto yy283; + if (yych != ' ') goto yy261; + } +yy279: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= 0x1F) { + if (yych == '\t') goto yy279; + goto yy261; + } else { + if (yych <= ' ') goto yy279; + if (yych == '"') goto yy284; + goto yy261; + } +yy281: + ++YYCURSOR; + YYCURSOR = YYCTXMARKER; + { + set_sourceline(cursor); + goto code; + } +yy283: + yych = *++YYCURSOR; + if (yych == '\n') goto yy281; + goto yy261; +yy284: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); + yych = *YYCURSOR; + if (yych <= '!') { + if (yych == '\n') goto yy261; + goto yy284; + } else { + if (yych <= '"') goto yy287; + if (yych != '\\') goto yy284; + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych == '\n') goto yy261; + goto yy284; +yy287: + yych = *++YYCURSOR; + if (yych == '\n') goto yy281; + if (yych == '\r') goto yy283; + goto yy261; +yy288: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= 0x1F) { + if (yych == '\t') goto yy288; + goto yy261; + } else { + if (yych <= ' ') goto yy288; + if (yych == '#') goto yy269; + goto yy261; + } } @@ -1354,20 +1753,54 @@ comment: { YYCTYPE yych; + static const unsigned char yybm[] = { + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 160, 0, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 160, 128, 0, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 0, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + }; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; if (yych <= ')') { - if (yych == '\n') goto yy231; - goto yy233; + if (yych == '\n') goto yy295; + goto yy297; } else { - if (yych <= '*') goto yy228; - if (yych == '/') goto yy230; - goto yy233; + if (yych <= '*') goto yy292; + if (yych == '/') goto yy294; + goto yy297; } -yy228: +yy292: ++YYCURSOR; - if ((yych = *YYCURSOR) == '/') goto yy236; -yy229: + if ((yych = *YYCURSOR) == '/') goto yy322; +yy293: { if (cursor == eof) { @@ -1375,12 +1808,17 @@ yy229: } goto comment; } -yy230: +yy294: yych = *++YYCURSOR; - if (yych == '*') goto yy234; - goto yy229; -yy231: - ++YYCURSOR; + if (yych == '*') goto yy320; + goto yy293; +yy295: + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy298; + } + if (yych == '#') goto yy301; +yy296: { if (cursor == eof) { @@ -1390,17 +1828,121 @@ yy231: cline++; goto comment; } -yy233: +yy297: + yych = *++YYCURSOR; + goto yy293; +yy298: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 32) { + goto yy298; + } + if (yych == '#') goto yy301; +yy300: + YYCURSOR = YYMARKER; + goto yy296; +yy301: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 5) YYFILL(5); + yych = *YYCURSOR; + if (yych <= 0x1F) { + if (yych == '\t') goto yy301; + goto yy300; + } else { + if (yych <= ' ') goto yy301; + if (yych != 'l') goto yy300; + } + yych = *++YYCURSOR; + if (yych != 'i') goto yy300; + yych = *++YYCURSOR; + if (yych != 'n') goto yy300; + yych = *++YYCURSOR; + if (yych != 'e') goto yy300; + yych = *++YYCURSOR; + if (yych <= '0') goto yy308; + if (yych <= '9') goto yy300; + goto yy308; +yy307: + YYCTXMARKER = YYCURSOR + 1; + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; +yy308: + if (yych <= 0x1F) { + if (yych == '\t') goto yy307; + goto yy300; + } else { + if (yych <= ' ') goto yy307; + if (yych <= '0') goto yy300; + if (yych >= ':') goto yy300; + } +yy309: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + if (yybm[0+yych] & 64) { + goto yy309; + } + if (yych <= '\f') { + if (yych <= 0x08) goto yy300; + if (yych <= '\t') goto yy311; + if (yych <= '\n') goto yy313; + goto yy300; + } else { + if (yych <= '\r') goto yy315; + if (yych != ' ') goto yy300; + } +yy311: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= 0x1F) { + if (yych == '\t') goto yy311; + goto yy300; + } else { + if (yych <= ' ') goto yy311; + if (yych == '"') goto yy316; + goto yy300; + } +yy313: + ++YYCURSOR; + YYCURSOR = YYCTXMARKER; + { + set_sourceline(cursor); + goto comment; + } +yy315: + yych = *++YYCURSOR; + if (yych == '\n') goto yy313; + goto yy300; +yy316: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); + yych = *YYCURSOR; + if (yybm[0+yych] & 128) { + goto yy316; + } + if (yych <= '!') goto yy300; + if (yych <= '"') goto yy319; + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych == '\n') goto yy300; + goto yy316; +yy319: yych = *++YYCURSOR; - goto yy229; -yy234: + if (yych == '\n') goto yy313; + if (yych == '\r') goto yy315; + goto yy300; +yy320: ++YYCURSOR; { ++depth; fatal("ambiguous /* found"); goto comment; } -yy236: +yy322: ++YYCURSOR; { if (--depth == 0) @@ -1456,52 +1998,52 @@ config: if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; if (yych <= 0x1F) { - if (yych != '\t') goto yy244; + if (yych != '\t') goto yy330; } else { - if (yych <= ' ') goto yy240; - if (yych == '=') goto yy242; - goto yy244; + if (yych <= ' ') goto yy326; + if (yych == '=') goto yy328; + goto yy330; } -yy240: +yy326: ++YYCURSOR; yych = *YYCURSOR; - goto yy249; -yy241: + goto yy335; +yy327: { goto config; } -yy242: +yy328: ++YYCURSOR; yych = *YYCURSOR; - goto yy247; -yy243: + goto yy333; +yy329: { iscfg = 2; cur = cursor; RETURN('='); } -yy244: +yy330: ++YYCURSOR; { fatal("missing '='"); } -yy246: +yy332: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; -yy247: +yy333: if (yybm[0+yych] & 128) { - goto yy246; + goto yy332; } - goto yy243; -yy248: + goto yy329; +yy334: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; -yy249: - if (yych == '\t') goto yy248; - if (yych == ' ') goto yy248; - goto yy241; +yy335: + if (yych == '\t') goto yy334; + if (yych == ' ') goto yy334; + goto yy327; } @@ -1547,191 +2089,315 @@ value: yych = *YYCURSOR; if (yych <= '&') { if (yych <= '\r') { - if (yych <= 0x08) goto yy258; - if (yych <= '\n') goto yy252; - if (yych <= '\f') goto yy258; + if (yych <= 0x08) goto yy344; + if (yych <= '\n') goto yy338; + if (yych <= '\f') goto yy344; } else { if (yych <= ' ') { - if (yych <= 0x1F) goto yy258; + if (yych <= 0x1F) goto yy344; } else { - if (yych == '"') goto yy260; - goto yy258; + if (yych == '"') goto yy346; + goto yy344; } } } else { if (yych <= '/') { - if (yych <= '\'') goto yy262; - if (yych == '-') goto yy255; - goto yy258; + if (yych <= '\'') goto yy348; + if (yych == '-') goto yy341; + goto yy344; } else { if (yych <= '9') { - if (yych <= '0') goto yy253; - goto yy256; + if (yych <= '0') goto yy339; + goto yy342; } else { - if (yych != ';') goto yy258; + if (yych != ';') goto yy344; } } } -yy252: +yy338: { cur = cursor; yylval.str = new Str(token()); iscfg = 0; return VALUE; } -yy253: +yy339: ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 8) { - goto yy258; + goto yy344; } -yy254: +yy340: { cur = cursor; yylval.number = atoi(token().to_string().c_str()); iscfg = 0; return NUMBER; } -yy255: +yy341: yych = *++YYCURSOR; - if (yych <= '0') goto yy259; - if (yych >= ':') goto yy259; -yy256: + if (yych <= '0') goto yy345; + if (yych >= ':') goto yy345; +yy342: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yybm[0+yych] & 4) { - goto yy256; + goto yy342; } if (yych <= '\r') { - if (yych <= 0x08) goto yy258; - if (yych <= '\n') goto yy254; - if (yych >= '\r') goto yy254; + if (yych <= 0x08) goto yy344; + if (yych <= '\n') goto yy340; + if (yych >= '\r') goto yy340; } else { if (yych <= ' ') { - if (yych >= ' ') goto yy254; + if (yych >= ' ') goto yy340; } else { - if (yych == ';') goto yy254; + if (yych == ';') goto yy340; } } -yy258: +yy344: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; -yy259: +yy345: if (yybm[0+yych] & 8) { - goto yy258; + goto yy344; } - goto yy252; -yy260: + goto yy338; +yy346: YYMARKER = ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yybm[0+yych] & 16) { - goto yy260; + goto yy346; } if (yych <= '!') { - if (yych == '\n') goto yy252; - goto yy270; + if (yych == '\n') goto yy338; + goto yy356; } else { - if (yych <= '"') goto yy258; - if (yych <= '[') goto yy270; - goto yy272; + if (yych <= '"') goto yy344; + if (yych <= '[') goto yy356; + goto yy358; } -yy262: +yy348: YYMARKER = ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yybm[0+yych] & 32) { - goto yy262; + goto yy348; } if (yych <= '&') { - if (yych == '\n') goto yy252; + if (yych == '\n') goto yy338; } else { - if (yych <= '\'') goto yy258; - if (yych >= '\\') goto yy267; + if (yych <= '\'') goto yy344; + if (yych >= '\\') goto yy353; } -yy264: +yy350: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yybm[0+yych] & 64) { - goto yy264; + goto yy350; } - if (yych <= '&') goto yy266; - if (yych <= '\'') goto yy268; - goto yy269; -yy266: + if (yych <= '&') goto yy352; + if (yych <= '\'') goto yy354; + goto yy355; +yy352: YYCURSOR = YYMARKER; - goto yy252; -yy267: + goto yy338; +yy353: YYMARKER = ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych <= '\r') { if (yych <= '\t') { - if (yych <= 0x08) goto yy262; - goto yy264; + if (yych <= 0x08) goto yy348; + goto yy350; } else { - if (yych <= '\n') goto yy252; - if (yych <= '\f') goto yy262; - goto yy264; + if (yych <= '\n') goto yy338; + if (yych <= '\f') goto yy348; + goto yy350; } } else { if (yych <= ' ') { - if (yych <= 0x1F) goto yy262; - goto yy264; + if (yych <= 0x1F) goto yy348; + goto yy350; } else { - if (yych == ';') goto yy264; - goto yy262; + if (yych == ';') goto yy350; + goto yy348; } } -yy268: +yy354: yych = *++YYCURSOR; - goto yy252; -yy269: + goto yy338; +yy355: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; - if (yych == '\n') goto yy266; - goto yy264; -yy270: + if (yych == '\n') goto yy352; + goto yy350; +yy356: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yybm[0+yych] & 128) { - goto yy270; + goto yy356; } - if (yych <= '!') goto yy266; - if (yych <= '"') goto yy268; - goto yy273; -yy272: + if (yych <= '!') goto yy352; + if (yych <= '"') goto yy354; + goto yy359; +yy358: YYMARKER = ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych <= '\r') { if (yych <= '\t') { - if (yych <= 0x08) goto yy260; - goto yy270; + if (yych <= 0x08) goto yy346; + goto yy356; } else { - if (yych <= '\n') goto yy252; - if (yych <= '\f') goto yy260; - goto yy270; + if (yych <= '\n') goto yy338; + if (yych <= '\f') goto yy346; + goto yy356; } } else { if (yych <= ' ') { - if (yych <= 0x1F) goto yy260; - goto yy270; + if (yych <= 0x1F) goto yy346; + goto yy356; } else { - if (yych == ';') goto yy270; - goto yy260; + if (yych == ';') goto yy356; + goto yy346; } } -yy273: +yy359: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych == '\n') goto yy352; + goto yy356; +} + +} + +void Scanner::set_sourceline(char *& cursor) +{ +sourceline: + tok = cursor; + +{ + YYCTYPE yych; + static const unsigned char yybm[] = { + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 0, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 0, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 0, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + }; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + if (yych <= '!') { + if (yych == '\n') goto yy366; + goto yy368; + } else { + if (yych <= '"') goto yy364; + if (yych <= '0') goto yy368; + if (yych >= ':') goto yy368; + } + ++YYCURSOR; + yych = *YYCURSOR; + goto yy376; +yy363: + { + cur = cursor; + cline = atoi(token().to_string().c_str()); + goto sourceline; + } +yy364: + yych = *(YYMARKER = ++YYCURSOR); + if (yych != '\n') goto yy370; +yy365: + { + goto sourceline; + } +yy366: + ++YYCURSOR; + { + if (cursor == eof) + { + --cursor; + } + else + { + pos = cursor; + } + tok = cursor; + return; + } +yy368: + yych = *++YYCURSOR; + goto yy365; +yy369: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; +yy370: + if (yybm[0+yych] & 64) { + goto yy369; + } + if (yych <= '!') goto yy371; + if (yych <= '"') goto yy373; + goto yy372; +yy371: + YYCURSOR = YYMARKER; + goto yy365; +yy372: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych == '\n') goto yy371; + goto yy369; +yy373: + ++YYCURSOR; + { + cur = cursor; + sourceFileInfo.set_fname(token(1, cur - tok - 2).to_string()); + goto sourceline; + } +yy375: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; - if (yych == '\n') goto yy266; - goto yy270; +yy376: + if (yybm[0+yych] & 128) { + goto yy375; + } + goto yy363; } } diff --git a/re2c/code.cc b/re2c/code.cc index 8c09decd..761b6cda 100644 --- a/re2c/code.cc +++ b/re2c/code.cc @@ -736,7 +736,7 @@ void Rule::emit(std::ostream &o, uint ind, bool &, const std::string& condName) o << indent(ind) << yySetupRule << "\n"; } - o << file_info(sourceFileInfo, &rl); + o << file_info(rule->code->source, &rl); o << indent(ind); if (rule->code->autogen) { diff --git a/re2c/htdocs/index.html b/re2c/htdocs/index.html index de2b9869..37c3c931 100755 --- a/re2c/htdocs/index.html +++ b/re2c/htdocs/index.html @@ -81,6 +81,7 @@ fixes which were incorporated.

Changelog

2008-??-??: 0.13.4

+
  • Added transparent handling of #line directives in input files.
  • Added re2c:yyfill:check inplace configuration.
  • Added re2c:define:YYSETSTATE:naked inplace configuration.
  • Added re2c:flags:w and re2c:flags:u inplace configurations.
  • diff --git a/re2c/main.cc b/re2c/main.cc index 1c5c09d8..24775d9b 100644 --- a/re2c/main.cc +++ b/re2c/main.cc @@ -457,6 +457,7 @@ int main(int argc, char *argv[]) bWroteCondCheck = false; bUsedYYMaxFill = false; bFirstPass = false; + sourceFileInfo.set_fname(sourceFileName); } bLastPass = true; diff --git a/re2c/parser.y b/re2c/parser.y index ed51b189..9f8e9c7a 100644 --- a/re2c/parser.y +++ b/re2c/parser.y @@ -83,7 +83,7 @@ void context_rule(CondList *clist, RegExp *expr, RegExp *look, Str *newcond, Tok for(CondList::const_iterator it = clist->begin(); it != clist->end(); ++it) { //Str *condcpy = newcond ? new Str(*newcond) : newcond; - Token *token = new Token(code, in->get_line(), newcond);//condcpy); + Token *token = new Token(code, sourceFileInfo, newcond);//condcpy); RuleOp *rule = new RuleOp(expr, look, token, accept++); RegExpMap::iterator itRE = specMap.find(*it); @@ -237,7 +237,7 @@ rule: | '<' STAR '>' expr look newcond CODE { context_check(NULL); - Token *token = new Token($7, $7->line, $6); + Token *token = new Token($7, $7->source, $7->line, $6); delete $7; delete $6; specStar.push_back(new RuleOp($4, $5, token, accept++)); @@ -246,7 +246,7 @@ rule: { assert($7); context_check(NULL); - Token *token = new Token(NULL, in->get_line(), $7); + Token *token = new Token(NULL, sourceFileInfo, $7); delete $7; specStar.push_back(new RuleOp($4, $5, token, accept++)); } @@ -268,7 +268,7 @@ rule: { in->fatal("code to handle illegal condition already defined"); } - Token *token = new Token($3, $3->line, $2); + Token *token = new Token($3, $3->source, $3->line, $2); delete $2; delete $3; $$ = specNone = new RuleOp(new NullOp(), new NullOp(), token, accept++); @@ -281,7 +281,7 @@ rule: { in->fatal("code to handle illegal condition already defined"); } - Token *token = new Token(NULL, in->get_line(), $3); + Token *token = new Token(NULL, sourceFileInfo, $3); delete $3; $$ = specNone = new RuleOp(new NullOp(), new NullOp(), token, accept++); } diff --git a/re2c/scanner.h b/re2c/scanner.h index 67035c0b..db6528f8 100644 --- a/re2c/scanner.h +++ b/re2c/scanner.h @@ -32,6 +32,7 @@ private: char *fill(char*, uint); Scanner(const Scanner&); //unimplemented Scanner& operator=(const Scanner&); //unimplemented + void set_sourceline(char *& cursor); public: Scanner(std::istream&, std::ostream&); diff --git a/re2c/scanner.re b/re2c/scanner.re index 59944fe3..8cfe737f 100644 --- a/re2c/scanner.re +++ b/re2c/scanner.re @@ -38,6 +38,7 @@ dstring = "\"" ((esc \ ["] ) | "\\" dot)* "\""; sstring = "'" ((esc \ ['] ) | "\\" dot)* "'" ; letter = [a-zA-Z]; digit = [0-9]; +lineno = [1-9] digit*; number = "0" | ("-"? [1-9] digit*); name = (letter|"_") (letter|digit|"_")*; cname = ":" name; @@ -46,6 +47,7 @@ ws = (space | [\r\n]); eol = ("\r\n" | "\n"); config = "re2c" cname+ ("@" name)?; value = [^\r\n; \t]* | dstring | sstring; +lineinf = lineno (space+ dstring)? eol; */ Scanner::ParseMode Scanner::echo() @@ -188,6 +190,10 @@ echo: tok = pos = cursor; goto echo; } + "\n" space* "#" space* "line" space+ / lineinf { + set_sourceline(cursor); + goto echo; + } "\n" { if (ignore_eoc) { @@ -416,6 +422,11 @@ scan: goto scan; } + eol space* "#" space* "line" space+ / lineinf { + set_sourceline(cursor); + goto scan; + } + eol { if (cursor == eof) RETURN(0); pos = cursor; @@ -442,7 +453,7 @@ code: else if (--depth == 0) { cur = cursor; - yylval.token = new Token(token(), tline); + yylval.token = new Token(token(), sourceFileInfo.fname, tline); return CODE; } goto code; @@ -458,6 +469,10 @@ code: } goto code; } + "\n" space* "#" space* "line" space+ / lineinf { + set_sourceline(cursor); + goto code; + } "\n" / ws { if (depth == 0) { @@ -480,7 +495,7 @@ code: { --cur; } - yylval.token = new Token(token(), tline); + yylval.token = new Token(token(), sourceFileInfo.fname, tline); return CODE; } else if (cursor == eof) @@ -524,6 +539,10 @@ comment: fatal("ambiguous /* found"); goto comment; } + "\n" space* "#" space* "line" space+ / lineinf { + set_sourceline(cursor); + goto comment; + } "\n" { if (cursor == eof) { @@ -574,4 +593,37 @@ value: */ } +void Scanner::set_sourceline(char *& cursor) +{ +sourceline: + tok = cursor; +/*!re2c + lineno { + cur = cursor; + cline = atoi(token().to_string().c_str()); + goto sourceline; + } + dstring { + cur = cursor; + sourceFileInfo.set_fname(token(1, cur - tok - 2).to_string()); + goto sourceline; + } + "\n" { + if (cursor == eof) + { + --cursor; + } + else + { + pos = cursor; + } + tok = cursor; + return; + } + any { + goto sourceline; + } +*/ +} + } // end namespace re2c diff --git a/re2c/stream_lc.h b/re2c/stream_lc.h index c2895125..04cf7c2d 100755 --- a/re2c/stream_lc.h +++ b/re2c/stream_lc.h @@ -422,6 +422,11 @@ public: return *this; } + void set_fname(const std::string& _fname) + { + *(const_cast(&this->fname)) = _fname; + } + const std::string fname; const line_number* ln; }; diff --git a/re2c/test/line-01.c b/re2c/test/line-01.c new file mode 100755 index 00000000..8bf8a465 --- /dev/null +++ b/re2c/test/line-01.c @@ -0,0 +1,59 @@ +/* Generated by re2c */ +#line 1 "line-01.re" +const char* scan(unsigned char* in) +{ + +#line 7 "" +{ + YYCTYPE yych; + + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + switch (yych) { + case '\n': goto yy2; + case 'a': goto yy3; + case 'b': goto yy5; + case 'c': goto yy7; + case 'd': goto yy9; + default: goto yy11; + } +yy2: +yy3: + ++YYCURSOR; +#line 1 "a" + { + return "a"; + } +#line 28 "" +yy5: + ++YYCURSOR; +#line 2 "b" + { + return "b"; + } +#line 35 "" +yy7: + ++YYCURSOR; +#line 5 "b" + { + return "c"; + } +#line 42 "" +yy9: + ++YYCURSOR; +#line 2 "d" + { + return "d"; + } +#line 49 "" +yy11: + ++YYCURSOR; +#line 6 "d" + { + return "."; + } +#line 56 "" +} +#line 1 "e" + +} diff --git a/re2c/test/line-01.re b/re2c/test/line-01.re new file mode 100755 index 00000000..db7bbcc4 --- /dev/null +++ b/re2c/test/line-01.re @@ -0,0 +1,27 @@ +const char* scan(unsigned char* in) +{ +/*!re2c + +#line 1 "a" +"a" { + return "a"; + } +#line 2 "b" +"b" { + return "b"; + } +"c" { + return "c"; + } +#line 1 "d" + +"d" { + return "d"; + } + +. { + return "."; + } +#line 1 "e" +*/ +} diff --git a/re2c/token.h b/re2c/token.h index cded2a60..9ef5b258 100644 --- a/re2c/token.h +++ b/re2c/token.h @@ -3,6 +3,7 @@ #define _token_h #include "substr.h" +#include "stream_lc.h" namespace re2c { @@ -12,29 +13,54 @@ class Token public: const Str text; const std::string newcond; - const uint line; + const std::string source; + uint line; const bool autogen; public: - Token(const SubStr&, uint); - Token(const Token*, uint, const Str*); + Token(const SubStr&, const file_info&); + Token(const SubStr&, const std::string&, uint); + Token(const Token*, const file_info&, const Str*); + Token(const Token*, const std::string&, uint, const Str*); Token(const Token& oth); ~Token(); }; -inline Token::Token(const SubStr& t, uint l) +inline Token::Token(const SubStr& t, const file_info& fi) : text(t) , newcond() + , source(fi.fname) + , line(fi.ln->get_line()) + , autogen(false) +{ + ; +} + +inline Token::Token(const SubStr& t, const std::string& s, uint l) + : text(t) + , newcond() + , source(s) , line(l) , autogen(false) { ; } -inline Token::Token(const Token* t, uint l, const Str *c) +inline Token::Token(const Token* t, const file_info& fi, const Str *c) : text(t ? t->text.to_string().c_str() : "") , newcond(c ? c->to_string() : "") - , line(t ? t->line : l) + , source(t ? t->source : fi.fname) + , line(t ? t->line : fi.ln->get_line()) + , autogen(t == NULL) +{ + ; +} + +inline Token::Token(const Token* t, const std::string& s, uint l, const Str *c) + : text(t ? t->text.to_string().c_str() : "") + , newcond(c ? c->to_string() : "") + , source(s) + , line(l) , autogen(t == NULL) { ; @@ -43,6 +69,7 @@ inline Token::Token(const Token* t, uint l, const Str *c) inline Token::Token(const Token& oth) : text(oth.text.to_string().c_str()) , newcond(oth.newcond) + , source(oth.source) , line(oth.line) , autogen(oth.autogen) { -- 2.40.0