From ceafc79c5ce90e97832bbfa61a8ec63f7715bc7d Mon Sep 17 00:00:00 2001 From: Ulya Trofimovich Date: Mon, 27 Jul 2015 09:00:33 +0100 Subject: [PATCH] Added warinigs: -W, -Werror. -W: enable all warnings -Werror: turn all enabled (hereafter) warnings into errors Specific warnings added by this commit: -Wempty-character-class -Wempty-rule -Wnaked-default For each warning there are -Wno-, -Werror-, -Wno-error- options. --- re2c/Makefile.am | 2 + re2c/bootstrap/src/conf/parse_opts.cc | 1314 ++++++++++++++----------- re2c/src/codegen/prepare_dfa.cc | 25 + re2c/src/conf/msg.cc | 16 +- re2c/src/conf/msg.h | 1 + re2c/src/conf/opt.cc | 6 +- re2c/src/conf/parse_opts.re | 42 +- re2c/src/conf/warn.cc | 106 ++ re2c/src/conf/warn.h | 53 + re2c/src/globals.h | 3 + re2c/src/ir/regexp/regexp.cc | 2 + re2c/src/main.cc | 2 +- re2c/src/parse/scanner.h | 6 + 13 files changed, 998 insertions(+), 580 deletions(-) create mode 100644 re2c/src/conf/warn.cc create mode 100644 re2c/src/conf/warn.h diff --git a/re2c/Makefile.am b/re2c/Makefile.am index 510eb8ca..9fed2b61 100644 --- a/re2c/Makefile.am +++ b/re2c/Makefile.am @@ -24,6 +24,7 @@ SRC_HDR = \ src/codegen/skeleton/skeleton.h \ src/conf/msg.h \ src/conf/opt.h \ + src/conf/warn.h \ src/ir/bytecode/charset.h \ src/ir/bytecode/bytecode.h \ src/ir/bytecode/ins.h \ @@ -86,6 +87,7 @@ SRC = \ src/codegen/skeleton/skeleton.cc \ src/conf/msg.cc \ src/conf/opt.cc \ + src/conf/warn.cc \ src/ir/bytecode/bytecode.cc \ src/ir/bytecode/ins.cc \ src/ir/bytecode/charset.cc \ diff --git a/re2c/bootstrap/src/conf/parse_opts.cc b/re2c/bootstrap/src/conf/parse_opts.cc index 8c7612f7..b4817421 100644 --- a/re2c/bootstrap/src/conf/parse_opts.cc +++ b/re2c/bootstrap/src/conf/parse_opts.cc @@ -1,4 +1,4 @@ -/* Generated by re2c 0.14.3 on Tue Jul 21 13:43:41 2015 */ +/* Generated by re2c 0.14.3 on Sun Jul 26 14:45:34 2015 */ #include #include "src/conf/msg.h" @@ -18,6 +18,7 @@ parse_opts_t parse_opts (int argc, char ** argv, Opt & opts) #define YYCTYPE char YYCTYPE * YYCURSOR; YYCTYPE * YYMARKER; + Warn::option_t option; @@ -30,6 +31,7 @@ opt: { YYCTYPE yych; + unsigned int yyaccept = 0; static const unsigned char yybm[] = { 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, @@ -71,26 +73,43 @@ opt: goto yy4; yy2: ++YYCURSOR; +yy3: { - error ("bad option: %s\n", *argv); + error ("bad option: %s", *argv); return EXIT_FAIL; } yy4: + yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); - goto yy14; + goto yy39; yy5: ++YYCURSOR; - if ((yych = *YYCURSOR) <= 0x00) goto yy9; - if (yych == '-') goto yy7; + if ((yych = *YYCURSOR) <= '-') { + if (yych <= 0x00) goto yy11; + if (yych >= '-') goto yy9; + } else { + if (yych == 'W') goto yy7; + } { goto opt_short; } yy7: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 'e') { + if (yych <= 0x00) goto yy15; + if (yych >= 'e') goto yy17; + } else { + if (yych == 'n') goto yy19; + } +yy8: + { option = Warn::W; goto opt_warn; } +yy9: ++YYCURSOR; - if ((yych = *YYCURSOR) <= 0x00) goto yy11; + if ((yych = *YYCURSOR) <= 0x00) goto yy13; { goto opt_long; } -yy9: +yy11: ++YYCURSOR; { if (!opts.source ("")) return EXIT_FAIL; goto opt; } -yy11: +yy13: ++YYCURSOR; { // all remaining arguments are non-options @@ -105,18 +124,185 @@ yy11: } goto end; } -yy13: +yy15: + ++YYCURSOR; + { warn.set_all (Warn::W); goto opt; } +yy17: + yych = *++YYCURSOR; + if (yych == 'r') goto yy30; +yy18: + YYCURSOR = YYMARKER; + if (yyaccept <= 1) { + if (yyaccept == 0) { + goto yy3; + } else { + goto yy8; + } + } else { + goto yy22; + } +yy19: + yych = *++YYCURSOR; + if (yych != 'o') goto yy18; + yych = *++YYCURSOR; + if (yych != '-') goto yy18; + yyaccept = 2; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'e') goto yy23; +yy22: + { option = Warn::WNO; goto opt_warn; } +yy23: + yych = *++YYCURSOR; + if (yych != 'r') goto yy18; + yych = *++YYCURSOR; + if (yych != 'r') goto yy18; + yych = *++YYCURSOR; + if (yych != 'o') goto yy18; + yych = *++YYCURSOR; + if (yych != 'r') goto yy18; + yych = *++YYCURSOR; + if (yych != '-') goto yy18; + ++YYCURSOR; + { option = Warn::WNOERROR; goto opt_warn; } +yy30: + yych = *++YYCURSOR; + if (yych != 'r') goto yy18; + yych = *++YYCURSOR; + if (yych != 'o') goto yy18; + yych = *++YYCURSOR; + if (yych != 'r') goto yy18; + yych = *++YYCURSOR; + if (yych <= 0x00) goto yy36; + if (yych != '-') goto yy18; + ++YYCURSOR; + { option = Warn::WERROR; goto opt_warn; } +yy36: + ++YYCURSOR; + { warn.set_all (Warn::WERROR); goto opt; } +yy38: ++YYCURSOR; yych = *YYCURSOR; -yy14: +yy39: if (yybm[0+yych] & 128) { - goto yy13; + goto yy38; } ++YYCURSOR; { if (!opts.source (*argv)) return EXIT_FAIL; goto opt; } } +opt_warn: + +{ + YYCTYPE yych; + yych = *YYCURSOR; + if (yych == 'e') goto yy46; + if (yych == 'n') goto yy47; + ++YYCURSOR; +yy45: + { + error ("bad warning: %s", *argv); + return EXIT_FAIL; + } +yy46: + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'm') goto yy63; + goto yy45; +yy47: + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'a') goto yy45; + yych = *++YYCURSOR; + if (yych == 'k') goto yy50; +yy49: + YYCURSOR = YYMARKER; + goto yy45; +yy50: + yych = *++YYCURSOR; + if (yych != 'e') goto yy49; + yych = *++YYCURSOR; + if (yych != 'd') goto yy49; + yych = *++YYCURSOR; + if (yych != '-') goto yy49; + yych = *++YYCURSOR; + if (yych != 'd') goto yy49; + yych = *++YYCURSOR; + if (yych != 'e') goto yy49; + yych = *++YYCURSOR; + if (yych != 'f') goto yy49; + yych = *++YYCURSOR; + if (yych != 'a') goto yy49; + yych = *++YYCURSOR; + if (yych != 'u') goto yy49; + yych = *++YYCURSOR; + if (yych != 'l') goto yy49; + yych = *++YYCURSOR; + if (yych != 't') goto yy49; + yych = *++YYCURSOR; + if (yych >= 0x01) goto yy49; + ++YYCURSOR; + { warn.set (Warn::NAKED_DEFAULT, option); goto opt; } +yy63: + yych = *++YYCURSOR; + if (yych != 'p') goto yy49; + yych = *++YYCURSOR; + if (yych != 't') goto yy49; + yych = *++YYCURSOR; + if (yych != 'y') goto yy49; + yych = *++YYCURSOR; + if (yych != '-') goto yy49; + yych = *++YYCURSOR; + if (yych == 'c') goto yy68; + if (yych == 'r') goto yy69; + goto yy49; +yy68: + yych = *++YYCURSOR; + if (yych == 'h') goto yy75; + goto yy49; +yy69: + yych = *++YYCURSOR; + if (yych != 'u') goto yy49; + yych = *++YYCURSOR; + if (yych != 'l') goto yy49; + yych = *++YYCURSOR; + if (yych != 'e') goto yy49; + yych = *++YYCURSOR; + if (yych >= 0x01) goto yy49; + ++YYCURSOR; + { warn.set (Warn::EMPTY_RULE, option); goto opt; } +yy75: + yych = *++YYCURSOR; + if (yych != 'a') goto yy49; + yych = *++YYCURSOR; + if (yych != 'r') goto yy49; + yych = *++YYCURSOR; + if (yych != 'a') goto yy49; + yych = *++YYCURSOR; + if (yych != 'c') goto yy49; + yych = *++YYCURSOR; + if (yych != 't') goto yy49; + yych = *++YYCURSOR; + if (yych != 'e') goto yy49; + yych = *++YYCURSOR; + if (yych != 'r') goto yy49; + yych = *++YYCURSOR; + if (yych != '-') goto yy49; + yych = *++YYCURSOR; + if (yych != 'c') goto yy49; + yych = *++YYCURSOR; + if (yych != 'l') goto yy49; + yych = *++YYCURSOR; + if (yych != 'a') goto yy49; + yych = *++YYCURSOR; + if (yych != 's') goto yy49; + yych = *++YYCURSOR; + if (yych != 's') goto yy49; + yych = *++YYCURSOR; + if (yych >= 0x01) goto yy49; + ++YYCURSOR; + { warn.set (Warn::EMPTY_CHARACTER_CLASS, option); goto opt; } +} + + opt_short: { @@ -125,135 +311,135 @@ opt_short: if (yych <= 'c') { if (yych <= 'C') { if (yych <= '7') { - if (yych <= 0x00) goto yy19; - if (yych == '1') goto yy23; - goto yy21; + if (yych <= 0x00) goto yy93; + if (yych == '1') goto yy97; + goto yy95; } else { - if (yych <= '8') goto yy25; - if (yych == '?') goto yy27; - goto yy21; + if (yych <= '8') goto yy99; + if (yych == '?') goto yy101; + goto yy95; } } else { if (yych <= 'U') { - if (yych <= 'D') goto yy29; - if (yych == 'F') goto yy31; - goto yy21; + if (yych <= 'D') goto yy103; + if (yych == 'F') goto yy105; + goto yy95; } else { - if (yych <= 'V') goto yy33; - if (yych <= 'a') goto yy21; - if (yych <= 'b') goto yy35; - goto yy37; + if (yych <= 'V') goto yy107; + if (yych <= 'a') goto yy95; + if (yych <= 'b') goto yy109; + goto yy111; } } } else { if (yych <= 'o') { if (yych <= 'g') { - if (yych <= 'd') goto yy39; - if (yych <= 'e') goto yy41; - if (yych <= 'f') goto yy43; - goto yy45; + if (yych <= 'd') goto yy113; + if (yych <= 'e') goto yy115; + if (yych <= 'f') goto yy117; + goto yy119; } else { - if (yych <= 'h') goto yy27; - if (yych <= 'i') goto yy47; - if (yych <= 'n') goto yy21; - goto yy49; + if (yych <= 'h') goto yy101; + if (yych <= 'i') goto yy121; + if (yych <= 'n') goto yy95; + goto yy123; } } else { if (yych <= 't') { - if (yych <= 'q') goto yy21; - if (yych <= 'r') goto yy51; - if (yych <= 's') goto yy53; - goto yy55; + if (yych <= 'q') goto yy95; + if (yych <= 'r') goto yy125; + if (yych <= 's') goto yy127; + goto yy129; } else { if (yych <= 'v') { - if (yych <= 'u') goto yy57; - goto yy59; + if (yych <= 'u') goto yy131; + goto yy133; } else { - if (yych <= 'w') goto yy61; - if (yych <= 'x') goto yy63; - goto yy21; + if (yych <= 'w') goto yy135; + if (yych <= 'x') goto yy137; + goto yy95; } } } } -yy19: +yy93: ++YYCURSOR; { goto opt; } -yy21: +yy95: ++YYCURSOR; { - error ("bad short option: %s\n", *argv); + error ("bad short option: %s", *argv); return EXIT_FAIL; } -yy23: +yy97: ++YYCURSOR; { goto opt_short; } -yy25: +yy99: ++YYCURSOR; { if (!opts.utf_8 ()) { error_encoding (); return EXIT_FAIL; } goto opt_short; } -yy27: +yy101: ++YYCURSOR; { usage (); return EXIT_OK; } -yy29: +yy103: ++YYCURSOR; { opts.emit_dot (); goto opt_short; } -yy31: +yy105: ++YYCURSOR; { opts.flex_syntax (); goto opt_short; } -yy33: +yy107: ++YYCURSOR; { vernum (); return EXIT_OK; } -yy35: +yy109: ++YYCURSOR; { opts.bit_vectors (); goto opt_short; } -yy37: +yy111: ++YYCURSOR; { opts.start_conditions (); goto opt_short; } -yy39: +yy113: ++YYCURSOR; { opts.debug_output (); goto opt_short; } -yy41: +yy115: ++YYCURSOR; { if (!opts.ecb ()) { error_encoding (); return EXIT_FAIL; } goto opt_short; } -yy43: +yy117: ++YYCURSOR; { opts.storable_state (); goto opt_short; } -yy45: +yy119: ++YYCURSOR; { opts.computed_gotos (); goto opt_short; } -yy47: +yy121: ++YYCURSOR; { opts.no_debug_info (); goto opt_short; } -yy49: +yy123: ++YYCURSOR; - if ((yych = *YYCURSOR) <= 0x00) goto yy67; + if ((yych = *YYCURSOR) <= 0x00) goto yy141; { *argv = YYCURSOR; goto opt_output; } -yy51: +yy125: ++YYCURSOR; { opts.reusable (); goto opt_short; } -yy53: +yy127: ++YYCURSOR; { opts.nested_ifs (); goto opt_short; } -yy55: +yy129: ++YYCURSOR; - if ((yych = *YYCURSOR) <= 0x00) goto yy65; + if ((yych = *YYCURSOR) <= 0x00) goto yy139; { *argv = YYCURSOR; goto opt_header; } -yy57: +yy131: ++YYCURSOR; { if (!opts.unicode ()) { error_encoding (); return EXIT_FAIL; } goto opt_short; } -yy59: +yy133: ++YYCURSOR; { version (); return EXIT_OK; } -yy61: +yy135: ++YYCURSOR; { if (!opts.wide_chars ()) { error_encoding (); return EXIT_FAIL; } goto opt_short; } -yy63: +yy137: ++YYCURSOR; { if (!opts.utf_16 ()) { error_encoding (); return EXIT_FAIL; } goto opt_short; } -yy65: +yy139: ++YYCURSOR; { YYCURSOR = *++argv; goto opt_header; } -yy67: +yy141: ++YYCURSOR; { YYCURSOR = *++argv; goto opt_output; } } @@ -265,699 +451,699 @@ opt_long: YYCTYPE yych; yych = *YYCURSOR; switch (yych) { - case 'b': goto yy73; - case 'c': goto yy74; - case 'd': goto yy75; - case 'e': goto yy76; - case 'f': goto yy77; - case 'h': goto yy78; - case 'i': goto yy79; - case 'n': goto yy80; - case 'o': goto yy81; - case 'r': goto yy82; - case 's': goto yy83; - case 't': goto yy84; - case 'u': goto yy85; - case 'v': goto yy86; - case 'w': goto yy87; - default: goto yy71; + case 'b': goto yy147; + case 'c': goto yy148; + case 'd': goto yy149; + case 'e': goto yy150; + case 'f': goto yy151; + case 'h': goto yy152; + case 'i': goto yy153; + case 'n': goto yy154; + case 'o': goto yy155; + case 'r': goto yy156; + case 's': goto yy157; + case 't': goto yy158; + case 'u': goto yy159; + case 'v': goto yy160; + case 'w': goto yy161; + default: goto yy145; } -yy71: +yy145: ++YYCURSOR; -yy72: +yy146: { - error ("bad long option: %s\n", *argv); + error ("bad long option: %s", *argv); return EXIT_FAIL; } -yy73: +yy147: yych = *(YYMARKER = ++YYCURSOR); - if (yych == 'i') goto yy369; - goto yy72; -yy74: + if (yych == 'i') goto yy443; + goto yy146; +yy148: yych = *(YYMARKER = ++YYCURSOR); - if (yych == 'a') goto yy329; - if (yych == 'o') goto yy330; - goto yy72; -yy75: + if (yych == 'a') goto yy403; + if (yych == 'o') goto yy404; + goto yy146; +yy149: yych = *(YYMARKER = ++YYCURSOR); - if (yych == 'e') goto yy316; - goto yy72; -yy76: + if (yych == 'e') goto yy390; + goto yy146; +yy150: yych = *(YYMARKER = ++YYCURSOR); if (yych <= 'l') { - if (yych == 'c') goto yy278; - goto yy72; + if (yych == 'c') goto yy352; + goto yy146; } else { - if (yych <= 'm') goto yy276; - if (yych <= 'n') goto yy277; - goto yy72; + if (yych <= 'm') goto yy350; + if (yych <= 'n') goto yy351; + goto yy146; } -yy77: +yy151: yych = *(YYMARKER = ++YYCURSOR); - if (yych == 'l') goto yy264; - goto yy72; -yy78: + if (yych == 'l') goto yy338; + goto yy146; +yy152: yych = *(YYMARKER = ++YYCURSOR); - if (yych == 'e') goto yy259; - goto yy72; -yy79: + if (yych == 'e') goto yy333; + goto yy146; +yy153: yych = *(YYMARKER = ++YYCURSOR); - if (yych == 'n') goto yy253; - goto yy72; -yy80: + if (yych == 'n') goto yy327; + goto yy146; +yy154: yych = *(YYMARKER = ++YYCURSOR); - if (yych == 'e') goto yy212; - if (yych == 'o') goto yy211; - goto yy72; -yy81: + if (yych == 'e') goto yy286; + if (yych == 'o') goto yy285; + goto yy146; +yy155: yych = *(YYMARKER = ++YYCURSOR); - if (yych == 'u') goto yy204; - goto yy72; -yy82: + if (yych == 'u') goto yy278; + goto yy146; +yy156: yych = *(YYMARKER = ++YYCURSOR); - if (yych == 'e') goto yy195; - goto yy72; -yy83: + if (yych == 'e') goto yy269; + goto yy146; +yy157: yych = *(YYMARKER = ++YYCURSOR); if (yych <= 'j') { - if (yych == 'i') goto yy143; - goto yy72; + if (yych == 'i') goto yy217; + goto yy146; } else { - if (yych <= 'k') goto yy144; - if (yych == 't') goto yy145; - goto yy72; + if (yych <= 'k') goto yy218; + if (yych == 't') goto yy219; + goto yy146; } -yy84: +yy158: yych = *(YYMARKER = ++YYCURSOR); - if (yych == 'y') goto yy131; - goto yy72; -yy85: + if (yych == 'y') goto yy205; + goto yy146; +yy159: yych = *(YYMARKER = ++YYCURSOR); - if (yych == 'n') goto yy114; - if (yych == 't') goto yy113; - goto yy72; -yy86: + if (yych == 'n') goto yy188; + if (yych == 't') goto yy187; + goto yy146; +yy160: yych = *(YYMARKER = ++YYCURSOR); - if (yych == 'e') goto yy100; - goto yy72; -yy87: + if (yych == 'e') goto yy174; + goto yy146; +yy161: yych = *(YYMARKER = ++YYCURSOR); - if (yych != 'i') goto yy72; + if (yych != 'i') goto yy146; yych = *++YYCURSOR; - if (yych == 'd') goto yy90; -yy89: + if (yych == 'd') goto yy164; +yy163: YYCURSOR = YYMARKER; - goto yy72; -yy90: + goto yy146; +yy164: yych = *++YYCURSOR; - if (yych != 'e') goto yy89; + if (yych != 'e') goto yy163; yych = *++YYCURSOR; - if (yych != '-') goto yy89; + if (yych != '-') goto yy163; yych = *++YYCURSOR; - if (yych != 'c') goto yy89; + if (yych != 'c') goto yy163; yych = *++YYCURSOR; - if (yych != 'h') goto yy89; + if (yych != 'h') goto yy163; yych = *++YYCURSOR; - if (yych != 'a') goto yy89; + if (yych != 'a') goto yy163; yych = *++YYCURSOR; - if (yych != 'r') goto yy89; + if (yych != 'r') goto yy163; yych = *++YYCURSOR; - if (yych != 's') goto yy89; + if (yych != 's') goto yy163; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { if (!opts.wide_chars ()) { error_encoding (); return EXIT_FAIL; } goto opt; } -yy100: +yy174: yych = *++YYCURSOR; - if (yych != 'r') goto yy89; + if (yych != 'r') goto yy163; yych = *++YYCURSOR; - if (yych == 'n') goto yy102; - if (yych == 's') goto yy103; - goto yy89; -yy102: + if (yych == 'n') goto yy176; + if (yych == 's') goto yy177; + goto yy163; +yy176: yych = *++YYCURSOR; - if (yych == 'u') goto yy109; - goto yy89; -yy103: + if (yych == 'u') goto yy183; + goto yy163; +yy177: yych = *++YYCURSOR; - if (yych != 'i') goto yy89; + if (yych != 'i') goto yy163; yych = *++YYCURSOR; - if (yych != 'o') goto yy89; + if (yych != 'o') goto yy163; yych = *++YYCURSOR; - if (yych != 'n') goto yy89; + if (yych != 'n') goto yy163; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { version (); return EXIT_OK; } -yy109: +yy183: yych = *++YYCURSOR; - if (yych != 'm') goto yy89; + if (yych != 'm') goto yy163; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { vernum (); return EXIT_OK; } -yy113: +yy187: yych = *++YYCURSOR; - if (yych == 'f') goto yy122; - goto yy89; -yy114: + if (yych == 'f') goto yy196; + goto yy163; +yy188: yych = *++YYCURSOR; - if (yych != 'i') goto yy89; + if (yych != 'i') goto yy163; yych = *++YYCURSOR; - if (yych != 'c') goto yy89; + if (yych != 'c') goto yy163; yych = *++YYCURSOR; - if (yych != 'o') goto yy89; + if (yych != 'o') goto yy163; yych = *++YYCURSOR; - if (yych != 'd') goto yy89; + if (yych != 'd') goto yy163; yych = *++YYCURSOR; - if (yych != 'e') goto yy89; + if (yych != 'e') goto yy163; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { if (!opts.unicode ()) { error_encoding (); return EXIT_FAIL; } goto opt; } -yy122: +yy196: yych = *++YYCURSOR; - if (yych != '-') goto yy89; + if (yych != '-') goto yy163; yych = *++YYCURSOR; - if (yych == '1') goto yy124; - if (yych == '8') goto yy125; - goto yy89; -yy124: + if (yych == '1') goto yy198; + if (yych == '8') goto yy199; + goto yy163; +yy198: yych = *++YYCURSOR; - if (yych == '6') goto yy128; - goto yy89; -yy125: + if (yych == '6') goto yy202; + goto yy163; +yy199: yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { if (!opts.utf_8 ()) { error_encoding (); return EXIT_FAIL; } goto opt; } -yy128: +yy202: yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { if (!opts.utf_16 ()) { error_encoding (); return EXIT_FAIL; } goto opt; } -yy131: +yy205: yych = *++YYCURSOR; - if (yych != 'p') goto yy89; + if (yych != 'p') goto yy163; yych = *++YYCURSOR; - if (yych != 'e') goto yy89; + if (yych != 'e') goto yy163; yych = *++YYCURSOR; - if (yych != '-') goto yy89; + if (yych != '-') goto yy163; yych = *++YYCURSOR; - if (yych != 'h') goto yy89; + if (yych != 'h') goto yy163; yych = *++YYCURSOR; - if (yych != 'e') goto yy89; + if (yych != 'e') goto yy163; yych = *++YYCURSOR; - if (yych != 'a') goto yy89; + if (yych != 'a') goto yy163; yych = *++YYCURSOR; - if (yych != 'd') goto yy89; + if (yych != 'd') goto yy163; yych = *++YYCURSOR; - if (yych != 'e') goto yy89; + if (yych != 'e') goto yy163; yych = *++YYCURSOR; - if (yych != 'r') goto yy89; + if (yych != 'r') goto yy163; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { YYCURSOR = *++argv; goto opt_header; } -yy143: +yy217: yych = *++YYCURSOR; - if (yych == 'n') goto yy184; - goto yy89; -yy144: + if (yych == 'n') goto yy258; + goto yy163; +yy218: yych = *++YYCURSOR; - if (yych == 'e') goto yy176; - goto yy89; -yy145: + if (yych == 'e') goto yy250; + goto yy163; +yy219: yych = *++YYCURSOR; - if (yych == 'a') goto yy146; - if (yych == 'o') goto yy147; - goto yy89; -yy146: + if (yych == 'a') goto yy220; + if (yych == 'o') goto yy221; + goto yy163; +yy220: yych = *++YYCURSOR; - if (yych == 'r') goto yy161; - goto yy89; -yy147: + if (yych == 'r') goto yy235; + goto yy163; +yy221: yych = *++YYCURSOR; - if (yych != 'r') goto yy89; + if (yych != 'r') goto yy163; yych = *++YYCURSOR; - if (yych != 'a') goto yy89; + if (yych != 'a') goto yy163; yych = *++YYCURSOR; - if (yych != 'b') goto yy89; + if (yych != 'b') goto yy163; yych = *++YYCURSOR; - if (yych != 'l') goto yy89; + if (yych != 'l') goto yy163; yych = *++YYCURSOR; - if (yych != 'e') goto yy89; + if (yych != 'e') goto yy163; yych = *++YYCURSOR; - if (yych != '-') goto yy89; + if (yych != '-') goto yy163; yych = *++YYCURSOR; - if (yych != 's') goto yy89; + if (yych != 's') goto yy163; yych = *++YYCURSOR; - if (yych != 't') goto yy89; + if (yych != 't') goto yy163; yych = *++YYCURSOR; - if (yych != 'a') goto yy89; + if (yych != 'a') goto yy163; yych = *++YYCURSOR; - if (yych != 't') goto yy89; + if (yych != 't') goto yy163; yych = *++YYCURSOR; - if (yych != 'e') goto yy89; + if (yych != 'e') goto yy163; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { opts.storable_state (); goto opt; } -yy161: +yy235: yych = *++YYCURSOR; - if (yych != 't') goto yy89; + if (yych != 't') goto yy163; yych = *++YYCURSOR; - if (yych != '-') goto yy89; + if (yych != '-') goto yy163; yych = *++YYCURSOR; - if (yych != 'c') goto yy89; + if (yych != 'c') goto yy163; yych = *++YYCURSOR; - if (yych != 'o') goto yy89; + if (yych != 'o') goto yy163; yych = *++YYCURSOR; - if (yych != 'n') goto yy89; + if (yych != 'n') goto yy163; yych = *++YYCURSOR; - if (yych != 'd') goto yy89; + if (yych != 'd') goto yy163; yych = *++YYCURSOR; - if (yych != 'i') goto yy89; + if (yych != 'i') goto yy163; yych = *++YYCURSOR; - if (yych != 't') goto yy89; + if (yych != 't') goto yy163; yych = *++YYCURSOR; - if (yych != 'i') goto yy89; + if (yych != 'i') goto yy163; yych = *++YYCURSOR; - if (yych != 'o') goto yy89; + if (yych != 'o') goto yy163; yych = *++YYCURSOR; - if (yych != 'n') goto yy89; + if (yych != 'n') goto yy163; yych = *++YYCURSOR; - if (yych != 's') goto yy89; + if (yych != 's') goto yy163; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { opts.start_conditions (); goto opt; } -yy176: +yy250: yych = *++YYCURSOR; - if (yych != 'l') goto yy89; + if (yych != 'l') goto yy163; yych = *++YYCURSOR; - if (yych != 'e') goto yy89; + if (yych != 'e') goto yy163; yych = *++YYCURSOR; - if (yych != 't') goto yy89; + if (yych != 't') goto yy163; yych = *++YYCURSOR; - if (yych != 'o') goto yy89; + if (yych != 'o') goto yy163; yych = *++YYCURSOR; - if (yych != 'n') goto yy89; + if (yych != 'n') goto yy163; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { opts.skeleton (); goto opt; } -yy184: +yy258: yych = *++YYCURSOR; - if (yych != 'g') goto yy89; + if (yych != 'g') goto yy163; yych = *++YYCURSOR; - if (yych != 'l') goto yy89; + if (yych != 'l') goto yy163; yych = *++YYCURSOR; - if (yych != 'e') goto yy89; + if (yych != 'e') goto yy163; yych = *++YYCURSOR; - if (yych != '-') goto yy89; + if (yych != '-') goto yy163; yych = *++YYCURSOR; - if (yych != 'p') goto yy89; + if (yych != 'p') goto yy163; yych = *++YYCURSOR; - if (yych != 'a') goto yy89; + if (yych != 'a') goto yy163; yych = *++YYCURSOR; - if (yych != 's') goto yy89; + if (yych != 's') goto yy163; yych = *++YYCURSOR; - if (yych != 's') goto yy89; + if (yych != 's') goto yy163; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { goto opt; } -yy195: +yy269: yych = *++YYCURSOR; - if (yych != 'u') goto yy89; + if (yych != 'u') goto yy163; yych = *++YYCURSOR; - if (yych != 's') goto yy89; + if (yych != 's') goto yy163; yych = *++YYCURSOR; - if (yych != 'a') goto yy89; + if (yych != 'a') goto yy163; yych = *++YYCURSOR; - if (yych != 'b') goto yy89; + if (yych != 'b') goto yy163; yych = *++YYCURSOR; - if (yych != 'l') goto yy89; + if (yych != 'l') goto yy163; yych = *++YYCURSOR; - if (yych != 'e') goto yy89; + if (yych != 'e') goto yy163; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { opts.reusable (); goto opt; } -yy204: +yy278: yych = *++YYCURSOR; - if (yych != 't') goto yy89; + if (yych != 't') goto yy163; yych = *++YYCURSOR; - if (yych != 'p') goto yy89; + if (yych != 'p') goto yy163; yych = *++YYCURSOR; - if (yych != 'u') goto yy89; + if (yych != 'u') goto yy163; yych = *++YYCURSOR; - if (yych != 't') goto yy89; + if (yych != 't') goto yy163; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { YYCURSOR = *++argv; goto opt_output; } -yy211: +yy285: yych = *++YYCURSOR; - if (yych == '-') goto yy223; - goto yy89; -yy212: + if (yych == '-') goto yy297; + goto yy163; +yy286: yych = *++YYCURSOR; - if (yych != 's') goto yy89; + if (yych != 's') goto yy163; yych = *++YYCURSOR; - if (yych != 't') goto yy89; + if (yych != 't') goto yy163; yych = *++YYCURSOR; - if (yych != 'e') goto yy89; + if (yych != 'e') goto yy163; yych = *++YYCURSOR; - if (yych != 'd') goto yy89; + if (yych != 'd') goto yy163; yych = *++YYCURSOR; - if (yych != '-') goto yy89; + if (yych != '-') goto yy163; yych = *++YYCURSOR; - if (yych != 'i') goto yy89; + if (yych != 'i') goto yy163; yych = *++YYCURSOR; - if (yych != 'f') goto yy89; + if (yych != 'f') goto yy163; yych = *++YYCURSOR; - if (yych != 's') goto yy89; + if (yych != 's') goto yy163; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { opts.nested_ifs (); goto opt; } -yy223: +yy297: yych = *++YYCURSOR; - if (yych == 'd') goto yy225; - if (yych != 'g') goto yy89; + if (yych == 'd') goto yy299; + if (yych != 'g') goto yy163; yych = *++YYCURSOR; - if (yych == 'e') goto yy237; - goto yy89; -yy225: + if (yych == 'e') goto yy311; + goto yy163; +yy299: yych = *++YYCURSOR; - if (yych != 'e') goto yy89; + if (yych != 'e') goto yy163; yych = *++YYCURSOR; - if (yych != 'b') goto yy89; + if (yych != 'b') goto yy163; yych = *++YYCURSOR; - if (yych != 'u') goto yy89; + if (yych != 'u') goto yy163; yych = *++YYCURSOR; - if (yych != 'g') goto yy89; + if (yych != 'g') goto yy163; yych = *++YYCURSOR; - if (yych != '-') goto yy89; + if (yych != '-') goto yy163; yych = *++YYCURSOR; - if (yych != 'i') goto yy89; + if (yych != 'i') goto yy163; yych = *++YYCURSOR; - if (yych != 'n') goto yy89; + if (yych != 'n') goto yy163; yych = *++YYCURSOR; - if (yych != 'f') goto yy89; + if (yych != 'f') goto yy163; yych = *++YYCURSOR; - if (yych != 'o') goto yy89; + if (yych != 'o') goto yy163; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { opts.no_debug_info (); goto opt; } -yy237: +yy311: yych = *++YYCURSOR; - if (yych != 'n') goto yy89; + if (yych != 'n') goto yy163; yych = *++YYCURSOR; - if (yych != 'e') goto yy89; + if (yych != 'e') goto yy163; yych = *++YYCURSOR; - if (yych != 'r') goto yy89; + if (yych != 'r') goto yy163; yych = *++YYCURSOR; - if (yych != 'a') goto yy89; + if (yych != 'a') goto yy163; yych = *++YYCURSOR; - if (yych != 't') goto yy89; + if (yych != 't') goto yy163; yych = *++YYCURSOR; - if (yych != 'i') goto yy89; + if (yych != 'i') goto yy163; yych = *++YYCURSOR; - if (yych != 'o') goto yy89; + if (yych != 'o') goto yy163; yych = *++YYCURSOR; - if (yych != 'n') goto yy89; + if (yych != 'n') goto yy163; yych = *++YYCURSOR; - if (yych != '-') goto yy89; + if (yych != '-') goto yy163; yych = *++YYCURSOR; - if (yych != 'd') goto yy89; + if (yych != 'd') goto yy163; yych = *++YYCURSOR; - if (yych != 'a') goto yy89; + if (yych != 'a') goto yy163; yych = *++YYCURSOR; - if (yych != 't') goto yy89; + if (yych != 't') goto yy163; yych = *++YYCURSOR; - if (yych != 'e') goto yy89; + if (yych != 'e') goto yy163; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { opts.no_generation_date (); goto opt; } -yy253: +yy327: yych = *++YYCURSOR; - if (yych != 'p') goto yy89; + if (yych != 'p') goto yy163; yych = *++YYCURSOR; - if (yych != 'u') goto yy89; + if (yych != 'u') goto yy163; yych = *++YYCURSOR; - if (yych != 't') goto yy89; + if (yych != 't') goto yy163; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { goto opt_input; } -yy259: +yy333: yych = *++YYCURSOR; - if (yych != 'l') goto yy89; + if (yych != 'l') goto yy163; yych = *++YYCURSOR; - if (yych != 'p') goto yy89; + if (yych != 'p') goto yy163; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { usage (); return EXIT_OK; } -yy264: +yy338: yych = *++YYCURSOR; - if (yych != 'e') goto yy89; + if (yych != 'e') goto yy163; yych = *++YYCURSOR; - if (yych != 'x') goto yy89; + if (yych != 'x') goto yy163; yych = *++YYCURSOR; - if (yych != '-') goto yy89; + if (yych != '-') goto yy163; yych = *++YYCURSOR; - if (yych != 's') goto yy89; + if (yych != 's') goto yy163; yych = *++YYCURSOR; - if (yych != 'y') goto yy89; + if (yych != 'y') goto yy163; yych = *++YYCURSOR; - if (yych != 'n') goto yy89; + if (yych != 'n') goto yy163; yych = *++YYCURSOR; - if (yych != 't') goto yy89; + if (yych != 't') goto yy163; yych = *++YYCURSOR; - if (yych != 'a') goto yy89; + if (yych != 'a') goto yy163; yych = *++YYCURSOR; - if (yych != 'x') goto yy89; + if (yych != 'x') goto yy163; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { opts.flex_syntax (); goto opt; } -yy276: +yy350: yych = *++YYCURSOR; - if (yych == 'i') goto yy297; - if (yych == 'p') goto yy298; - goto yy89; -yy277: + if (yych == 'i') goto yy371; + if (yych == 'p') goto yy372; + goto yy163; +yy351: yych = *++YYCURSOR; - if (yych == 'c') goto yy282; - goto yy89; -yy278: + if (yych == 'c') goto yy356; + goto yy163; +yy352: yych = *++YYCURSOR; - if (yych != 'b') goto yy89; + if (yych != 'b') goto yy163; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { if (!opts.ecb ()) { error_encoding (); return EXIT_FAIL; } goto opt; } -yy282: +yy356: yych = *++YYCURSOR; - if (yych != 'o') goto yy89; + if (yych != 'o') goto yy163; yych = *++YYCURSOR; - if (yych != 'd') goto yy89; + if (yych != 'd') goto yy163; yych = *++YYCURSOR; - if (yych != 'i') goto yy89; + if (yych != 'i') goto yy163; yych = *++YYCURSOR; - if (yych != 'n') goto yy89; + if (yych != 'n') goto yy163; yych = *++YYCURSOR; - if (yych != 'g') goto yy89; + if (yych != 'g') goto yy163; yych = *++YYCURSOR; - if (yych != '-') goto yy89; + if (yych != '-') goto yy163; yych = *++YYCURSOR; - if (yych != 'p') goto yy89; + if (yych != 'p') goto yy163; yych = *++YYCURSOR; - if (yych != 'o') goto yy89; + if (yych != 'o') goto yy163; yych = *++YYCURSOR; - if (yych != 'l') goto yy89; + if (yych != 'l') goto yy163; yych = *++YYCURSOR; - if (yych != 'i') goto yy89; + if (yych != 'i') goto yy163; yych = *++YYCURSOR; - if (yych != 'c') goto yy89; + if (yych != 'c') goto yy163; yych = *++YYCURSOR; - if (yych != 'y') goto yy89; + if (yych != 'y') goto yy163; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { goto opt_encoding_policy; } -yy297: +yy371: yych = *++YYCURSOR; - if (yych == 't') goto yy309; - goto yy89; -yy298: + if (yych == 't') goto yy383; + goto yy163; +yy372: yych = *++YYCURSOR; - if (yych != 't') goto yy89; + if (yych != 't') goto yy163; yych = *++YYCURSOR; - if (yych != 'y') goto yy89; + if (yych != 'y') goto yy163; yych = *++YYCURSOR; - if (yych != '-') goto yy89; + if (yych != '-') goto yy163; yych = *++YYCURSOR; - if (yych != 'c') goto yy89; + if (yych != 'c') goto yy163; yych = *++YYCURSOR; - if (yych != 'l') goto yy89; + if (yych != 'l') goto yy163; yych = *++YYCURSOR; - if (yych != 'a') goto yy89; + if (yych != 'a') goto yy163; yych = *++YYCURSOR; - if (yych != 's') goto yy89; + if (yych != 's') goto yy163; yych = *++YYCURSOR; - if (yych != 's') goto yy89; + if (yych != 's') goto yy163; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { goto opt_empty_class; } -yy309: +yy383: yych = *++YYCURSOR; - if (yych != '-') goto yy89; + if (yych != '-') goto yy163; yych = *++YYCURSOR; - if (yych != 'd') goto yy89; + if (yych != 'd') goto yy163; yych = *++YYCURSOR; - if (yych != 'o') goto yy89; + if (yych != 'o') goto yy163; yych = *++YYCURSOR; - if (yych != 't') goto yy89; + if (yych != 't') goto yy163; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { opts.emit_dot (); goto opt; } -yy316: +yy390: yych = *++YYCURSOR; - if (yych != 'b') goto yy89; + if (yych != 'b') goto yy163; yych = *++YYCURSOR; - if (yych != 'u') goto yy89; + if (yych != 'u') goto yy163; yych = *++YYCURSOR; - if (yych != 'g') goto yy89; + if (yych != 'g') goto yy163; yych = *++YYCURSOR; - if (yych != '-') goto yy89; + if (yych != '-') goto yy163; yych = *++YYCURSOR; - if (yych != 'o') goto yy89; + if (yych != 'o') goto yy163; yych = *++YYCURSOR; - if (yych != 'u') goto yy89; + if (yych != 'u') goto yy163; yych = *++YYCURSOR; - if (yych != 't') goto yy89; + if (yych != 't') goto yy163; yych = *++YYCURSOR; - if (yych != 'p') goto yy89; + if (yych != 'p') goto yy163; yych = *++YYCURSOR; - if (yych != 'u') goto yy89; + if (yych != 'u') goto yy163; yych = *++YYCURSOR; - if (yych != 't') goto yy89; + if (yych != 't') goto yy163; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { opts.debug_output (); goto opt; } -yy329: +yy403: yych = *++YYCURSOR; - if (yych == 's') goto yy345; - goto yy89; -yy330: + if (yych == 's') goto yy419; + goto yy163; +yy404: yych = *++YYCURSOR; - if (yych != 'm') goto yy89; + if (yych != 'm') goto yy163; yych = *++YYCURSOR; - if (yych != 'p') goto yy89; + if (yych != 'p') goto yy163; yych = *++YYCURSOR; - if (yych != 'u') goto yy89; + if (yych != 'u') goto yy163; yych = *++YYCURSOR; - if (yych != 't') goto yy89; + if (yych != 't') goto yy163; yych = *++YYCURSOR; - if (yych != 'e') goto yy89; + if (yych != 'e') goto yy163; yych = *++YYCURSOR; - if (yych != 'd') goto yy89; + if (yych != 'd') goto yy163; yych = *++YYCURSOR; - if (yych != '-') goto yy89; + if (yych != '-') goto yy163; yych = *++YYCURSOR; - if (yych != 'g') goto yy89; + if (yych != 'g') goto yy163; yych = *++YYCURSOR; - if (yych != 'o') goto yy89; + if (yych != 'o') goto yy163; yych = *++YYCURSOR; - if (yych != 't') goto yy89; + if (yych != 't') goto yy163; yych = *++YYCURSOR; - if (yych != 'o') goto yy89; + if (yych != 'o') goto yy163; yych = *++YYCURSOR; - if (yych != 's') goto yy89; + if (yych != 's') goto yy163; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { opts.computed_gotos (); goto opt; } -yy345: +yy419: yych = *++YYCURSOR; - if (yych != 'e') goto yy89; + if (yych != 'e') goto yy163; yych = *++YYCURSOR; - if (yych != '-') goto yy89; + if (yych != '-') goto yy163; yych = *++YYCURSOR; - if (yych != 'i') goto yy89; + if (yych != 'i') goto yy163; yych = *++YYCURSOR; - if (yych != 'n') goto yy89; + if (yych != 'n') goto yy163; yych = *++YYCURSOR; - if (yych == 's') goto yy351; - if (yych != 'v') goto yy89; + if (yych == 's') goto yy425; + if (yych != 'v') goto yy163; yych = *++YYCURSOR; - if (yych == 'e') goto yy362; - goto yy89; -yy351: + if (yych == 'e') goto yy436; + goto yy163; +yy425: yych = *++YYCURSOR; - if (yych != 'e') goto yy89; + if (yych != 'e') goto yy163; yych = *++YYCURSOR; - if (yych != 'n') goto yy89; + if (yych != 'n') goto yy163; yych = *++YYCURSOR; - if (yych != 's') goto yy89; + if (yych != 's') goto yy163; yych = *++YYCURSOR; - if (yych != 'i') goto yy89; + if (yych != 'i') goto yy163; yych = *++YYCURSOR; - if (yych != 't') goto yy89; + if (yych != 't') goto yy163; yych = *++YYCURSOR; - if (yych != 'i') goto yy89; + if (yych != 'i') goto yy163; yych = *++YYCURSOR; - if (yych != 'v') goto yy89; + if (yych != 'v') goto yy163; yych = *++YYCURSOR; - if (yych != 'e') goto yy89; + if (yych != 'e') goto yy163; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { opts.case_insensitive (); goto opt; } -yy362: +yy436: yych = *++YYCURSOR; - if (yych != 'r') goto yy89; + if (yych != 'r') goto yy163; yych = *++YYCURSOR; - if (yych != 't') goto yy89; + if (yych != 't') goto yy163; yych = *++YYCURSOR; - if (yych != 'e') goto yy89; + if (yych != 'e') goto yy163; yych = *++YYCURSOR; - if (yych != 'd') goto yy89; + if (yych != 'd') goto yy163; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { opts.case_inverted (); goto opt; } -yy369: +yy443: yych = *++YYCURSOR; - if (yych != 't') goto yy89; + if (yych != 't') goto yy163; yych = *++YYCURSOR; - if (yych != '-') goto yy89; + if (yych != '-') goto yy163; yych = *++YYCURSOR; - if (yych != 'v') goto yy89; + if (yych != 'v') goto yy163; yych = *++YYCURSOR; - if (yych != 'e') goto yy89; + if (yych != 'e') goto yy163; yych = *++YYCURSOR; - if (yych != 'c') goto yy89; + if (yych != 'c') goto yy163; yych = *++YYCURSOR; - if (yych != 't') goto yy89; + if (yych != 't') goto yy163; yych = *++YYCURSOR; - if (yych != 'o') goto yy89; + if (yych != 'o') goto yy163; yych = *++YYCURSOR; - if (yych != 'r') goto yy89; + if (yych != 'r') goto yy163; yych = *++YYCURSOR; - if (yych != 's') goto yy89; + if (yych != 's') goto yy163; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy89; + if (yych >= 0x01) goto yy163; ++YYCURSOR; { opts.bit_vectors (); goto opt; } } @@ -1002,23 +1188,23 @@ opt_output: 128, 128, 128, 128, 128, 128, 128, 128, }; yych = *YYCURSOR; - if (yych <= 0x00) goto yy383; - if (yych != '-') goto yy385; -yy383: + if (yych <= 0x00) goto yy457; + if (yych != '-') goto yy459; +yy457: ++YYCURSOR; { - error ("bad argument to option -o, --output: %s\n", *argv); + error ("bad argument to option -o, --output: %s", *argv); return EXIT_FAIL; } -yy385: +yy459: yych = *(YYMARKER = ++YYCURSOR); - goto yy387; -yy386: + goto yy461; +yy460: ++YYCURSOR; yych = *YYCURSOR; -yy387: +yy461: if (yybm[0+yych] & 128) { - goto yy386; + goto yy460; } ++YYCURSOR; { if (!opts.output (*argv)) return EXIT_FAIL; goto opt; } @@ -1064,23 +1250,23 @@ opt_header: 128, 128, 128, 128, 128, 128, 128, 128, }; yych = *YYCURSOR; - if (yych <= 0x00) goto yy392; - if (yych != '-') goto yy394; -yy392: + if (yych <= 0x00) goto yy466; + if (yych != '-') goto yy468; +yy466: ++YYCURSOR; { - error ("bad argument to option -t, --type-header: %s\n", *argv); + error ("bad argument to option -t, --type-header: %s", *argv); return EXIT_FAIL; } -yy394: +yy468: yych = *(YYMARKER = ++YYCURSOR); - goto yy396; -yy395: + goto yy470; +yy469: ++YYCURSOR; yych = *YYCURSOR; -yy396: +yy470: if (yybm[0+yych] & 128) { - goto yy395; + goto yy469; } ++YYCURSOR; { if (!opts.type_header (*argv)) return EXIT_FAIL; goto opt; } @@ -1094,72 +1280,72 @@ opt_encoding_policy: YYCTYPE yych; yych = *YYCURSOR; if (yych <= 'h') { - if (yych == 'f') goto yy403; + if (yych == 'f') goto yy477; } else { - if (yych <= 'i') goto yy404; - if (yych == 's') goto yy405; + if (yych <= 'i') goto yy478; + if (yych == 's') goto yy479; } ++YYCURSOR; -yy402: +yy476: { - error ("bad argument to option --encoding-policy (expected: ignore | substitute | fail): %s\n", *argv); + error ("bad argument to option --encoding-policy (expected: ignore | substitute | fail): %s", *argv); return EXIT_FAIL; } -yy403: +yy477: yych = *(YYMARKER = ++YYCURSOR); - if (yych == 'a') goto yy425; - goto yy402; -yy404: + if (yych == 'a') goto yy499; + goto yy476; +yy478: yych = *(YYMARKER = ++YYCURSOR); - if (yych == 'g') goto yy418; - goto yy402; -yy405: + if (yych == 'g') goto yy492; + goto yy476; +yy479: yych = *(YYMARKER = ++YYCURSOR); - if (yych != 'u') goto yy402; + if (yych != 'u') goto yy476; yych = *++YYCURSOR; - if (yych == 'b') goto yy408; -yy407: + if (yych == 'b') goto yy482; +yy481: YYCURSOR = YYMARKER; - goto yy402; -yy408: + goto yy476; +yy482: yych = *++YYCURSOR; - if (yych != 's') goto yy407; + if (yych != 's') goto yy481; yych = *++YYCURSOR; - if (yych != 't') goto yy407; + if (yych != 't') goto yy481; yych = *++YYCURSOR; - if (yych != 'i') goto yy407; + if (yych != 'i') goto yy481; yych = *++YYCURSOR; - if (yych != 't') goto yy407; + if (yych != 't') goto yy481; yych = *++YYCURSOR; - if (yych != 'u') goto yy407; + if (yych != 'u') goto yy481; yych = *++YYCURSOR; - if (yych != 't') goto yy407; + if (yych != 't') goto yy481; yych = *++YYCURSOR; - if (yych != 'e') goto yy407; + if (yych != 'e') goto yy481; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy407; + if (yych >= 0x01) goto yy481; ++YYCURSOR; { opts.encoding_policy (Enc::POLICY_SUBSTITUTE); goto opt; } -yy418: +yy492: yych = *++YYCURSOR; - if (yych != 'n') goto yy407; + if (yych != 'n') goto yy481; yych = *++YYCURSOR; - if (yych != 'o') goto yy407; + if (yych != 'o') goto yy481; yych = *++YYCURSOR; - if (yych != 'r') goto yy407; + if (yych != 'r') goto yy481; yych = *++YYCURSOR; - if (yych != 'e') goto yy407; + if (yych != 'e') goto yy481; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy407; + if (yych >= 0x01) goto yy481; ++YYCURSOR; { opts.encoding_policy (Enc::POLICY_IGNORE); goto opt; } -yy425: +yy499: yych = *++YYCURSOR; - if (yych != 'i') goto yy407; + if (yych != 'i') goto yy481; yych = *++YYCURSOR; - if (yych != 'l') goto yy407; + if (yych != 'l') goto yy481; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy407; + if (yych >= 0x01) goto yy481; ++YYCURSOR; { opts.encoding_policy (Enc::POLICY_FAIL); goto opt; } } @@ -1171,52 +1357,52 @@ opt_input: { YYCTYPE yych; yych = *YYCURSOR; - if (yych <= 'b') goto yy432; - if (yych <= 'c') goto yy434; - if (yych <= 'd') goto yy435; -yy432: + if (yych <= 'b') goto yy506; + if (yych <= 'c') goto yy508; + if (yych <= 'd') goto yy509; +yy506: ++YYCURSOR; -yy433: +yy507: { - error ("bad argument to option --input (expected: default | custom): %s\n", *argv); + error ("bad argument to option --input (expected: default | custom): %s", *argv); return EXIT_FAIL; } -yy434: +yy508: yych = *(YYMARKER = ++YYCURSOR); - if (yych == 'u') goto yy445; - goto yy433; -yy435: + if (yych == 'u') goto yy519; + goto yy507; +yy509: yych = *(YYMARKER = ++YYCURSOR); - if (yych != 'e') goto yy433; + if (yych != 'e') goto yy507; yych = *++YYCURSOR; - if (yych == 'f') goto yy438; -yy437: + if (yych == 'f') goto yy512; +yy511: YYCURSOR = YYMARKER; - goto yy433; -yy438: + goto yy507; +yy512: yych = *++YYCURSOR; - if (yych != 'a') goto yy437; + if (yych != 'a') goto yy511; yych = *++YYCURSOR; - if (yych != 'u') goto yy437; + if (yych != 'u') goto yy511; yych = *++YYCURSOR; - if (yych != 'l') goto yy437; + if (yych != 'l') goto yy511; yych = *++YYCURSOR; - if (yych != 't') goto yy437; + if (yych != 't') goto yy511; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy437; + if (yych >= 0x01) goto yy511; ++YYCURSOR; { opts.input (InputAPI::DEFAULT); goto opt; } -yy445: +yy519: yych = *++YYCURSOR; - if (yych != 's') goto yy437; + if (yych != 's') goto yy511; yych = *++YYCURSOR; - if (yych != 't') goto yy437; + if (yych != 't') goto yy511; yych = *++YYCURSOR; - if (yych != 'o') goto yy437; + if (yych != 'o') goto yy511; yych = *++YYCURSOR; - if (yych != 'm') goto yy437; + if (yych != 'm') goto yy511; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy437; + if (yych >= 0x01) goto yy511; ++YYCURSOR; { opts.input (InputAPI::CUSTOM); goto opt; } } @@ -1228,72 +1414,72 @@ opt_empty_class: { YYCTYPE yych; yych = *YYCURSOR; - if (yych == 'e') goto yy456; - if (yych == 'm') goto yy457; + if (yych == 'e') goto yy530; + if (yych == 'm') goto yy531; ++YYCURSOR; -yy455: +yy529: { - error ("bad argument to option --empty-class (expected: match-empty | match-none | error): %s\n", *argv); + error ("bad argument to option --empty-class (expected: match-empty | match-none | error): %s", *argv); return EXIT_FAIL; } -yy456: +yy530: yych = *(YYMARKER = ++YYCURSOR); - if (yych == 'r') goto yy477; - goto yy455; -yy457: + if (yych == 'r') goto yy551; + goto yy529; +yy531: yych = *(YYMARKER = ++YYCURSOR); - if (yych != 'a') goto yy455; + if (yych != 'a') goto yy529; yych = *++YYCURSOR; - if (yych == 't') goto yy460; -yy459: + if (yych == 't') goto yy534; +yy533: YYCURSOR = YYMARKER; - goto yy455; -yy460: + goto yy529; +yy534: yych = *++YYCURSOR; - if (yych != 'c') goto yy459; + if (yych != 'c') goto yy533; yych = *++YYCURSOR; - if (yych != 'h') goto yy459; + if (yych != 'h') goto yy533; yych = *++YYCURSOR; - if (yych != '-') goto yy459; + if (yych != '-') goto yy533; yych = *++YYCURSOR; - if (yych == 'e') goto yy464; - if (yych == 'n') goto yy465; - goto yy459; -yy464: + if (yych == 'e') goto yy538; + if (yych == 'n') goto yy539; + goto yy533; +yy538: yych = *++YYCURSOR; - if (yych == 'm') goto yy471; - goto yy459; -yy465: + if (yych == 'm') goto yy545; + goto yy533; +yy539: yych = *++YYCURSOR; - if (yych != 'o') goto yy459; + if (yych != 'o') goto yy533; yych = *++YYCURSOR; - if (yych != 'n') goto yy459; + if (yych != 'n') goto yy533; yych = *++YYCURSOR; - if (yych != 'e') goto yy459; + if (yych != 'e') goto yy533; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy459; + if (yych >= 0x01) goto yy533; ++YYCURSOR; { opts.empty_class (EMPTY_CLASS_MATCH_NONE); goto opt; } -yy471: +yy545: yych = *++YYCURSOR; - if (yych != 'p') goto yy459; + if (yych != 'p') goto yy533; yych = *++YYCURSOR; - if (yych != 't') goto yy459; + if (yych != 't') goto yy533; yych = *++YYCURSOR; - if (yych != 'y') goto yy459; + if (yych != 'y') goto yy533; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy459; + if (yych >= 0x01) goto yy533; ++YYCURSOR; { opts.empty_class (EMPTY_CLASS_MATCH_EMPTY); goto opt; } -yy477: +yy551: yych = *++YYCURSOR; - if (yych != 'r') goto yy459; + if (yych != 'r') goto yy533; yych = *++YYCURSOR; - if (yych != 'o') goto yy459; + if (yych != 'o') goto yy533; yych = *++YYCURSOR; - if (yych != 'r') goto yy459; + if (yych != 'r') goto yy533; yych = *++YYCURSOR; - if (yych >= 0x01) goto yy459; + if (yych >= 0x01) goto yy533; ++YYCURSOR; { opts.empty_class (EMPTY_CLASS_ERROR); goto opt; } } @@ -1302,17 +1488,17 @@ yy477: end: if (!opts.source_file) { - error ("no source file\n"); + error ("no source file"); return EXIT_FAIL; } if (!cFlag && opts.header_file) { - error ("can only output a header file when using -c switch\n"); + error ("can only output a header file when using -c switch"); return EXIT_FAIL; } if (DFlag && (bFlag || dFlag || sFlag || flag_skeleton)) { - error ("cannot combine -D with -b, -d, -s or --skeleton switches\n"); + error ("cannot combine -D with -b, -d, -s or --skeleton switches"); return EXIT_FAIL; } diff --git a/re2c/src/codegen/prepare_dfa.cc b/re2c/src/codegen/prepare_dfa.cc index 57640430..a3ad9f10 100644 --- a/re2c/src/codegen/prepare_dfa.cc +++ b/re2c/src/codegen/prepare_dfa.cc @@ -235,6 +235,31 @@ void DFA::prepare(OutputFile & o, uint32_t & max_fill) default_state->action.set_accept (&accepts); } + const bool empty_rule = head->rule; + + std::vector > stray_cunits; + uint32_t lb = 0; + for (uint32_t i = 0; i < head->go.nSpans; ++i) + { + if (!head->go.span[i].to->rule) + { + stray_cunits.push_back (std::make_pair (lb, head->go.span[i].ub)); + } + lb = head->go.span[i].ub; + } + + // warn if default case is not handled + if (default_state && !stray_cunits.empty () && !empty_rule) + { + warn.naked_default (stray_cunits); + } + + // warn about not shadowed empty rule + if (empty_rule && !stray_cunits.empty ()) + { + warn.empty_rule (head->rule->code->line); + } + // split ``base'' states into two parts for (State * s = head; s; s = s->next) { diff --git a/re2c/src/conf/msg.cc b/re2c/src/conf/msg.cc index 9e3af72f..b16e6ff0 100644 --- a/re2c/src/conf/msg.cc +++ b/re2c/src/conf/msg.cc @@ -15,11 +15,25 @@ void error (const char * fmt, ...) va_start (args, fmt); vfprintf (stderr, fmt, args); va_end (args); + + fprintf (stderr, "\n"); } void error_encoding () { - error ("only one of switches -e, -w, -x, -u and -8 must be set\n"); + error ("only one of switches -e, -w, -x, -u and -8 must be set"); +} + +void warning (const char * type, const char * fmt, ...) +{ + fprintf (stderr, "re2c: warning: "); + + va_list args; + va_start (args, fmt); + vfprintf (stderr, fmt, args); + va_end (args); + + fprintf (stderr, " [-W%s]\n", type); } void usage () diff --git a/re2c/src/conf/msg.h b/re2c/src/conf/msg.h index 8a7f3c27..75239545 100644 --- a/re2c/src/conf/msg.h +++ b/re2c/src/conf/msg.h @@ -7,6 +7,7 @@ namespace re2c { void error (const char * fmt, ...) RE2C_GXX_ATTRIBUTE ((format (printf, 1, 2))); void error_encoding (); +void warning (const char * type, const char * fmt, ...) RE2C_GXX_ATTRIBUTE ((format (printf, 2, 3))); void usage (); void vernum (); void version (); diff --git a/re2c/src/conf/opt.cc b/re2c/src/conf/opt.cc index 9773fbf6..bbf19155 100644 --- a/re2c/src/conf/opt.cc +++ b/re2c/src/conf/opt.cc @@ -149,7 +149,7 @@ bool Opt::source (const char * s) { if (source_file) { - error ("multiple source files: %s, %s\n", source_file, s); + error ("multiple source files: %s, %s", source_file, s); return false; } else @@ -163,7 +163,7 @@ bool Opt::output (const char * s) { if (output_file) { - error ("multiple output files: %s, %s\n", output_file, s); + error ("multiple output files: %s, %s", output_file, s); return false; } else @@ -177,7 +177,7 @@ bool Opt::type_header (const char * s) { if (header_file) { - error ("multiple header files: %s, %s\n", header_file, s); + error ("multiple header files: %s, %s", header_file, s); return false; } else diff --git a/re2c/src/conf/parse_opts.re b/re2c/src/conf/parse_opts.re index 087c2721..25865611 100644 --- a/re2c/src/conf/parse_opts.re +++ b/re2c/src/conf/parse_opts.re @@ -17,6 +17,7 @@ parse_opts_t parse_opts (int argc, char ** argv, Opt & opts) #define YYCTYPE char YYCTYPE * YYCURSOR; YYCTYPE * YYMARKER; + Warn::option_t option; /*!re2c re2c:yyfill:enable = 0; @@ -34,7 +35,7 @@ opt: /*!re2c * { - error ("bad option: %s\n", *argv); + error ("bad option: %s", *argv); return EXIT_FAIL; } @@ -58,13 +59,32 @@ opt: "-" { goto opt_short; } "--" { goto opt_long; } + + "-W" end { warn.set_all (Warn::W); goto opt; } + "-Werror" end { warn.set_all (Warn::WERROR); goto opt; } + "-W" { option = Warn::W; goto opt_warn; } + "-Wno-" { option = Warn::WNO; goto opt_warn; } + "-Werror-" { option = Warn::WERROR; goto opt_warn; } + "-Wno-error-" { option = Warn::WNOERROR; goto opt_warn; } +*/ + +opt_warn: +/*!re2c + * + { + error ("bad warning: %s", *argv); + return EXIT_FAIL; + } + "empty-character-class" end { warn.set (Warn::EMPTY_CHARACTER_CLASS, option); goto opt; } + "empty-rule" end { warn.set (Warn::EMPTY_RULE, option); goto opt; } + "naked-default" end { warn.set (Warn::NAKED_DEFAULT, option); goto opt; } */ opt_short: /*!re2c * { - error ("bad short option: %s\n", *argv); + error ("bad short option: %s", *argv); return EXIT_FAIL; } end { goto opt; } @@ -97,7 +117,7 @@ opt_long: /*!re2c * { - error ("bad long option: %s\n", *argv); + error ("bad long option: %s", *argv); return EXIT_FAIL; } "help" end { usage (); return EXIT_OK; } @@ -134,7 +154,7 @@ opt_output: /*!re2c * { - error ("bad argument to option -o, --output: %s\n", *argv); + error ("bad argument to option -o, --output: %s", *argv); return EXIT_FAIL; } filename end { if (!opts.output (*argv)) return EXIT_FAIL; goto opt; } @@ -144,7 +164,7 @@ opt_header: /*!re2c * { - error ("bad argument to option -t, --type-header: %s\n", *argv); + error ("bad argument to option -t, --type-header: %s", *argv); return EXIT_FAIL; } filename end { if (!opts.type_header (*argv)) return EXIT_FAIL; goto opt; } @@ -155,7 +175,7 @@ opt_encoding_policy: /*!re2c * { - error ("bad argument to option --encoding-policy (expected: ignore | substitute | fail): %s\n", *argv); + error ("bad argument to option --encoding-policy (expected: ignore | substitute | fail): %s", *argv); return EXIT_FAIL; } "ignore" end { opts.encoding_policy (Enc::POLICY_IGNORE); goto opt; } @@ -168,7 +188,7 @@ opt_input: /*!re2c * { - error ("bad argument to option --input (expected: default | custom): %s\n", *argv); + error ("bad argument to option --input (expected: default | custom): %s", *argv); return EXIT_FAIL; } "default" end { opts.input (InputAPI::DEFAULT); goto opt; } @@ -180,7 +200,7 @@ opt_empty_class: /*!re2c * { - error ("bad argument to option --empty-class (expected: match-empty | match-none | error): %s\n", *argv); + error ("bad argument to option --empty-class (expected: match-empty | match-none | error): %s", *argv); return EXIT_FAIL; } "match-empty" end { opts.empty_class (EMPTY_CLASS_MATCH_EMPTY); goto opt; } @@ -191,17 +211,17 @@ opt_empty_class: end: if (!opts.source_file) { - error ("no source file\n"); + error ("no source file"); return EXIT_FAIL; } if (!cFlag && opts.header_file) { - error ("can only output a header file when using -c switch\n"); + error ("can only output a header file when using -c switch"); return EXIT_FAIL; } if (DFlag && (bFlag || dFlag || sFlag || flag_skeleton)) { - error ("cannot combine -D with -b, -d, -s or --skeleton switches\n"); + error ("cannot combine -D with -b, -d, -s or --skeleton switches"); return EXIT_FAIL; } diff --git a/re2c/src/conf/warn.cc b/re2c/src/conf/warn.cc new file mode 100644 index 00000000..6bd045f6 --- /dev/null +++ b/re2c/src/conf/warn.cc @@ -0,0 +1,106 @@ +#include +#include + +#include "src/codegen/print.h" +#include "src/conf/msg.h" +#include "src/conf/warn.h" + +namespace re2c { + +Warn warn; + +const uint8_t Warn::SILENT = 0; +const uint8_t Warn::WARNING = 1u << 0; +const uint8_t Warn::ERROR = 1u << 1; + +const char * Warn::names [TYPES] = +{ +#define W(x, y) y + RE2C_WARNING_TYPES +#undef W +}; + +Warn::Warn () + : mask () + , error (false) +{ + for (uint32_t i = 0; i < TYPES; ++i) + { + mask[i] = SILENT; + } +} + +uint32_t Warn::error_code () const +{ + return error; +} + +void Warn::set (type_t t, option_t o) +{ + switch (o) + { + case W: + mask[t] |= WARNING; + break; + case WNO: + mask[t] &= ~WARNING; + break; + case WERROR: + mask[t] |= ERROR; + break; + case WNOERROR: + mask[t] &= ~ERROR; + break; + } +} + +void Warn::set_all (option_t o) +{ + for (uint32_t i = 0; i < TYPES; ++i) + { + set (static_cast (i), o); + } +} + +void Warn::empty_class (uint32_t line) +{ + if (mask[EMPTY_CHARACTER_CLASS] & WARNING) + { + if (mask[EMPTY_CHARACTER_CLASS] & ERROR) + { + error = true; + } + warning (names[EMPTY_CHARACTER_CLASS], "empty character class at line %u", line); + } +} + +void Warn::empty_rule (uint32_t line) +{ + if (mask[EMPTY_RULE] & WARNING) + { + if (mask[EMPTY_RULE] & ERROR) + { + error = true; + } + warning (names[EMPTY_RULE], "empty rule at line %u", line); + } +} + +void Warn::naked_default (const std::vector > & stray_cunits) +{ + if (mask[NAKED_DEFAULT] & WARNING) + { + if (mask[NAKED_DEFAULT] & ERROR) + { + error = true; + } + std::ostringstream s; + for (uint32_t i = 0; i < stray_cunits.size (); ++i) + { + printSpan (s, stray_cunits[i].first, stray_cunits[i].second); + } + warning (names[NAKED_DEFAULT], "naked default case (stray code units: %s), better add default rule *", s.str ().c_str ()); + } +} + +} // namespace re2c diff --git a/re2c/src/conf/warn.h b/re2c/src/conf/warn.h new file mode 100644 index 00000000..f0b11fa1 --- /dev/null +++ b/re2c/src/conf/warn.h @@ -0,0 +1,53 @@ +#ifndef _RE2C_CONF_WARN_ +#define _RE2C_CONF_WARN_ + +#include + +#include "src/util/c99_stdint.h" + +namespace re2c { + +#define RE2C_WARNING_TYPES \ + W (EMPTY_CHARACTER_CLASS, "empty-character-class"), \ + W (EMPTY_RULE, "empty-rule"), \ + W (NAKED_DEFAULT, "naked-default"), + +class Warn +{ +public: + enum type_t + { +#define W(x, y) x + RE2C_WARNING_TYPES +#undef W + TYPES // count + }; + enum option_t + { + W, + WNO, + WERROR, + WNOERROR + }; + +private: + static const uint8_t SILENT; + static const uint8_t WARNING; + static const uint8_t ERROR; + static const char * names [TYPES]; + uint8_t mask[TYPES]; + bool error; + +public: + Warn (); + uint32_t error_code () const; + void set (type_t t, option_t o); + void set_all (option_t o); + void empty_class (uint32_t line); + void empty_rule (uint32_t line); + void naked_default (const std::vector > & stray_cunits); +}; + +} // namespace re2c + +#endif // _RE2C_CONF_WARN_ diff --git a/re2c/src/globals.h b/re2c/src/globals.h index d05f43a4..30a0b4e9 100644 --- a/re2c/src/globals.h +++ b/re2c/src/globals.h @@ -5,6 +5,7 @@ #include "src/codegen/code_names.h" #include "src/codegen/input_api.h" +#include "src/conf/warn.h" #include "src/ir/regexp/encoding/enc.h" #include "src/ir/regexp/empty_class_policy.h" #include "src/util/c99_stdint.h" @@ -77,6 +78,8 @@ extern InputAPI input_api; extern empty_class_policy_t empty_class_policy; +extern Warn warn; + } // end namespace re2c #endif // _RE2C_GLOBALS_ diff --git a/re2c/src/ir/regexp/regexp.cc b/re2c/src/ir/regexp/regexp.cc index 55981b30..4f57a8a2 100644 --- a/re2c/src/ir/regexp/regexp.cc +++ b/re2c/src/ir/regexp/regexp.cc @@ -214,8 +214,10 @@ RegExp * Scanner::matchSymbolRange(Range * r) const switch (empty_class_policy) { case EMPTY_CLASS_MATCH_EMPTY: + warn.empty_class (get_line ()); return new NullOp; case EMPTY_CLASS_MATCH_NONE: + warn.empty_class (get_line ()); break; case EMPTY_CLASS_ERROR: fatal ("empty character class"); diff --git a/re2c/src/main.cc b/re2c/src/main.cc index 39e48624..fa23b25a 100644 --- a/re2c/src/main.cc +++ b/re2c/src/main.cc @@ -57,5 +57,5 @@ int main(int argc, char *argv[]) Scanner scanner (input, output.source); parse (scanner, output); - return 0; + return warn.error_code (); } diff --git a/re2c/src/parse/scanner.h b/re2c/src/parse/scanner.h index 15a83c59..8ec6e0a8 100644 --- a/re2c/src/parse/scanner.h +++ b/re2c/src/parse/scanner.h @@ -72,6 +72,7 @@ public: void restore_state(const ScannerState&); uint32_t get_cline() const; + uint32_t get_line() const; const std::string & get_fname () const; void set_in_parse(bool new_in_parse); void fatal_at(uint32_t line, uint32_t ofs, const char *msg) const; @@ -116,6 +117,11 @@ inline uint32_t Scanner::get_cline() const return cline; } +inline uint32_t Scanner::get_line() const +{ + return in_parse ? tline : cline; +} + inline void Scanner::save_state(ScannerState& state) const { state = *this; -- 2.40.0