--- /dev/null
+/* Generated by re2c 0.14.3 on Sun Jul 19 12:06:48 2015 */
+#include <stdio.h>
+
+#include "src/conf/msg.h"
+#include "src/conf/opt.h"
+
+namespace re2c
+{
+
+parse_opts_t parse_opts (int argc, char ** argv, Opt & opts)
+{
+ if (argc == 1)
+ {
+ usage ();
+ return EXIT_FAIL;
+ }
+
+#define YYCTYPE char
+ YYCTYPE * YYCURSOR;
+ YYCTYPE * YYMARKER;
+
+
+
+opt:
+ YYCURSOR = *++argv;
+ if (YYCURSOR == NULL)
+ {
+ goto end;
+ }
+
+{
+ YYCTYPE yych;
+ static const unsigned char yybm[] = {
+ 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, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ };
+
+ yych = *YYCURSOR;
+ if (yych <= 0x00) goto yy2;
+ if (yych == '-') goto yy5;
+ goto yy4;
+yy2:
+ ++YYCURSOR;
+ {
+ error ("bad option: %s\n", *argv);
+ return EXIT_FAIL;
+ }
+yy4:
+ yych = *(YYMARKER = ++YYCURSOR);
+ goto yy14;
+yy5:
+ ++YYCURSOR;
+ if ((yych = *YYCURSOR) <= 0x00) goto yy9;
+ if (yych == '-') goto yy7;
+ { goto opt_short; }
+yy7:
+ ++YYCURSOR;
+ if ((yych = *YYCURSOR) <= 0x00) goto yy11;
+ { goto opt_long; }
+yy9:
+ ++YYCURSOR;
+ { opts.source ("<stdin>"); goto opt; }
+yy11:
+ ++YYCURSOR;
+ { goto end; }
+yy13:
+ ++YYCURSOR;
+ yych = *YYCURSOR;
+yy14:
+ if (yybm[0+yych] & 128) {
+ goto yy13;
+ }
+ ++YYCURSOR;
+ { opts.source (*argv); goto opt; }
+}
+
+
+opt_short:
+
+{
+ YYCTYPE yych;
+ yych = *YYCURSOR;
+ if (yych <= 'c') {
+ if (yych <= 'C') {
+ if (yych <= '7') {
+ if (yych <= 0x00) goto yy19;
+ if (yych == '1') goto yy23;
+ goto yy21;
+ } else {
+ if (yych <= '8') goto yy25;
+ if (yych == '?') goto yy27;
+ goto yy21;
+ }
+ } else {
+ if (yych <= 'U') {
+ if (yych <= 'D') goto yy29;
+ if (yych == 'F') goto yy31;
+ goto yy21;
+ } else {
+ if (yych <= 'V') goto yy33;
+ if (yych <= 'a') goto yy21;
+ if (yych <= 'b') goto yy35;
+ goto yy37;
+ }
+ }
+ } else {
+ if (yych <= 'o') {
+ if (yych <= 'g') {
+ if (yych <= 'd') goto yy39;
+ if (yych <= 'e') goto yy41;
+ if (yych <= 'f') goto yy43;
+ goto yy45;
+ } else {
+ if (yych <= 'h') goto yy27;
+ if (yych <= 'i') goto yy47;
+ if (yych <= 'n') goto yy21;
+ goto yy49;
+ }
+ } else {
+ if (yych <= 't') {
+ if (yych <= 'q') goto yy21;
+ if (yych <= 'r') goto yy51;
+ if (yych <= 's') goto yy53;
+ goto yy55;
+ } else {
+ if (yych <= 'v') {
+ if (yych <= 'u') goto yy57;
+ goto yy59;
+ } else {
+ if (yych <= 'w') goto yy61;
+ if (yych <= 'x') goto yy63;
+ goto yy21;
+ }
+ }
+ }
+ }
+yy19:
+ ++YYCURSOR;
+ { goto opt; }
+yy21:
+ ++YYCURSOR;
+ {
+ error ("bad short option: %s\n", *argv);
+ return EXIT_FAIL;
+ }
+yy23:
+ ++YYCURSOR;
+ { goto opt_short; }
+yy25:
+ ++YYCURSOR;
+ { if (!opts.utf_8 ()) { error_encoding (); return EXIT_FAIL; } goto opt_short; }
+yy27:
+ ++YYCURSOR;
+ { usage (); return EXIT_OK; }
+yy29:
+ ++YYCURSOR;
+ { opts.emit_dot (); goto opt_short; }
+yy31:
+ ++YYCURSOR;
+ { opts.flex_syntax (); goto opt_short; }
+yy33:
+ ++YYCURSOR;
+ { vernum (); return EXIT_OK; }
+yy35:
+ ++YYCURSOR;
+ { opts.bit_vectors (); goto opt_short; }
+yy37:
+ ++YYCURSOR;
+ { opts.start_conditions (); goto opt_short; }
+yy39:
+ ++YYCURSOR;
+ { opts.debug_output (); goto opt_short; }
+yy41:
+ ++YYCURSOR;
+ { if (!opts.ecb ()) { error_encoding (); return EXIT_FAIL; } goto opt_short; }
+yy43:
+ ++YYCURSOR;
+ { opts.storable_state (); goto opt_short; }
+yy45:
+ ++YYCURSOR;
+ { opts.computed_gotos (); goto opt_short; }
+yy47:
+ ++YYCURSOR;
+ { opts.no_debug_info (); goto opt_short; }
+yy49:
+ ++YYCURSOR;
+ if ((yych = *YYCURSOR) <= 0x00) goto yy67;
+ { *argv = YYCURSOR; goto opt_output; }
+yy51:
+ ++YYCURSOR;
+ { opts.reusable (); goto opt_short; }
+yy53:
+ ++YYCURSOR;
+ { opts.nested_ifs (); goto opt_short; }
+yy55:
+ ++YYCURSOR;
+ if ((yych = *YYCURSOR) <= 0x00) goto yy65;
+ { *argv = YYCURSOR; goto opt_header; }
+yy57:
+ ++YYCURSOR;
+ { if (!opts.unicode ()) { error_encoding (); return EXIT_FAIL; } goto opt_short; }
+yy59:
+ ++YYCURSOR;
+ { version (); return EXIT_OK; }
+yy61:
+ ++YYCURSOR;
+ { if (!opts.wide_chars ()) { error_encoding (); return EXIT_FAIL; } goto opt_short; }
+yy63:
+ ++YYCURSOR;
+ { if (!opts.utf_16 ()) { error_encoding (); return EXIT_FAIL; } goto opt_short; }
+yy65:
+ ++YYCURSOR;
+ { YYCURSOR = *++argv; goto opt_header; }
+yy67:
+ ++YYCURSOR;
+ { YYCURSOR = *++argv; goto opt_output; }
+}
+
+
+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;
+ }
+yy71:
+ ++YYCURSOR;
+yy72:
+ {
+ error ("bad long option: %s\n", *argv);
+ return EXIT_FAIL;
+ }
+yy73:
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych == 'i') goto yy369;
+ goto yy72;
+yy74:
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych == 'a') goto yy329;
+ if (yych == 'o') goto yy330;
+ goto yy72;
+yy75:
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych == 'e') goto yy316;
+ goto yy72;
+yy76:
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= 'l') {
+ if (yych == 'c') goto yy278;
+ goto yy72;
+ } else {
+ if (yych <= 'm') goto yy276;
+ if (yych <= 'n') goto yy277;
+ goto yy72;
+ }
+yy77:
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych == 'l') goto yy264;
+ goto yy72;
+yy78:
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych == 'e') goto yy259;
+ goto yy72;
+yy79:
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych == 'n') goto yy253;
+ goto yy72;
+yy80:
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych == 'e') goto yy212;
+ if (yych == 'o') goto yy211;
+ goto yy72;
+yy81:
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych == 'u') goto yy204;
+ goto yy72;
+yy82:
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych == 'e') goto yy195;
+ goto yy72;
+yy83:
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= 'j') {
+ if (yych == 'i') goto yy143;
+ goto yy72;
+ } else {
+ if (yych <= 'k') goto yy144;
+ if (yych == 't') goto yy145;
+ goto yy72;
+ }
+yy84:
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych == 'y') goto yy131;
+ goto yy72;
+yy85:
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych == 'n') goto yy114;
+ if (yych == 't') goto yy113;
+ goto yy72;
+yy86:
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych == 'e') goto yy100;
+ goto yy72;
+yy87:
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych != 'i') goto yy72;
+ yych = *++YYCURSOR;
+ if (yych == 'd') goto yy90;
+yy89:
+ YYCURSOR = YYMARKER;
+ goto yy72;
+yy90:
+ yych = *++YYCURSOR;
+ if (yych != 'e') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != '-') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'c') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'h') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'a') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'r') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 's') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { if (!opts.wide_chars ()) { error_encoding (); return EXIT_FAIL; } goto opt; }
+yy100:
+ yych = *++YYCURSOR;
+ if (yych != 'r') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych == 'n') goto yy102;
+ if (yych == 's') goto yy103;
+ goto yy89;
+yy102:
+ yych = *++YYCURSOR;
+ if (yych == 'u') goto yy109;
+ goto yy89;
+yy103:
+ yych = *++YYCURSOR;
+ if (yych != 'i') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'o') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'n') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { version (); return EXIT_OK; }
+yy109:
+ yych = *++YYCURSOR;
+ if (yych != 'm') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { vernum (); return EXIT_OK; }
+yy113:
+ yych = *++YYCURSOR;
+ if (yych == 'f') goto yy122;
+ goto yy89;
+yy114:
+ yych = *++YYCURSOR;
+ if (yych != 'i') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'c') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'o') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'd') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'e') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { if (!opts.unicode ()) { error_encoding (); return EXIT_FAIL; } goto opt; }
+yy122:
+ yych = *++YYCURSOR;
+ if (yych != '-') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych == '1') goto yy124;
+ if (yych == '8') goto yy125;
+ goto yy89;
+yy124:
+ yych = *++YYCURSOR;
+ if (yych == '6') goto yy128;
+ goto yy89;
+yy125:
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { if (!opts.utf_8 ()) { error_encoding (); return EXIT_FAIL; } goto opt; }
+yy128:
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { if (!opts.utf_16 ()) { error_encoding (); return EXIT_FAIL; } goto opt; }
+yy131:
+ yych = *++YYCURSOR;
+ if (yych != 'p') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'e') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != '-') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'h') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'e') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'a') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'd') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'e') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'r') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { goto opt_header; }
+yy143:
+ yych = *++YYCURSOR;
+ if (yych == 'n') goto yy184;
+ goto yy89;
+yy144:
+ yych = *++YYCURSOR;
+ if (yych == 'e') goto yy176;
+ goto yy89;
+yy145:
+ yych = *++YYCURSOR;
+ if (yych == 'a') goto yy146;
+ if (yych == 'o') goto yy147;
+ goto yy89;
+yy146:
+ yych = *++YYCURSOR;
+ if (yych == 'r') goto yy161;
+ goto yy89;
+yy147:
+ yych = *++YYCURSOR;
+ if (yych != 'r') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'a') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'b') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'l') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'e') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != '-') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 's') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'a') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'e') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { opts.storable_state (); goto opt; }
+yy161:
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != '-') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'c') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'o') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'n') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'd') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'i') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'i') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'o') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'n') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 's') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { opts.start_conditions (); goto opt; }
+yy176:
+ yych = *++YYCURSOR;
+ if (yych != 'l') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'e') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'o') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'n') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { opts.skeleton (); goto opt; }
+yy184:
+ yych = *++YYCURSOR;
+ if (yych != 'g') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'l') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'e') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != '-') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'p') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'a') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 's') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 's') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { goto opt; }
+yy195:
+ yych = *++YYCURSOR;
+ if (yych != 'u') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 's') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'a') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'b') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'l') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'e') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { opts.reusable (); goto opt; }
+yy204:
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'p') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'u') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { goto opt_output; }
+yy211:
+ yych = *++YYCURSOR;
+ if (yych == '-') goto yy223;
+ goto yy89;
+yy212:
+ yych = *++YYCURSOR;
+ if (yych != 's') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'e') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'd') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != '-') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'i') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'f') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 's') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { opts.nested_ifs (); goto opt; }
+yy223:
+ yych = *++YYCURSOR;
+ if (yych == 'd') goto yy225;
+ if (yych != 'g') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych == 'e') goto yy237;
+ goto yy89;
+yy225:
+ yych = *++YYCURSOR;
+ if (yych != 'e') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'b') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'u') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'g') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != '-') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'i') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'n') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'f') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'o') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { opts.no_debug_info (); goto opt; }
+yy237:
+ yych = *++YYCURSOR;
+ if (yych != 'n') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'e') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'r') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'a') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'i') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'o') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'n') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != '-') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'd') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'a') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'e') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { opts.no_generation_date (); goto opt; }
+yy253:
+ yych = *++YYCURSOR;
+ if (yych != 'p') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'u') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { goto opt_input; }
+yy259:
+ yych = *++YYCURSOR;
+ if (yych != 'l') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'p') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { usage (); return EXIT_OK; }
+yy264:
+ yych = *++YYCURSOR;
+ if (yych != 'e') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'x') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != '-') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 's') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'y') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'n') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'a') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'x') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { opts.flex_syntax (); goto opt; }
+yy276:
+ yych = *++YYCURSOR;
+ if (yych == 'i') goto yy297;
+ if (yych == 'p') goto yy298;
+ goto yy89;
+yy277:
+ yych = *++YYCURSOR;
+ if (yych == 'c') goto yy282;
+ goto yy89;
+yy278:
+ yych = *++YYCURSOR;
+ if (yych != 'b') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { if (!opts.ecb ()) { error_encoding (); return EXIT_FAIL; } goto opt; }
+yy282:
+ yych = *++YYCURSOR;
+ if (yych != 'o') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'd') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'i') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'n') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'g') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != '-') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'p') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'o') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'l') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'i') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'c') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'y') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { goto opt_encoding_policy; }
+yy297:
+ yych = *++YYCURSOR;
+ if (yych == 't') goto yy309;
+ goto yy89;
+yy298:
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'y') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != '-') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'c') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'l') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'a') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 's') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 's') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { goto opt_empty_class; }
+yy309:
+ yych = *++YYCURSOR;
+ if (yych != '-') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'd') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'o') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { opts.emit_dot (); goto opt; }
+yy316:
+ yych = *++YYCURSOR;
+ if (yych != 'b') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'u') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'g') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != '-') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'o') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'u') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'p') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'u') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { opts.debug_output (); goto opt; }
+yy329:
+ yych = *++YYCURSOR;
+ if (yych == 's') goto yy345;
+ goto yy89;
+yy330:
+ yych = *++YYCURSOR;
+ if (yych != 'm') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'p') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'u') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'e') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'd') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != '-') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'g') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'o') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'o') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 's') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { opts.computed_gotos (); goto opt; }
+yy345:
+ yych = *++YYCURSOR;
+ if (yych != 'e') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != '-') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'i') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'n') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych == 's') goto yy351;
+ if (yych != 'v') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych == 'e') goto yy362;
+ goto yy89;
+yy351:
+ yych = *++YYCURSOR;
+ if (yych != 'e') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'n') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 's') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'i') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'i') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'v') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'e') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { opts.case_insensitive (); goto opt; }
+yy362:
+ yych = *++YYCURSOR;
+ if (yych != 'r') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'e') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'd') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { opts.case_inverted (); goto opt; }
+yy369:
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != '-') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'v') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'e') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'c') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'o') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 'r') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych != 's') goto yy89;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy89;
+ ++YYCURSOR;
+ { opts.bit_vectors (); goto opt; }
+}
+
+
+opt_output:
+
+{
+ YYCTYPE yych;
+ static const unsigned char yybm[] = {
+ 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, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ };
+ yych = *YYCURSOR;
+ if (yych <= 0x00) goto yy383;
+ if (yych != '-') goto yy385;
+yy383:
+ ++YYCURSOR;
+ {
+ error ("bad argument to option -o, --output: %s\n", *argv);
+ return EXIT_FAIL;
+ }
+yy385:
+ yych = *(YYMARKER = ++YYCURSOR);
+ goto yy387;
+yy386:
+ ++YYCURSOR;
+ yych = *YYCURSOR;
+yy387:
+ if (yybm[0+yych] & 128) {
+ goto yy386;
+ }
+ ++YYCURSOR;
+ { opts.output (*argv); goto opt; }
+}
+
+
+opt_header:
+
+{
+ YYCTYPE yych;
+ static const unsigned char yybm[] = {
+ 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, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ };
+ yych = *YYCURSOR;
+ if (yych <= 0x00) goto yy392;
+ if (yych != '-') goto yy394;
+yy392:
+ ++YYCURSOR;
+ {
+ error ("bad argument to option -t, --type-header: %s\n", *argv);
+ return EXIT_FAIL;
+ }
+yy394:
+ yych = *(YYMARKER = ++YYCURSOR);
+ goto yy396;
+yy395:
+ ++YYCURSOR;
+ yych = *YYCURSOR;
+yy396:
+ if (yybm[0+yych] & 128) {
+ goto yy395;
+ }
+ ++YYCURSOR;
+ { opts.type_header (*argv); goto opt; }
+}
+
+
+opt_encoding_policy:
+ YYCURSOR = *++argv;
+
+{
+ YYCTYPE yych;
+ yych = *YYCURSOR;
+ if (yych <= 'h') {
+ if (yych == 'f') goto yy403;
+ } else {
+ if (yych <= 'i') goto yy404;
+ if (yych == 's') goto yy405;
+ }
+ ++YYCURSOR;
+yy402:
+ {
+ error ("bad argument to option --encoding-policy (expected: ignore | substitute | fail): %s\n", *argv);
+ return EXIT_FAIL;
+ }
+yy403:
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych == 'a') goto yy425;
+ goto yy402;
+yy404:
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych == 'g') goto yy418;
+ goto yy402;
+yy405:
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych != 'u') goto yy402;
+ yych = *++YYCURSOR;
+ if (yych == 'b') goto yy408;
+yy407:
+ YYCURSOR = YYMARKER;
+ goto yy402;
+yy408:
+ yych = *++YYCURSOR;
+ if (yych != 's') goto yy407;
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy407;
+ yych = *++YYCURSOR;
+ if (yych != 'i') goto yy407;
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy407;
+ yych = *++YYCURSOR;
+ if (yych != 'u') goto yy407;
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy407;
+ yych = *++YYCURSOR;
+ if (yych != 'e') goto yy407;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy407;
+ ++YYCURSOR;
+ { opts.encoding_policy (Enc::POLICY_SUBSTITUTE); goto opt; }
+yy418:
+ yych = *++YYCURSOR;
+ if (yych != 'n') goto yy407;
+ yych = *++YYCURSOR;
+ if (yych != 'o') goto yy407;
+ yych = *++YYCURSOR;
+ if (yych != 'r') goto yy407;
+ yych = *++YYCURSOR;
+ if (yych != 'e') goto yy407;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy407;
+ ++YYCURSOR;
+ { opts.encoding_policy (Enc::POLICY_IGNORE); goto opt; }
+yy425:
+ yych = *++YYCURSOR;
+ if (yych != 'i') goto yy407;
+ yych = *++YYCURSOR;
+ if (yych != 'l') goto yy407;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy407;
+ ++YYCURSOR;
+ { opts.encoding_policy (Enc::POLICY_FAIL); goto opt; }
+}
+
+
+opt_input:
+ YYCURSOR = *++argv;
+
+{
+ YYCTYPE yych;
+ yych = *YYCURSOR;
+ if (yych <= 'b') goto yy432;
+ if (yych <= 'c') goto yy434;
+ if (yych <= 'd') goto yy435;
+yy432:
+ ++YYCURSOR;
+yy433:
+ {
+ error ("bad argument to option --input (expected: default | custom): %s\n", *argv);
+ return EXIT_FAIL;
+ }
+yy434:
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych == 'u') goto yy445;
+ goto yy433;
+yy435:
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych != 'e') goto yy433;
+ yych = *++YYCURSOR;
+ if (yych == 'f') goto yy438;
+yy437:
+ YYCURSOR = YYMARKER;
+ goto yy433;
+yy438:
+ yych = *++YYCURSOR;
+ if (yych != 'a') goto yy437;
+ yych = *++YYCURSOR;
+ if (yych != 'u') goto yy437;
+ yych = *++YYCURSOR;
+ if (yych != 'l') goto yy437;
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy437;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy437;
+ ++YYCURSOR;
+ { opts.input (InputAPI::DEFAULT); goto opt; }
+yy445:
+ yych = *++YYCURSOR;
+ if (yych != 's') goto yy437;
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy437;
+ yych = *++YYCURSOR;
+ if (yych != 'o') goto yy437;
+ yych = *++YYCURSOR;
+ if (yych != 'm') goto yy437;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy437;
+ ++YYCURSOR;
+ { opts.input (InputAPI::CUSTOM); goto opt; }
+}
+
+
+opt_empty_class:
+ YYCURSOR = *++argv;
+
+{
+ YYCTYPE yych;
+ yych = *YYCURSOR;
+ if (yych == 'e') goto yy456;
+ if (yych == 'm') goto yy457;
+ ++YYCURSOR;
+yy455:
+ {
+ error ("bad argument to option --empty-class (expected: match-empty | match-none | error): %s\n", *argv);
+ return EXIT_FAIL;
+ }
+yy456:
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych == 'r') goto yy477;
+ goto yy455;
+yy457:
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych != 'a') goto yy455;
+ yych = *++YYCURSOR;
+ if (yych == 't') goto yy460;
+yy459:
+ YYCURSOR = YYMARKER;
+ goto yy455;
+yy460:
+ yych = *++YYCURSOR;
+ if (yych != 'c') goto yy459;
+ yych = *++YYCURSOR;
+ if (yych != 'h') goto yy459;
+ yych = *++YYCURSOR;
+ if (yych != '-') goto yy459;
+ yych = *++YYCURSOR;
+ if (yych == 'e') goto yy464;
+ if (yych == 'n') goto yy465;
+ goto yy459;
+yy464:
+ yych = *++YYCURSOR;
+ if (yych == 'm') goto yy471;
+ goto yy459;
+yy465:
+ yych = *++YYCURSOR;
+ if (yych != 'o') goto yy459;
+ yych = *++YYCURSOR;
+ if (yych != 'n') goto yy459;
+ yych = *++YYCURSOR;
+ if (yych != 'e') goto yy459;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy459;
+ ++YYCURSOR;
+ { opts.empty_class (EMPTY_CLASS_MATCH_NONE); goto opt; }
+yy471:
+ yych = *++YYCURSOR;
+ if (yych != 'p') goto yy459;
+ yych = *++YYCURSOR;
+ if (yych != 't') goto yy459;
+ yych = *++YYCURSOR;
+ if (yych != 'y') goto yy459;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy459;
+ ++YYCURSOR;
+ { opts.empty_class (EMPTY_CLASS_MATCH_EMPTY); goto opt; }
+yy477:
+ yych = *++YYCURSOR;
+ if (yych != 'r') goto yy459;
+ yych = *++YYCURSOR;
+ if (yych != 'o') goto yy459;
+ yych = *++YYCURSOR;
+ if (yych != 'r') goto yy459;
+ yych = *++YYCURSOR;
+ if (yych >= 0x01) goto yy459;
+ ++YYCURSOR;
+ { opts.empty_class (EMPTY_CLASS_ERROR); goto opt; }
+}
+
+
+end:
+ if (!cFlag && opts.header_file)
+ {
+ error ("can only output a header file when using -c switch\n");
+ return EXIT_FAIL;
+ }
+ if (DFlag && (bFlag || dFlag || sFlag || flag_skeleton))
+ {
+ error ("cannot combine -D with -b, -d, -s or --skeleton switches\n");
+ return EXIT_FAIL;
+ }
+
+ return OK;
+
+#undef YYCTYPE
+}
+
+} // namespace re2c
-#include <fstream>
-#include <iostream>
-#include <stdlib.h>
-#include <string.h>
-
#include "config.h"
+#include "src/conf/msg.h"
+#include "src/conf/opt.h"
#include "src/globals.h"
-#include "src/mbo_getopt.h"
#include "src/parse/parser.h"
namespace re2c
{
-bool bFlag = false;
-bool cFlag = false;
-bool dFlag = false;
-bool DFlag = false;
-bool fFlag = false;
-bool FFlag = false;
-bool gFlag = false;
-bool iFlag = false;
-bool rFlag = false;
-bool sFlag = false;
-bool tFlag = false;
-bool flag_skeleton = false;
-
-bool bNoGenerationDate = false;
bool bUsedYYBitmap = false;
-bool bEmitYYCh = true;
-bool bUseStateNext = false;
-bool bUseYYFill = true;
-bool bUseYYFillParam = true;
-bool bUseYYFillCheck = true;
-bool bUseYYFillNaked = false;
-bool bUseYYSetConditionParam = true;
-bool bUseYYGetConditionNaked = false;
-bool bUseYYSetStateParam = true;
-bool bUseYYSetStateNaked = false;
-bool bUseYYGetStateNaked = false;
-
-std::string labelPrefix("yy");
-std::string condPrefix("yyc_");
-std::string condEnumPrefix("yyc");
-std::string condDivider("/* *********************************** */");
-std::string condDividerParam("@@");
-std::string condGoto("goto @@;");
-std::string condGotoParam("@@");
-std::string yychConversion("");
-std::string yyFillLength("@@");
-std::string yySetConditionParam("@@");
-std::string yySetStateParam("@@");
-std::string yySetupRule("");
-uint32_t cGotoThreshold = 9;
-
-uint32_t topIndent = 0;
-std::string indString("\t");
-bool yybmHexTable = false;
-bool bUseStateAbort = false;
bool bWroteGetState = false;
bool bWroteCondCheck = false;
-bool bCaseInsensitive = false;
-bool bCaseInverted = false;
-
-Enc encoding;
-InputAPI input_api;
-
-empty_class_policy_t empty_class_policy = EMPTY_CLASS_MATCH_EMPTY;
-
uint32_t last_fill_index = 0;
CodeNames mapCodeName;
-
free_list<RegExp*> RegExp::vFreeList;
-using namespace std;
-
-static char *opt_arg = NULL;
-static int opt_ind = 1;
-
-static const mbo_opt_struct OPTIONS[] =
-{
- mbo_opt_struct('?', 0, "help"),
- mbo_opt_struct('b', 0, "bit-vectors"),
- mbo_opt_struct('c', 0, "start-conditions"),
- mbo_opt_struct('d', 0, "debug-output"),
- mbo_opt_struct('D', 0, "emit-dot"),
- mbo_opt_struct('e', 0, "ecb"),
- mbo_opt_struct('f', 0, "storable-state"),
- mbo_opt_struct('F', 0, "flex-syntax"),
- mbo_opt_struct('g', 0, "computed-gotos"),
- mbo_opt_struct('h', 0, "help"),
- mbo_opt_struct('i', 0, "no-debug-info"),
- mbo_opt_struct('o', 1, "output"),
- mbo_opt_struct('r', 0, "reusable"),
- mbo_opt_struct('s', 0, "nested-ifs"),
- mbo_opt_struct('t', 1, "type-header"),
- mbo_opt_struct('u', 0, "unicode"),
- mbo_opt_struct('v', 0, "version"),
- mbo_opt_struct('V', 0, "vernum"),
- mbo_opt_struct('w', 0, "wide-chars"),
- mbo_opt_struct('x', 0, "utf-16"),
- mbo_opt_struct('8', 0, "utf-8"),
- mbo_opt_struct('1', 0, "deprecated, single-pass"),
- mbo_opt_struct(10, 0, "no-generation-date"),
- mbo_opt_struct(11, 0, "case-insensitive"),
- mbo_opt_struct(12, 0, "case-inverted"),
- mbo_opt_struct(13, 1, "encoding-policy"),
- mbo_opt_struct(14, 1, "input"),
- mbo_opt_struct(15, 0, "skeleton"),
- mbo_opt_struct(16, 1, "empty-class"),
- mbo_opt_struct('-', 0, NULL) /* end of args */
-};
-
-static void usage()
-{
- std::cerr << "usage: re2c [-bcdDefFghirsuvVwx18] [-o of] [-t th] file\n"
- "\n"
- "-? -h --help Display this info.\n"
- "\n"
- "-b --bit-vectors Implies -s. Use bit vectors as well in the attempt to\n"
- " coax better code out of the compiler. Most useful for\n"
- " specifications with more than a few keywords (e.g. for\n"
- " most programming languages).\n"
- "\n"
- "-c --conditions Require start conditions.\n"
- "\n"
- "-d --debug-output Creates a parser that dumps information during\n"
- " about the current position and in which state the\n"
- " parser is.\n"
- "\n"
- "-D --emit-dot Emit a Graphviz dot view of the DFA graph\n"
- "\n"
- "-e --ecb Generate a parser that supports EBCDIC. The generated code\n"
- " can deal with any character up to 0xFF. In this mode re2c\n"
- " assumes that input character size is 1 byte. This switch is\n"
- " incompatible with -w, -u, -x and -8\n"
- "\n"
- "-f --storable-state Generate a scanner that supports storable states.\n"
- "\n"
- "-F --flex-syntax Partial support for flex syntax.\n"
- "\n"
- "-g --computed-gotos Implies -b. Generate computed goto code (only useable\n"
- " with gcc).\n"
- "\n"
- "-i --no-debug-info Do not generate '#line' info (usefull for versioning).\n"
- "\n"
- "-o of --output=of Specify the output file (of) instead of stdout\n"
- "\n"
- "-r --reusable Allow reuse of scanner definitions.\n"
- "\n"
- "-s --nested-ifs Generate nested ifs for some switches. Many compilers\n"
- " need this assist to generate better code.\n"
- "\n"
- "-t th --type-header=th Generate a type header file (th) with type definitions.\n"
- "\n"
- "-u --unicode Generate a parser that supports UTF-32. The generated code\n"
- " can deal with any valid Unicode character up to 0x10FFFF.\n"
- " In this mode re2c assumes that input character size is 4 bytes.\n"
- " This switch is incompatible with -e, -w, -x and -8. It implies -s.\n"
- "\n"
- "-v --version Show version information.\n"
- "\n"
- "-V --vernum Show version as one number.\n"
- "\n"
- "-w --wide-chars Generate a parser that supports UCS-2. The generated code can\n"
- " deal with any valid Unicode character up to 0xFFFF. In this mode\n"
- " re2c assumes that input character size is 2 bytes. This switch is\n"
- " incompatible with -e, -x, -u and -8. It implies -s."
- "\n"
- "-x --utf-16 Generate a parser that supports UTF-16. The generated code can\n"
- " deal with any valid Unicode character up to 0x10FFFF. In this mode\n"
- " re2c assumes that input character size is 2 bytes. This switch is\n"
- " incompatible with -e, -w, -u and -8. It implies -s."
- "\n"
- "-8 --utf-8 Generate a parser that supports UTF-8. The generated code can\n"
- " deal with any valid Unicode character up to 0x10FFFF. In this mode\n"
- " re2c assumes that input character size is 1 byte. This switch is\n"
- " incompatible with -e, -w, -x and -u."
- "\n"
- "--no-generation-date Suppress date output in the generated output so that it\n"
- " only shows the re2c version.\n"
- "\n"
- "--case-insensitive All strings are case insensitive, so all \"-expressions\n"
- " are treated in the same way '-expressions are.\n"
- "\n"
- "--case-inverted Invert the meaning of single and double quoted strings.\n"
- " With this switch single quotes are case sensitive and\n"
- " double quotes are case insensitive.\n"
- "\n"
- "--encoding-policy ep Specify what re2c should do when given bad code unit.\n"
- " ep can be one of the following: fail, substitute, ignore.\n"
- "\n"
- "--input i Specify re2c input API.\n"
- " i can be one of the following: default, custom.\n"
- "\n"
- "--skeleton Instead of embedding re2c-generated code into C/C++ source,\n"
- " generate a self-contained program for the same DFA.\n"
- " Most useful for correctness and performance testing.\n"
- "\n"
- "--empty-class policy What to do if user inputs empty character class. policy can be\n"
- " one of the following: 'match-empty' (match empty input, default),\n"
- " 'match-none' (fail to match on any input), 'error' (compilation\n"
- " error). Note that there are various ways to construct empty class,\n"
- " e.g: [], [^\\x00-\\xFF], [\\x00-\\xFF]\\[\\x00-\\xFF].\n"
- "\n"
- "-1 --single-pass Deprecated and does nothing (single pass is by default now).\n"
- ;
-}
-
} // end namespace re2c
using namespace re2c;
int main(int argc, char *argv[])
{
- int c;
- const char *sourceFileName = 0;
- const char *outputFileName = "<stdout>";
- const char *headerFileName = 0;
-
- if (argc == 1)
- {
- usage();
- return 2;
- }
-
- while ((c = mbo_getopt(argc, argv, OPTIONS, &opt_arg, &opt_ind, 1)) != -1)
- {
- switch (c)
- {
-
- case 'b':
- bFlag = true;
- sFlag = true;
- break;
-
- case 'c':
- cFlag = true;
- break;
-
- case 'e':
- if (!encoding.set(Enc::EBCDIC))
- {
- std::cerr << "re2c: error: Only one of switches -e, -w, -x, -u and -8 must be set\n";
- return 2;
- }
- break;
-
- case 'd':
- dFlag = true;
- break;
-
- case 'D':
- DFlag = true;
- iFlag = true;
- break;
-
- case 'f':
- fFlag = true;
- break;
-
- case 'F':
- FFlag = true;
- break;
-
- case 'g':
- gFlag = true;
- bFlag = true;
- sFlag = true;
- break;
-
- case 'i':
- iFlag = true;
- break;
-
- case 'o':
- outputFileName = opt_arg;
- break;
-
- case 'r':
- rFlag = true;
- break;
-
- case 's':
- sFlag = true;
- break;
-
- case 't':
- tFlag = true;
- headerFileName = opt_arg;
- break;
-
- case '1':
- break;
-
- case 'v':
- cout << "re2c " << PACKAGE_VERSION << "\n";
- return 2;
-
- case 'V': {
- string vernum(PACKAGE_VERSION);
-
- if (vernum[1] == '.')
- {
- vernum.insert(0, "0");
- }
- vernum.erase(2, 1);
- if (vernum[3] == '.')
- {
- vernum.insert(2, "0");
- }
- vernum.erase(4, 1);
- if (vernum.length() < 6 || vernum[5] < '0' || vernum[5] > '9')
- {
- vernum.insert(4, "0");
- }
- vernum.resize(6);
- cout << vernum << endl;
- return 2;
- }
-
- case 'w':
- sFlag = true;
- if (!encoding.set(Enc::UCS2))
- {
- std::cerr << "re2c: error: Only one of switches -e, -w, -x, -u and -8 must be set\n";
- return 2;
- }
- break;
-
- case 'x':
- sFlag = true;
- if (!encoding.set(Enc::UTF16))
- {
- std::cerr << "re2c: error: Only one of switches -e, -w, -x, -u and -8 must be set\n";
- return 2;
- }
- break;
-
- case 'u':
- sFlag = true;
- if (!encoding.set(Enc::UTF32))
- {
- std::cerr << "re2c: error: Only one of switches -e, -w, -x, -u and -8 must be set\n";
- return 2;
- }
- break;
-
- case '8':
- if (!encoding.set(Enc::UTF8))
- {
- std::cerr << "re2c: error: Only one of switches -e, -w, -x, -u and -8 must be set\n";
- return 2;
- }
- break;
-
- default:
- case 'h':
- case '?':
- usage();
- return 2;
-
- case 10:
- bNoGenerationDate = true;
- break;
-
- case 11:
- bCaseInsensitive = true;
- break;
-
- case 12:
- bCaseInverted = true;
- break;
-
- case 13:
- if (strcmp(opt_arg, "fail") == 0)
- encoding.setPolicy(Enc::POLICY_FAIL);
- else if (strcmp(opt_arg, "substitute") == 0)
- encoding.setPolicy(Enc::POLICY_SUBSTITUTE);
- else if (strcmp(opt_arg, "ignore") == 0)
- encoding.setPolicy(Enc::POLICY_IGNORE);
- else
- {
- std::cerr << "re2c: error: Invalid encoding policy: \"" << opt_arg << "\"\n";
- return 1;
- }
- break;
-
- case 14:
- if (strcmp(opt_arg, "default") == 0)
- input_api.set (InputAPI::DEFAULT);
- else if (strcmp(opt_arg, "custom") == 0)
- input_api.set (InputAPI::CUSTOM);
- else
- {
- std::cerr << "re2c: error: Invalid input API: \"" << opt_arg << "\"\n";
- return 1;
- }
- break;
-
- case 15:
- flag_skeleton = true;
- input_api.set (InputAPI::CUSTOM);
- break;
-
- case 16:
- if (strcmp(opt_arg, "match-empty") == 0)
- empty_class_policy = EMPTY_CLASS_MATCH_EMPTY;
- else if (strcmp(opt_arg, "match-none") == 0)
- empty_class_policy = EMPTY_CLASS_MATCH_NONE;
- else if (strcmp(opt_arg, "error") == 0)
- empty_class_policy = EMPTY_CLASS_ERROR;
- else
- {
- std::cerr << "re2c: error: Invalid empty class policy: \"" << opt_arg << "\"\n";
- return 1;
- }
- break;
- }
- }
-
- if (!cFlag && headerFileName)
- {
- std::cerr << "re2c: error: Can only output a header file when using -c switch\n";
- return 2;
- }
-
- if (DFlag && (bFlag || dFlag || sFlag || flag_skeleton))
- {
- std::cerr << "re2c: error: Cannot combine -D with -b, -d, -s or --skeleton switches\n";
- return 2;
- }
-
- if (argc == opt_ind + 1)
- {
- sourceFileName = argv[opt_ind];
- if (strcmp (sourceFileName, "-") == 0)
- {
- if (fFlag)
- {
- std::cerr << "re2c: error: multiple /*!re2c stdin is not acceptable when -f is specified\n";
- return 1;
- }
- sourceFileName = "<stdin>";
- outputFileName = "<stdout>";
- }
- }
- else
+ Opt opts;
+ switch (parse_opts (argc, argv, opts))
{
- std::cerr << "Unexpected argument: " << argv[argc-1] << "\n\n";
- usage();
- return 2;
+ case OK: break;
+ case EXIT_OK: return 0;
+ case EXIT_FAIL: return 1;
}
// set up the source stream
- re2c::Input input (sourceFileName);
+ re2c::Input input (opts.source_file);
if (!input.open ())
{
- cerr << "re2c: error: cannot open " << sourceFileName << "\n";
+ error ("cannot open source file: %s\n", opts.source_file);
return 1;
}
// set up the output streams
- re2c::Output output (outputFileName, headerFileName);
+ re2c::Output output (opts.output_file, opts.header_file);
if (!output.source.open ())
{
- cerr << "re2c: error: cannot open " << outputFileName << "\n";
+ error ("cannot open output file: %s\n", opts.output_file);
return 1;
}
if (tFlag && !output.header.open ())
{
- cerr << "re2c: error: cannot open " << headerFileName << "\n";
+ error ("cannot open header file: %s\n", opts.header_file);
return 1;
}
if (flag_skeleton && !output.data.open ())
{
- cerr << "re2c: error: cannot open " << output.data.file_name << "\n";
+ error ("cannot open data file: %s\n", output.data.file_name.c_str ());
return 1;
}