From: Ulya Trofimovich Date: Tue, 5 Feb 2019 13:10:56 +0000 (+0000) Subject: Differentiate between "POSIX syntax" and "POSIX semantics" options. X-Git-Tag: 1.2~202 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fd8278cc66a83083fe126128a36f8e3f6c5318f8;p=re2c Differentiate between "POSIX syntax" and "POSIX semantics" options. This is needed because we may want to use POSIX syntax with leftmost greedy disambiguation. In that case, we still need parentheses-as-tags attitude, but we don't want all the overhead and heuristics to spped up POSIX closure. libre2c_posix: added test for leftmost TNFA matcher. --- diff --git a/re2c/bootstrap/src/options/parse_opts.cc b/re2c/bootstrap/src/options/parse_opts.cc index fd449473..2076aec3 100644 --- a/re2c/bootstrap/src/options/parse_opts.cc +++ b/re2c/bootstrap/src/options/parse_opts.cc @@ -1,4 +1,4 @@ -/* Generated by re2c 1.1.1 on Sat Jan 5 22:53:11 2019 */ +/* Generated by re2c 1.1.1 on Tue Feb 5 11:51:11 2019 */ #line 1 "../src/options/parse_opts.re" #include "src/codegen/input_api.h" #include "src/options/msg.h" @@ -943,12 +943,12 @@ yy204: #line 944 "src/options/parse_opts.cc" yy206: ++YYCURSOR; -#line 121 "../src/options/parse_opts.re" +#line 126 "../src/options/parse_opts.re" { goto opt_short; } #line 949 "src/options/parse_opts.cc" yy208: ++YYCURSOR; -#line 110 "../src/options/parse_opts.re" +#line 109 "../src/options/parse_opts.re" { opts.set_encoding(Enc::UTF8); goto opt_short; } #line 954 "src/options/parse_opts.cc" yy210: @@ -969,128 +969,132 @@ yy214: yy216: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy256; -#line 113 "../src/options/parse_opts.re" +#line 118 "../src/options/parse_opts.re" { *argv = YYCURSOR; goto opt_incpath; } #line 975 "src/options/parse_opts.cc" yy218: ++YYCURSOR; -#line 105 "../src/options/parse_opts.re" - { opts.set_posix_captures(true); goto opt_short; } -#line 980 "src/options/parse_opts.cc" +#line 111 "../src/options/parse_opts.re" + { + opts.set_posix_syntax(true); + opts.set_posix_semantics(true); + goto opt_short; + } +#line 984 "src/options/parse_opts.cc" yy220: ++YYCURSOR; #line 97 "../src/options/parse_opts.re" { globopts.target = TARGET_SKELETON; goto opt_short; } -#line 985 "src/options/parse_opts.cc" +#line 989 "src/options/parse_opts.cc" yy222: ++YYCURSOR; #line 104 "../src/options/parse_opts.re" { opts.set_tags(true); goto opt_short; } -#line 990 "src/options/parse_opts.cc" +#line 994 "src/options/parse_opts.cc" yy224: ++YYCURSOR; #line 90 "../src/options/parse_opts.re" { vernum (); return EXIT_OK; } -#line 995 "src/options/parse_opts.cc" +#line 999 "src/options/parse_opts.cc" yy226: ++YYCURSOR; #line 99 "../src/options/parse_opts.re" { opts.set_bFlag(true); goto opt_short; } -#line 1000 "src/options/parse_opts.cc" +#line 1004 "src/options/parse_opts.cc" yy228: ++YYCURSOR; #line 92 "../src/options/parse_opts.re" { globopts.cFlag = true; goto opt_short; } -#line 1005 "src/options/parse_opts.cc" +#line 1009 "src/options/parse_opts.cc" yy230: ++YYCURSOR; #line 100 "../src/options/parse_opts.re" { opts.set_dFlag(true); goto opt_short; } -#line 1010 "src/options/parse_opts.cc" +#line 1014 "src/options/parse_opts.cc" yy232: ++YYCURSOR; -#line 106 "../src/options/parse_opts.re" +#line 105 "../src/options/parse_opts.re" { opts.set_encoding(Enc::EBCDIC); goto opt_short; } -#line 1015 "src/options/parse_opts.cc" +#line 1019 "src/options/parse_opts.cc" yy234: ++YYCURSOR; #line 94 "../src/options/parse_opts.re" { globopts.fFlag = true; goto opt_short; } -#line 1020 "src/options/parse_opts.cc" +#line 1024 "src/options/parse_opts.cc" yy236: ++YYCURSOR; #line 101 "../src/options/parse_opts.re" { opts.set_gFlag(true); goto opt_short; } -#line 1025 "src/options/parse_opts.cc" +#line 1029 "src/options/parse_opts.cc" yy238: ++YYCURSOR; #line 102 "../src/options/parse_opts.re" { opts.set_iFlag(true); goto opt_short; } -#line 1030 "src/options/parse_opts.cc" +#line 1034 "src/options/parse_opts.cc" yy240: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy258; -#line 116 "../src/options/parse_opts.re" +#line 121 "../src/options/parse_opts.re" { *argv = YYCURSOR; goto opt_output; } -#line 1036 "src/options/parse_opts.cc" +#line 1040 "src/options/parse_opts.cc" yy242: ++YYCURSOR; #line 96 "../src/options/parse_opts.re" { globopts.rFlag = true; goto opt_short; } -#line 1041 "src/options/parse_opts.cc" +#line 1045 "src/options/parse_opts.cc" yy244: ++YYCURSOR; #line 103 "../src/options/parse_opts.re" { opts.set_sFlag(true); goto opt_short; } -#line 1046 "src/options/parse_opts.cc" +#line 1050 "src/options/parse_opts.cc" yy246: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy260; -#line 119 "../src/options/parse_opts.re" +#line 124 "../src/options/parse_opts.re" { *argv = YYCURSOR; goto opt_header; } -#line 1052 "src/options/parse_opts.cc" +#line 1056 "src/options/parse_opts.cc" yy248: ++YYCURSOR; -#line 107 "../src/options/parse_opts.re" +#line 106 "../src/options/parse_opts.re" { opts.set_encoding(Enc::UTF32); goto opt_short; } -#line 1057 "src/options/parse_opts.cc" +#line 1061 "src/options/parse_opts.cc" yy250: ++YYCURSOR; #line 89 "../src/options/parse_opts.re" { version (); return EXIT_OK; } -#line 1062 "src/options/parse_opts.cc" +#line 1066 "src/options/parse_opts.cc" yy252: ++YYCURSOR; -#line 108 "../src/options/parse_opts.re" +#line 107 "../src/options/parse_opts.re" { opts.set_encoding(Enc::UCS2); goto opt_short; } -#line 1067 "src/options/parse_opts.cc" +#line 1071 "src/options/parse_opts.cc" yy254: ++YYCURSOR; -#line 109 "../src/options/parse_opts.re" +#line 108 "../src/options/parse_opts.re" { opts.set_encoding(Enc::UTF16); goto opt_short; } -#line 1072 "src/options/parse_opts.cc" +#line 1076 "src/options/parse_opts.cc" yy256: ++YYCURSOR; -#line 112 "../src/options/parse_opts.re" +#line 117 "../src/options/parse_opts.re" { NEXT_ARG("-I", opt_incpath); } -#line 1077 "src/options/parse_opts.cc" +#line 1081 "src/options/parse_opts.cc" yy258: ++YYCURSOR; -#line 115 "../src/options/parse_opts.re" +#line 120 "../src/options/parse_opts.re" { NEXT_ARG("-o, --output", opt_output); } -#line 1082 "src/options/parse_opts.cc" +#line 1086 "src/options/parse_opts.cc" yy260: ++YYCURSOR; -#line 118 "../src/options/parse_opts.re" +#line 123 "../src/options/parse_opts.re" { NEXT_ARG("-t, --type-header", opt_header); } -#line 1087 "src/options/parse_opts.cc" +#line 1091 "src/options/parse_opts.cc" } -#line 122 "../src/options/parse_opts.re" +#line 127 "../src/options/parse_opts.re" opt_long: -#line 1094 "src/options/parse_opts.cc" +#line 1098 "src/options/parse_opts.cc" { YYCTYPE yych; yych = (YYCTYPE)*YYCURSOR; @@ -1116,9 +1120,9 @@ opt_long: yy264: ++YYCURSOR; yy265: -#line 126 "../src/options/parse_opts.re" +#line 131 "../src/options/parse_opts.re" { ERROR("bad long option: %s", *argv); } -#line 1122 "src/options/parse_opts.cc" +#line 1126 "src/options/parse_opts.cc" yy266: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == 'i') goto yy282; @@ -1482,9 +1486,9 @@ yy347: goto yy283; yy348: ++YYCURSOR; -#line 150 "../src/options/parse_opts.re" +#line 154 "../src/options/parse_opts.re" { opts.set_encoding(Enc::EBCDIC); goto opt; } -#line 1488 "src/options/parse_opts.cc" +#line 1492 "src/options/parse_opts.cc" yy350: yych = (YYCTYPE)*++YYCURSOR; if (yych == '-') goto yy384; @@ -1646,9 +1650,9 @@ yy387: goto yy283; yy388: ++YYCURSOR; -#line 128 "../src/options/parse_opts.re" +#line 133 "../src/options/parse_opts.re" { usage (); return EXIT_OK; } -#line 1652 "src/options/parse_opts.cc" +#line 1656 "src/options/parse_opts.cc" yy390: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy429; @@ -1707,9 +1711,9 @@ yy403: goto yy283; yy404: ++YYCURSOR; -#line 148 "../src/options/parse_opts.re" +#line 153 "../src/options/parse_opts.re" { opts.set_tags (true); goto opt; } -#line 1713 "src/options/parse_opts.cc" +#line 1717 "src/options/parse_opts.cc" yy406: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'h') goto yy444; @@ -1805,9 +1809,9 @@ yy428: goto yy283; yy429: ++YYCURSOR; -#line 159 "../src/options/parse_opts.re" +#line 169 "../src/options/parse_opts.re" { NEXT_ARG("--input", opt_input); } -#line 1811 "src/options/parse_opts.cc" +#line 1815 "src/options/parse_opts.cc" yy431: yych = (YYCTYPE)*++YYCURSOR; if (yych == '-') goto yy469; @@ -1874,9 +1878,9 @@ yy446: goto yy283; yy447: ++YYCURSOR; -#line 154 "../src/options/parse_opts.re" +#line 158 "../src/options/parse_opts.re" { opts.set_encoding(Enc::UTF8); goto opt; } -#line 1880 "src/options/parse_opts.cc" +#line 1884 "src/options/parse_opts.cc" yy449: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy487; @@ -1984,9 +1988,9 @@ yy474: goto yy283; yy475: ++YYCURSOR; -#line 156 "../src/options/parse_opts.re" +#line 166 "../src/options/parse_opts.re" { NEXT_ARG("-o, --output", opt_output); } -#line 1990 "src/options/parse_opts.cc" +#line 1994 "src/options/parse_opts.cc" yy477: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'a') goto yy515; @@ -2022,14 +2026,14 @@ yy484: goto yy283; yy485: ++YYCURSOR; -#line 153 "../src/options/parse_opts.re" +#line 157 "../src/options/parse_opts.re" { opts.set_encoding(Enc::UTF16); goto opt; } -#line 2028 "src/options/parse_opts.cc" +#line 2032 "src/options/parse_opts.cc" yy487: ++YYCURSOR; -#line 130 "../src/options/parse_opts.re" +#line 135 "../src/options/parse_opts.re" { vernum (); return EXIT_OK; } -#line 2033 "src/options/parse_opts.cc" +#line 2037 "src/options/parse_opts.cc" yy489: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy525; @@ -2168,14 +2172,14 @@ yy522: goto yy283; yy523: ++YYCURSOR; -#line 151 "../src/options/parse_opts.re" +#line 155 "../src/options/parse_opts.re" { opts.set_encoding(Enc::UTF32); goto opt; } -#line 2174 "src/options/parse_opts.cc" +#line 2178 "src/options/parse_opts.cc" yy525: ++YYCURSOR; -#line 129 "../src/options/parse_opts.re" +#line 134 "../src/options/parse_opts.re" { version (); return EXIT_OK; } -#line 2179 "src/options/parse_opts.cc" +#line 2183 "src/options/parse_opts.cc" yy527: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy564; @@ -2214,9 +2218,9 @@ yy535: goto yy283; yy536: ++YYCURSOR; -#line 178 "../src/options/parse_opts.re" +#line 188 "../src/options/parse_opts.re" { globopts.dump_cfg = true; goto opt; } -#line 2220 "src/options/parse_opts.cc" +#line 2224 "src/options/parse_opts.cc" yy538: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'u') goto yy574; @@ -2236,18 +2240,18 @@ yy540: goto yy283; yy541: ++YYCURSOR; -#line 172 "../src/options/parse_opts.re" +#line 182 "../src/options/parse_opts.re" { globopts.dump_nfa = true; goto opt; } -#line 2242 "src/options/parse_opts.cc" +#line 2246 "src/options/parse_opts.cc" yy543: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'p') goto yy580; goto yy283; yy544: ++YYCURSOR; -#line 133 "../src/options/parse_opts.re" +#line 138 "../src/options/parse_opts.re" { globopts.target = TARGET_DOT; goto opt; } -#line 2251 "src/options/parse_opts.cc" +#line 2255 "src/options/parse_opts.cc" yy546: yych = (YYCTYPE)*++YYCURSOR; if (yych == 's') goto yy581; @@ -2294,18 +2298,18 @@ yy556: goto yy283; yy557: ++YYCURSOR; -#line 136 "../src/options/parse_opts.re" +#line 141 "../src/options/parse_opts.re" { globopts.rFlag = true; goto opt; } -#line 2300 "src/options/parse_opts.cc" +#line 2304 "src/options/parse_opts.cc" yy559: yych = (YYCTYPE)*++YYCURSOR; if (yych == 's') goto yy592; goto yy283; yy560: ++YYCURSOR; -#line 139 "../src/options/parse_opts.re" +#line 144 "../src/options/parse_opts.re" { globopts.target = TARGET_SKELETON; goto opt; } -#line 2309 "src/options/parse_opts.cc" +#line 2313 "src/options/parse_opts.cc" yy562: yych = (YYCTYPE)*++YYCURSOR; if (yych == 's') goto yy593; @@ -2348,9 +2352,9 @@ yy571: goto yy283; yy572: ++YYCURSOR; -#line 177 "../src/options/parse_opts.re" +#line 187 "../src/options/parse_opts.re" { globopts.dump_adfa = true; goto opt; } -#line 2354 "src/options/parse_opts.cc" +#line 2358 "src/options/parse_opts.cc" yy574: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy604; @@ -2457,9 +2461,9 @@ yy599: goto yy283; yy600: ++YYCURSOR; -#line 132 "../src/options/parse_opts.re" +#line 137 "../src/options/parse_opts.re" { globopts.cFlag = true; goto opt; } -#line 2463 "src/options/parse_opts.cc" +#line 2467 "src/options/parse_opts.cc" yy602: yych = (YYCTYPE)*++YYCURSOR; if (yych == 't') goto yy635; @@ -2494,9 +2498,9 @@ yy609: goto yy283; yy610: ++YYCURSOR; -#line 169 "../src/options/parse_opts.re" +#line 179 "../src/options/parse_opts.re" { globopts.eager_skip = true; goto opt; } -#line 2500 "src/options/parse_opts.cc" +#line 2504 "src/options/parse_opts.cc" yy612: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy644; @@ -2511,9 +2515,9 @@ yy614: goto yy283; yy615: ++YYCURSOR; -#line 145 "../src/options/parse_opts.re" +#line 150 "../src/options/parse_opts.re" { opts.set_sFlag (true); goto opt; } -#line 2517 "src/options/parse_opts.cc" +#line 2521 "src/options/parse_opts.cc" yy617: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'f') goto yy649; @@ -2532,9 +2536,9 @@ yy620: goto yy283; yy621: ++YYCURSOR; -#line 138 "../src/options/parse_opts.re" +#line 143 "../src/options/parse_opts.re" { globopts.version = false; goto opt; } -#line 2538 "src/options/parse_opts.cc" +#line 2542 "src/options/parse_opts.cc" yy623: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy653; @@ -2557,14 +2561,14 @@ yy627: goto yy283; yy628: ++YYCURSOR; -#line 152 "../src/options/parse_opts.re" +#line 156 "../src/options/parse_opts.re" { opts.set_encoding(Enc::UCS2); goto opt; } -#line 2563 "src/options/parse_opts.cc" +#line 2567 "src/options/parse_opts.cc" yy630: ++YYCURSOR; -#line 141 "../src/options/parse_opts.re" +#line 146 "../src/options/parse_opts.re" { opts.set_bFlag (true); goto opt; } -#line 2568 "src/options/parse_opts.cc" +#line 2572 "src/options/parse_opts.cc" yy632: yych = (YYCTYPE)*++YYCURSOR; if (yych == 't') goto yy660; @@ -2607,23 +2611,23 @@ yy641: goto yy283; yy642: ++YYCURSOR; -#line 179 "../src/options/parse_opts.re" +#line 189 "../src/options/parse_opts.re" { globopts.dump_interf = true; goto opt; } -#line 2613 "src/options/parse_opts.cc" +#line 2617 "src/options/parse_opts.cc" yy644: ++YYCURSOR; -#line 160 "../src/options/parse_opts.re" +#line 170 "../src/options/parse_opts.re" { NEXT_ARG("--empty-class", opt_empty_class); } -#line 2618 "src/options/parse_opts.cc" +#line 2622 "src/options/parse_opts.cc" yy646: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'i') goto yy674; goto yy283; yy647: ++YYCURSOR; -#line 135 "../src/options/parse_opts.re" +#line 140 "../src/options/parse_opts.re" { globopts.FFlag = true; goto opt; } -#line 2627 "src/options/parse_opts.cc" +#line 2631 "src/options/parse_opts.cc" yy649: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'o') goto yy675; @@ -2650,18 +2654,18 @@ yy654: goto yy283; yy655: ++YYCURSOR; -#line 162 "../src/options/parse_opts.re" +#line 172 "../src/options/parse_opts.re" { goto opt; } -#line 2656 "src/options/parse_opts.cc" +#line 2660 "src/options/parse_opts.cc" yy657: yych = (YYCTYPE)*++YYCURSOR; if (yych == 't') goto yy682; goto yy283; yy658: ++YYCURSOR; -#line 157 "../src/options/parse_opts.re" +#line 167 "../src/options/parse_opts.re" { NEXT_ARG("-t, --type-header", opt_header); } -#line 2665 "src/options/parse_opts.cc" +#line 2669 "src/options/parse_opts.cc" yy660: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'i') goto yy683; @@ -2676,9 +2680,9 @@ yy662: goto yy283; yy663: ++YYCURSOR; -#line 142 "../src/options/parse_opts.re" +#line 147 "../src/options/parse_opts.re" { opts.set_dFlag (true); goto opt; } -#line 2682 "src/options/parse_opts.cc" +#line 2686 "src/options/parse_opts.cc" yy665: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'i') goto yy687; @@ -2689,19 +2693,19 @@ yy666: goto yy283; yy667: ++YYCURSOR; -#line 174 "../src/options/parse_opts.re" +#line 184 "../src/options/parse_opts.re" { globopts.dump_dfa_det = true; goto opt; } -#line 2695 "src/options/parse_opts.cc" +#line 2699 "src/options/parse_opts.cc" yy669: ++YYCURSOR; -#line 176 "../src/options/parse_opts.re" +#line 186 "../src/options/parse_opts.re" { globopts.dump_dfa_min = true; goto opt; } -#line 2700 "src/options/parse_opts.cc" +#line 2704 "src/options/parse_opts.cc" yy671: ++YYCURSOR; -#line 173 "../src/options/parse_opts.re" +#line 183 "../src/options/parse_opts.re" { globopts.dump_dfa_raw = true; goto opt; } -#line 2705 "src/options/parse_opts.cc" +#line 2709 "src/options/parse_opts.cc" yy673: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'p') goto yy689; @@ -2720,9 +2724,9 @@ yy676: goto yy283; yy677: ++YYCURSOR; -#line 167 "../src/options/parse_opts.re" +#line 177 "../src/options/parse_opts.re" { globopts.lookahead = false; goto opt; } -#line 2726 "src/options/parse_opts.cc" +#line 2730 "src/options/parse_opts.cc" yy679: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'a') goto yy694; @@ -2745,9 +2749,9 @@ yy683: goto yy283; yy684: ++YYCURSOR; -#line 147 "../src/options/parse_opts.re" +#line 152 "../src/options/parse_opts.re" { opts.set_bCaseInverted (true); goto opt; } -#line 2751 "src/options/parse_opts.cc" +#line 2755 "src/options/parse_opts.cc" yy686: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy700; @@ -2770,9 +2774,9 @@ yy690: goto yy283; yy691: ++YYCURSOR; -#line 144 "../src/options/parse_opts.re" +#line 149 "../src/options/parse_opts.re" { opts.set_iFlag (true); goto opt; } -#line 2776 "src/options/parse_opts.cc" +#line 2780 "src/options/parse_opts.cc" yy693: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'd') goto yy706; @@ -2787,9 +2791,9 @@ yy695: goto yy283; yy696: ++YYCURSOR; -#line 166 "../src/options/parse_opts.re" +#line 176 "../src/options/parse_opts.re" { NEXT_ARG("--posix-closure", opt_posix_closure); } -#line 2793 "src/options/parse_opts.cc" +#line 2797 "src/options/parse_opts.cc" yy698: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy710; @@ -2800,9 +2804,9 @@ yy699: goto yy283; yy700: ++YYCURSOR; -#line 143 "../src/options/parse_opts.re" +#line 148 "../src/options/parse_opts.re" { opts.set_gFlag (true); goto opt; } -#line 2806 "src/options/parse_opts.cc" +#line 2810 "src/options/parse_opts.cc" yy702: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'n') goto yy713; @@ -2829,14 +2833,18 @@ yy707: goto yy283; yy708: ++YYCURSOR; -#line 149 "../src/options/parse_opts.re" - { opts.set_posix_captures(true); goto opt; } -#line 2835 "src/options/parse_opts.cc" +#line 160 "../src/options/parse_opts.re" + { + opts.set_posix_syntax(true); + opts.set_posix_semantics(true); + goto opt; + } +#line 2843 "src/options/parse_opts.cc" yy710: ++YYCURSOR; -#line 134 "../src/options/parse_opts.re" +#line 139 "../src/options/parse_opts.re" { globopts.fFlag = true; goto opt; } -#line 2840 "src/options/parse_opts.cc" +#line 2848 "src/options/parse_opts.cc" yy712: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy721; @@ -2851,14 +2859,14 @@ yy714: goto yy283; yy715: ++YYCURSOR; -#line 175 "../src/options/parse_opts.re" +#line 185 "../src/options/parse_opts.re" { globopts.dump_dfa_tagopt = true; goto opt; } -#line 2857 "src/options/parse_opts.cc" +#line 2865 "src/options/parse_opts.cc" yy717: ++YYCURSOR; -#line 158 "../src/options/parse_opts.re" +#line 168 "../src/options/parse_opts.re" { NEXT_ARG("--encoding-policy", opt_encoding_policy); } -#line 2862 "src/options/parse_opts.cc" +#line 2870 "src/options/parse_opts.cc" yy719: yych = (YYCTYPE)*++YYCURSOR; if (yych == 't') goto yy726; @@ -2869,14 +2877,14 @@ yy720: goto yy283; yy721: ++YYCURSOR; -#line 146 "../src/options/parse_opts.re" +#line 151 "../src/options/parse_opts.re" { opts.set_bCaseInsensitive (true); goto opt; } -#line 2875 "src/options/parse_opts.cc" +#line 2883 "src/options/parse_opts.cc" yy723: ++YYCURSOR; -#line 165 "../src/options/parse_opts.re" +#line 175 "../src/options/parse_opts.re" { NEXT_ARG("--dfa-minimization", opt_dfa_minimization); } -#line 2880 "src/options/parse_opts.cc" +#line 2888 "src/options/parse_opts.cc" yy725: yych = (YYCTYPE)*++YYCURSOR; if (yych == 's') goto yy729; @@ -2887,9 +2895,9 @@ yy726: goto yy283; yy727: ++YYCURSOR; -#line 168 "../src/options/parse_opts.re" +#line 178 "../src/options/parse_opts.re" { globopts.optimize_tags = false; goto opt; } -#line 2893 "src/options/parse_opts.cc" +#line 2901 "src/options/parse_opts.cc" yy729: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy731; @@ -2900,21 +2908,21 @@ yy730: goto yy283; yy731: ++YYCURSOR; -#line 180 "../src/options/parse_opts.re" +#line 190 "../src/options/parse_opts.re" { globopts.dump_closure_stats = true; goto opt; } -#line 2906 "src/options/parse_opts.cc" +#line 2914 "src/options/parse_opts.cc" yy733: ++YYCURSOR; -#line 137 "../src/options/parse_opts.re" +#line 142 "../src/options/parse_opts.re" { globopts.bNoGenerationDate = true; goto opt; } -#line 2911 "src/options/parse_opts.cc" +#line 2919 "src/options/parse_opts.cc" } -#line 181 "../src/options/parse_opts.re" +#line 191 "../src/options/parse_opts.re" opt_output: -#line 2918 "src/options/parse_opts.cc" +#line 2926 "src/options/parse_opts.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -2956,25 +2964,25 @@ opt_output: if (yych != '-') goto yy739; yy737: ++YYCURSOR; -#line 185 "../src/options/parse_opts.re" +#line 195 "../src/options/parse_opts.re" { ERROR("bad argument to option -o, --output: %s", *argv); } -#line 2962 "src/options/parse_opts.cc" +#line 2970 "src/options/parse_opts.cc" yy739: yych = (YYCTYPE)*++YYCURSOR; if (yybm[0+yych] & 128) { goto yy739; } ++YYCURSOR; -#line 186 "../src/options/parse_opts.re" +#line 196 "../src/options/parse_opts.re" { opts.set_output_file (*argv); goto opt; } -#line 2971 "src/options/parse_opts.cc" +#line 2979 "src/options/parse_opts.cc" } -#line 187 "../src/options/parse_opts.re" +#line 197 "../src/options/parse_opts.re" opt_header: -#line 2978 "src/options/parse_opts.cc" +#line 2986 "src/options/parse_opts.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -3016,25 +3024,25 @@ opt_header: if (yych != '-') goto yy747; yy745: ++YYCURSOR; -#line 191 "../src/options/parse_opts.re" +#line 201 "../src/options/parse_opts.re" { ERROR("bad argument to option -t, --type-header: %s", *argv); } -#line 3022 "src/options/parse_opts.cc" +#line 3030 "src/options/parse_opts.cc" yy747: yych = (YYCTYPE)*++YYCURSOR; if (yybm[0+yych] & 128) { goto yy747; } ++YYCURSOR; -#line 192 "../src/options/parse_opts.re" +#line 202 "../src/options/parse_opts.re" { opts.set_header_file (*argv); goto opt; } -#line 3031 "src/options/parse_opts.cc" +#line 3039 "src/options/parse_opts.cc" } -#line 193 "../src/options/parse_opts.re" +#line 203 "../src/options/parse_opts.re" opt_incpath: -#line 3038 "src/options/parse_opts.cc" +#line 3046 "src/options/parse_opts.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -3076,25 +3084,25 @@ opt_incpath: if (yych != '-') goto yy755; yy753: ++YYCURSOR; -#line 197 "../src/options/parse_opts.re" +#line 207 "../src/options/parse_opts.re" { ERROR("bad argument to option -I: %s", *argv); } -#line 3082 "src/options/parse_opts.cc" +#line 3090 "src/options/parse_opts.cc" yy755: yych = (YYCTYPE)*++YYCURSOR; if (yybm[0+yych] & 128) { goto yy755; } ++YYCURSOR; -#line 198 "../src/options/parse_opts.re" +#line 208 "../src/options/parse_opts.re" { globopts.incpaths.push_back(*argv); goto opt; } -#line 3091 "src/options/parse_opts.cc" +#line 3099 "src/options/parse_opts.cc" } -#line 199 "../src/options/parse_opts.re" +#line 209 "../src/options/parse_opts.re" opt_encoding_policy: -#line 3098 "src/options/parse_opts.cc" +#line 3106 "src/options/parse_opts.cc" { YYCTYPE yych; yych = (YYCTYPE)*YYCURSOR; @@ -3106,12 +3114,12 @@ opt_encoding_policy: } ++YYCURSOR; yy762: -#line 203 "../src/options/parse_opts.re" +#line 213 "../src/options/parse_opts.re" { ERROR("bad argument to option --encoding-policy " "(expected: ignore | substitute | fail): %s", *argv); } -#line 3115 "src/options/parse_opts.cc" +#line 3123 "src/options/parse_opts.cc" yy763: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == 'a') goto yy766; @@ -3164,9 +3172,9 @@ yy775: goto yy767; yy776: ++YYCURSOR; -#line 209 "../src/options/parse_opts.re" +#line 219 "../src/options/parse_opts.re" { opts.set_encoding_policy (Enc::POLICY_FAIL); goto opt; } -#line 3170 "src/options/parse_opts.cc" +#line 3178 "src/options/parse_opts.cc" yy778: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy780; @@ -3185,9 +3193,9 @@ yy781: goto yy767; yy782: ++YYCURSOR; -#line 207 "../src/options/parse_opts.re" +#line 217 "../src/options/parse_opts.re" { opts.set_encoding_policy (Enc::POLICY_IGNORE); goto opt; } -#line 3191 "src/options/parse_opts.cc" +#line 3199 "src/options/parse_opts.cc" yy784: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'u') goto yy767; @@ -3198,16 +3206,16 @@ yy784: yych = (YYCTYPE)*++YYCURSOR; if (yych >= 0x01) goto yy767; ++YYCURSOR; -#line 208 "../src/options/parse_opts.re" +#line 218 "../src/options/parse_opts.re" { opts.set_encoding_policy (Enc::POLICY_SUBSTITUTE); goto opt; } -#line 3204 "src/options/parse_opts.cc" +#line 3212 "src/options/parse_opts.cc" } -#line 210 "../src/options/parse_opts.re" +#line 220 "../src/options/parse_opts.re" opt_input: -#line 3211 "src/options/parse_opts.cc" +#line 3219 "src/options/parse_opts.cc" { YYCTYPE yych; yych = (YYCTYPE)*YYCURSOR; @@ -3217,12 +3225,12 @@ opt_input: yy792: ++YYCURSOR; yy793: -#line 214 "../src/options/parse_opts.re" +#line 224 "../src/options/parse_opts.re" { ERROR("bad argument to option --input " "(expected: default | custom): %s", *argv); } -#line 3226 "src/options/parse_opts.cc" +#line 3234 "src/options/parse_opts.cc" yy794: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == 'u') goto yy796; @@ -3275,23 +3283,23 @@ yy806: goto yy797; yy807: ++YYCURSOR; -#line 219 "../src/options/parse_opts.re" +#line 229 "../src/options/parse_opts.re" { opts.set_input_api(INPUT_CUSTOM); goto opt; } -#line 3281 "src/options/parse_opts.cc" +#line 3289 "src/options/parse_opts.cc" yy809: yych = (YYCTYPE)*++YYCURSOR; if (yych >= 0x01) goto yy797; ++YYCURSOR; -#line 218 "../src/options/parse_opts.re" +#line 228 "../src/options/parse_opts.re" { opts.set_input_api(INPUT_DEFAULT); goto opt; } -#line 3288 "src/options/parse_opts.cc" +#line 3296 "src/options/parse_opts.cc" } -#line 220 "../src/options/parse_opts.re" +#line 230 "../src/options/parse_opts.re" opt_empty_class: -#line 3295 "src/options/parse_opts.cc" +#line 3303 "src/options/parse_opts.cc" { YYCTYPE yych; yych = (YYCTYPE)*YYCURSOR; @@ -3299,12 +3307,12 @@ opt_empty_class: if (yych == 'm') goto yy817; ++YYCURSOR; yy815: -#line 224 "../src/options/parse_opts.re" +#line 234 "../src/options/parse_opts.re" { ERROR("bad argument to option --empty-class " "(expected: match-empty | match-none | error): %s", *argv); } -#line 3308 "src/options/parse_opts.cc" +#line 3316 "src/options/parse_opts.cc" yy816: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == 'r') goto yy818; @@ -3349,9 +3357,9 @@ yy826: goto yy819; yy827: ++YYCURSOR; -#line 230 "../src/options/parse_opts.re" +#line 240 "../src/options/parse_opts.re" { opts.set_empty_class_policy (EMPTY_CLASS_ERROR); goto opt; } -#line 3355 "src/options/parse_opts.cc" +#line 3363 "src/options/parse_opts.cc" yy829: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy830; @@ -3395,21 +3403,21 @@ yy838: goto yy819; yy839: ++YYCURSOR; -#line 229 "../src/options/parse_opts.re" +#line 239 "../src/options/parse_opts.re" { opts.set_empty_class_policy (EMPTY_CLASS_MATCH_NONE); goto opt; } -#line 3401 "src/options/parse_opts.cc" +#line 3409 "src/options/parse_opts.cc" yy841: ++YYCURSOR; -#line 228 "../src/options/parse_opts.re" +#line 238 "../src/options/parse_opts.re" { opts.set_empty_class_policy (EMPTY_CLASS_MATCH_EMPTY); goto opt; } -#line 3406 "src/options/parse_opts.cc" +#line 3414 "src/options/parse_opts.cc" } -#line 231 "../src/options/parse_opts.re" +#line 241 "../src/options/parse_opts.re" opt_dfa_minimization: -#line 3413 "src/options/parse_opts.cc" +#line 3421 "src/options/parse_opts.cc" { YYCTYPE yych; yych = (YYCTYPE)*YYCURSOR; @@ -3417,12 +3425,12 @@ opt_dfa_minimization: if (yych == 't') goto yy848; ++YYCURSOR; yy846: -#line 235 "../src/options/parse_opts.re" +#line 245 "../src/options/parse_opts.re" { ERROR("bad argument to option --dfa-minimization " "(expected: table | moore): %s", *argv); } -#line 3426 "src/options/parse_opts.cc" +#line 3434 "src/options/parse_opts.cc" yy847: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == 'o') goto yy849; @@ -3467,33 +3475,33 @@ yy857: goto yy850; yy858: ++YYCURSOR; -#line 240 "../src/options/parse_opts.re" +#line 250 "../src/options/parse_opts.re" { globopts.dfa_minimization = DFA_MINIMIZATION_MOORE; goto opt; } -#line 3473 "src/options/parse_opts.cc" +#line 3481 "src/options/parse_opts.cc" yy860: ++YYCURSOR; -#line 239 "../src/options/parse_opts.re" +#line 249 "../src/options/parse_opts.re" { globopts.dfa_minimization = DFA_MINIMIZATION_TABLE; goto opt; } -#line 3478 "src/options/parse_opts.cc" +#line 3486 "src/options/parse_opts.cc" } -#line 241 "../src/options/parse_opts.re" +#line 251 "../src/options/parse_opts.re" opt_posix_closure: -#line 3485 "src/options/parse_opts.cc" +#line 3493 "src/options/parse_opts.cc" { YYCTYPE yych; yych = (YYCTYPE)*YYCURSOR; if (yych == 'g') goto yy866; ++YYCURSOR; yy865: -#line 245 "../src/options/parse_opts.re" +#line 255 "../src/options/parse_opts.re" { ERROR("bad argument to option --posix_closure " "(expected: gor1 | gtop): %s", *argv); } -#line 3497 "src/options/parse_opts.cc" +#line 3505 "src/options/parse_opts.cc" yy866: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == 'o') goto yy867; @@ -3527,16 +3535,16 @@ yy873: goto yy868; yy874: ++YYCURSOR; -#line 249 "../src/options/parse_opts.re" +#line 259 "../src/options/parse_opts.re" { globopts.posix_closure = POSIX_CLOSURE_GOR1; goto opt; } -#line 3533 "src/options/parse_opts.cc" +#line 3541 "src/options/parse_opts.cc" yy876: ++YYCURSOR; -#line 250 "../src/options/parse_opts.re" +#line 260 "../src/options/parse_opts.re" { globopts.posix_closure = POSIX_CLOSURE_GTOP; goto opt; } -#line 3538 "src/options/parse_opts.cc" +#line 3546 "src/options/parse_opts.cc" } -#line 251 "../src/options/parse_opts.re" +#line 261 "../src/options/parse_opts.re" end: diff --git a/re2c/bootstrap/src/parse/lex_conf.cc b/re2c/bootstrap/src/parse/lex_conf.cc index c823daeb..d6619579 100644 --- a/re2c/bootstrap/src/parse/lex_conf.cc +++ b/re2c/bootstrap/src/parse/lex_conf.cc @@ -1,4 +1,4 @@ -/* Generated by re2c 1.1.1 on Sat Jan 5 22:53:11 2019 */ +/* Generated by re2c 1.1.1 on Tue Feb 5 11:51:11 2019 */ #line 1 "../src/parse/lex_conf.re" #include "src/util/c99_stdint.h" #include @@ -105,7 +105,7 @@ void Scanner::lex_conf(Opt &opts) } } yy2: -#line 170 "../src/parse/lex_conf.re" +#line 176 "../src/parse/lex_conf.re" { fatal_lc(l, c, "unrecognized configuration '%.*s'", static_cast(cur - tok), tok); @@ -228,7 +228,7 @@ yy29: if (yybm[0+yych] & 32) { goto yy3; } -#line 66 "../src/parse/lex_conf.re" +#line 72 "../src/parse/lex_conf.re" { const int32_t eof = lex_conf_number(); if (eof < 0) fatal_lc(l, c, "eof cannot have negative value"); @@ -519,7 +519,7 @@ yy93: if (yybm[0+yych] & 32) { goto yy3; } -#line 60 "../src/parse/lex_conf.re" +#line 66 "../src/parse/lex_conf.re" { lex_conf_enc(Enc::UTF8, opts); return; } #line 525 "src/parse/lex_conf.cc" yy95: @@ -527,9 +527,14 @@ yy95: if (yybm[0+yych] & 32) { goto yy3; } -#line 50 "../src/parse/lex_conf.re" - { opts.set_posix_captures (lex_conf_bool()); return; } -#line 533 "src/parse/lex_conf.cc" +#line 55 "../src/parse/lex_conf.re" + { + bool b = lex_conf_bool(); + opts.set_posix_syntax(b); + opts.set_posix_semantics(b); + return; + } +#line 538 "src/parse/lex_conf.cc" yy97: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { @@ -537,7 +542,7 @@ yy97: } #line 49 "../src/parse/lex_conf.re" { opts.set_tags (lex_conf_bool()); return; } -#line 541 "src/parse/lex_conf.cc" +#line 546 "src/parse/lex_conf.cc" yy99: yych = (unsigned char)*++cur; if (yych <= 'Z') { @@ -558,7 +563,7 @@ yy99: yy100: #line 44 "../src/parse/lex_conf.re" { opts.set_bFlag (lex_conf_bool()); return; } -#line 562 "src/parse/lex_conf.cc" +#line 567 "src/parse/lex_conf.cc" yy101: yych = (unsigned char)*++cur; if (yych == 'a') goto yy144; @@ -584,7 +589,7 @@ yy102: yy103: #line 45 "../src/parse/lex_conf.re" { opts.set_dFlag (lex_conf_bool()); return; } -#line 588 "src/parse/lex_conf.cc" +#line 593 "src/parse/lex_conf.cc" yy104: yych = (unsigned char)*++cur; if (yych <= '_') { @@ -608,9 +613,9 @@ yy104: } } yy105: -#line 56 "../src/parse/lex_conf.re" +#line 62 "../src/parse/lex_conf.re" { lex_conf_enc(Enc::EBCDIC, opts); return; } -#line 614 "src/parse/lex_conf.cc" +#line 619 "src/parse/lex_conf.cc" yy106: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { @@ -618,7 +623,7 @@ yy106: } #line 46 "../src/parse/lex_conf.re" { opts.set_gFlag (lex_conf_bool()); return; } -#line 622 "src/parse/lex_conf.cc" +#line 627 "src/parse/lex_conf.cc" yy108: yych = (unsigned char)*++cur; if (yych <= 'Z') { @@ -639,7 +644,7 @@ yy108: yy109: #line 47 "../src/parse/lex_conf.re" { opts.set_iFlag (lex_conf_bool()); return; } -#line 643 "src/parse/lex_conf.cc" +#line 648 "src/parse/lex_conf.cc" yy110: yych = (unsigned char)*++cur; if (yych == 'e') goto yy151; @@ -663,9 +668,9 @@ yy111: } } yy112: -#line 53 "../src/parse/lex_conf.re" +#line 52 "../src/parse/lex_conf.re" { opts.set_output_file (lex_conf_string()); return; } -#line 669 "src/parse/lex_conf.cc" +#line 674 "src/parse/lex_conf.cc" yy113: yych = (unsigned char)*++cur; if (yych == 'o') goto yy154; @@ -677,7 +682,7 @@ yy114: } #line 48 "../src/parse/lex_conf.re" { opts.set_sFlag (lex_conf_bool()); return; } -#line 681 "src/parse/lex_conf.cc" +#line 686 "src/parse/lex_conf.cc" yy116: yych = (unsigned char)*++cur; if (yych <= '^') { @@ -698,9 +703,9 @@ yy116: } } yy117: -#line 54 "../src/parse/lex_conf.re" +#line 53 "../src/parse/lex_conf.re" { opts.set_header_file (lex_conf_string()); return; } -#line 704 "src/parse/lex_conf.cc" +#line 709 "src/parse/lex_conf.cc" yy118: yych = (unsigned char)*++cur; if (yych <= '^') { @@ -722,9 +727,9 @@ yy118: } } yy119: -#line 57 "../src/parse/lex_conf.re" +#line 63 "../src/parse/lex_conf.re" { lex_conf_enc(Enc::UTF32, opts); return; } -#line 728 "src/parse/lex_conf.cc" +#line 733 "src/parse/lex_conf.cc" yy120: yych = (unsigned char)*++cur; if (yych <= 'Z') { @@ -743,17 +748,17 @@ yy120: } } yy121: -#line 58 "../src/parse/lex_conf.re" +#line 64 "../src/parse/lex_conf.re" { lex_conf_enc(Enc::UCS2, opts); return; } -#line 749 "src/parse/lex_conf.cc" +#line 754 "src/parse/lex_conf.cc" yy122: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 59 "../src/parse/lex_conf.re" +#line 65 "../src/parse/lex_conf.re" { lex_conf_enc(Enc::UTF16, opts); return; } -#line 757 "src/parse/lex_conf.cc" +#line 762 "src/parse/lex_conf.cc" yy124: yych = (unsigned char)*++cur; if (yych <= 'r') goto yy4; @@ -952,9 +957,9 @@ yy170: if (yybm[0+yych] & 32) { goto yy3; } -#line 101 "../src/parse/lex_conf.re" +#line 107 "../src/parse/lex_conf.re" { opts.set_yybmHexTable (lex_conf_bool()); return; } -#line 958 "src/parse/lex_conf.cc" +#line 963 "src/parse/lex_conf.cc" yy172: yych = (unsigned char)*++cur; if (yych == 'v') goto yy212; @@ -991,9 +996,9 @@ yy179: } if (yych == '@') goto yy220; yy180: -#line 85 "../src/parse/lex_conf.re" +#line 91 "../src/parse/lex_conf.re" { opts.set_condGoto (lex_conf_string ()); return; } -#line 997 "src/parse/lex_conf.cc" +#line 1002 "src/parse/lex_conf.cc" yy181: yych = (unsigned char)*++cur; if (yych == 'r') goto yy222; @@ -1140,9 +1145,9 @@ yy213: if (yybm[0+yych] & 32) { goto yy3; } -#line 152 "../src/parse/lex_conf.re" +#line 158 "../src/parse/lex_conf.re" { opts.set_bEmitYYCh (lex_conf_bool()); return; } -#line 1146 "src/parse/lex_conf.cc" +#line 1151 "src/parse/lex_conf.cc" yy215: yych = (unsigned char)*++cur; if (yych == 'e') goto yy264; @@ -1198,9 +1203,9 @@ yy223: if (yybm[0+yych] & 32) { goto yy3; } -#line 81 "../src/parse/lex_conf.re" +#line 87 "../src/parse/lex_conf.re" { opts.set_condPrefix (lex_conf_string ()); return; } -#line 1204 "src/parse/lex_conf.cc" +#line 1209 "src/parse/lex_conf.cc" yy225: yych = (unsigned char)*++cur; if (yych == 'A') goto yy271; @@ -1325,7 +1330,7 @@ yy251: if (yybm[0+yych] & 32) { goto yy3; } -#line 137 "../src/parse/lex_conf.re" +#line 143 "../src/parse/lex_conf.re" { const int32_t n = lex_conf_number (); if (n < 0) @@ -1335,7 +1340,7 @@ yy251: opts.set_topIndent (static_cast (n)); return; } -#line 1339 "src/parse/lex_conf.cc" +#line 1344 "src/parse/lex_conf.cc" yy253: yych = (unsigned char)*++cur; if (yych == 'l') goto yy304; @@ -1370,9 +1375,9 @@ yy256: } } yy257: -#line 165 "../src/parse/lex_conf.re" +#line 171 "../src/parse/lex_conf.re" { opts.set_startlabel (lex_conf_string()); return; } -#line 1376 "src/parse/lex_conf.cc" +#line 1381 "src/parse/lex_conf.cc" yy258: yych = (unsigned char)*++cur; if (yych == 't') goto yy312; @@ -1520,9 +1525,9 @@ yy293: if (yybm[0+yych] & 32) { goto yy3; } -#line 63 "../src/parse/lex_conf.re" +#line 69 "../src/parse/lex_conf.re" { lex_conf_input(opts); return; } -#line 1526 "src/parse/lex_conf.cc" +#line 1531 "src/parse/lex_conf.cc" yy295: yych = (unsigned char)*++cur; if (yych == 'd') goto yy351; @@ -1572,9 +1577,9 @@ yy306: if (yybm[0+yych] & 32) { goto yy3; } -#line 161 "../src/parse/lex_conf.re" +#line 167 "../src/parse/lex_conf.re" { opts.set_labelPrefix (lex_conf_string ()); return; } -#line 1578 "src/parse/lex_conf.cc" +#line 1583 "src/parse/lex_conf.cc" yy308: ++cur; if (lim <= cur) YYFILL(1); @@ -1610,9 +1615,9 @@ yy312: if (yybm[0+yych] & 32) { goto yy3; } -#line 96 "../src/parse/lex_conf.re" +#line 102 "../src/parse/lex_conf.re" { opts.set_bUseStateAbort (lex_conf_bool()); return; } -#line 1616 "src/parse/lex_conf.cc" +#line 1621 "src/parse/lex_conf.cc" yy314: yych = (unsigned char)*++cur; if (yych == 'a') goto yy367; @@ -1626,9 +1631,9 @@ yy316: if (yybm[0+yych] & 32) { goto yy3; } -#line 132 "../src/parse/lex_conf.re" +#line 138 "../src/parse/lex_conf.re" { opts.set_tags_prefix (lex_conf_string ()); return; } -#line 1632 "src/parse/lex_conf.cc" +#line 1637 "src/parse/lex_conf.cc" yy318: yych = (unsigned char)*++cur; if (yych <= 'c') { @@ -1670,9 +1675,9 @@ yy324: } if (yych == '@') goto yy380; yy325: -#line 83 "../src/parse/lex_conf.re" +#line 89 "../src/parse/lex_conf.re" { opts.set_condDivider (lex_conf_string ()); return; } -#line 1676 "src/parse/lex_conf.cc" +#line 1681 "src/parse/lex_conf.cc" yy326: yych = (unsigned char)*++cur; if (yych == 'n') goto yy381; @@ -1818,9 +1823,9 @@ yy360: if (yybm[0+yych] & 32) { goto yy3; } -#line 95 "../src/parse/lex_conf.re" +#line 101 "../src/parse/lex_conf.re" { opts.set_yynext (lex_conf_string ()); return; } -#line 1824 "src/parse/lex_conf.cc" +#line 1829 "src/parse/lex_conf.cc" yy362: yych = (unsigned char)*++cur; if (yych <= '0') goto yy221; @@ -1830,9 +1835,9 @@ yy363: ++cur; yy364: cur = ctx; -#line 164 "../src/parse/lex_conf.re" +#line 170 "../src/parse/lex_conf.re" { opts.set_startlabel_force (lex_conf_bool()); return; } -#line 1836 "src/parse/lex_conf.cc" +#line 1841 "src/parse/lex_conf.cc" yy365: ++cur; if (lim <= cur) YYFILL(1); @@ -1879,9 +1884,9 @@ yy375: if (yybm[0+yych] & 32) { goto yy3; } -#line 159 "../src/parse/lex_conf.re" +#line 165 "../src/parse/lex_conf.re" { opts.set_fill_check (lex_conf_bool()); return; } -#line 1885 "src/parse/lex_conf.cc" +#line 1890 "src/parse/lex_conf.cc" yy377: yych = (unsigned char)*++cur; if (yych == 'e') goto yy431; @@ -1950,9 +1955,9 @@ yy389: } } yy390: -#line 154 "../src/parse/lex_conf.re" +#line 160 "../src/parse/lex_conf.re" { opts.set_fill (lex_conf_string ()); return; } -#line 1956 "src/parse/lex_conf.cc" +#line 1961 "src/parse/lex_conf.cc" yy391: yych = (unsigned char)*++cur; if (yych == 'O') goto yy450; @@ -1983,9 +1988,9 @@ yy397: if (yybm[0+yych] & 32) { goto yy3; } -#line 119 "../src/parse/lex_conf.re" +#line 125 "../src/parse/lex_conf.re" { opts.set_yypeek (lex_conf_string ()); return; } -#line 1989 "src/parse/lex_conf.cc" +#line 1994 "src/parse/lex_conf.cc" yy399: yych = (unsigned char)*++cur; if (yych == 'O') goto yy460; @@ -2003,9 +2008,9 @@ yy402: if (yybm[0+yych] & 32) { goto yy3; } -#line 120 "../src/parse/lex_conf.re" +#line 126 "../src/parse/lex_conf.re" { opts.set_yyskip (lex_conf_string ()); return; } -#line 2009 "src/parse/lex_conf.cc" +#line 2014 "src/parse/lex_conf.cc" yy404: yych = (unsigned char)*++cur; if (yych == 'N') goto yy463; @@ -2067,9 +2072,9 @@ yy417: if (yybm[0+yych] & 32) { goto yy3; } -#line 135 "../src/parse/lex_conf.re" +#line 141 "../src/parse/lex_conf.re" { opts.set_indString (lex_conf_string ()); return; } -#line 2073 "src/parse/lex_conf.cc" +#line 2078 "src/parse/lex_conf.cc" yy419: yych = (unsigned char)*++cur; if (yych == 'a') goto yy479; @@ -2091,17 +2096,17 @@ yy423: if (yybm[0+yych] & 32) { goto yy3; } -#line 100 "../src/parse/lex_conf.re" +#line 106 "../src/parse/lex_conf.re" { opts.set_yybm (lex_conf_string ()); return; } -#line 2097 "src/parse/lex_conf.cc" +#line 2102 "src/parse/lex_conf.cc" yy425: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 150 "../src/parse/lex_conf.re" +#line 156 "../src/parse/lex_conf.re" { opts.set_yych (lex_conf_string ()); return; } -#line 2105 "src/parse/lex_conf.cc" +#line 2110 "src/parse/lex_conf.cc" yy427: yych = (unsigned char)*++cur; if (yych == 'a') goto yy483; @@ -2123,9 +2128,9 @@ yy431: if (yybm[0+yych] & 32) { goto yy3; } -#line 155 "../src/parse/lex_conf.re" +#line 161 "../src/parse/lex_conf.re" { opts.set_fill_use (lex_conf_bool()); return; } -#line 2129 "src/parse/lex_conf.cc" +#line 2134 "src/parse/lex_conf.cc" yy433: yych = (unsigned char)*++cur; if (yych == 't') goto yy487; @@ -2140,17 +2145,17 @@ yy435: goto yy221; yy436: ++cur; -#line 86 "../src/parse/lex_conf.re" +#line 92 "../src/parse/lex_conf.re" { opts.set_condGotoParam (lex_conf_string ()); return; } -#line 2146 "src/parse/lex_conf.cc" +#line 2151 "src/parse/lex_conf.cc" yy438: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 82 "../src/parse/lex_conf.re" +#line 88 "../src/parse/lex_conf.re" { opts.set_condEnumPrefix (lex_conf_string ()); return; } -#line 2154 "src/parse/lex_conf.cc" +#line 2159 "src/parse/lex_conf.cc" yy440: yych = (unsigned char)*++cur; if (yych == 'P') goto yy491; @@ -2168,9 +2173,9 @@ yy443: if (yybm[0+yych] & 32) { goto yy3; } -#line 149 "../src/parse/lex_conf.re" +#line 155 "../src/parse/lex_conf.re" { opts.set_yyctype (lex_conf_string ()); return; } -#line 2174 "src/parse/lex_conf.cc" +#line 2179 "src/parse/lex_conf.cc" yy445: yych = (unsigned char)*++cur; if (yych == 'R') goto yy495; @@ -2180,9 +2185,9 @@ yy446: if (yybm[0+yych] & 32) { goto yy3; } -#line 147 "../src/parse/lex_conf.re" +#line 153 "../src/parse/lex_conf.re" { opts.set_yydebug (lex_conf_string ()); return; } -#line 2186 "src/parse/lex_conf.cc" +#line 2191 "src/parse/lex_conf.cc" yy448: yych = (unsigned char)*++cur; if (yych == 'n') goto yy497; @@ -2208,9 +2213,9 @@ yy453: if (yybm[0+yych] & 32) { goto yy3; } -#line 117 "../src/parse/lex_conf.re" +#line 123 "../src/parse/lex_conf.re" { opts.set_yylimit (lex_conf_string ()); return; } -#line 2214 "src/parse/lex_conf.cc" +#line 2219 "src/parse/lex_conf.cc" yy455: yych = (unsigned char)*++cur; if (yych == 'R') goto yy502; @@ -2220,17 +2225,17 @@ yy456: if (yybm[0+yych] & 32) { goto yy3; } -#line 129 "../src/parse/lex_conf.re" +#line 135 "../src/parse/lex_conf.re" { opts.set_yymtagn (lex_conf_string ()); return; } -#line 2226 "src/parse/lex_conf.cc" +#line 2231 "src/parse/lex_conf.cc" yy458: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 130 "../src/parse/lex_conf.re" +#line 136 "../src/parse/lex_conf.re" { opts.set_yymtagp (lex_conf_string ()); return; } -#line 2234 "src/parse/lex_conf.cc" +#line 2239 "src/parse/lex_conf.cc" yy460: yych = (unsigned char)*++cur; if (yych == 'R') goto yy504; @@ -2248,17 +2253,17 @@ yy463: if (yybm[0+yych] & 32) { goto yy3; } -#line 127 "../src/parse/lex_conf.re" +#line 133 "../src/parse/lex_conf.re" { opts.set_yystagn (lex_conf_string ()); return; } -#line 2254 "src/parse/lex_conf.cc" +#line 2259 "src/parse/lex_conf.cc" yy465: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 128 "../src/parse/lex_conf.re" +#line 134 "../src/parse/lex_conf.re" { opts.set_yystagp (lex_conf_string ()); return; } -#line 2262 "src/parse/lex_conf.cc" +#line 2267 "src/parse/lex_conf.cc" yy467: yych = (unsigned char)*++cur; if (yych == 'o') goto yy507; @@ -2348,7 +2353,7 @@ yy488: if (yybm[0+yych] & 32) { goto yy3; } -#line 103 "../src/parse/lex_conf.re" +#line 109 "../src/parse/lex_conf.re" { const int32_t n = lex_conf_number (); if (n < 0) @@ -2358,7 +2363,7 @@ yy488: opts.set_cGotoThreshold (static_cast (n)); return; } -#line 2362 "src/parse/lex_conf.cc" +#line 2367 "src/parse/lex_conf.cc" yy490: yych = (unsigned char)*++cur; if (yych == 'n') goto yy531; @@ -2382,9 +2387,9 @@ yy491: } } yy492: -#line 121 "../src/parse/lex_conf.re" +#line 127 "../src/parse/lex_conf.re" { opts.set_yybackup (lex_conf_string ()); return; } -#line 2388 "src/parse/lex_conf.cc" +#line 2393 "src/parse/lex_conf.cc" yy493: yych = (unsigned char)*++cur; if (yych == 'P') goto yy533; @@ -2398,9 +2403,9 @@ yy495: if (yybm[0+yych] & 32) { goto yy3; } -#line 114 "../src/parse/lex_conf.re" +#line 120 "../src/parse/lex_conf.re" { opts.set_yycursor (lex_conf_string ()); return; } -#line 2404 "src/parse/lex_conf.cc" +#line 2409 "src/parse/lex_conf.cc" yy497: yych = (unsigned char)*++cur; if (yych == 'a') goto yy535; @@ -2426,9 +2431,9 @@ yy502: if (yybm[0+yych] & 32) { goto yy3; } -#line 115 "../src/parse/lex_conf.re" +#line 121 "../src/parse/lex_conf.re" { opts.set_yymarker (lex_conf_string ()); return; } -#line 2432 "src/parse/lex_conf.cc" +#line 2437 "src/parse/lex_conf.cc" yy504: yych = (unsigned char)*++cur; if (yych == 'E') goto yy540; @@ -2498,17 +2503,17 @@ yy520: if (yybm[0+yych] & 32) { goto yy3; } -#line 97 "../src/parse/lex_conf.re" +#line 103 "../src/parse/lex_conf.re" { opts.set_bUseStateNext (lex_conf_bool()); return; } -#line 2504 "src/parse/lex_conf.cc" +#line 2509 "src/parse/lex_conf.cc" yy522: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 133 "../src/parse/lex_conf.re" +#line 139 "../src/parse/lex_conf.re" { opts.set_tags_expression(lex_conf_string ()); return; } -#line 2512 "src/parse/lex_conf.cc" +#line 2517 "src/parse/lex_conf.cc" yy524: yych = (unsigned char)*++cur; if (yych == 'p') goto yy556; @@ -2530,9 +2535,9 @@ yy528: if (yybm[0+yych] & 32) { goto yy3; } -#line 151 "../src/parse/lex_conf.re" +#line 157 "../src/parse/lex_conf.re" { opts.set_yychConversion (lex_conf_bool()); return; } -#line 2536 "src/parse/lex_conf.cc" +#line 2541 "src/parse/lex_conf.cc" yy530: yych = (unsigned char)*++cur; if (yych == 'r') goto yy560; @@ -2594,9 +2599,9 @@ yy540: } } yy541: -#line 123 "../src/parse/lex_conf.re" +#line 129 "../src/parse/lex_conf.re" { opts.set_yyrestore (lex_conf_string ()); return; } -#line 2600 "src/parse/lex_conf.cc" +#line 2605 "src/parse/lex_conf.cc" yy542: yych = (unsigned char)*++cur; if (yych == 'I') goto yy578; @@ -2676,14 +2681,14 @@ yy560: if (yybm[0+yych] & 32) { goto yy3; } -#line 157 "../src/parse/lex_conf.re" +#line 163 "../src/parse/lex_conf.re" { opts.set_fill_arg_use (lex_conf_bool()); return; } -#line 2682 "src/parse/lex_conf.cc" +#line 2687 "src/parse/lex_conf.cc" yy562: ++cur; -#line 84 "../src/parse/lex_conf.re" +#line 90 "../src/parse/lex_conf.re" { opts.set_condDividerParam (lex_conf_string ()); return; } -#line 2687 "src/parse/lex_conf.cc" +#line 2692 "src/parse/lex_conf.cc" yy564: yych = (unsigned char)*++cur; if (yych == 'X') goto yy602; @@ -2693,9 +2698,9 @@ yy565: if (yybm[0+yych] & 32) { goto yy3; } -#line 75 "../src/parse/lex_conf.re" +#line 81 "../src/parse/lex_conf.re" { opts.set_yycondtype (lex_conf_string ()); return; } -#line 2699 "src/parse/lex_conf.cc" +#line 2704 "src/parse/lex_conf.cc" yy567: yych = (unsigned char)*++cur; if (yych == 'R') goto yy604; @@ -2706,9 +2711,9 @@ yy568: goto yy4; yy569: ++cur; -#line 156 "../src/parse/lex_conf.re" +#line 162 "../src/parse/lex_conf.re" { opts.set_fill_arg (lex_conf_string ()); return; } -#line 2712 "src/parse/lex_conf.cc" +#line 2717 "src/parse/lex_conf.cc" yy571: yych = (unsigned char)*++cur; if (yych == 'T') goto yy607; @@ -2732,17 +2737,17 @@ yy572: } } yy573: -#line 89 "../src/parse/lex_conf.re" +#line 95 "../src/parse/lex_conf.re" { opts.set_state_get (lex_conf_string ()); return; } -#line 2738 "src/parse/lex_conf.cc" +#line 2743 "src/parse/lex_conf.cc" yy574: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 126 "../src/parse/lex_conf.re" +#line 132 "../src/parse/lex_conf.re" { opts.set_yylessthan (lex_conf_string ()); return; } -#line 2746 "src/parse/lex_conf.cc" +#line 2751 "src/parse/lex_conf.cc" yy576: yych = (unsigned char)*++cur; if (yych == 'T') goto yy609; @@ -2775,9 +2780,9 @@ yy579: } } yy580: -#line 91 "../src/parse/lex_conf.re" +#line 97 "../src/parse/lex_conf.re" { opts.set_state_set (lex_conf_string ()); return; } -#line 2781 "src/parse/lex_conf.cc" +#line 2786 "src/parse/lex_conf.cc" yy581: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { @@ -2805,9 +2810,9 @@ yy586: if (yybm[0+yych] & 32) { goto yy3; } -#line 64 "../src/parse/lex_conf.re" +#line 70 "../src/parse/lex_conf.re" { lex_conf_empty_class(opts); return; } -#line 2811 "src/parse/lex_conf.cc" +#line 2816 "src/parse/lex_conf.cc" yy588: yych = (unsigned char)*++cur; if (yych == 'l') goto yy618; @@ -2831,57 +2836,57 @@ yy592: if (yybm[0+yych] & 32) { goto yy3; } -#line 94 "../src/parse/lex_conf.re" +#line 100 "../src/parse/lex_conf.re" { opts.set_yyfilllabel (lex_conf_string ()); return; } -#line 2837 "src/parse/lex_conf.cc" +#line 2842 "src/parse/lex_conf.cc" yy594: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 98 "../src/parse/lex_conf.re" +#line 104 "../src/parse/lex_conf.re" { opts.set_yyaccept (lex_conf_string ()); return; } -#line 2845 "src/parse/lex_conf.cc" +#line 2850 "src/parse/lex_conf.cc" yy596: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 87 "../src/parse/lex_conf.re" +#line 93 "../src/parse/lex_conf.re" { opts.set_yyctable (lex_conf_string ()); return; } -#line 2853 "src/parse/lex_conf.cc" +#line 2858 "src/parse/lex_conf.cc" yy598: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 168 "../src/parse/lex_conf.re" +#line 174 "../src/parse/lex_conf.re" { lex_conf_string (); return; } -#line 2861 "src/parse/lex_conf.cc" +#line 2866 "src/parse/lex_conf.cc" yy600: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 112 "../src/parse/lex_conf.re" +#line 118 "../src/parse/lex_conf.re" { opts.set_yytarget (lex_conf_string ()); return; } -#line 2869 "src/parse/lex_conf.cc" +#line 2874 "src/parse/lex_conf.cc" yy602: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 122 "../src/parse/lex_conf.re" +#line 128 "../src/parse/lex_conf.re" { opts.set_yybackupctx (lex_conf_string ()); return; } -#line 2877 "src/parse/lex_conf.cc" +#line 2882 "src/parse/lex_conf.cc" yy604: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 116 "../src/parse/lex_conf.re" +#line 122 "../src/parse/lex_conf.re" { opts.set_yyctxmarker (lex_conf_string ()); return; } -#line 2885 "src/parse/lex_conf.cc" +#line 2890 "src/parse/lex_conf.cc" yy606: yych = (unsigned char)*++cur; if (yych == 'd') goto yy621; @@ -2949,9 +2954,9 @@ yy621: if (yybm[0+yych] & 32) { goto yy3; } -#line 158 "../src/parse/lex_conf.re" +#line 164 "../src/parse/lex_conf.re" { opts.set_fill_naked (lex_conf_bool()); return; } -#line 2955 "src/parse/lex_conf.cc" +#line 2960 "src/parse/lex_conf.cc" yy623: yych = (unsigned char)*++cur; if (yych == 'O') goto yy639; @@ -2965,17 +2970,17 @@ yy625: if (yybm[0+yych] & 32) { goto yy3; } -#line 124 "../src/parse/lex_conf.re" +#line 130 "../src/parse/lex_conf.re" { opts.set_yyrestorectx (lex_conf_string ()); return; } -#line 2971 "src/parse/lex_conf.cc" +#line 2976 "src/parse/lex_conf.cc" yy627: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 125 "../src/parse/lex_conf.re" +#line 131 "../src/parse/lex_conf.re" { opts.set_yyrestoretag (lex_conf_string ()); return; } -#line 2979 "src/parse/lex_conf.cc" +#line 2984 "src/parse/lex_conf.cc" yy629: yych = (unsigned char)*++cur; if (yych == 'O') goto yy641; @@ -2997,9 +3002,9 @@ yy633: if (yybm[0+yych] & 32) { goto yy3; } -#line 52 "../src/parse/lex_conf.re" +#line 51 "../src/parse/lex_conf.re" { opts.set_bCaseInverted (lex_conf_bool()); return; } -#line 3003 "src/parse/lex_conf.cc" +#line 3008 "src/parse/lex_conf.cc" yy635: yych = (unsigned char)*++cur; if (yych == 's') goto yy106; @@ -3065,9 +3070,9 @@ yy646: } } yy647: -#line 76 "../src/parse/lex_conf.re" +#line 82 "../src/parse/lex_conf.re" { opts.set_cond_get (lex_conf_string ()); return; } -#line 3071 "src/parse/lex_conf.cc" +#line 3076 "src/parse/lex_conf.cc" yy648: yych = (unsigned char)*++cur; if (yych == 'e') goto yy657; @@ -3092,9 +3097,9 @@ yy649: } } yy650: -#line 78 "../src/parse/lex_conf.re" +#line 84 "../src/parse/lex_conf.re" { opts.set_cond_set (lex_conf_string ()); return; } -#line 3098 "src/parse/lex_conf.cc" +#line 3103 "src/parse/lex_conf.cc" yy651: yych = (unsigned char)*++cur; if (yych == 'e') goto yy660; @@ -3112,9 +3117,9 @@ yy654: if (yybm[0+yych] & 32) { goto yy3; } -#line 62 "../src/parse/lex_conf.re" +#line 68 "../src/parse/lex_conf.re" { lex_conf_encoding_policy(opts); return; } -#line 3118 "src/parse/lex_conf.cc" +#line 3123 "src/parse/lex_conf.cc" yy656: yych = (unsigned char)*++cur; if (yych == 'n') goto yy664; @@ -3144,9 +3149,9 @@ yy662: if (yybm[0+yych] & 32) { goto yy3; } -#line 51 "../src/parse/lex_conf.re" +#line 50 "../src/parse/lex_conf.re" { opts.set_bCaseInsensitive (lex_conf_bool()); return; } -#line 3150 "src/parse/lex_conf.cc" +#line 3155 "src/parse/lex_conf.cc" yy664: yych = (unsigned char)*++cur; if (yych == 'a') goto yy673; @@ -3156,9 +3161,9 @@ yy665: if (yybm[0+yych] & 32) { goto yy3; } -#line 90 "../src/parse/lex_conf.re" +#line 96 "../src/parse/lex_conf.re" { opts.set_state_get_naked (lex_conf_bool()); return; } -#line 3162 "src/parse/lex_conf.cc" +#line 3167 "src/parse/lex_conf.cc" yy667: yych = (unsigned char)*++cur; if (yych == 'a') goto yy674; @@ -3172,14 +3177,14 @@ yy669: if (yybm[0+yych] & 32) { goto yy3; } -#line 92 "../src/parse/lex_conf.re" +#line 98 "../src/parse/lex_conf.re" { opts.set_state_set_naked (lex_conf_bool()); return; } -#line 3178 "src/parse/lex_conf.cc" +#line 3183 "src/parse/lex_conf.cc" yy671: ++cur; -#line 93 "../src/parse/lex_conf.re" +#line 99 "../src/parse/lex_conf.re" { opts.set_state_set_arg (lex_conf_string ()); return; } -#line 3183 "src/parse/lex_conf.cc" +#line 3188 "src/parse/lex_conf.cc" yy673: yych = (unsigned char)*++cur; if (yych == 'k') goto yy676; @@ -3214,27 +3219,27 @@ yy680: goto yy4; yy681: ++cur; -#line 79 "../src/parse/lex_conf.re" +#line 85 "../src/parse/lex_conf.re" { opts.set_cond_set_arg (lex_conf_string ()); return; } -#line 3220 "src/parse/lex_conf.cc" +#line 3225 "src/parse/lex_conf.cc" yy683: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 77 "../src/parse/lex_conf.re" +#line 83 "../src/parse/lex_conf.re" { opts.set_cond_get_naked (lex_conf_bool()); return; } -#line 3228 "src/parse/lex_conf.cc" +#line 3233 "src/parse/lex_conf.cc" yy685: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 80 "../src/parse/lex_conf.re" +#line 86 "../src/parse/lex_conf.re" { opts.set_cond_set_naked (lex_conf_bool()); return; } -#line 3236 "src/parse/lex_conf.cc" +#line 3241 "src/parse/lex_conf.cc" } -#line 174 "../src/parse/lex_conf.re" +#line 180 "../src/parse/lex_conf.re" } @@ -3242,7 +3247,7 @@ void Scanner::lex_conf_encoding_policy(Opt &opts) { lex_conf_assign (); -#line 3246 "src/parse/lex_conf.cc" +#line 3251 "src/parse/lex_conf.cc" { unsigned char yych; if ((lim - cur) < 10) YYFILL(10); @@ -3255,10 +3260,10 @@ void Scanner::lex_conf_encoding_policy(Opt &opts) } ++cur; yy690: -#line 181 "../src/parse/lex_conf.re" +#line 187 "../src/parse/lex_conf.re" { fatal_lc(get_line(), get_column(), "bad configuration value (expected: 'ignore', 'substitute', 'fail')"); } -#line 3262 "src/parse/lex_conf.cc" +#line 3267 "src/parse/lex_conf.cc" yy691: yych = (unsigned char)*(mar = ++cur); if (yych == 'a') goto yy694; @@ -3299,9 +3304,9 @@ yy700: goto yy695; yy701: ++cur; -#line 185 "../src/parse/lex_conf.re" +#line 191 "../src/parse/lex_conf.re" { opts.set_encoding_policy(Enc::POLICY_FAIL); goto end; } -#line 3305 "src/parse/lex_conf.cc" +#line 3310 "src/parse/lex_conf.cc" yy703: yych = (unsigned char)*++cur; if (yych == 'r') goto yy705; @@ -3320,9 +3325,9 @@ yy706: goto yy695; yy707: ++cur; -#line 183 "../src/parse/lex_conf.re" +#line 189 "../src/parse/lex_conf.re" { opts.set_encoding_policy(Enc::POLICY_IGNORE); goto end; } -#line 3326 "src/parse/lex_conf.cc" +#line 3331 "src/parse/lex_conf.cc" yy709: yych = (unsigned char)*++cur; if (yych != 't') goto yy695; @@ -3333,11 +3338,11 @@ yy709: yych = (unsigned char)*++cur; if (yych != 'e') goto yy695; ++cur; -#line 184 "../src/parse/lex_conf.re" +#line 190 "../src/parse/lex_conf.re" { opts.set_encoding_policy(Enc::POLICY_SUBSTITUTE); goto end; } -#line 3339 "src/parse/lex_conf.cc" +#line 3344 "src/parse/lex_conf.cc" } -#line 186 "../src/parse/lex_conf.re" +#line 192 "../src/parse/lex_conf.re" end: lex_conf_semicolon(); @@ -3347,7 +3352,7 @@ void Scanner::lex_conf_input(Opt &opts) { lex_conf_assign (); -#line 3351 "src/parse/lex_conf.cc" +#line 3356 "src/parse/lex_conf.cc" { unsigned char yych; if ((lim - cur) < 7) YYFILL(7); @@ -3358,10 +3363,10 @@ void Scanner::lex_conf_input(Opt &opts) yy717: ++cur; yy718: -#line 195 "../src/parse/lex_conf.re" +#line 201 "../src/parse/lex_conf.re" { fatal_lc(get_line(), get_column(), "bad configuration value (expected: 'default', 'custom')"); } -#line 3365 "src/parse/lex_conf.cc" +#line 3370 "src/parse/lex_conf.cc" yy719: yych = (unsigned char)*(mar = ++cur); if (yych == 'u') goto yy721; @@ -3406,18 +3411,18 @@ yy729: goto yy722; yy730: ++cur; -#line 198 "../src/parse/lex_conf.re" +#line 204 "../src/parse/lex_conf.re" { opts.set_input_api(INPUT_CUSTOM); goto end; } -#line 3412 "src/parse/lex_conf.cc" +#line 3417 "src/parse/lex_conf.cc" yy732: yych = (unsigned char)*++cur; if (yych != 't') goto yy722; ++cur; -#line 197 "../src/parse/lex_conf.re" +#line 203 "../src/parse/lex_conf.re" { opts.set_input_api(INPUT_DEFAULT); goto end; } -#line 3419 "src/parse/lex_conf.cc" +#line 3424 "src/parse/lex_conf.cc" } -#line 199 "../src/parse/lex_conf.re" +#line 205 "../src/parse/lex_conf.re" end: lex_conf_semicolon(); @@ -3427,7 +3432,7 @@ void Scanner::lex_conf_empty_class(Opt &opts) { lex_conf_assign (); -#line 3431 "src/parse/lex_conf.cc" +#line 3436 "src/parse/lex_conf.cc" { unsigned char yych; if ((lim - cur) < 11) YYFILL(11); @@ -3436,10 +3441,10 @@ void Scanner::lex_conf_empty_class(Opt &opts) if (yych == 'm') goto yy740; ++cur; yy738: -#line 208 "../src/parse/lex_conf.re" +#line 214 "../src/parse/lex_conf.re" { fatal_lc(get_line(), get_column(), "bad configuration value (expected: 'match-empty', 'match-none', 'error')"); } -#line 3443 "src/parse/lex_conf.cc" +#line 3448 "src/parse/lex_conf.cc" yy739: yych = (unsigned char)*(mar = ++cur); if (yych == 'r') goto yy741; @@ -3476,9 +3481,9 @@ yy747: goto yy742; yy748: ++cur; -#line 212 "../src/parse/lex_conf.re" +#line 218 "../src/parse/lex_conf.re" { opts.set_empty_class_policy(EMPTY_CLASS_ERROR); goto end; } -#line 3482 "src/parse/lex_conf.cc" +#line 3487 "src/parse/lex_conf.cc" yy750: yych = (unsigned char)*++cur; if (yych != '-') goto yy742; @@ -3516,16 +3521,16 @@ yy758: goto yy742; yy759: ++cur; -#line 211 "../src/parse/lex_conf.re" +#line 217 "../src/parse/lex_conf.re" { opts.set_empty_class_policy(EMPTY_CLASS_MATCH_NONE); goto end; } -#line 3522 "src/parse/lex_conf.cc" +#line 3527 "src/parse/lex_conf.cc" yy761: ++cur; -#line 210 "../src/parse/lex_conf.re" +#line 216 "../src/parse/lex_conf.re" { opts.set_empty_class_policy(EMPTY_CLASS_MATCH_EMPTY); goto end; } -#line 3527 "src/parse/lex_conf.cc" +#line 3532 "src/parse/lex_conf.cc" } -#line 213 "../src/parse/lex_conf.re" +#line 219 "../src/parse/lex_conf.re" end: lex_conf_semicolon(); @@ -3543,7 +3548,7 @@ void Scanner::lex_conf_enc(Enc::type_t enc, Opt &opts) void Scanner::lex_conf_assign () { -#line 3547 "src/parse/lex_conf.cc" +#line 3552 "src/parse/lex_conf.cc" { unsigned char yych; static const unsigned char yybm[] = { @@ -3590,9 +3595,9 @@ void Scanner::lex_conf_assign () } ++cur; yy766: -#line 230 "../src/parse/lex_conf.re" +#line 236 "../src/parse/lex_conf.re" { fatal_lc(get_line(), get_column(), "missing '=' in configuration"); } -#line 3596 "src/parse/lex_conf.cc" +#line 3601 "src/parse/lex_conf.cc" yy767: yych = (unsigned char)*(mar = ++cur); if (yych <= 0x1F) { @@ -3609,9 +3614,9 @@ yy768: if (yybm[0+yych] & 128) { goto yy768; } -#line 231 "../src/parse/lex_conf.re" +#line 237 "../src/parse/lex_conf.re" { return; } -#line 3615 "src/parse/lex_conf.cc" +#line 3620 "src/parse/lex_conf.cc" yy771: ++cur; if (lim <= cur) YYFILL(1); @@ -3625,14 +3630,14 @@ yy771: cur = mar; goto yy766; } -#line 232 "../src/parse/lex_conf.re" +#line 238 "../src/parse/lex_conf.re" } void Scanner::lex_conf_semicolon () { -#line 3636 "src/parse/lex_conf.cc" +#line 3641 "src/parse/lex_conf.cc" { unsigned char yych; static const unsigned char yybm[] = { @@ -3679,9 +3684,9 @@ void Scanner::lex_conf_semicolon () } ++cur; yy777: -#line 238 "../src/parse/lex_conf.re" +#line 244 "../src/parse/lex_conf.re" { fatal_lc(get_line(), get_column(), "missing ending ';' in configuration"); } -#line 3685 "src/parse/lex_conf.cc" +#line 3690 "src/parse/lex_conf.cc" yy778: yych = (unsigned char)*(mar = ++cur); if (yybm[0+yych] & 128) { @@ -3690,9 +3695,9 @@ yy778: if (yych != ';') goto yy777; yy779: ++cur; -#line 239 "../src/parse/lex_conf.re" +#line 245 "../src/parse/lex_conf.re" { return; } -#line 3696 "src/parse/lex_conf.cc" +#line 3701 "src/parse/lex_conf.cc" yy781: ++cur; if (lim <= cur) YYFILL(1); @@ -3704,7 +3709,7 @@ yy781: cur = mar; goto yy777; } -#line 240 "../src/parse/lex_conf.re" +#line 246 "../src/parse/lex_conf.re" } @@ -3718,7 +3723,7 @@ int32_t Scanner::lex_conf_number () lex_conf_assign (); tok = cur; -#line 3722 "src/parse/lex_conf.cc" +#line 3727 "src/parse/lex_conf.cc" { unsigned char yych; static const unsigned char yybm[] = { @@ -3765,10 +3770,10 @@ int32_t Scanner::lex_conf_number () } ++cur; yy787: -#line 253 "../src/parse/lex_conf.re" +#line 259 "../src/parse/lex_conf.re" { fatal_lc(get_line(), get_column(), "bad configuration value (expected number)"); } -#line 3772 "src/parse/lex_conf.cc" +#line 3777 "src/parse/lex_conf.cc" yy788: yych = (unsigned char)*++cur; if (yych <= '0') goto yy787; @@ -3777,7 +3782,7 @@ yy788: yy789: ++cur; yy790: -#line 255 "../src/parse/lex_conf.re" +#line 261 "../src/parse/lex_conf.re" { int32_t n = 0; if (!s_to_i32_unsafe (tok, cur, n)) { @@ -3786,7 +3791,7 @@ yy790: lex_conf_semicolon (); return n; } -#line 3790 "src/parse/lex_conf.cc" +#line 3795 "src/parse/lex_conf.cc" yy791: ++cur; if (lim <= cur) YYFILL(1); @@ -3796,7 +3801,7 @@ yy791: } goto yy790; } -#line 263 "../src/parse/lex_conf.re" +#line 269 "../src/parse/lex_conf.re" } @@ -3806,7 +3811,7 @@ std::string Scanner::lex_conf_string () std::string s; tok = cur; -#line 3810 "src/parse/lex_conf.cc" +#line 3815 "src/parse/lex_conf.cc" { unsigned char yych; static const unsigned char yybm[] = { @@ -3862,9 +3867,9 @@ std::string Scanner::lex_conf_string () } } yy795: -#line 291 "../src/parse/lex_conf.re" +#line 297 "../src/parse/lex_conf.re" { goto end; } -#line 3868 "src/parse/lex_conf.cc" +#line 3873 "src/parse/lex_conf.cc" yy796: ++cur; if (lim <= cur) YYFILL(1); @@ -3872,15 +3877,15 @@ yy796: if (yybm[0+yych] & 128) { goto yy796; } -#line 287 "../src/parse/lex_conf.re" +#line 293 "../src/parse/lex_conf.re" { s = getstr(tok, cur); goto end; } -#line 3881 "src/parse/lex_conf.cc" +#line 3886 "src/parse/lex_conf.cc" yy799: ++cur; -#line 272 "../src/parse/lex_conf.re" +#line 278 "../src/parse/lex_conf.re" { const char quote = tok[0]; for (bool end;;) { @@ -3896,9 +3901,9 @@ yy799: } } } -#line 3900 "src/parse/lex_conf.cc" +#line 3905 "src/parse/lex_conf.cc" } -#line 292 "../src/parse/lex_conf.re" +#line 298 "../src/parse/lex_conf.re" end: lex_conf_semicolon (); diff --git a/re2c/libre2c_posix/regcomp.cc b/re2c/libre2c_posix/regcomp.cc index cc6e9f1a..7d6e28bc 100644 --- a/re2c/libre2c_posix/regcomp.cc +++ b/re2c/libre2c_posix/regcomp.cc @@ -20,7 +20,8 @@ int regcomp(regex_t *preg, const char *pattern, int cflags) conopt_t globopts; globopts.FFlag = true; Opt opts(globopts); - opts.set_posix_captures(true); + opts.set_posix_syntax(true); + opts.set_posix_semantics((cflags & REG_LEFTMOST) == 0); const opt_t *opt = opts.snapshot(); Warn warn; diff --git a/re2c/libre2c_posix/test.cpp b/re2c/libre2c_posix/test.cpp index 6b16ad71..13cf0243 100644 --- a/re2c/libre2c_posix/test.cpp +++ b/re2c/libre2c_posix/test.cpp @@ -85,7 +85,7 @@ end: #define T9(R,S,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) { GS = {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r}; T(R,S,gs); } #define T10(R,S,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) { GS = {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t}; T(R,S,gs); } -int test_all(int flags) +static int test_all_posix(int flags) { int e = 0; @@ -500,6 +500,421 @@ int test_all(int flags) return e; } +static int test_all_leftmost(int flags) +{ + int e = 0; + + T1("a", "a", 0,1); + T2("(a)", "a", 0,1, 0,1); + T2("(a*)", "aaa", 0,3, 0,3); + T3("(a*)(b*)", "aabb", 0,4, 0,2, 2,4); + T3("(a*)(a*)", "aa", 0,2, 0,2, 2,2); + T2("(a|aa)*", "aa", 0,2, 1,2); + T3("(a)|(a)", "a", 0,1, 0,1, -1,-1); + T3("(a)*(a)*", "a", 0,1, 0,1, -1,-1); + + T1("[a]", "a", 0,1); + T0("[a]", "b"); + T0("[^a]", "a"); + T1("[^a]", "b", 0,1); + T1("[ac]*", "ac", 0,2); + T1("[a-c]*", "abc", 0,3); + T1("[]]", "]", 0,1); + T0("[^]]", "]"); + T1("[^]]", "a", 0,1); + T1("[-]", "-", 0,1); + T1("[]-]*", "]-", 0,2); + T1("[-a]*", "-a", 0,2); + T1("[a-]*", "-a", 0,2); + T1("[-a-]*", "-a", 0,2); + + // basic + T3("(..)*(...)*", "a", 0,0, -1,-1, -1,-1); + T3("(..)*(...)*", "abcd", 0,4, 2,4, -1,-1); + T3("(ab|a)(bc|c)", "abc", 0,3, 0,2, 2,3); + T2("(ab)c|abc", "abc", 0,3, 0,2); + T4("(a*)(b?)(b+)b{3}", "aaabbbbbbb", 0,10, 0,3, 3,4, 4,7); + T4("(a*)(b{0,1})(b{1,})b{3}", "aaabbbbbbb", 0,10, 0,3, 3,4, 4,7); + T3("((a|a)|a)", "a", 0,1, 0,1, 0,1); + T3("(a*)(a|aa)", "aaaa", 0,4, 0,3, 3,4); + T2("a*(a.|aa)", "aaaa", 0,4, 2,4); + T4("a(b)|c(d)|a(e)f", "aef", 0,3, -1,-1, -1,-1, 1,2); + T2("(a|b)?.*", "b", 0,1, 0,1); + T3("(a|b)c|a(b|c)", "ac", 0,2, 0,1, -1,-1); + T3("(a|b)c|a(b|c)", "ab", 0,2, -1,-1, 1,2); + T3("(a|b)*c|(a|ab)*c", "abc", 0,3, 1,2, -1,-1); + T3("(.a|.b).*|.*(.a|.b)", "xa", 0,2, 0,2, -1,-1); + T2("a?(ab|ba)ab", "abab", 0,4, 0,2); + T2("a?(a[c]{0}b|ba)ab", "abab", 0,4, 0,2); + T1("ab|abab", "abbabab", 0,2); + T3("(aa|aaa)*|(a|aaaaa)", "aa", 0,2, 0,2, -1,-1); + T3("(a.|.a.)*|(a|.a...)", "aa", 0,2, 0,2, -1,-1); + T4("(a)(b)(c)", "abc", 0,3, 0,1, 1,2, 2,3); + T7("((((((x))))))", "x", 0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1); + T7("((((((x))))))*", "xx", 0,2, 1,2, 1,2, 1,2, 1,2, 1,2, 1,2); + T2("a?(ab|ba)*", "ababababababababababababababababababababababababababababababababababababababababa", 0,81, 79,81); + T1("a*a*a*a*a*b", "aaaaaaaaab", 0,10); + T1("a[b]+bc", "abbc", 0,4); + T1("a[b]+bc", "abbbbc", 0,6); + T1("a[b]?bc", "abbc", 0,4); + T1("a[b]?bc", "abc", 0,3); + T1("a[b]?c", "abc", 0,3); + T1("ab|cd", "abc", 0,2); + T1("ab|cd", "abcd", 0,2); + T3("((a))", "abc", 0,1, 0,1, 0,1); + T3("(a)b(c)", "abc", 0,3, 0,1, 2,3); + T1("a*", "aaa", 0,3); + T2("(a*)*", "-", 0,0, 0,0); + T2("(a*)+", "-", 0,0, 0,0); + T2("(a*|b)*", "-", 0,0, 0,0); + T2("(a+|b)*", "ab", 0,2, 1,2); + T2("(a+|b)+", "ab", 0,2, 1,2); + T2("(a+|b)?", "ab", 0,1, 0,1); + T2("([abc])*d", "abbbcd", 0,6, 4,5); + T2("([abc])*bcd", "abcd", 0,4, 0,1); + T1("a|b|c|d|e", "e", 0,1); + T2("(a|b|c|d|e)f", "ef", 0,2, 0,1); + T3("((a*|b))*", "-", 0,0, 0,0, 0,0); + T2("(ab|a[b]*)bc", "abc", 0,3, 0,1); + T2("a([bc]*)c*", "abc", 0,3, 1,3); + T3("a([bc]*)(c*d)", "abcd", 0,4, 1,3, 3,4); + T3("a([bc]+)(c*d)", "abcd", 0,4, 1,3, 3,4); + T3("a([bc]*)(c+d)", "abcd", 0,4, 1,2, 2,4); + T1("a[bcd]*dcdcde", "adcdcde", 0,7); + T2("(ab|a)b*c", "abc", 0,3, 0,2); + T5("((a)(b)c)(d)", "abcd", 0,4, 0,3, 0,1, 1,2, 3,4); + T3("(.*)c(.*)", "abcde", 0,5, 0,2, 3,5); + T2("a(bc)d", "abcd", 0,4, 1,3); + T2("a+(b|c)*d+", "aabcdd", 0,6, 3,4); + + // categorize + T4("(a*)(ab)*(b*)", "abc", 0,2, 0,1, -1,-1, 1,2); + T7("((a*)(ab)*)((b*)(a*))", "aba", 0,3, 0,1, 0,1, -1,-1, 1,3, 1,2, 2,3); + T2("(...?.?)*", "xxxxxx", 0,6, 4,6); + T3("(a|ab)(bc|c)", "abcabc", 0,3, 0,1, 1,3); + T3("(aba|a*b)(aba|a*b)", "ababa", 0,5, 0,2, 2,5); + T2("(a*){2}", "xxxxx", 0,0, 0,0); + T2("(a*)*", "a", 0,1, 0,1); + T2("(aba|a*b)*", "ababa", 0,5, 2,5); + T3("(a(b)?)+", "aba", 0,3, 2,3, -1,-1); + T2(".*(.*)", "ab", 0,2, 2,2); + T6("(a?)((ab)?)(b?)a?(ab)?b?", "abab", 0,4, 0,1, 1,1, -1,-1, 1,2, -1,-1); + + // forcedassoc + T3("(a|ab)(c|bcd)", "abcd", 0,4, 0,1, 1,4); + T3("(a|ab)(bcd|c)", "abcd", 0,4, 0,1, 1,4); + T3("(ab|a)(c|bcd)", "abcd", 0,4, 0,1, 1,4); + T3("(ab|a)(bcd|c)", "abcd", 0,4, 0,1, 1,4); + T5("((a|ab)(c|bcd))(d*)", "abcd", 0,4, 0,4, 0,1, 1,4, 4,4); + T5("((a|ab)(bcd|c))(d*)", "abcd", 0,4, 0,4, 0,1, 1,4, 4,4); + T5("((ab|a)(c|bcd))(d*)", "abcd", 0,4, 0,3, 0,2, 2,3, 3,4); + T5("((ab|a)(bcd|c))(d*)", "abcd", 0,4, 0,3, 0,2, 2,3, 3,4); + T5("(a|ab)((c|bcd)(d*))", "abcd", 0,4, 0,1, 1,4, 1,4, 4,4); + T5("(a|ab)((bcd|c)(d*))", "abcd", 0,4, 0,1, 1,4, 1,4, 4,4); + T5("(ab|a)((c|bcd)(d*))", "abcd", 0,4, 0,2, 2,4, 2,3, 3,4); + T5("(ab|a)((bcd|c)(d*))", "abcd", 0,4, 0,2, 2,4, 2,3, 3,4); + T3("(a*)(b|abc)", "abc", 0,3, 0,0, 0,3); + T3("(a*)(abc|b)", "abc", 0,3, 0,0, 0,3); + T5("((a*)(b|abc))(c*)", "abc", 0,3, 0,2, 0,1, 1,2, 2,3); + T5("((a*)(abc|b))(c*)", "abc", 0,3, 0,2, 0,1, 1,2, 2,3); + T5("(a*)((b|abc)(c*))", "abc", 0,3, 0,1, 1,3, 1,2, 2,3); + T5("(a*)((abc|b)(c*))", "abc", 0,3, 0,1, 1,3, 1,2, 2,3); + T3("(a*)(b|abc)", "abc", 0,3, 0,0, 0,3); + T3("(a*)(abc|b)", "abc", 0,3, 0,0, 0,3); + T5("((a*)(b|abc))(c*)", "abc", 0,3, 0,2, 0,1, 1,2, 2,3); + T5("((a*)(abc|b))(c*)", "abc", 0,3, 0,2, 0,1, 1,2, 2,3); + T5("(a*)((b|abc)(c*))", "abc", 0,3, 0,1, 1,3, 1,2, 2,3); + T5("(a*)((abc|b)(c*))", "abc", 0,3, 0,1, 1,3, 1,2, 2,3); + T2("(a|ab)", "ab", 0,2, 0,2); + T2("(ab|a)", "ab", 0,2, 0,2); + T3("(a|ab)(b*)", "ab", 0,2, 0,1, 1,2); + T3("(ab|a)(b*)", "ab", 0,2, 0,2, 2,2); + + // glennfowler + T4("(a?)((ab)?)", "ab", 0,2, 0,0, 0,2, 0,2); + T5("(a?)((ab)?)(b?)", "ab", 0,2, 0,1, 1,1, -1,-1, 1,2); + T6("((a?)((ab)?))(b?)", "ab", 0,2, 0,1, 0,1, 1,1, -1,-1, 1,2); + T6("(a?)(((ab)?)(b?))", "ab", 0,2, 0,1, 1,2, 1,1, -1,-1, 1,2); + T2("(.?)", "x", 0,1, 0,1); + T2("(.?){1}", "x", 0,1, 0,1); + T3("(.?)(.?)", "x", 0,1, 0,1, 1,1); + T2("(.?){2}", "x", 0,1, 1,1); + T2("(.?)*", "x", 0,1, 0,1); + T2("(.?.?)", "xxx", 0,2, 0,2); + T2("(.?.?){1}", "xxx", 0,2, 0,2); + T3("(.?.?)(.?.?)", "xxx", 0,3, 0,2, 2,3); + T2("(.?.?){2}", "xxx", 0,3, 2,3); + T4("(.?.?)(.?.?)(.?.?)", "xxx", 0,3, 0,2, 2,3, 3,3); + T2("(.?.?){3}", "xxx", 0,3, 3,3); + T2("(.?.?)*", "xxx", 0,3, 2,3); + T4("a?((ab)?)(b?)", "ab", 0,2, 1,1, -1,-1, 1,2); + T4("(a?)((ab)?)b?", "ab", 0,2, 0,1, 1,1, -1,-1); + T3("a?((ab)?)b?", "ab", 0,2, 1,1, -1,-1); + T2("(a*){2}", "xxxxx", 0,0, 0,0); + T3("(ab?)(b?a)", "aba", 0,3, 0,2, 2,3); + T3("(a|ab)(ba|a)", "aba", 0,3, 0,1, 1,3); + T2("(a|ab|ba)", "aba", 0,2, 0,2); + T3("(a|ab|ba)(a|ab|ba)", "aba", 0,3, 0,1, 1,3); + T2("(a|ab|ba)*", "aba", 0,3, 1,3); + T2("(aba|a*b)", "ababa", 0,3, 0,3); + T3("(aba|a*b)(aba|a*b)", "ababa", 0,5, 0,2, 2,5); + T0("(aba|a*b)(aba|a*b)(aba|a*b)", "ababa"); + T2("(aba|a*b)*", "ababa", 0,5, 2,5); + T2("(aba|ab|a)", "ababa", 0,3, 0,3); + T3("(aba|ab|a)(aba|ab|a)", "ababa", 0,5, 0,2, 2,5); + T4("(aba|ab|a)(aba|ab|a)(aba|ab|a)", "ababa", 0,5, 0,2, 2,4, 4,5); + T2("(aba|ab|a)*", "ababa", 0,5, 2,5); + T3("(a(b)?)", "aba", 0,2, 0,2, 1,2); + T5("(a(b)?)(a(b)?)", "aba", 0,3, 0,2, 1,2, 2,3, -1,-1); + T3("(a(b)?)+", "aba", 0,3, 2,3, -1,-1); + T3("(.*)(.*)", "xx", 0,2, 0,2, 2,2); + T2(".*(.*)", "xx", 0,2, 2,2); + T2("(a.*z|b.*y)", "azbazby", 0,5, 0,5); + T3("(a.*z|b.*y)(a.*z|b.*y)", "azbazby", 0,7, 0,5, 5,7); + T2("(a.*z|b.*y)*", "azbazby", 0,7, 5,7); + T3("(.|..)(.*)", "ab", 0,2, 0,1, 1,2); + T4("((..)*(...)*)", "xxx", 0,3, 0,3, -1,-1, 0,3); + T7("((..)*(...)*)((..)*(...)*)", "xxx", 0,3, 0,3, -1,-1, 0,3, 3,3, -1,-1, -1,-1); + T4("((..)*(...)*)*", "xxx", 0,3, 0,3, -1,-1, 0,3); + + // nullsubexpr + T2("(a*)*", "a", 0,1, 0,1); + T2("(a*)*", "x", 0,0, 0,0); + T2("(a*)*", "aaaaaa", 0,6, 0,6); + T2("(a*)*", "aaaaaax", 0,6, 0,6); + T2("(a*)+", "a", 0,1, 0,1); + T2("(a*)+", "x", 0,0, 0,0); + T2("(a*)+", "aaaaaa", 0,6, 0,6); + T2("(a*)+", "aaaaaax", 0,6, 0,6); + T2("(a+)*", "a", 0,1, 0,1); + T2("(a+)*", "x", 0,0, -1,-1); + T2("(a+)*", "aaaaaa", 0,6, 0,6); + T2("(a+)*", "aaaaaax", 0,6, 0,6); + T2("(a+)+", "a", 0,1, 0,1); + T0("(a+)+", "x"); + T2("(a+)+", "aaaaaa", 0,6, 0,6); + T2("(a+)+", "aaaaaax", 0,6, 0,6); + T2("([a]*)*", "a", 0,1, 0,1); + T2("([a]*)*", "x", 0,0, 0,0); + T2("([a]*)*", "aaaaaa", 0,6, 0,6); + T2("([a]*)*", "aaaaaax", 0,6, 0,6); + T2("([a]*)+", "a", 0,1, 0,1); + T2("([a]*)+", "x", 0,0, 0,0); + T2("([a]*)+", "aaaaaa", 0,6, 0,6); + T2("([a]*)+", "aaaaaax", 0,6, 0,6); + T2("([^b]*)*", "a", 0,1, 0,1); + T2("([^b]*)*", "b", 0,0, 0,0); + T2("([^b]*)*", "aaaaaa", 0,6, 0,6); + T2("([^b]*)*", "aaaaaab", 0,6, 0,6); + T2("([ab]*)*", "a", 0,1, 0,1); + T2("([ab]*)*", "aaaaaa", 0,6, 0,6); + T2("([ab]*)*", "ababab", 0,6, 0,6); + T2("([ab]*)*", "bababa", 0,6, 0,6); + T2("([ab]*)*", "b", 0,1, 0,1); + T2("([ab]*)*", "bbbbbb", 0,6, 0,6); + T2("([ab]*)*", "aaaabcde", 0,5, 0,5); + T2("([^a]*)*", "b", 0,1, 0,1); + T2("([^a]*)*", "bbbbbb", 0,6, 0,6); + T2("([^a]*)*", "aaaaaa", 0,0, 0,0); + T2("([^ab]*)*", "ccccxx", 0,6, 0,6); + T2("([^ab]*)*", "ababab", 0,0, 0,0); + T3("((z)+|a)*", "zabcde", 0,2, 1,2, -1,-1); + T2("(a)", "aaa", 0,1, 0,1); + T3("(a*)*(x)", "x", 0,1, 0,0, 0,1); + T3("(a*)*(x)", "ax", 0,2, 0,1, 1,2); + T3("(a*)*(x)", "axa", 0,2, 0,1, 1,2); + T3("(a*)+(x)", "x", 0,1, 0,0, 0,1); + T3("(a*)+(x)", "ax", 0,2, 0,1, 1,2); + T3("(a*)+(x)", "axa", 0,2, 0,1, 1,2); + T3("(a*){2}(x)", "x", 0,1, 0,0, 0,1); + T3("(a*){2}(x)", "ax", 0,2, 1,1, 1,2); + T3("(a*){2}(x)", "axa", 0,2, 1,1, 1,2); + + T4("(()|.)(b)", "ab", 0,2, 0,1, -1,-1, 1,2); + T4("(()|[ab])(b)", "ab", 0,2, 0,1, -1,-1, 1,2); + T3("(()|[ab])+b", "aaab", 0,4, 2,3, -1,-1); + T4("(.|())(b)", "ab", 0,2, 0,1, -1,-1, 1,2); + T4("([ab]|())(b)", "ab", 0,2, 0,1, -1,-1, 1,2); + T3("([ab]|())+b", "aaab", 0,4, 2,3, -1,-1); + T3("(.?)(b)", "ab", 0,2, 0,1, 1,2); + + // other + T2("(a|aa)*", "aaa", 0,3, 2,3); + T2("(a|aa)*", "aaaa", 0,4, 3,4); + T2("(aa|a)*", "aaa", 0,3, 2,3); + T2("(aa|a)*", "aaaa", 0,4, 2,4); + T2("a|(a)", "a", 0,1, -1,-1); + T2("(a)|a", "a", 0,1, 0,1); + T3("(b)a|b(a)", "ba", 0,2, 0,1, -1,-1); + T3("b(a)|(b)a", "ba", 0,2, 1,2, -1,-1); + T2("a*|(a|aa)*", "aa", 0,2, -1,-1); + T2("(a|aa)*|a*", "aa", 0,2, 1,2); + T2("(aa*|aaa*)*", "aaaaaa", 0,6, 0,6); + T3("(aa*|aaa*)(aa*|aaa*)", "aaaaaa", 0,6, 0,5, 5,6); + T2("(aa*|aaa*){2}", "aaaaaa", 0,6, 5,6); + T7("((aa)*|(aaa)*)((aa)*|(aaa)*)", "aaaaaa", 0,6, 0,6, 4,6, -1,-1, 6,6, -1,-1, -1,-1); + T4("((aa)*|(aaa)*){2}", "aaaaaa", 0,6, 6,6, -1,-1, -1,-1); + T3("(aa)*|(aaa)*", "aaaaaa", 0,6, 4,6, -1,-1); + T2("(X|Xa|Xab|Xaba|abab|baba|bY|Y)*", "XY", 0,2, 1,2); + T2("(X|Xa|Xab|Xaba|abab|baba|bY|Y)*", "XabY", 0,4, 2,4); + T2("(X|Xa|Xab|Xaba|abab|baba|bY|Y)*", "XababY", 0,6, 5,6); + T2("(X|Xa|Xab|Xaba|abab|baba|bY|Y)*", "XabababY", 0,8, 6,8); + T2("(X|Xa|Xab|Xaba|abab|baba|bY|Y)*", "XababababY", 0,10, 9,10); + T0("(y){2}", "NULL"); + T0("(y){2}", "y"); + T2("(y){2}", "yy", 0,2, 1,2); + T2("(y){0,2}", "NULL", 0,0, -1,-1); + T2("(y){0,2}", "y", 0,1, 0,1); + T2("(y){0,2}", "yy", 0,2, 1,2); + T0("(y){1,2}", "NULL"); + T2("(y){1,2}", "y", 0,1, 0,1); + T2("(y){1,2}", "yy", 0,2, 1,2); + T0("(y){1,2}y", "NULL"); + T0("(y){1,2}y", "y"); + T2("(y){1,2}y", "yy", 0,2, 0,1); + T2("(y){1,2}y", "yyy", 0,3, 1,2); + T0("(y){1,2}y?", "NULL"); + T2("(y){1,2}y?", "y", 0,1, 0,1); + T2("(y){1,2}y?", "yy", 0,2, 1,2); + T2("(y){1,2}y?", "yyy", 0,3, 1,2); + T0("(y){2,}", "NULL"); + T0("(y){2,}", "y"); + T2("(y){2,}", "yy", 0,2, 1,2); + T2("(y){2,}", "yyy", 0,3, 2,3); + T2("(y?){2}", "NULL", 0,0, 0,0); + T2("(y?){2}", "y", 0,1, 1,1); + T2("(y?){2}", "yy", 0,2, 1,2); + T2("(y?){0,2}", "NULL", 0,0, 0,0); + T2("(y?){0,2}", "y", 0,1, 1,1); + T2("(y?){0,2}", "yy", 0,2, 1,2); + T2("(y?){1,2}", "NULL", 0,0, 0,0); + T2("(y?){1,2}", "y", 0,1, 1,1); + T2("(y?){1,2}", "yy", 0,2, 1,2); + T0("(y?){1,2}y", "NULL"); + T2("(y?){1,2}y", "y", 0,1, 0,0); + T2("(y?){1,2}y", "yy", 0,2, 1,1); + T2("(y?){1,2}y", "yyy", 0,3, 1,2); + T2("(y?){1,2}y?", "NULL", 0,0, 0,0); + T2("(y?){1,2}y?", "y", 0,1, 1,1); + T2("(y?){1,2}y?", "yy", 0,2, 1,2); + T2("(y?){1,2}y?", "yyy", 0,3, 1,2); + T2("(y?){2,}", "NULL", 0,0, 0,0); + T2("(y?){2,}", "y", 0,1, 1,1); + T2("(y?){2,}", "yy", 0,2, 1,2); + T2("(y?){2,}", "yyy", 0,3, 2,3); + T3("(y|(x?)){1,3}", "y", 0,1, 1,1, 1,1); + T2("(y[y]?){3}", "yyyy", 0,4, 3,4); + + // repetition + T0("((..)|(.))", ""); + T0("((..)|(.))((..)|(.))", ""); + T0("((..)|(.))((..)|(.))((..)|(.))", ""); + T0("((..)|(.)){1}", ""); + T0("((..)|(.)){2}", ""); + T0("((..)|(.)){3}", ""); + T4("((..)|(.))*", "", 0,0, -1,-1, -1,-1, -1,-1); + T4("((..)|(.))", "a", 0,1, 0,1, -1,-1, 0,1); + T0("((..)|(.))((..)|(.))", "a"); + T0("((..)|(.))((..)|(.))((..)|(.))", "a"); + T4("((..)|(.)){1}", "a", 0,1, 0,1, -1,-1, 0,1); + T0("((..)|(.)){2}", "a"); + T0("((..)|(.)){3}", "a"); + T4("((..)|(.))*", "a", 0,1, 0,1, -1,-1, 0,1); + T4("((..)|(.))", "aa", 0,2, 0,2, 0,2, -1,-1); + T7("((..)|(.))((..)|(.))", "aa", 0,2, 0,1, -1,-1, 0,1, 1,2, -1,-1, 1,2); + T0("((..)|(.))((..)|(.))((..)|(.))", "aa"); + T4("((..)|(.)){1}", "aa", 0,2, 0,2, 0,2, -1,-1); + T4("((..)|(.)){2}", "aa", 0,2, 1,2, -1,-1, 1,2); + T0("((..)|(.)){3}", "aa"); + T4("((..)|(.))*", "aa", 0,2, 0,2, 0,2, -1,-1); + T4("((..)|(.))", "aaa", 0,2, 0,2, 0,2, -1,-1); + T7("((..)|(.))((..)|(.))", "aaa", 0,3, 0,2, 0,2, -1,-1, 2,3, -1,-1, 2,3); + T10("((..)|(.))((..)|(.))((..)|(.))", "aaa", 0,3, 0,1, -1,-1, 0,1, 1,2, -1,-1, 1,2, 2,3, -1,-1, 2,3); + T4("((..)|(.)){1}", "aaa", 0,2, 0,2, 0,2, -1,-1); + T4("((..)|(.)){2}", "aaa", 0,3, 2,3, -1,-1, 2,3); + T4("((..)|(.)){3}", "aaa", 0,3, 2,3, -1,-1, 2,3); + T4("((..)|(.))*", "aaa", 0,3, 2,3, -1,-1, 2,3); + T4("((..)|(.))", "aaaa", 0,2, 0,2, 0,2, -1,-1); + T7("((..)|(.))((..)|(.))", "aaaa", 0,4, 0,2, 0,2, -1,-1, 2,4, 2,4, -1,-1); + T10("((..)|(.))((..)|(.))((..)|(.))", "aaaa", 0,4, 0,2, 0,2, -1,-1, 2,3, -1,-1, 2,3, 3,4, -1,-1, 3,4); + T4("((..)|(.)){1}", "aaaa", 0,2, 0,2, 0,2, -1,-1); + T4("((..)|(.)){2}", "aaaa", 0,4, 2,4, 2,4, -1,-1); + T4("((..)|(.)){3}", "aaaa", 0,4, 3,4, -1,-1, 3,4); + T4("((..)|(.))*", "aaaa", 0,4, 2,4, 2,4, -1,-1); + T4("((..)|(.))", "aaaaa", 0,2, 0,2, 0,2, -1,-1); + T7("((..)|(.))((..)|(.))", "aaaaa", 0,4, 0,2, 0,2, -1,-1, 2,4, 2,4, -1,-1); + T10("((..)|(.))((..)|(.))((..)|(.))", "aaaaa", 0,5, 0,2, 0,2, -1,-1, 2,4, 2,4, -1,-1, 4,5, -1,-1, 4,5); + T4("((..)|(.)){1}", "aaaaa", 0,2, 0,2, 0,2, -1,-1); + T4("((..)|(.)){2}", "aaaaa", 0,4, 2,4, 2,4, -1,-1); + T4("((..)|(.)){3}", "aaaaa", 0,5, 4,5, -1,-1, 4,5); + T4("((..)|(.))*", "aaaaa", 0,5, 4,5, -1,-1, 4,5); + T4("((..)|(.))", "aaaaaa", 0,2, 0,2, 0,2, -1,-1); + T7("((..)|(.))((..)|(.))", "aaaaaa", 0,4, 0,2, 0,2, -1,-1, 2,4, 2,4, -1,-1); + T10("((..)|(.))((..)|(.))((..)|(.))", "aaaaaa", 0,6, 0,2, 0,2, -1,-1, 2,4, 2,4, -1,-1, 4,6, 4,6, -1,-1); + T4("((..)|(.)){1}", "aaaaaa", 0,2, 0,2, 0,2, -1,-1); + T4("((..)|(.)){2}", "aaaaaa", 0,4, 2,4, 2,4, -1,-1); + T4("((..)|(.)){3}", "aaaaaa", 0,6, 4,6, 4,6, -1,-1); + T4("((..)|(.))*", "aaaaaa", 0,6, 4,6, 4,6, -1,-1); + T2("X(.?){0,}Y", "X1234567Y", 0,9, 7,8); + T2("X(.?){1,}Y", "X1234567Y", 0,9, 7,8); + T2("X(.?){2,}Y", "X1234567Y", 0,9, 7,8); + T2("X(.?){3,}Y", "X1234567Y", 0,9, 7,8); + T2("X(.?){4,}Y", "X1234567Y", 0,9, 7,8); + T2("X(.?){5,}Y", "X1234567Y", 0,9, 7,8); + T2("X(.?){6,}Y", "X1234567Y", 0,9, 7,8); + T2("X(.?){7,}Y", "X1234567Y", 0,9, 7,8); + T2("X(.?){8,}Y", "X1234567Y", 0,9, 8,8); + T2("X(.?){0,8}Y", "X1234567Y", 0,9, 8,8); + T2("X(.?){1,8}Y", "X1234567Y", 0,9, 8,8); + T2("X(.?){2,8}Y", "X1234567Y", 0,9, 8,8); + T2("X(.?){3,8}Y", "X1234567Y", 0,9, 8,8); + T2("X(.?){4,8}Y", "X1234567Y", 0,9, 8,8); + T2("X(.?){5,8}Y", "X1234567Y", 0,9, 8,8); + T2("X(.?){6,8}Y", "X1234567Y", 0,9, 8,8); + T2("X(.?){7,8}Y", "X1234567Y", 0,9, 8,8); + T2("X(.?){8,8}Y", "X1234567Y", 0,9, 8,8); + T3("(a|ab|c|bcd){0,}(d*)", "ababcd", 0,6, 3,6, 6,6); + T3("(a|ab|c|bcd){1,}(d*)", "ababcd", 0,6, 3,6, 6,6); + T3("(a|ab|c|bcd){2,}(d*)", "ababcd", 0,6, 3,6, 6,6); + T3("(a|ab|c|bcd){3,}(d*)", "ababcd", 0,6, 3,6, 6,6); + T0("(a|ab|c|bcd){4,}(d*)", "ababcd"); + T3("(a|ab|c|bcd){0,10}(d*)", "ababcd", 0,6, 3,6, 6,6); + T3("(a|ab|c|bcd){1,10}(d*)", "ababcd", 0,6, 3,6, 6,6); + T3("(a|ab|c|bcd){2,10}(d*)", "ababcd", 0,6, 3,6, 6,6); + T3("(a|ab|c|bcd){3,10}(d*)", "ababcd", 0,6, 3,6, 6,6); + T0("(a|ab|c|bcd){4,10}(d*)", "ababcd"); + T3("(a|ab|c|bcd)*(d*)", "ababcd", 0,6, 3,6, 6,6); + T3("(a|ab|c|bcd)+(d*)", "ababcd", 0,6, 3,6, 6,6); + T3("(ab|a|c|bcd){0,}(d*)", "ababcd", 0,6, 4,5, 5,6); + T3("(ab|a|c|bcd){1,}(d*)", "ababcd", 0,6, 4,5, 5,6); + T3("(ab|a|c|bcd){2,}(d*)", "ababcd", 0,6, 4,5, 5,6); + T3("(ab|a|c|bcd){3,}(d*)", "ababcd", 0,6, 4,5, 5,6); + T0("(ab|a|c|bcd){4,}(d*)", "ababcd"); + T3("(ab|a|c|bcd){0,10}(d*)", "ababcd", 0,6, 4,5, 5,6); + T3("(ab|a|c|bcd){1,10}(d*)", "ababcd", 0,6, 4,5, 5,6); + T3("(ab|a|c|bcd){2,10}(d*)", "ababcd", 0,6, 4,5, 5,6); + T3("(ab|a|c|bcd){3,10}(d*)", "ababcd", 0,6, 4,5, 5,6); + T0("(ab|a|c|bcd){4,10}(d*)", "ababcd"); + T3("(ab|a|c|bcd)*(d*)", "ababcd", 0,6, 4,5, 5,6); + T3("(ab|a|c|bcd)+(d*)", "ababcd", 0,6, 4,5, 5,6); + + // rightassoc + T4("(a|ab)(c|bcd)(d*)", "abcd", 0,4, 0,1, 1,4, 4,4); + T4("(a|ab)(bcd|c)(d*)", "abcd", 0,4, 0,1, 1,4, 4,4); + T4("(ab|a)(c|bcd)(d*)", "abcd", 0,4, 0,2, 2,3, 3,4); + T4("(ab|a)(bcd|c)(d*)", "abcd", 0,4, 0,2, 2,3, 3,4); + T4("(a*)(b|abc)(c*)", "abc", 0,3, 0,1, 1,2, 2,3); + T4("(a*)(abc|b)(c*)", "abc", 0,3, 0,1, 1,2, 2,3); + T4("(a*)(b|abc)(c*)", "abc", 0,3, 0,1, 1,2, 2,3); + T4("(a*)(abc|b)(c*)", "abc", 0,3, 0,1, 1,2, 2,3); + T4("(a|ab)(c|bcd)(d|.*)", "abcd", 0,4, 0,1, 1,4, 4,4); + T4("(a|ab)(bcd|c)(d|.*)", "abcd", 0,4, 0,1, 1,4, 4,4); + T4("(ab|a)(c|bcd)(d|.*)", "abcd", 0,4, 0,2, 2,3, 3,4); + T4("(ab|a)(bcd|c)(d|.*)", "abcd", 0,4, 0,2, 2,3, 3,4); + + return e; +} + #undef GS #undef T #undef T0 @@ -515,9 +930,9 @@ int main() { int e = 0; - e |= test_all(0); - e |= test_all(REG_NFA); - e |= test_all(REG_NFA | REG_LEFTMOST); + e |= test_all_posix(0); + e |= test_all_posix(REG_NFA); + e |= test_all_leftmost(REG_NFA | REG_LEFTMOST); return e; } diff --git a/re2c/src/codegen/output.cc b/re2c/src/codegen/output.cc index 53e9f369..e541f563 100644 --- a/re2c/src/codegen/output.cc +++ b/re2c/src/codegen/output.cc @@ -319,7 +319,7 @@ Output & Output::wdelay_yymaxfill () Output& Output::wdelay_yymaxnmatch() { if (block().opts->target == TARGET_CODE - && block().opts->posix_captures) { + && block().opts->posix_syntax) { block().fragments.push_back (new OutputFragment (OutputFragment::MAXNMATCH, 0)); } return *this; diff --git a/re2c/src/dfa/closure.cc b/re2c/src/dfa/closure.cc index 5d2235e3..1ed21f4d 100644 --- a/re2c/src/dfa/closure.cc +++ b/re2c/src/dfa/closure.cc @@ -86,7 +86,7 @@ void tagged_epsilon_closure(determ_context_t &ctx) closure_t &closure = ctx.dc_closure; // build tagged epsilon-closure of the given set of NFA states - if (ctx.dc_opts->posix_captures) { + if (ctx.dc_opts->posix_semantics) { closure_posix(ctx); prune(closure, ctx.dc_nfa.rules); std::sort(closure.begin(), closure.end(), cmpby_rule_state); diff --git a/re2c/src/dfa/determinization.cc b/re2c/src/dfa/determinization.cc index 3490a2fd..c6540ff6 100644 --- a/re2c/src/dfa/determinization.cc +++ b/re2c/src/dfa/determinization.cc @@ -148,7 +148,7 @@ uint32_t init_tag_versions(determ_context_t &ctx) // WARNING: this function assumes that kernel items are grouped by rule void warn_nondeterministic_tags(const determ_context_t &ctx) { - if (ctx.dc_opts->posix_captures) return; + if (ctx.dc_opts->posix_syntax) return; Warn &warn = ctx.dc_warn; const kernels_t &kernels = ctx.dc_kernels; diff --git a/re2c/src/nfa/re_to_nfa.cc b/re2c/src/nfa/re_to_nfa.cc index b11c2c86..59b0cb8d 100644 --- a/re2c/src/nfa/re_to_nfa.cc +++ b/re2c/src/nfa/re_to_nfa.cc @@ -80,7 +80,7 @@ static nfa_state_t *re_to_nfa(rtn_ctx_t &ctx, const RE *re, nfa_state_t *t) s = re_to_nfa(ctx, iter, t); for (uint32_t i = min; i < max; ++i) { nfa_state_t *q = &nfa.states[nfa.size++]; - if (ctx.opts->posix_captures) { + if (ctx.opts->posix_semantics) { // POSIX: shorter alternative first to speed up GOR1 // by first exploring paths without optional empty repetitions q->make_alt(nrule, t, s); @@ -140,7 +140,7 @@ nfa_t::nfa_t(const RESpec &spec) } } - if (spec.opts->posix_captures) { + if (spec.opts->posix_semantics) { // needed for closure algorithms GOR1 and GTOP uint32_t topord = 0; calc_topord(root, topord); diff --git a/re2c/src/options/opt.cc b/re2c/src/options/opt.cc index c88d4b69..de6c4427 100644 --- a/re2c/src/options/opt.cc +++ b/re2c/src/options/opt.cc @@ -146,7 +146,10 @@ void mutopt_t::fix(const conopt_t *globopts) bUseStateAbort = Opt::baseopt.bUseStateAbort; bUseStateNext = Opt::baseopt.bUseStateNext; } - if (posix_captures) { + if (posix_semantics) { + posix_syntax = true; + } + if (posix_syntax) { tags = true; } if (!tags) diff --git a/re2c/src/options/opt.h b/re2c/src/options/opt.h index c74309e8..9f2d2e49 100644 --- a/re2c/src/options/opt.h +++ b/re2c/src/options/opt.h @@ -108,7 +108,8 @@ const uint32_t NOEOF = ~0u - 1; MUTOPT (bool, tags, false) \ MUTOPT (std::string, tags_prefix, "yyt") \ MUTOPT (std::string, tags_expression, "@@") \ - MUTOPT (bool, posix_captures, false) \ + MUTOPT (bool, posix_syntax, false) \ + MUTOPT (bool, posix_semantics, false) \ /* code generation */ \ MUTOPT (bool, sFlag, false) \ MUTOPT (bool, bFlag, false) \ diff --git a/re2c/src/options/parse_opts.re b/re2c/src/options/parse_opts.re index 2b9f157e..8b15daff 100644 --- a/re2c/src/options/parse_opts.re +++ b/re2c/src/options/parse_opts.re @@ -102,13 +102,18 @@ opt_short: "i" { opts.set_iFlag(true); goto opt_short; } "s" { opts.set_sFlag(true); goto opt_short; } "T" { opts.set_tags(true); goto opt_short; } - "P" { opts.set_posix_captures(true); goto opt_short; } "e" { opts.set_encoding(Enc::EBCDIC); goto opt_short; } "u" { opts.set_encoding(Enc::UTF32); goto opt_short; } "w" { opts.set_encoding(Enc::UCS2); goto opt_short; } "x" { opts.set_encoding(Enc::UTF16); goto opt_short; } "8" { opts.set_encoding(Enc::UTF8); goto opt_short; } + "P" { + opts.set_posix_syntax(true); + opts.set_posix_semantics(true); + goto opt_short; + } + "I" end { NEXT_ARG("-I", opt_incpath); } "I" { *argv = YYCURSOR; goto opt_incpath; } @@ -146,13 +151,18 @@ opt_long: "case-insensitive" end { opts.set_bCaseInsensitive (true); goto opt; } "case-inverted" end { opts.set_bCaseInverted (true); goto opt; } "tags" end { opts.set_tags (true); goto opt; } - "posix-captures" end { opts.set_posix_captures(true); goto opt; } "ecb" end { opts.set_encoding(Enc::EBCDIC); goto opt; } "unicode" end { opts.set_encoding(Enc::UTF32); goto opt; } "wide-chars" end { opts.set_encoding(Enc::UCS2); goto opt; } "utf-16" end { opts.set_encoding(Enc::UTF16); goto opt; } "utf-8" end { opts.set_encoding(Enc::UTF8); goto opt; } + "posix-captures" end { + opts.set_posix_syntax(true); + opts.set_posix_semantics(true); + goto opt; + } + "output" end { NEXT_ARG("-o, --output", opt_output); } "type-header" end { NEXT_ARG("-t, --type-header", opt_header); } "encoding-policy" end { NEXT_ARG("--encoding-policy", opt_encoding_policy); } diff --git a/re2c/src/parse/lex_conf.re b/re2c/src/parse/lex_conf.re index 4a95f53a..bb7ea627 100644 --- a/re2c/src/parse/lex_conf.re +++ b/re2c/src/parse/lex_conf.re @@ -47,12 +47,18 @@ void Scanner::lex_conf(Opt &opts) "flags:" ("i" | "no-debug-info") { opts.set_iFlag (lex_conf_bool()); return; } "flags:" ("s" | "nested-ifs") { opts.set_sFlag (lex_conf_bool()); return; } "flags:" ("T" | "tags") { opts.set_tags (lex_conf_bool()); return; } - "flags:" ("P" | "posix-captures") { opts.set_posix_captures (lex_conf_bool()); return; } "flags:case-insensitive" { opts.set_bCaseInsensitive (lex_conf_bool()); return; } "flags:case-inverted" { opts.set_bCaseInverted (lex_conf_bool()); return; } "flags:" ("o" | "output") { opts.set_output_file (lex_conf_string()); return; } "flags:" ("t" | "type-header") { opts.set_header_file (lex_conf_string()); return; } + "flags:" ("P" | "posix-captures") { + bool b = lex_conf_bool(); + opts.set_posix_syntax(b); + opts.set_posix_semantics(b); + return; + } + "flags:" ("e" | "ecb") { lex_conf_enc(Enc::EBCDIC, opts); return; } "flags:" ("u" | "unicode") { lex_conf_enc(Enc::UTF32, opts); return; } "flags:" ("w" | "wide-chars") { lex_conf_enc(Enc::UCS2, opts); return; } diff --git a/re2c/src/regexp/ast_to_re.cc b/re2c/src/regexp/ast_to_re.cc index 36c8b157..a2956fe2 100644 --- a/re2c/src/regexp/ast_to_re.cc +++ b/re2c/src/regexp/ast_to_re.cc @@ -129,7 +129,7 @@ RE *ast_to_re(RESpec &spec, const AST *ast, size_t &ncap, int32_t height) } case AST::ALT: { RE *t1 = NULL, *t2 = NULL, *t3 = NULL, *t4 = NULL, *x, *y; - if (opts->posix_captures && has_tags(ast)) { + if (opts->posix_syntax && has_tags(ast)) { // see note [POSIX subexpression hierarchy] if (ast->cat.ast1->type != AST::CAP) { t1 = re_tag(spec, tags.size(), false); @@ -152,7 +152,7 @@ RE *ast_to_re(RESpec &spec, const AST *ast, size_t &ncap, int32_t height) } case AST::CAT: { RE *t1 = NULL, *t2 = NULL, *t3 = NULL, *t4 = NULL, *x, *y; - if (opts->posix_captures && has_tags(ast)) { + if (opts->posix_syntax && has_tags(ast)) { // see note [POSIX subexpression hierarchy] if (ast->cat.ast1->type != AST::CAP) { t1 = re_tag(spec, tags.size(), false); @@ -178,7 +178,7 @@ RE *ast_to_re(RESpec &spec, const AST *ast, size_t &ncap, int32_t height) fatal_lc(ast->line, ast->column, "tags are only allowed with '-T, --tags' option"); } - if (opts->posix_captures) { + if (opts->posix_syntax) { fatal_lc(ast->line, ast->column, "simple tags are not allowed with '--posix-captures' option"); } @@ -187,7 +187,7 @@ RE *ast_to_re(RESpec &spec, const AST *ast, size_t &ncap, int32_t height) return t; } case AST::CAP: { - if (!opts->posix_captures) { + if (!opts->posix_syntax) { return ast_to_re(spec, ast->cap, ncap, height); } const AST *x = ast->cap; @@ -214,7 +214,7 @@ RE *ast_to_re(RESpec &spec, const AST *ast, size_t &ncap, int32_t height) const AST *x = ast->iter.ast; RE *t1 = NULL, *t2 = NULL; - if (opts->posix_captures && x->type == AST::CAP) { + if (opts->posix_syntax && x->type == AST::CAP) { x = x->cap; if (x->type == AST::REF) x = x->ref.ast; @@ -318,7 +318,7 @@ Range *ast_to_range(RESpec &spec, const AST *ast) case AST::ITER: break; case AST::CAP: - if (spec.opts->posix_captures) break; + if (spec.opts->posix_syntax) break; return ast_to_range(spec, ast->cap); case AST::REF: if (misuse_of_named_def(spec, ast)) return NULL; @@ -398,7 +398,7 @@ bool misuse_of_named_def(RESpec &spec, const AST *ast) { DASSERT(ast->type == AST::REF); - if (!spec.opts->posix_captures) return false; + if (!spec.opts->posix_syntax) return false; fatal_l(ast->line, "implicit grouping is forbidden with '--posix-captures'" diff --git a/re2c/src/regexp/default_tags.cc b/re2c/src/regexp/default_tags.cc index 4d44f224..a45bcf5c 100644 --- a/re2c/src/regexp/default_tags.cc +++ b/re2c/src/regexp/default_tags.cc @@ -26,7 +26,11 @@ static void insert_default_tags(RESpec &spec, RE *re, size_t *&tidx) y = re_cat(spec, y, re_tag(spec, *i, true)); } re->alt.re1 = re_cat(spec, re->alt.re1, y); - re->alt.re2 = spec.opts->posix_captures + // Decision to place negative tags before/after could be based + // on POSIX semantics, not syntax. But strangely on some tests + // placing before results in better performance. More benchmarks + // are needed to understand this (with AOT/JIT, TNFA/TDFA). + re->alt.re2 = spec.opts->posix_syntax ? re_cat(spec, x, re->alt.re2) : re_cat(spec, re->alt.re2, x); break; diff --git a/re2c/src/skeleton/generate_code.cc b/re2c/src/skeleton/generate_code.cc index b0fc56a9..c4986e33 100644 --- a/re2c/src/skeleton/generate_code.cc +++ b/re2c/src/skeleton/generate_code.cc @@ -324,7 +324,7 @@ void emit_start(Output &o, size_t maxfill, size_t maxnmatch, const std::string & o.ws("\n").wind(1).ws("const YYCTYPE *limit = NULL;"); o.ws("\n").wind(1).ws("const YYCTYPE *token = NULL;"); o.ws("\n").wind(1).ws("const YYCTYPE *eof = NULL;"); - if (opts->posix_captures) { + if (opts->posix_syntax) { o.ws("\n").wind(1).ws("size_t yynmatch;"); o.ws("\n").wind(1).ws("const YYCTYPE *yypmatch[").wu64(maxnmatch).ws(" * 2];"); }