From: helly Date: Sun, 22 Jan 2006 17:15:03 +0000 (+0000) Subject: - Improve error messages and flush output before error out X-Git-Tag: 0.13.6~487 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=02082644bf7b187f1930ff99a037119e3d6d4a4a;p=re2c - Improve error messages and flush output before error out - Use minimal buffering when outputting single chars --- diff --git a/bootstrap/scanner.cc b/bootstrap/scanner.cc index 1e4916db..31a4117b 100644 --- a/bootstrap/scanner.cc +++ b/bootstrap/scanner.cc @@ -1,13 +1,15 @@ -/* Generated by re2c 0.10.0.dev on Sat Jan 21 16:15:00 2006 */ +/* Generated by re2c 0.10.0.dev on Sun Jan 22 18:04:36 2006 */ #line 1 "scanner.re" /* $Id$ */ #include #include #include +#include #include "scanner.h" #include "parser.h" #include "y.tab.h" #include "globals.h" +#include "dfa.h" extern YYSTYPE yylval; @@ -28,9 +30,11 @@ extern YYSTYPE yylval; namespace re2c { -Scanner::Scanner(std::istream& i) : in(i), - bot(NULL), tok(NULL), ptr(NULL), cur(NULL), pos(NULL), lim(NULL), - top(NULL), eof(NULL), tchar(0), tline(0), cline(1), iscfg(0) +Scanner::Scanner(std::istream& i, std::ostream& o) + : in(i) + , out(o) + , bot(NULL), tok(NULL), ptr(NULL), cur(NULL), pos(NULL), lim(NULL) + , top(NULL), eof(NULL), tchar(0), tline(0), cline(1), iscfg(0) { ; } @@ -72,7 +76,7 @@ char *Scanner::fill(char *cursor) return cursor; } -#line 91 "scanner.re" +#line 95 "scanner.re" int Scanner::echo(std::ostream &out){ @@ -88,10 +92,11 @@ int Scanner::echo(std::ostream &out){ tok = cursor; echo: -#line 92 "scanner.cc" +#line 96 "scanner.cc" { YYCTYPE yych; unsigned int yyaccept = 0; + if((YYLIMIT - YYCURSOR) < 11) YYFILL(11); yych = *YYCURSOR; if(yych <= ')') { @@ -106,40 +111,40 @@ echo: yych = *(YYMARKER = ++YYCURSOR); if(yych == '*') goto yy12; yy3: -#line 137 "scanner.re" +#line 141 "scanner.re" { goto echo; } -#line 114 "scanner.cc" +#line 119 "scanner.cc" yy4: yych = *++YYCURSOR; if(yych == '/') goto yy10; goto yy3; yy5: ++YYCURSOR; -#line 126 "scanner.re" +#line 130 "scanner.re" { out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok)); tok = pos = cursor; cline++; goto echo; } -#line 127 "scanner.cc" +#line 132 "scanner.cc" yy7: ++YYCURSOR; -#line 131 "scanner.re" +#line 135 "scanner.re" { out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok) - 1); // -1 so we don't write out the \0 if(cursor == eof) { RETURN(0); } } -#line 137 "scanner.cc" +#line 142 "scanner.cc" yy9: yych = *++YYCURSOR; goto yy3; yy10: ++YYCURSOR; -#line 117 "scanner.re" +#line 121 "scanner.re" { if (ignore_eoc) { ignore_eoc = false; @@ -149,7 +154,7 @@ yy10: tok = pos = cursor; goto echo; } -#line 153 "scanner.cc" +#line 158 "scanner.cc" yy12: yych = *++YYCURSOR; if(yych == '!') goto yy14; @@ -175,13 +180,13 @@ yy16: yych = *++YYCURSOR; if(yych != 'c') goto yy13; ++YYCURSOR; -#line 106 "scanner.re" +#line 110 "scanner.re" { out.write((const char*)(tok), (const char*)(&cursor[-7]) - (const char*)(tok)); tok = cursor; RETURN(1); } -#line 185 "scanner.cc" +#line 190 "scanner.cc" yy21: yych = *++YYCURSOR; if(yych != 'x') goto yy13; @@ -196,16 +201,16 @@ yy21: yych = *++YYCURSOR; if(yych != 'c') goto yy13; ++YYCURSOR; -#line 111 "scanner.re" +#line 115 "scanner.re" { out << "#define YYMAXFILL " << maxFill << std::endl; tok = pos = cursor; ignore_eoc = true; goto echo; } -#line 207 "scanner.cc" +#line 212 "scanner.cc" } -#line 140 "scanner.re" +#line 144 "scanner.re" } @@ -228,7 +233,7 @@ scan: goto value; } -#line 232 "scanner.cc" +#line 237 "scanner.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -302,42 +307,42 @@ yy31: if(yych <= '9') goto yy95; } yy32: -#line 162 "scanner.re" +#line 166 "scanner.re" { depth = 1; goto code; } -#line 310 "scanner.cc" +#line 315 "scanner.cc" yy33: ++YYCURSOR; if((yych = *YYCURSOR) == '*') goto yy92; yy34: -#line 192 "scanner.re" +#line 196 "scanner.re" { RETURN(*tok); } -#line 317 "scanner.cc" +#line 322 "scanner.cc" yy35: ++YYCURSOR; if((yych = *YYCURSOR) == '/') goto yy90; yy36: -#line 194 "scanner.re" +#line 198 "scanner.re" { yylval.op = *tok; RETURN(CLOSE); } -#line 325 "scanner.cc" +#line 330 "scanner.cc" yy37: yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); if(yych != 0x0A) goto yy86; yy38: -#line 179 "scanner.re" +#line 183 "scanner.re" { fatal("unterminated string constant (missing \")"); } -#line 333 "scanner.cc" +#line 338 "scanner.cc" yy39: yyaccept = 2; yych = *(YYMARKER = ++YYCURSOR); if(yych != 0x0A) goto yy81; yy40: -#line 180 "scanner.re" +#line 184 "scanner.re" { fatal("unterminated string constant (missing ')"); } -#line 341 "scanner.cc" +#line 346 "scanner.cc" yy41: yyaccept = 3; yych = *(YYMARKER = ++YYCURSOR); @@ -345,9 +350,9 @@ yy41: if(yych == '^') goto yy72; goto yy71; yy42: -#line 190 "scanner.re" +#line 194 "scanner.re" { fatal("unterminated range (missing ])"); } -#line 351 "scanner.cc" +#line 356 "scanner.cc" yy43: yych = *++YYCURSOR; goto yy34; @@ -359,57 +364,51 @@ yy45: if((yych = *YYCURSOR) == 'e') goto yy62; goto yy61; yy46: -#line 221 "scanner.re" +#line 225 "scanner.re" { cur = cursor; yylval.symbol = Symbol::find(token()); return ID; } -#line 367 "scanner.cc" +#line 372 "scanner.cc" yy47: yych = *++YYCURSOR; goto yy61; yy48: ++YYCURSOR; -#line 225 "scanner.re" +#line 229 "scanner.re" { cur = cursor; yylval.regexp = mkDot(); return RANGE; } -#line 378 "scanner.cc" +#line 383 "scanner.cc" yy50: ++YYCURSOR; yych = *YYCURSOR; goto yy59; yy51: -#line 230 "scanner.re" +#line 234 "scanner.re" { goto scan; } -#line 386 "scanner.cc" +#line 391 "scanner.cc" yy52: ++YYCURSOR; yy53: -#line 232 "scanner.re" +#line 236 "scanner.re" { if(cursor == eof) RETURN(0); pos = cursor; cline++; goto scan; } -#line 395 "scanner.cc" +#line 400 "scanner.cc" yy54: ++YYCURSOR; if((yych = *YYCURSOR) == 0x0A) goto yy57; yy55: -#line 237 "scanner.re" - { std::cerr << "line " << tline << ", column " << (tchar + 1) - << ": unexpected character: "; - if (isprint(*tok)) - { - std::cerr << *tok << std::endl; - } - else - { - std::cerr << "0x" << hexCh(*tok >> 4) << hexCh(*tok) << std::endl; - } +#line 241 "scanner.re" + { std::ostringstream msg; + msg << "unexpected character: "; + prtChOrHex(msg, *tok); + fatal(msg.str().c_str()); goto scan; } -#line 413 "scanner.cc" +#line 412 "scanner.cc" yy56: yych = *++YYCURSOR; goto yy55; @@ -487,14 +486,14 @@ yy67: } } yy69: -#line 214 "scanner.re" +#line 218 "scanner.re" { cur = cursor; tok+= 5; /* skip "re2c:" */ iscfg = 1; yylval.str = new Str(token()); return CONFIG; } -#line 498 "scanner.cc" +#line 497 "scanner.cc" yy70: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -528,11 +527,11 @@ yy74: goto yy70; yy75: ++YYCURSOR; -#line 186 "scanner.re" +#line 190 "scanner.re" { cur = cursor; yylval.regexp = ranToRE(token()); return RANGE; } -#line 536 "scanner.cc" +#line 535 "scanner.cc" yy77: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -541,11 +540,11 @@ yy77: goto yy72; yy78: ++YYCURSOR; -#line 182 "scanner.re" +#line 186 "scanner.re" { cur = cursor; yylval.regexp = invToRE(token()); return RANGE; } -#line 549 "scanner.cc" +#line 548 "scanner.cc" yy80: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -565,11 +564,11 @@ yy81: goto yy80; yy83: ++YYCURSOR; -#line 175 "scanner.re" +#line 179 "scanner.re" { cur = cursor; yylval.regexp = strToCaseInsensitiveRE(token()); return STRING; } -#line 573 "scanner.cc" +#line 572 "scanner.cc" yy85: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -589,23 +588,23 @@ yy86: goto yy85; yy88: ++YYCURSOR; -#line 171 "scanner.re" +#line 175 "scanner.re" { cur = cursor; yylval.regexp = strToRE(token()); return STRING; } -#line 597 "scanner.cc" +#line 596 "scanner.cc" yy90: ++YYCURSOR; -#line 168 "scanner.re" +#line 172 "scanner.re" { tok = cursor; RETURN(0); } -#line 603 "scanner.cc" +#line 602 "scanner.cc" yy92: ++YYCURSOR; -#line 165 "scanner.re" +#line 169 "scanner.re" { depth = 1; goto comment; } -#line 609 "scanner.cc" +#line 608 "scanner.cc" yy94: yych = *++YYCURSOR; if(yych == ',') goto yy108; @@ -626,16 +625,16 @@ yy96: yy97: ++YYCURSOR; yy98: -#line 212 "scanner.re" +#line 216 "scanner.re" { fatal("illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers"); } -#line 632 "scanner.cc" +#line 631 "scanner.cc" yy99: ++YYCURSOR; -#line 200 "scanner.re" +#line 204 "scanner.re" { yylval.extop.minsize = atoi((char *)tok+1); yylval.extop.maxsize = atoi((char *)tok+1); RETURN(CLOSESIZE); } -#line 639 "scanner.cc" +#line 638 "scanner.cc" yy101: yyaccept = 6; yych = *(YYMARKER = ++YYCURSOR); @@ -643,11 +642,11 @@ yy101: if(yych <= '9') goto yy104; if(yych != '}') goto yy98; ++YYCURSOR; -#line 208 "scanner.re" +#line 212 "scanner.re" { yylval.extop.minsize = atoi((char *)tok+1); yylval.extop.maxsize = -1; RETURN(CLOSESIZE); } -#line 651 "scanner.cc" +#line 650 "scanner.cc" yy104: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -656,11 +655,11 @@ yy104: if(yych <= '9') goto yy104; if(yych != '}') goto yy66; ++YYCURSOR; -#line 204 "scanner.re" +#line 208 "scanner.re" { yylval.extop.minsize = atoi((char *)tok+1); yylval.extop.maxsize = MAX(yylval.extop.minsize,atoi(strchr((char *)tok, ',')+1)); RETURN(CLOSESIZE); } -#line 664 "scanner.cc" +#line 663 "scanner.cc" yy108: yyaccept = 6; yych = *(YYMARKER = ++YYCURSOR); @@ -668,17 +667,17 @@ yy108: if(yych <= '9') goto yy104; if(yych != '}') goto yy98; ++YYCURSOR; -#line 197 "scanner.re" +#line 201 "scanner.re" { yylval.op = '*'; RETURN(CLOSE); } -#line 675 "scanner.cc" +#line 674 "scanner.cc" } -#line 249 "scanner.re" +#line 247 "scanner.re" code: -#line 682 "scanner.cc" +#line 681 "scanner.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -702,34 +701,34 @@ code: } } ++YYCURSOR; -#line 253 "scanner.re" +#line 251 "scanner.re" { if(--depth == 0){ cur = cursor; yylval.token = new Token(token(), tline); return CODE; } goto code; } -#line 713 "scanner.cc" +#line 712 "scanner.cc" yy115: ++YYCURSOR; -#line 259 "scanner.re" +#line 257 "scanner.re" { ++depth; goto code; } -#line 719 "scanner.cc" +#line 718 "scanner.cc" yy117: ++YYCURSOR; -#line 261 "scanner.re" +#line 259 "scanner.re" { if(cursor == eof) fatal("missing '}'"); pos = cursor; cline++; goto code; } -#line 727 "scanner.cc" +#line 726 "scanner.cc" yy119: ++YYCURSOR; yy120: -#line 265 "scanner.re" +#line 263 "scanner.re" { goto code; } -#line 733 "scanner.cc" +#line 732 "scanner.cc" yy121: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); @@ -781,12 +780,12 @@ yy128: if(yych == 0x0A) goto yy125; goto yy127; } -#line 266 "scanner.re" +#line 264 "scanner.re" comment: -#line 790 "scanner.cc" +#line 789 "scanner.cc" { YYCTYPE yych; if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -803,47 +802,47 @@ yy132: ++YYCURSOR; if((yych = *YYCURSOR) == '/') goto yy140; yy133: -#line 281 "scanner.re" +#line 279 "scanner.re" { if(cursor == eof) RETURN(0); goto comment; } -#line 810 "scanner.cc" +#line 809 "scanner.cc" yy134: yych = *++YYCURSOR; if(yych == '*') goto yy138; goto yy133; yy135: ++YYCURSOR; -#line 277 "scanner.re" +#line 275 "scanner.re" { if(cursor == eof) RETURN(0); tok = pos = cursor; cline++; goto comment; } -#line 822 "scanner.cc" +#line 821 "scanner.cc" yy137: yych = *++YYCURSOR; goto yy133; yy138: ++YYCURSOR; -#line 274 "scanner.re" +#line 272 "scanner.re" { ++depth; fatal("ambiguous /* found"); goto comment; } -#line 832 "scanner.cc" +#line 831 "scanner.cc" yy140: ++YYCURSOR; -#line 270 "scanner.re" +#line 268 "scanner.re" { if(--depth == 0) goto scan; else goto comment; } -#line 840 "scanner.cc" +#line 839 "scanner.cc" } -#line 283 "scanner.re" +#line 281 "scanner.re" config: -#line 847 "scanner.cc" +#line 846 "scanner.cc" { YYCTYPE yych; if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -860,25 +859,25 @@ yy144: yych = *YYCURSOR; goto yy153; yy145: -#line 287 "scanner.re" +#line 285 "scanner.re" { goto config; } -#line 866 "scanner.cc" +#line 865 "scanner.cc" yy146: ++YYCURSOR; yych = *YYCURSOR; goto yy151; yy147: -#line 288 "scanner.re" +#line 286 "scanner.re" { iscfg = 2; cur = cursor; RETURN('='); } -#line 877 "scanner.cc" +#line 876 "scanner.cc" yy148: ++YYCURSOR; -#line 292 "scanner.re" +#line 290 "scanner.re" { fatal("missing '='"); } -#line 882 "scanner.cc" +#line 881 "scanner.cc" yy150: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -896,12 +895,12 @@ yy153: if(yych == ' ') goto yy152; goto yy145; } -#line 293 "scanner.re" +#line 291 "scanner.re" value: -#line 905 "scanner.cc" +#line 904 "scanner.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -935,13 +934,13 @@ value: } } yy156: -#line 302 "scanner.re" +#line 300 "scanner.re" { cur = cursor; yylval.str = new Str(token()); iscfg = 0; return VALUE; } -#line 945 "scanner.cc" +#line 944 "scanner.cc" yy157: ++YYCURSOR; if((yych = *YYCURSOR) <= 0x0D) { @@ -956,13 +955,13 @@ yy157: } } yy158: -#line 297 "scanner.re" +#line 295 "scanner.re" { cur = cursor; yylval.number = atoi(token().to_string().c_str()); iscfg = 0; return NUMBER; } -#line 966 "scanner.cc" +#line 965 "scanner.cc" yy159: yych = *++YYCURSOR; if(yych <= '0') goto yy163; @@ -1142,20 +1141,18 @@ yy177: if(yych == 0x0A) goto yy170; goto yy174; } -#line 307 "scanner.re" +#line 305 "scanner.re" } void Scanner::fatal(uint ofs, const char *msg) const { - std::cerr << "line " << tline << ", column " << (tchar + ofs + 1) << ": " + out.flush(); + std::cerr << "re2c: error: " + << "line " << tline << ", column " << (tchar + ofs + 1) << ": " << msg << std::endl; - exit(1); -} - -void Scanner::fatal(const char *msg) const -{ - fatal(0, msg); + exit(1); } } // end namespace re2c + diff --git a/code.cc b/code.cc index d913fa6a..9d546774 100644 --- a/code.cc +++ b/code.cc @@ -1182,7 +1182,8 @@ void DFA::emit(std::ostream &o, uint ind) bool hasFillLabels = (0<=vFillIndexes); if (hasFillLabels==true && label!=0) { - std::cerr << "re2c : error : multiple /*!re2c blocks aren't supported when -f is specified\n"; + o.flush(); + std::cerr << "re2c: error: multiple /*!re2c blocks aren't supported when -f is specified\n"; exit(1); } diff --git a/main.cc b/main.cc index e1bd13dc..875474d4 100644 --- a/main.cc +++ b/main.cc @@ -249,7 +249,7 @@ int main(int argc, char *argv[]) } } - Scanner in(*input); + Scanner in(*input, output); if (!iFlag) { diff --git a/scanner.h b/scanner.h index e863cb62..ce09f4b9 100644 --- a/scanner.h +++ b/scanner.h @@ -16,6 +16,7 @@ class Scanner: { private: std::istream& in; + std::ostream& out; char *bot, *tok, *ptr, *cur, *pos, *lim, *top, *eof; uint tchar, tline, cline, iscfg; @@ -25,10 +26,10 @@ private: Scanner& operator=(const Scanner&); //unimplemented public: - Scanner(std::istream&); + Scanner(std::istream&, std::ostream&); int echo(std::ostream&); int scan(); - + void fatal(const char*) const; void fatal(uint, const char*) const; @@ -52,6 +53,11 @@ public: RegExp * mkDot() const; }; +inline void Scanner::fatal(const char *msg) const +{ + fatal(0, msg); +} + inline SubStr Scanner::token() const { return SubStr(tok, cur - tok); diff --git a/scanner.re b/scanner.re index 583cb8aa..bbc93803 100644 --- a/scanner.re +++ b/scanner.re @@ -2,10 +2,12 @@ #include #include #include +#include #include "scanner.h" #include "parser.h" #include "y.tab.h" #include "globals.h" +#include "dfa.h" extern YYSTYPE yylval; @@ -26,9 +28,11 @@ extern YYSTYPE yylval; namespace re2c { -Scanner::Scanner(std::istream& i) : in(i), - bot(NULL), tok(NULL), ptr(NULL), cur(NULL), pos(NULL), lim(NULL), - top(NULL), eof(NULL), tchar(0), tline(0), cline(1), iscfg(0) +Scanner::Scanner(std::istream& i, std::ostream& o) + : in(i) + , out(o) + , bot(NULL), tok(NULL), ptr(NULL), cur(NULL), pos(NULL), lim(NULL) + , top(NULL), eof(NULL), tchar(0), tline(0), cline(1), iscfg(0) { ; } @@ -234,16 +238,10 @@ scan: goto scan; } - any { std::cerr << "line " << tline << ", column " << (tchar + 1) - << ": unexpected character: "; - if (isprint(*tok)) - { - std::cerr << *tok << std::endl; - } - else - { - std::cerr << "0x" << hexCh(*tok >> 4) << hexCh(*tok) << std::endl; - } + any { std::ostringstream msg; + msg << "unexpected character: "; + prtChOrHex(msg, *tok); + fatal(msg.str().c_str()); goto scan; } */ @@ -309,14 +307,12 @@ value: void Scanner::fatal(uint ofs, const char *msg) const { - std::cerr << "line " << tline << ", column " << (tchar + ofs + 1) << ": " + out.flush(); + std::cerr << "re2c: error: " + << "line " << tline << ", column " << (tchar + ofs + 1) << ": " << msg << std::endl; - exit(1); -} - -void Scanner::fatal(const char *msg) const -{ - fatal(0, msg); + exit(1); } } // end namespace re2c + diff --git a/stream_lc.h b/stream_lc.h index 41ca65b0..37e89d43 100755 --- a/stream_lc.h +++ b/stream_lc.h @@ -165,7 +165,8 @@ protected: } else { - return fputc(_Tr::to_char_type(c), fp) ? c : _Tr::eof(); + buffer += _Tr::to_char_type(c); + return c; } } @@ -210,6 +211,8 @@ protected: virtual int sync() { + fwrite(buffer.c_str(), sizeof(_E), buffer.length(), fp); + buffer.clear(); return fp == 0 || _Tr::eq_int_type(_Tr::eof(), overflow()) || 0 <= fflush(fp) ? 0 : -1; @@ -222,6 +225,8 @@ protected: std::streamsize xsputn(const _E *buf, std::streamsize cnt) { + fwrite(buffer.c_str(), sizeof(_E), buffer.length(), fp); + buffer.clear(); oline += std::count(buf, buf + cnt, '\n'); return fwrite(buf, sizeof(_E), cnt, fp); } @@ -231,6 +236,7 @@ private: FILE * fp; bool must_close; uint oline; + std::basic_string<_E, _Tr> buffer; }; typedef basic_filebuf_lc filebuf_lc; diff --git a/test/error1.c b/test/error1.c index 145d8fd3..96ce7cac 100755 --- a/test/error1.c +++ b/test/error1.c @@ -1,4 +1,3 @@ -line 18, column 5: illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers /* Generated by re2c */ #line 1 "error1.re" #include @@ -15,3 +14,4 @@ const char *q; #define YYLIMIT (s+l) #define YYMARKER q #define YYFILL(n) +re2c: error: line 18, column 5: illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers diff --git a/test/error10.c b/test/error10.c index 3f841c40..566b3824 100755 --- a/test/error10.c +++ b/test/error10.c @@ -1,3 +1,3 @@ -line 2, column 6: Illegal unicode character, eight hexadecimal digits are required /* Generated by re2c */ #line 1 "error10.re" +re2c: error: line 2, column 6: Illegal unicode character, eight hexadecimal digits are required diff --git a/test/error11.c b/test/error11.c index 1b6154a1..a9b7ad0d 100755 --- a/test/error11.c +++ b/test/error11.c @@ -1,3 +1,3 @@ -line 2, column 9: Illegal unicode character, non hexadecimal digit found /* Generated by re2c */ #line 1 "error11.re" +re2c: error: line 2, column 9: Illegal unicode character, non hexadecimal digit found diff --git a/test/error2.c b/test/error2.c index 8ea7e6a2..b9340ae3 100755 --- a/test/error2.c +++ b/test/error2.c @@ -1,4 +1,3 @@ -line 18, column 5: illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers /* Generated by re2c */ #line 1 "error2.re" #include @@ -15,3 +14,4 @@ const char *q; #define YYLIMIT (s+l) #define YYMARKER q #define YYFILL(n) +re2c: error: line 18, column 5: illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers diff --git a/test/error3.c b/test/error3.c index 2369521d..ccd05205 100755 --- a/test/error3.c +++ b/test/error3.c @@ -1,4 +1,3 @@ -line 18, column 5: unexpected character: ] /* Generated by re2c */ #line 1 "error3.re" #include @@ -15,28 +14,4 @@ const char *q; #define YYLIMIT (s+l) #define YYMARKER q #define YYFILL(n) - -#line 19 "" -{ - YYCTYPE yych; - - if(YYLIMIT == YYCURSOR) YYFILL(1); - yych = *YYCURSOR; - switch(yych){ - case 'a': goto yy2; - default: goto yy4; - } -yy2: - ++YYCURSOR; -#line 18 "error3.re" - {RET(1);} -#line 33 "" -yy4: - ++YYCURSOR; -#line 19 "error3.re" - {RET(0);} -#line 38 "" -} -#line 20 "error3.re" - -} +re2c: error: line 18, column 5: unexpected character: ']' diff --git a/test/error4.c b/test/error4.c index b9c46b86..4b8eed83 100755 --- a/test/error4.c +++ b/test/error4.c @@ -1,3 +1,3 @@ -line 2, column 5: Illegal hexadecimal character code, two hexadecimal digits are required /* Generated by re2c */ #line 1 "error4.re" +re2c: error: line 2, column 5: Illegal hexadecimal character code, two hexadecimal digits are required diff --git a/test/error5.c b/test/error5.c index 6bcdc5a0..c90b4b9f 100755 --- a/test/error5.c +++ b/test/error5.c @@ -1,3 +1,3 @@ -line 2, column 5: Illegal hexadecimal character code /* Generated by re2c */ #line 1 "error5.re" +re2c: error: line 2, column 5: Illegal hexadecimal character code diff --git a/test/error6.c b/test/error6.c index 943d1a40..720d8a66 100755 --- a/test/error6.c +++ b/test/error6.c @@ -1,3 +1,3 @@ -line 2, column 7: Illegal hexadecimal character code, four hexadecimal digits are required /* Generated by re2c */ #line 1 "error6.re" +re2c: error: line 2, column 7: Illegal hexadecimal character code, four hexadecimal digits are required diff --git a/test/error7.c b/test/error7.c index 6456b1f8..b5e89b89 100755 --- a/test/error7.c +++ b/test/error7.c @@ -1,3 +1,3 @@ -line 2, column 3: Illegal octal character code, first digit must be 0 thru 3 /* Generated by re2c */ #line 1 "error7.re" +re2c: error: line 2, column 3: Illegal octal character code, first digit must be 0 thru 3 diff --git a/test/error8.c b/test/error8.c index f676fcda..653f07fc 100755 --- a/test/error8.c +++ b/test/error8.c @@ -1,3 +1,3 @@ -line 2, column 4: Illegal octal character code, non octal digit found /* Generated by re2c */ #line 1 "error8.re" +re2c: error: line 2, column 4: Illegal octal character code, non octal digit found diff --git a/test/error9.c b/test/error9.c index 1bbcc908..7fc51063 100755 --- a/test/error9.c +++ b/test/error9.c @@ -1,3 +1,3 @@ -line 2, column 5: Illegal octal character code, non octal digit found /* Generated by re2c */ #line 1 "error9.re" +re2c: error: line 2, column 5: Illegal octal character code, non octal digit found