From 8c1fe4f0113685b599bf906360814e4715e05447 Mon Sep 17 00:00:00 2001 From: Ulya Trofimovich Date: Wed, 26 Aug 2015 12:41:48 +0100 Subject: [PATCH] Simplified tracking of condition order. In theory re2c makes no guarantee about the order of conditions in the generated lexer. Users should use 'YYGETCONDITION'/'YYSETCONDITION' interface and generate enum with condition names using either '-t' option or '/*!types:re2c*/' directive. Only members of the generated enum should be used with 'YYGETCONDITION' and 'YYSETCONDITION'. This way code is independent of internal re2c condition numbering. However, it turns out that some users (and notably, PHP) rely on internal condition numbering: they manually hardcode condition numbers and make re2c generate condition dispatch in such a way that it doesn't mention condition names at all (e.g. with in the form of nested 'if' statements with '-b' or in the form of 'goto' table with '-g'). The code compiles, but change of code generation mode may break compilation. Even worse, change of internal re2c condition numbering may lead to epic runtime failures. So re2c cannot just change internal condition numbering: it has to preserve the existing numbering scheme (rather illogical and not alphabetically sorted). This commit tries to simplify tracking of condition numbers. --- re2c/bootstrap/src/parse/parser.cc | 59 ++++++-------- re2c/src/codegen/emit.h | 1 - re2c/src/codegen/emit_dfa.cc | 77 +++++++------------ re2c/src/codegen/output.cc | 6 ++ re2c/src/codegen/output.h | 1 + re2c/src/ir/dfa/dfa.h | 4 +- re2c/src/parse/parser.h | 1 + re2c/src/parse/parser.ypp | 43 ++++------- re2c/test/condition_14.cif.c | 2 +- ...0211_zend_ini_scanner.cDF--case-inverted.c | 6 +- ...php20150211_zend_ini_scanner_trimmed.icF.c | 6 +- ...zend_language_scanner.cDF--case-inverted.c | 10 +-- 12 files changed, 88 insertions(+), 128 deletions(-) diff --git a/re2c/bootstrap/src/parse/parser.cc b/re2c/bootstrap/src/parse/parser.cc index 8881a164..2dfa94bf 100644 --- a/re2c/bootstrap/src/parse/parser.cc +++ b/re2c/bootstrap/src/parse/parser.cc @@ -82,7 +82,6 @@ #include "src/ir/regexp/regexp_cat.h" #include "src/ir/regexp/regexp_close.h" #include "src/ir/regexp/regexp_null.h" -#include "src/codegen/emit.h" // genTypes #include "src/globals.h" #include "src/parse/code.h" #include "src/parse/extop.h" @@ -102,6 +101,7 @@ void yyerror(const char*); } static counter_t rank_counter; +static std::vector condnames; static re2c::RegExpMap specMap; static RegExp *spec = NULL, *specNone = NULL; static RuleOpList specStar; @@ -150,13 +150,12 @@ void context_rule(CondList *clist, RegExp *expr, RegExp *look, const std::string if (itRE != specMap.end()) { - itRE->second.second = mkAlt(itRE->second.second, rule); + itRE->second = mkAlt(itRE->second, rule); } else { - size_t nIndex = specMap.size() + 1; // 0 is reserved for "0"-spec - assert( nIndex < 1u << 31); - specMap[*it] = std::make_pair(int(nIndex), rule); + specMap[*it] = rule; + condnames.push_back (*it); } } @@ -646,14 +645,14 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 227, 227, 229, 233, 237, 246, 255, 259, 263, - 272, 277, 282, 287, 292, 297, 302, 310, 314, 320, - 324, 328, 334, 338, 344, 357, 362, 370, 375, 379, - 384, 388, 392, 396, 402, 406, 410, 414, 421, 430, - 439, 443, 449, 454, 460, 464, 470, 478, 483, 489, - 495, 505, 517, 523, 531, 534, 541, 547, 557, 560, - 568, 571, 578, 582, 589, 593, 600, 604, 611, 615, - 630, 650, 654, 658, 662, 669, 679, 683 + 0, 226, 226, 228, 232, 236, 245, 254, 258, 262, + 271, 276, 281, 286, 291, 296, 301, 309, 313, 319, + 323, 327, 333, 337, 343, 356, 361, 369, 374, 378, + 383, 387, 391, 395, 401, 405, 409, 413, 420, 429, + 438, 442, 448, 453, 459, 463, 469, 477, 482, 488, + 494, 504, 516, 522, 530, 533, 540, 546, 556, 559, + 567, 570, 577, 581, 588, 592, 599, 603, 610, 614, + 629, 649, 653, 657, 661, 668, 678, 682 }; #endif @@ -2661,37 +2660,28 @@ void parse(Scanner& i, Output & o) // but compile it separately because of RegExp::PRIVATE attribute for (it = specMap.begin(); it != specMap.end(); ++it) { - assert(it->second.second); + assert(it->second); for (RuleOpList::const_iterator itOp = specStar.begin(); itOp != specStar.end(); ++itOp) { - it->second.second = mkAlt(*itOp, it->second.second); + it->second = mkAlt(*itOp, it->second); } } } if (specNone) { - // After merging star rules merge none code to specmap - // this simplifies some stuff. + specMap["0"] = specNone; // Note that "0" inserts first, which is important. - specMap["0"] = std::make_pair(0, specNone); - } - else - { - // We reserved 0 for specNone but it is not present, - // so we can decrease all specs. - for (it = specMap.begin(); it != specMap.end(); ++it) - { - it->second.first--; - } + condnames.insert (condnames.begin (), "0"); } + o.types = condnames; } size_t nCount = specMap.size(); for (it = specMap.begin(); it != specMap.end(); ++it) { - assert(it->second.second); + assert(it->second); if (parseMode != Scanner::Reuse) { @@ -2716,7 +2706,7 @@ void parse(Scanner& i, Output & o) if (itRuleDefault != ruleDefaultMap.end()) { RuleOp * def = new RuleOp(in->mkDefault(), new NullOp(), *(itRuleDefault->second), rank_counter.next (), RegExp::SHARED, NULL); - it->second.second = it->second.second ? mkAlt(def, it->second.second) : def; + it->second = it->second ? mkAlt(def, it->second) : def; } else { @@ -2724,18 +2714,16 @@ void parse(Scanner& i, Output & o) if (itRuleDefault != ruleDefaultMap.end()) { RuleOp * def = new RuleOp(in->mkDefault(), new NullOp(), *(itRuleDefault->second), rank_counter.next (), RegExp::SHARED, NULL); - it->second.second = it->second.second ? mkAlt(def, it->second.second) : def; + it->second = it->second ? mkAlt(def, it->second) : def; } } - dfa_map[it->first] = genCode(it->second.second, o, topIndent, it->first); + dfa_map[it->first] = genCode(it->second, o, topIndent, it->first); } if (parseMode != Scanner::Rules && dfa_map.find(it->first) != dfa_map.end()) { - dfa_map[it->first]->emit(o, topIndent, &specMap, it->first, !--nCount, bPrologBrace); + dfa_map[it->first]->emit(o, topIndent, it->first, !--nCount, bPrologBrace); } } - - genTypes (o, specMap); } else { @@ -2752,7 +2740,7 @@ void parse(Scanner& i, Output & o) } if (parseMode != Scanner::Rules && dfa_map.find("") != dfa_map.end()) { - dfa_map[""]->emit(o, topIndent, NULL, "", 0, bPrologBrace); + dfa_map[""]->emit(o, topIndent, "", 0, bPrologBrace); } } } @@ -2794,6 +2782,7 @@ void parse_cleanup() RangeSuffix::freeList.clear(); Code::freelist.clear(); symbol_table.clear (); + condnames.clear (); specMap.clear(); specStar.clear(); specNone = NULL; diff --git a/re2c/src/codegen/emit.h b/re2c/src/codegen/emit.h index 5c78ef18..772ad62d 100644 --- a/re2c/src/codegen/emit.h +++ b/re2c/src/codegen/emit.h @@ -21,7 +21,6 @@ void emit_action // helpers void genGoTo (OutputFile & o, uint32_t ind, const State * from, const State * to, bool & readCh); -void genTypes (Output &, const RegExpMap &); template std::string replaceParam (std::string str, const std::string & param, const _Ty & value) { diff --git a/re2c/src/codegen/emit_dfa.cc b/re2c/src/codegen/emit_dfa.cc index ad701021..fa35858f 100644 --- a/re2c/src/codegen/emit_dfa.cc +++ b/re2c/src/codegen/emit_dfa.cc @@ -11,9 +11,9 @@ namespace re2c { static std::string genGetCondition (); -static void genCondGotoSub (OutputFile & o, uint32_t ind, RegExpIndices & vCondList, uint32_t cMin, uint32_t cMax); -static void genCondTable (OutputFile & o, uint32_t ind, const RegExpMap & specMap); -static void genCondGoto (OutputFile & o, uint32_t ind, const RegExpMap & specMap); +static void genCondGotoSub (OutputFile & o, uint32_t ind, const std::vector & condnames, uint32_t cMin, uint32_t cMax); +static void genCondTable (OutputFile & o, uint32_t ind, const std::vector & condnames); +static void genCondGoto (OutputFile & o, uint32_t ind, const std::vector & condnames); static void emit_state (OutputFile & o, uint32_t ind, const State * s, bool used_label); std::string genGetCondition() @@ -90,7 +90,7 @@ void DFA::count_used_labels (std::set & used, label_t start, label_t in } } -void DFA::emit(Output & output, uint32_t& ind, const RegExpMap* specMap, const std::string& condName, bool isLastCond, bool& bPrologBrace) +void DFA::emit(Output & output, uint32_t& ind, const std::string& condName, bool isLastCond, bool& bPrologBrace) { OutputFile & o = output.source; @@ -128,7 +128,7 @@ void DFA::emit(Output & output, uint32_t& ind, const RegExpMap* specMap, const s else if ((!fFlag && o.get_used_yyaccept ()) || (!fFlag && bEmitYYCh) || (bFlag && !cFlag && BitMap::first) - || (cFlag && !bWroteCondCheck && gFlag && specMap) + || (cFlag && !bWroteCondCheck && gFlag) || (fFlag && !bWroteGetState && gFlag) ) { @@ -159,9 +159,9 @@ void DFA::emit(Output & output, uint32_t& ind, const RegExpMap* specMap, const s } if (bProlog) { - if (cFlag && !bWroteCondCheck && gFlag && specMap) + if (cFlag && !bWroteCondCheck && gFlag) { - genCondTable(o, ind, *specMap); + genCondTable(o, ind, output.types); } o.insert_state_goto (ind); if (cFlag && !DFlag) @@ -172,9 +172,9 @@ void DFA::emit(Output & output, uint32_t& ind, const RegExpMap* specMap, const s } } o.write_user_start_label (); - if (cFlag && !bWroteCondCheck && specMap) + if (cFlag && !bWroteCondCheck) { - genCondGoto(o, ind, *specMap); + genCondGoto(o, ind, output.types); } } @@ -240,44 +240,36 @@ void DFA::emit(Output & output, uint32_t& ind, const RegExpMap* specMap, const s } } -void genCondTable(OutputFile & o, uint32_t ind, const RegExpMap& specMap) +void genCondTable(OutputFile & o, uint32_t ind, const std::vector & condnames) { - const uint32_t specMap_size = static_cast (specMap.size ()); - RegExpIndices vCondList(specMap_size); - - for(RegExpMap::const_iterator itSpec = specMap.begin(); itSpec != specMap.end(); ++itSpec) + const size_t conds = condnames.size (); + o << indent(ind++) << "static void *" << mapCodeName["yyctable"] << "[" << conds << "] = {\n"; + for (size_t i = 0; i < conds; ++i) { - vCondList[itSpec->second.first] = itSpec->first; - } - - o << indent(ind++) << "static void *" << mapCodeName["yyctable"] << "[" << specMap_size << "] = {\n"; - - for(RegExpIndices::const_iterator it = vCondList.begin(); it != vCondList.end(); ++it) - { - o << indent(ind) << "&&" << condPrefix << *it << ",\n"; + o << indent(ind) << "&&" << condPrefix << condnames[i] << ",\n"; } o << indent(--ind) << "};\n"; } -void genCondGotoSub(OutputFile & o, uint32_t ind, RegExpIndices& vCondList, uint32_t cMin, uint32_t cMax) +void genCondGotoSub(OutputFile & o, uint32_t ind, const std::vector & condnames, uint32_t cMin, uint32_t cMax) { if (cMin == cMax) { - o << indent(ind) << "goto " << condPrefix << vCondList[cMin] << ";\n"; + o << indent(ind) << "goto " << condPrefix << condnames[cMin] << ";\n"; } else { uint32_t cMid = cMin + ((cMax - cMin + 1) / 2); o << indent(ind) << "if (" << genGetCondition() << " < " << cMid << ") {\n"; - genCondGotoSub(o, ind + 1, vCondList, cMin, cMid - 1); + genCondGotoSub(o, ind + 1, condnames, cMin, cMid - 1); o << indent(ind) << "} else {\n"; - genCondGotoSub(o, ind + 1, vCondList, cMid, cMax); + genCondGotoSub(o, ind + 1, condnames, cMid, cMax); o << indent(ind) << "}\n"; } } -void genCondGoto(OutputFile & o, uint32_t ind, const RegExpMap& specMap) +void genCondGoto(OutputFile & o, uint32_t ind, const std::vector & condnames) { if (gFlag) { @@ -285,30 +277,26 @@ void genCondGoto(OutputFile & o, uint32_t ind, const RegExpMap& specMap) } else { + const size_t conds = condnames.size (); if (sFlag) { - RegExpIndices vCondList(specMap.size()); - - for(RegExpMap::const_iterator it = specMap.begin(); it != specMap.end(); ++it) - { - vCondList[it->second.first] = it->first; - } - genCondGotoSub(o, ind, vCondList, 0, static_cast (vCondList.size()) - 1); + genCondGotoSub(o, ind, condnames, 0, static_cast (conds) - 1); } else if (DFlag) { - for(RegExpMap::const_iterator it = specMap.begin(); it != specMap.end(); ++it) + for (size_t i = 0; i < conds; ++i) { - o << "0 -> " << it->first << " [label=\"state=" << it->first << "\"]\n"; + const std::string cond = condnames[i]; + o << "0 -> " << cond << " [label=\"state=" << cond << "\"]\n"; } } else { o << indent(ind) << "switch (" << genGetCondition() << ") {\n"; - - for(RegExpMap::const_iterator it = specMap.begin(); it != specMap.end(); ++it) + for (size_t i = 0; i < conds; ++i) { - o << indent(ind) << "case " << condEnumPrefix << it->first << ": goto " << condPrefix << it->first << ";\n"; + const std::string & cond = condnames[i]; + o << indent(ind) << "case " << condEnumPrefix << cond << ": goto " << condPrefix << cond << ";\n"; } o << indent(ind) << "}\n"; } @@ -316,15 +304,4 @@ void genCondGoto(OutputFile & o, uint32_t ind, const RegExpMap& specMap) bWroteCondCheck = true; } -void genTypes(Output & output, const RegExpMap& specMap) -{ - output.types.resize (specMap.size()); - for(RegExpMap::const_iterator itSpecMap = specMap.begin(); itSpecMap != specMap.end(); ++itSpecMap) - { - // If an entry is < 0 then we did the 0/empty correction twice. - assert(itSpecMap->second.first >= 0); - output.types[itSpecMap->second.first] = itSpecMap->first; - } -} - } // end namespace re2c diff --git a/re2c/src/codegen/output.cc b/re2c/src/codegen/output.cc index a55a5c05..71357e87 100644 --- a/re2c/src/codegen/output.cc +++ b/re2c/src/codegen/output.cc @@ -146,6 +146,12 @@ OutputFile & operator << (OutputFile & u, uint32_t n) return u; } +OutputFile & operator << (OutputFile & u, uint64_t n) +{ + u.stream () << n; + return u; +} + OutputFile & operator << (OutputFile & u, const std::string & s) { u.stream () << s; diff --git a/re2c/src/codegen/output.h b/re2c/src/codegen/output.h index 22e871e0..cc79d4b8 100644 --- a/re2c/src/codegen/output.h +++ b/re2c/src/codegen/output.h @@ -78,6 +78,7 @@ public: void write_user_start_label (); friend OutputFile & operator << (OutputFile & o, char c); friend OutputFile & operator << (OutputFile & o, uint32_t n); + friend OutputFile & operator << (OutputFile & o, uint64_t n); friend OutputFile & operator << (OutputFile & o, const std::string & s); friend OutputFile & operator << (OutputFile & o, const char * s); friend OutputFile & operator << (OutputFile & o, label_t l); diff --git a/re2c/src/ir/dfa/dfa.h b/re2c/src/ir/dfa/dfa.h index fc27ab68..7249fea1 100644 --- a/re2c/src/ir/dfa/dfa.h +++ b/re2c/src/ir/dfa/dfa.h @@ -8,8 +8,6 @@ namespace re2c { -typedef std::map > RegExpMap; - class DFA { public: @@ -36,7 +34,7 @@ public: void findBaseState (); void prepare (OutputFile & o, uint32_t &, const std::string & cond); void count_used_labels (std::set & used, label_t prolog, label_t start, bool force_start) const; - void emit (Output &, uint32_t &, const RegExpMap *, const std::string &, bool, bool &); + void emit (Output &, uint32_t &, const std::string &, bool, bool &); friend std::ostream & operator << (std::ostream &, const DFA &); diff --git a/re2c/src/parse/parser.h b/re2c/src/parse/parser.h index 73333740..deb74995 100644 --- a/re2c/src/parse/parser.h +++ b/re2c/src/parse/parser.h @@ -17,6 +17,7 @@ extern void parse_cleanup(); typedef std::set CondList; typedef std::list RuleOpList; +typedef std::map RegExpMap; typedef std::map > SetupMap; typedef std::map DefaultMap; typedef std::map symbol_table_t; diff --git a/re2c/src/parse/parser.ypp b/re2c/src/parse/parser.ypp index b7e54099..a1d04cef 100644 --- a/re2c/src/parse/parser.ypp +++ b/re2c/src/parse/parser.ypp @@ -14,7 +14,6 @@ #include "src/ir/regexp/regexp_cat.h" #include "src/ir/regexp/regexp_close.h" #include "src/ir/regexp/regexp_null.h" -#include "src/codegen/emit.h" // genTypes #include "src/globals.h" #include "src/parse/code.h" #include "src/parse/extop.h" @@ -34,6 +33,7 @@ void yyerror(const char*); } static counter_t rank_counter; +static std::vector condnames; static re2c::RegExpMap specMap; static RegExp *spec = NULL, *specNone = NULL; static RuleOpList specStar; @@ -82,13 +82,12 @@ void context_rule(CondList *clist, RegExp *expr, RegExp *look, const std::string if (itRE != specMap.end()) { - itRE->second.second = mkAlt(itRE->second.second, rule); + itRE->second = mkAlt(itRE->second, rule); } else { - size_t nIndex = specMap.size() + 1; // 0 is reserved for "0"-spec - assert( nIndex < 1u << 31); - specMap[*it] = std::make_pair(int(nIndex), rule); + specMap[*it] = rule; + condnames.push_back (*it); } } @@ -796,37 +795,28 @@ void parse(Scanner& i, Output & o) // but compile it separately because of RegExp::PRIVATE attribute for (it = specMap.begin(); it != specMap.end(); ++it) { - assert(it->second.second); + assert(it->second); for (RuleOpList::const_iterator itOp = specStar.begin(); itOp != specStar.end(); ++itOp) { - it->second.second = mkAlt(*itOp, it->second.second); + it->second = mkAlt(*itOp, it->second); } } } if (specNone) { - // After merging star rules merge none code to specmap - // this simplifies some stuff. + specMap["0"] = specNone; // Note that "0" inserts first, which is important. - specMap["0"] = std::make_pair(0, specNone); - } - else - { - // We reserved 0 for specNone but it is not present, - // so we can decrease all specs. - for (it = specMap.begin(); it != specMap.end(); ++it) - { - it->second.first--; - } + condnames.insert (condnames.begin (), "0"); } + o.types = condnames; } size_t nCount = specMap.size(); for (it = specMap.begin(); it != specMap.end(); ++it) { - assert(it->second.second); + assert(it->second); if (parseMode != Scanner::Reuse) { @@ -851,7 +841,7 @@ void parse(Scanner& i, Output & o) if (itRuleDefault != ruleDefaultMap.end()) { RuleOp * def = new RuleOp(in->mkDefault(), new NullOp(), *(itRuleDefault->second), rank_counter.next (), RegExp::SHARED, NULL); - it->second.second = it->second.second ? mkAlt(def, it->second.second) : def; + it->second = it->second ? mkAlt(def, it->second) : def; } else { @@ -859,18 +849,16 @@ void parse(Scanner& i, Output & o) if (itRuleDefault != ruleDefaultMap.end()) { RuleOp * def = new RuleOp(in->mkDefault(), new NullOp(), *(itRuleDefault->second), rank_counter.next (), RegExp::SHARED, NULL); - it->second.second = it->second.second ? mkAlt(def, it->second.second) : def; + it->second = it->second ? mkAlt(def, it->second) : def; } } - dfa_map[it->first] = genCode(it->second.second, o, topIndent, it->first); + dfa_map[it->first] = genCode(it->second, o, topIndent, it->first); } if (parseMode != Scanner::Rules && dfa_map.find(it->first) != dfa_map.end()) { - dfa_map[it->first]->emit(o, topIndent, &specMap, it->first, !--nCount, bPrologBrace); + dfa_map[it->first]->emit(o, topIndent, it->first, !--nCount, bPrologBrace); } } - - genTypes (o, specMap); } else { @@ -887,7 +875,7 @@ void parse(Scanner& i, Output & o) } if (parseMode != Scanner::Rules && dfa_map.find("") != dfa_map.end()) { - dfa_map[""]->emit(o, topIndent, NULL, "", 0, bPrologBrace); + dfa_map[""]->emit(o, topIndent, "", 0, bPrologBrace); } } } @@ -929,6 +917,7 @@ void parse_cleanup() RangeSuffix::freeList.clear(); Code::freelist.clear(); symbol_table.clear (); + condnames.clear (); specMap.clear(); specStar.clear(); specNone = NULL; diff --git a/re2c/test/condition_14.cif.c b/re2c/test/condition_14.cif.c index e1786dd3..233ddfff 100644 --- a/re2c/test/condition_14.cif.c +++ b/re2c/test/condition_14.cif.c @@ -92,8 +92,8 @@ void scan(Scanner *s) yy0: switch (s->cond) { - case EStateComment: goto yyc_Comment; case EStateNormal: goto yyc_Normal; + case EStateComment: goto yyc_Comment; case EStateSkiptoeol: goto yyc_Skiptoeol; case EStateString: goto yyc_String; } diff --git a/re2c/test/php20150211_zend_ini_scanner.cDF--case-inverted.c b/re2c/test/php20150211_zend_ini_scanner.cDF--case-inverted.c index fa63114b..a4c239e5 100644 --- a/re2c/test/php20150211_zend_ini_scanner.cDF--case-inverted.c +++ b/re2c/test/php20150211_zend_ini_scanner.cDF--case-inverted.c @@ -7,13 +7,13 @@ re2c: warning: line 392: column 11: escape has no effect: '\[' [-Wuseless-escape digraph re2c { 0 -> INITIAL [label="state=INITIAL"] -0 -> ST_DOUBLE_QUOTES [label="state=ST_DOUBLE_QUOTES"] 0 -> ST_OFFSET [label="state=ST_OFFSET"] -0 -> ST_RAW [label="state=ST_RAW"] -0 -> ST_SECTION_RAW [label="state=ST_SECTION_RAW"] 0 -> ST_SECTION_VALUE [label="state=ST_SECTION_VALUE"] 0 -> ST_VALUE [label="state=ST_VALUE"] +0 -> ST_SECTION_RAW [label="state=ST_SECTION_RAW"] +0 -> ST_DOUBLE_QUOTES [label="state=ST_DOUBLE_QUOTES"] 0 -> ST_VARNAME [label="state=ST_VARNAME"] +0 -> ST_RAW [label="state=ST_RAW"] /* *********************************** */ INITIAL -> 2 2 -> 3 [label="[0x00-0x08][0x0B-0x0C][0x0E-0x1F][#][0-9][A-E][G-M][P-S][U-X][Z][\\][_-e][g-m][p-s][u-x][z][0x7F-0xFF]"] diff --git a/re2c/test/php20150211_zend_ini_scanner_trimmed.icF.c b/re2c/test/php20150211_zend_ini_scanner_trimmed.icF.c index e9dbfd78..f6bd03fc 100644 --- a/re2c/test/php20150211_zend_ini_scanner_trimmed.icF.c +++ b/re2c/test/php20150211_zend_ini_scanner_trimmed.icF.c @@ -9,13 +9,13 @@ re2c: warning: line 12: column 11: escape has no effect: '\[' [-Wuseless-escape] unsigned int yyaccept = 0; switch (YYGETCONDITION()) { case yycINITIAL: goto yyc_INITIAL; - case yycST_DOUBLE_QUOTES: goto yyc_ST_DOUBLE_QUOTES; case yycST_OFFSET: goto yyc_ST_OFFSET; - case yycST_RAW: goto yyc_ST_RAW; - case yycST_SECTION_RAW: goto yyc_ST_SECTION_RAW; case yycST_SECTION_VALUE: goto yyc_ST_SECTION_VALUE; case yycST_VALUE: goto yyc_ST_VALUE; + case yycST_SECTION_RAW: goto yyc_ST_SECTION_RAW; + case yycST_DOUBLE_QUOTES: goto yyc_ST_DOUBLE_QUOTES; case yycST_VARNAME: goto yyc_ST_VARNAME; + case yycST_RAW: goto yyc_ST_RAW; } /* *********************************** */ yyc_INITIAL: diff --git a/re2c/test/php20150211_zend_language_scanner.cDF--case-inverted.c b/re2c/test/php20150211_zend_language_scanner.cDF--case-inverted.c index dfed811d..620e1c9f 100644 --- a/re2c/test/php20150211_zend_language_scanner.cDF--case-inverted.c +++ b/re2c/test/php20150211_zend_language_scanner.cDF--case-inverted.c @@ -5,16 +5,16 @@ re2c: warning: line 1480: column 19: escape has no effect: '\*' [-Wuseless-escap digraph re2c { -0 -> INITIAL [label="state=INITIAL"] +0 -> ST_IN_SCRIPTING [label="state=ST_IN_SCRIPTING"] +0 -> ST_LOOKING_FOR_PROPERTY [label="state=ST_LOOKING_FOR_PROPERTY"] 0 -> ST_BACKQUOTE [label="state=ST_BACKQUOTE"] 0 -> ST_DOUBLE_QUOTES [label="state=ST_DOUBLE_QUOTES"] -0 -> ST_END_HEREDOC [label="state=ST_END_HEREDOC"] 0 -> ST_HEREDOC [label="state=ST_HEREDOC"] -0 -> ST_IN_SCRIPTING [label="state=ST_IN_SCRIPTING"] -0 -> ST_LOOKING_FOR_PROPERTY [label="state=ST_LOOKING_FOR_PROPERTY"] 0 -> ST_LOOKING_FOR_VARNAME [label="state=ST_LOOKING_FOR_VARNAME"] -0 -> ST_NOWDOC [label="state=ST_NOWDOC"] 0 -> ST_VAR_OFFSET [label="state=ST_VAR_OFFSET"] +0 -> INITIAL [label="state=INITIAL"] +0 -> ST_END_HEREDOC [label="state=ST_END_HEREDOC"] +0 -> ST_NOWDOC [label="state=ST_NOWDOC"] /* *********************************** */ INITIAL -> 2 2 -> 5 [label="[0x00-;][=-0xFF]"] -- 2.40.0