From: helly Date: Tue, 1 May 2007 14:55:50 +0000 (+0000) Subject: - Split YYCONDITION into YYGETCONDITION and YYSETCONDITION X-Git-Tag: 0.13.6~161 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bcc4f59bfa1898217c056d1f427eae360f1df89b;p=re2c - Split YYCONDITION into YYGETCONDITION and YYSETCONDITION - Synch YYGETCONDITION with YYGETSTATE - Synch YYSETCONDITION with YYSETSTATE --- diff --git a/re2c/bootstrap/scanner.cc b/re2c/bootstrap/scanner.cc index 5d54c157..3a607375 100644 --- a/re2c/bootstrap/scanner.cc +++ b/re2c/bootstrap/scanner.cc @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.0.dev on Tue May 1 09:40:03 2007 */ +/* Generated by re2c 0.13.0.dev on Tue May 1 09:59:49 2007 */ #line 1 "scanner.re" /* $Id$ */ #include diff --git a/re2c/code.cc b/re2c/code.cc index 22820f3f..4d51e2e6 100644 --- a/re2c/code.cc +++ b/re2c/code.cc @@ -16,7 +16,7 @@ namespace re2c // there must be at least one span in list; all spans must cover // same range -std::string indent(uint ind) +static std::string indent(uint ind) { std::string str; @@ -27,6 +27,73 @@ std::string indent(uint ind) return str; } +static std::string replaceParam(std::string str, const std::string& param, const std::string& value) +{ + std::string::size_type pos; + + while((pos = str.find(param)) != std::string::npos) + { + str.replace(pos, param.length(), value); + } + + return str; +} + +static std::string replaceParam(std::string str, const std::string& param, int value) +{ + char tmp[16]; + + sprintf(tmp, "%d", value); + + return replaceParam(str, param, tmp); +} + +static void genYYFill(std::ostream &o, uint ind, uint need) +{ + if (bUseYYFillParam) + { + o << mapCodeName["YYFILL"]; + if (!bUseYYFillNaked) + { + o << "(" << need << ");"; + } + o << "\n"; + } + else + { + o << replaceParam(mapCodeName["YYFILL"], yyFillLength, need); + if (!bUseYYFillNaked) + { + o << ";"; + } + o << "\n"; + } +} + +static void genGetCondition(std::ostream &o) +{ + if (bUseYYGetConditionNaked) + { + o << mapCodeName["YYGETCONDITION"]; + } + else + { + o << mapCodeName["YYGETCONDITION"] << "()"; + } +} + +static void genSetCondition(std::ostream& o, uint ind, const std::string& newcond) +{ + if (bUseYYSetConditionParam) + { + o << indent(ind) << mapCodeName["YYSETCONDITION"] << "(" << condEnumPrefix << newcond << ");\n"; + } + else + { + o << indent(ind) << replaceParam(mapCodeName["YYSETCONDITION"], yySetConditionParam, condEnumPrefix + newcond) << "\n"; + } +} + static std::string space(uint this_label) { int nl = next_label > 999999 ? 6 : next_label > 99999 ? 5 : next_label > 9999 ? 4 : next_label > 999 ? 3 : next_label > 99 ? 2 : next_label > 9 ? 1 : 0; @@ -313,43 +380,6 @@ void genIf(std::ostream &o, uint ind, const char *cmp, uint v, bool &readCh) o << ") "; } -static std::string replaceParam(std::string str, const std::string& param, int value) -{ - std::string::size_type pos; - char tmp[16]; - - sprintf(tmp, "%d", value); - - while((pos = str.find(param)) != std::string::npos) - { - str.replace(pos, param.length(), tmp); - } - - return str; -} - -static void genYYFill(std::ostream &o, uint ind, uint need) -{ - if (bUseYYFillParam) - { - o << mapCodeName["YYFILL"]; - if (!bUseYYFillNaked) - { - o << "(" << need << ");"; - } - o << "\n"; - } - else - { - o << replaceParam(mapCodeName["YYFILL"], yyFillLength, need); - if (!bUseYYFillNaked) - { - o << ";"; - } - o << "\n"; - } -} - static void need(std::ostream &o, uint ind, uint n, bool & readCh, bool bSetMarker) { uint fillIndex = next_fill_index; @@ -639,7 +669,7 @@ void Rule::emit(std::ostream &o, uint ind, bool &) const if (rule->code->newcond) { - o << indent(ind) << mapCodeName["YYCONDITION"] << " = " << condEnumPrefix << rule->code->newcond << ";\n"; + genSetCondition(o, ind, rule->code->newcond->to_string()); } RuleLine rl(*rule); @@ -1770,7 +1800,9 @@ static void genCondGotoSub(std::ostream &o, uint ind, RegExpIndices& vCondList, { uint cMid = cMin + ((cMax - cMin + 1) / 2); - o << indent(ind) << "if (" << mapCodeName["YYCONDITION"] << " < " << cMid << ") {\n"; + o << indent(ind) << "if ("; + genGetCondition(o); + o << " < " << cMid << ") {\n"; genCondGotoSub(o, ind + 1, vCondList, cMin, cMid - 1); o << indent(ind) << "} else {\n"; genCondGotoSub(o, ind + 1, vCondList, cMid, cMax); @@ -1784,7 +1816,9 @@ void genCondGoto(std::ostream &o, uint ind, const RegExpMap& specMap) { if (gFlag) { - o << indent(ind) << "goto *" << mapCodeName["yyctable"] << "[" << mapCodeName["YYCONDITION"] << "];\n"; + o << indent(ind) << "goto *" << mapCodeName["yyctable"] << "["; + genGetCondition(o); + o << "];\n"; } else { @@ -1800,7 +1834,9 @@ void genCondGoto(std::ostream &o, uint ind, const RegExpMap& specMap) } else { - o << indent(ind) << "switch(" << mapCodeName["YYCONDITION"] << ") {\n"; + o << indent(ind) << "switch("; + genGetCondition(o); + o << ") {\n"; for(RegExpMap::const_iterator it = specMap.begin(); it != specMap.end(); ++it) { @@ -1891,10 +1927,6 @@ void Scanner::config(const Str& cfg, int num) { bUseYYFillParam = num != 0; } - else if (cfg.to_string() == "define:YYFILL:naked") - { - bUseYYFillNaked = num != 0; - } else if (cfg.to_string() == "cgoto:threshold") { cGotoThreshold = num; @@ -1916,13 +1948,24 @@ void Scanner::config(const Str& cfg, int num) { bEmitYYCh = num != 0; } + else if (cfg.to_string() == "define:YYFILL:naked") + { + bUseYYFillNaked = num != 0; + } + else if (cfg.to_string() == "define:YYGETCONDITION:naked") + { + bUseYYGetConditionNaked = num != 0; + } else if (cfg.to_string() == "define:YYGETSTATE:naked") { bUseYYGetStateNaked = num != 0; } else { - fatal("unrecognized configuration name or illegal integer value"); + std::string msg = "unrecognized configuration name '"; + msg += cfg.to_string(); + msg += "' or illegal integer value"; + fatal(msg.c_str()); } } @@ -1939,16 +1982,17 @@ void Scanner::config(const Str& cfg, const Str& val) mapVariableKeys.insert("variable:yych"); mapVariableKeys.insert("variable:yyctable"); mapVariableKeys.insert("variable:yytarget"); - mapDefineKeys.insert("define:YYCONDITION"); mapDefineKeys.insert("define:YYCONDTYPE"); mapDefineKeys.insert("define:YYCTXMARKER"); mapDefineKeys.insert("define:YYCTYPE"); mapDefineKeys.insert("define:YYCURSOR"); mapDefineKeys.insert("define:YYDEBUG"); mapDefineKeys.insert("define:YYFILL"); + mapDefineKeys.insert("define:YYGETCONDITION"); mapDefineKeys.insert("define:YYGETSTATE"); mapDefineKeys.insert("define:YYLIMIT"); mapDefineKeys.insert("define:YYMARKER"); + mapDefineKeys.insert("define:YYSETCONDITION"); mapDefineKeys.insert("define:YYSETSTATE"); mapLabelKeys.insert("label:yyFillLabel"); mapLabelKeys.insert("label:yyNext"); @@ -1993,6 +2037,11 @@ void Scanner::config(const Str& cfg, const Str& val) yyFillLength = strVal; bUseYYFillParam = false; } + else if (cfg.to_string() == "define:YYSETCONDITION@cond") + { + yySetConditionParam = strVal; + bUseYYSetConditionParam = false; + } else if (cfg.to_string() == "define:YYSETSTATE@state") { yySetStateParam = strVal; @@ -2027,7 +2076,10 @@ void Scanner::config(const Str& cfg, const Str& val) } else { - fatal("unrecognized configuration name or illegal string value"); + std::string msg = "unrecognized configuration name '"; + msg += cfg.to_string(); + msg += "' or illegal string value"; + fatal(msg.c_str()); } } diff --git a/re2c/globals.h b/re2c/globals.h index 2d9ec9ee..b313d1c8 100644 --- a/re2c/globals.h +++ b/re2c/globals.h @@ -45,6 +45,7 @@ extern std::string condPrefix; extern std::string condEnumPrefix; extern std::string yychConversion; extern std::string yyFillLength; +extern std::string yySetConditionParam; extern std::string yySetStateParam; extern uint maxFill; extern uint next_label; @@ -60,6 +61,8 @@ extern bool bUseStateNext; extern bool bUseYYFill; extern bool bUseYYFillParam; extern bool bUseYYFillNaked; +extern bool bUseYYSetConditionParam; +extern bool bUseYYGetConditionNaked; extern bool bUseYYSetStateParam; extern bool bUseYYGetStateNaked; extern bool bWroteGetState; diff --git a/re2c/main.cc b/re2c/main.cc index 29ddf8ca..b659b171 100644 --- a/re2c/main.cc +++ b/re2c/main.cc @@ -50,6 +50,8 @@ bool bUseStateNext = false; bool bUseYYFill = true; bool bUseYYFillParam = true; bool bUseYYFillNaked = false; +bool bUseYYSetConditionParam = true; +bool bUseYYGetConditionNaked = false; bool bUseYYSetStateParam = true; bool bUseYYGetStateNaked = false; @@ -59,6 +61,7 @@ std::string condPrefix("yyc_"); std::string condEnumPrefix("yyc"); std::string yychConversion(""); std::string yyFillLength("@@"); +std::string yySetConditionParam("@@"); std::string yySetStateParam("@@"); uint maxFill = 1; uint next_label = 0; diff --git a/re2c/test/condition_01.c.c b/re2c/test/condition_01.c.c index 78557556..99afe6b5 100755 --- a/re2c/test/condition_01.c.c +++ b/re2c/test/condition_01.c.c @@ -4,7 +4,7 @@ #line 5 "" { YYCTYPE yych; - switch(YYCONDITION) { + switch(YYGETCONDITION()) { case yyca: goto yyc_a; case yycb: goto yyc_b; } diff --git a/re2c/test/condition_02.c.c b/re2c/test/condition_02.c.c index f9b152ec..7667d77e 100755 --- a/re2c/test/condition_02.c.c +++ b/re2c/test/condition_02.c.c @@ -4,7 +4,7 @@ #line 5 "" { YYCTYPE yych; - switch(YYCONDITION) { + switch(YYGETCONDITION()) { case yyc0: goto yyc_0; case yycr1: goto yyc_r1; case yycr2: goto yyc_r2; diff --git a/re2c/test/condition_02.cg.c b/re2c/test/condition_02.cg.c index dfb1816f..732894e3 100755 --- a/re2c/test/condition_02.cg.c +++ b/re2c/test/condition_02.cg.c @@ -9,7 +9,7 @@ &&yyc_r1, &&yyc_r2, }; - goto *yyctable[YYCONDITION]; + goto *yyctable[YYGETCONDITION()]; /* *********************************** */ yyc_0: diff --git a/re2c/test/condition_03.cg.c b/re2c/test/condition_03.cg.c index 76a0da7e..671b9b8c 100755 --- a/re2c/test/condition_03.cg.c +++ b/re2c/test/condition_03.cg.c @@ -9,7 +9,7 @@ &&yyc_r1, &&yyc_r2, }; - goto *yyctable[YYCONDITION]; + goto *yyctable[YYGETCONDITION()]; /* *********************************** */ yyc_0: diff --git a/re2c/test/condition_04.cg.c b/re2c/test/condition_04.cg.c index b996a8d1..9346d662 100755 --- a/re2c/test/condition_04.cg.c +++ b/re2c/test/condition_04.cg.c @@ -8,7 +8,7 @@ &&yyc_r1, &&yyc_r2, }; - goto *yyctable[YYCONDITION]; + goto *yyctable[YYGETCONDITION()]; /* *********************************** */ yyc_r1: diff --git a/re2c/test/condition_05.cg.c b/re2c/test/condition_05.cg.c index 0f7c418f..b19dc744 100755 --- a/re2c/test/condition_05.cg.c +++ b/re2c/test/condition_05.cg.c @@ -47,7 +47,7 @@ int fill(Scanner *s, int len) char scan(Scanner *s) { - int state = 1; + int cond = 1; fill(s, 0); @@ -62,7 +62,7 @@ char scan(Scanner *s) &&yyc_normal, &&yyc_comment, }; - goto *yyctable[state]; + goto *yyctable[cond]; /* *********************************** */ yyc_comment: @@ -72,7 +72,7 @@ yyc_comment: ++s->cur; if((yych = *s->cur) == '/') goto yy5; yy3: -#line 82 "condition_05.cg.re" +#line 83 "condition_05.cg.re" { goto yyc_comment; } @@ -82,7 +82,7 @@ yy4: goto yy3; yy5: ++s->cur; -#line 78 "condition_05.cg.re" +#line 79 "condition_05.cg.re" { continue; } @@ -95,7 +95,7 @@ yyc_normal: ++s->cur; if((yych = *s->cur) == '*') goto yy12; yy10: -#line 73 "condition_05.cg.re" +#line 74 "condition_05.cg.re" { fputc(*s->tok, stdout); continue; @@ -106,13 +106,13 @@ yy11: goto yy10; yy12: ++s->cur; -#line 69 "condition_05.cg.re" +#line 70 "condition_05.cg.re" { goto yyc_comment; } #line 114 "" } -#line 86 "condition_05.cg.re" +#line 87 "condition_05.cg.re" } } diff --git a/re2c/test/condition_05.cg.re b/re2c/test/condition_05.cg.re index b70cb073..5e086513 100755 --- a/re2c/test/condition_05.cg.re +++ b/re2c/test/condition_05.cg.re @@ -45,7 +45,7 @@ int fill(Scanner *s, int len) char scan(Scanner *s) { - int state = 1; + int cond = 1; fill(s, 0); @@ -61,7 +61,8 @@ re2c:define:YYMARKER = s->ptr; re2c:define:YYFILL@len = #; re2c:define:YYFILL:naked= 1; re2c:define:YYFILL = "{ if(fill(s, #) >= 0) break; }"; -re2c:define:YYCONDITION = state; +re2c:define:YYGETCONDITION = cond; +re2c:define:YYGETCONDITION:naked = 1; re2c:yyfill:parameter = 0; re2c:indent:top = 2; diff --git a/re2c/test/condition_05.cgitcondition_05.cgit.h.c b/re2c/test/condition_05.cgitcondition_05.cgit.h.c index 1abbdb98..e2b4fcf9 100755 --- a/re2c/test/condition_05.cgitcondition_05.cgit.h.c +++ b/re2c/test/condition_05.cgitcondition_05.cgit.h.c @@ -46,7 +46,7 @@ int fill(Scanner *s, int len) char scan(Scanner *s) { - int state = 1; + int cond = 1; fill(s, 0); @@ -60,7 +60,7 @@ char scan(Scanner *s) &&yyc_normal, &&yyc_comment, }; - goto *yyctable[state]; + goto *yyctable[cond]; /* *********************************** */ yyc_comment: diff --git a/re2c/test/condition_05.cgitcondition_05.cgit.h.re b/re2c/test/condition_05.cgitcondition_05.cgit.h.re index b70cb073..5e086513 100755 --- a/re2c/test/condition_05.cgitcondition_05.cgit.h.re +++ b/re2c/test/condition_05.cgitcondition_05.cgit.h.re @@ -45,7 +45,7 @@ int fill(Scanner *s, int len) char scan(Scanner *s) { - int state = 1; + int cond = 1; fill(s, 0); @@ -61,7 +61,8 @@ re2c:define:YYMARKER = s->ptr; re2c:define:YYFILL@len = #; re2c:define:YYFILL:naked= 1; re2c:define:YYFILL = "{ if(fill(s, #) >= 0) break; }"; -re2c:define:YYCONDITION = state; +re2c:define:YYGETCONDITION = cond; +re2c:define:YYGETCONDITION:naked = 1; re2c:yyfill:parameter = 0; re2c:indent:top = 2; diff --git a/re2c/test/condition_05.cgtcondition_05.cgt.h.c b/re2c/test/condition_05.cgtcondition_05.cgt.h.c index a635939b..223e64ac 100755 --- a/re2c/test/condition_05.cgtcondition_05.cgt.h.c +++ b/re2c/test/condition_05.cgtcondition_05.cgt.h.c @@ -47,7 +47,7 @@ int fill(Scanner *s, int len) char scan(Scanner *s) { - int state = 1; + int cond = 1; fill(s, 0); @@ -62,7 +62,7 @@ char scan(Scanner *s) &&yyc_normal, &&yyc_comment, }; - goto *yyctable[state]; + goto *yyctable[cond]; /* *********************************** */ yyc_comment: @@ -72,7 +72,7 @@ yyc_comment: ++s->cur; if((yych = *s->cur) == '/') goto yy5; yy3: -#line 82 "condition_05.cgtcondition_05.cgt.h.re" +#line 83 "condition_05.cgtcondition_05.cgt.h.re" { goto yyc_comment; } @@ -82,7 +82,7 @@ yy4: goto yy3; yy5: ++s->cur; -#line 78 "condition_05.cgtcondition_05.cgt.h.re" +#line 79 "condition_05.cgtcondition_05.cgt.h.re" { continue; } @@ -95,7 +95,7 @@ yyc_normal: ++s->cur; if((yych = *s->cur) == '*') goto yy12; yy10: -#line 73 "condition_05.cgtcondition_05.cgt.h.re" +#line 74 "condition_05.cgtcondition_05.cgt.h.re" { fputc(*s->tok, stdout); continue; @@ -106,13 +106,13 @@ yy11: goto yy10; yy12: ++s->cur; -#line 69 "condition_05.cgtcondition_05.cgt.h.re" +#line 70 "condition_05.cgtcondition_05.cgt.h.re" { goto yyc_comment; } #line 114 "" } -#line 86 "condition_05.cgtcondition_05.cgt.h.re" +#line 87 "condition_05.cgtcondition_05.cgt.h.re" } } diff --git a/re2c/test/condition_05.cgtcondition_05.cgt.h.re b/re2c/test/condition_05.cgtcondition_05.cgt.h.re index b70cb073..5e086513 100755 --- a/re2c/test/condition_05.cgtcondition_05.cgt.h.re +++ b/re2c/test/condition_05.cgtcondition_05.cgt.h.re @@ -45,7 +45,7 @@ int fill(Scanner *s, int len) char scan(Scanner *s) { - int state = 1; + int cond = 1; fill(s, 0); @@ -61,7 +61,8 @@ re2c:define:YYMARKER = s->ptr; re2c:define:YYFILL@len = #; re2c:define:YYFILL:naked= 1; re2c:define:YYFILL = "{ if(fill(s, #) >= 0) break; }"; -re2c:define:YYCONDITION = state; +re2c:define:YYGETCONDITION = cond; +re2c:define:YYGETCONDITION:naked = 1; re2c:yyfill:parameter = 0; re2c:indent:top = 2; diff --git a/re2c/test/condition_05.cs.c b/re2c/test/condition_05.cs.c index e9dfb1db..b458b551 100755 --- a/re2c/test/condition_05.cs.c +++ b/re2c/test/condition_05.cs.c @@ -47,7 +47,7 @@ int fill(Scanner *s, int len) char scan(Scanner *s) { - int state = 1; + int cond = 1; fill(s, 0); @@ -58,7 +58,7 @@ char scan(Scanner *s) #line 59 "" { unsigned char yych; - if (state < 1) { + if (cond < 1) { goto yyc_normal; } else { goto yyc_comment; @@ -72,7 +72,7 @@ yyc_comment: ++s->cur; if((yych = *s->cur) == '/') goto yy5; yy3: -#line 82 "condition_05.cs.re" +#line 83 "condition_05.cs.re" { goto yyc_comment; } @@ -82,7 +82,7 @@ yy4: goto yy3; yy5: ++s->cur; -#line 78 "condition_05.cs.re" +#line 79 "condition_05.cs.re" { continue; } @@ -95,7 +95,7 @@ yyc_normal: ++s->cur; if((yych = *s->cur) == '*') goto yy12; yy10: -#line 73 "condition_05.cs.re" +#line 74 "condition_05.cs.re" { fputc(*s->tok, stdout); continue; @@ -106,13 +106,13 @@ yy11: goto yy10; yy12: ++s->cur; -#line 69 "condition_05.cs.re" +#line 70 "condition_05.cs.re" { goto yyc_comment; } #line 114 "" } -#line 86 "condition_05.cs.re" +#line 87 "condition_05.cs.re" } } diff --git a/re2c/test/condition_05.cs.re b/re2c/test/condition_05.cs.re index b70cb073..5e086513 100755 --- a/re2c/test/condition_05.cs.re +++ b/re2c/test/condition_05.cs.re @@ -45,7 +45,7 @@ int fill(Scanner *s, int len) char scan(Scanner *s) { - int state = 1; + int cond = 1; fill(s, 0); @@ -61,7 +61,8 @@ re2c:define:YYMARKER = s->ptr; re2c:define:YYFILL@len = #; re2c:define:YYFILL:naked= 1; re2c:define:YYFILL = "{ if(fill(s, #) >= 0) break; }"; -re2c:define:YYCONDITION = state; +re2c:define:YYGETCONDITION = cond; +re2c:define:YYGETCONDITION:naked = 1; re2c:yyfill:parameter = 0; re2c:indent:top = 2; diff --git a/re2c/test/condition_06.cs.c b/re2c/test/condition_06.cs.c index 7b861603..81b20862 100755 --- a/re2c/test/condition_06.cs.c +++ b/re2c/test/condition_06.cs.c @@ -66,7 +66,7 @@ enum YYCONDTYPE { void scan(Scanner *s) { - int state = EStateNormal; + int cond = EStateNormal; fill(s, 0); @@ -77,14 +77,14 @@ void scan(Scanner *s) #line 78 "" { unsigned char yych; - if (state < 2) { - if (state < 1) { + if (cond < 2) { + if (cond < 1) { goto yyc_Normal; } else { goto yyc_Comment; } } else { - if (state < 3) { + if (cond < 3) { goto yyc_Skiptoeol; } else { goto yyc_String; @@ -99,7 +99,7 @@ yyc_Comment: ++s->cur; if((yych = *s->cur) == '/') goto yy5; yy3: -#line 148 "condition_06.cs.re" +#line 149 "condition_06.cs.re" { goto yyc_Comment; } @@ -109,7 +109,7 @@ yy4: goto yy3; yy5: ++s->cur; -#line 144 "condition_06.cs.re" +#line 145 "condition_06.cs.re" { continue; } @@ -128,7 +128,7 @@ yyc_Normal: yych = *(s->tok = ++s->cur); if(yych == '?') goto yy19; yy10: -#line 139 "condition_06.cs.re" +#line 140 "condition_06.cs.re" { fputc(*s->tok, stdout); continue; @@ -141,7 +141,7 @@ yy11: goto yy10; yy12: ++s->cur; -#line 133 "condition_06.cs.re" +#line 134 "condition_06.cs.re" { fputc(*s->tok, stdout); state = EStateString; @@ -153,14 +153,14 @@ yy14: goto yy10; yy15: ++s->cur; -#line 129 "condition_06.cs.re" +#line 130 "condition_06.cs.re" { goto yyc_Skiptoeol; } #line 161 "" yy17: ++s->cur; -#line 125 "condition_06.cs.re" +#line 126 "condition_06.cs.re" { goto yyc_Comment; } @@ -184,7 +184,7 @@ yy20: goto yy10; yy21: ++s->cur; -#line 80 "condition_06.cs.re" +#line 81 "condition_06.cs.re" { fputc('[', stdout); continue; @@ -192,7 +192,7 @@ yy21: #line 193 "" yy23: ++s->cur; -#line 85 "condition_06.cs.re" +#line 86 "condition_06.cs.re" { fputc(']', stdout); continue; @@ -200,7 +200,7 @@ yy23: #line 201 "" yy25: ++s->cur; -#line 90 "condition_06.cs.re" +#line 91 "condition_06.cs.re" { fputc('{', stdout); continue; @@ -208,7 +208,7 @@ yy25: #line 209 "" yy27: ++s->cur; -#line 95 "condition_06.cs.re" +#line 96 "condition_06.cs.re" { fputc('}', stdout); continue; @@ -216,7 +216,7 @@ yy27: #line 217 "" yy29: ++s->cur; -#line 100 "condition_06.cs.re" +#line 101 "condition_06.cs.re" { fputc('#', stdout); continue; @@ -224,7 +224,7 @@ yy29: #line 225 "" yy31: ++s->cur; -#line 105 "condition_06.cs.re" +#line 106 "condition_06.cs.re" { fputc('\\', stdout); continue; @@ -232,7 +232,7 @@ yy31: #line 233 "" yy33: ++s->cur; -#line 110 "condition_06.cs.re" +#line 111 "condition_06.cs.re" { fputc('^', stdout); continue; @@ -240,7 +240,7 @@ yy33: #line 241 "" yy35: ++s->cur; -#line 115 "condition_06.cs.re" +#line 116 "condition_06.cs.re" { fputc('|', stdout); continue; @@ -248,7 +248,7 @@ yy35: #line 249 "" yy37: ++s->cur; -#line 120 "condition_06.cs.re" +#line 121 "condition_06.cs.re" { fputc('~', stdout); continue; @@ -270,7 +270,7 @@ yy41: yych = *(s->tok = ++s->cur); if(yych == '?') goto yy51; yy42: -#line 164 "condition_06.cs.re" +#line 165 "condition_06.cs.re" { goto yyc_Skiptoeol; } @@ -282,7 +282,7 @@ yy43: goto yy42; yy44: ++s->cur; -#line 160 "condition_06.cs.re" +#line 161 "condition_06.cs.re" { continue; } @@ -298,7 +298,7 @@ yy48: goto yy42; yy49: ++s->cur; -#line 156 "condition_06.cs.re" +#line 157 "condition_06.cs.re" { goto yyc_Skiptoeol; } @@ -313,7 +313,7 @@ yy51: if(yych != 0x0A) goto yy48; yy54: ++s->cur; -#line 152 "condition_06.cs.re" +#line 153 "condition_06.cs.re" { goto yyc_Skiptoeol; } @@ -327,7 +327,7 @@ yyc_String: ++s->cur; if((yych = *s->cur) != 0x0A) goto yy63; yy59: -#line 178 "condition_06.cs.re" +#line 179 "condition_06.cs.re" { fputc(*s->tok, stdout); continue; @@ -335,7 +335,7 @@ yy59: #line 336 "" yy60: ++s->cur; -#line 173 "condition_06.cs.re" +#line 174 "condition_06.cs.re" { fputc(*s->tok, stdout); continue; @@ -346,14 +346,14 @@ yy62: goto yy59; yy63: ++s->cur; -#line 168 "condition_06.cs.re" +#line 169 "condition_06.cs.re" { fputl((const char*)s->tok, 2, stdout); continue; } #line 355 "" } -#line 182 "condition_06.cs.re" +#line 183 "condition_06.cs.re" } } diff --git a/re2c/test/condition_06.cs.re b/re2c/test/condition_06.cs.re index e9d31872..b851162a 100755 --- a/re2c/test/condition_06.cs.re +++ b/re2c/test/condition_06.cs.re @@ -55,7 +55,7 @@ void fputl(const char *s, size_t len, FILE *stream) void scan(Scanner *s) { - int state = EStateNormal; + int cond = EStateNormal; fill(s, 0); @@ -71,7 +71,8 @@ re2c:define:YYMARKER = s->tok; re2c:define:YYFILL@len = #; re2c:define:YYFILL:naked= 1; re2c:define:YYFILL = "{ if(fill(s, #) >= 0) break; }"; -re2c:define:YYCONDITION = state; +re2c:define:YYGETCONDITION = cond; +re2c:define:YYGETCONDITION:naked = 1; re2c:yyfill:parameter = 0; re2c:indent:top = 2; re2c:condenumprefix = EState; diff --git a/re2c/test/condition_07.cbi.c b/re2c/test/condition_07.cbi.c index 5d8096bb..c34ba254 100755 --- a/re2c/test/condition_07.cbi.c +++ b/re2c/test/condition_07.cbi.c @@ -61,7 +61,7 @@ enum YYCONDTYPE { void scan(Scanner *s) { - int state = EStateR1; + int cond = EStateR1; fill(s, 0); @@ -71,7 +71,7 @@ void scan(Scanner *s) { unsigned char yych; - if (state < 1) { + if (cond < 1) { goto yyc_R1; } else { goto yyc_R2; diff --git a/re2c/test/condition_07.cbi.re b/re2c/test/condition_07.cbi.re index 921056ce..5a1c4c79 100755 --- a/re2c/test/condition_07.cbi.re +++ b/re2c/test/condition_07.cbi.re @@ -55,7 +55,7 @@ void fputl(const char *s, size_t len, FILE *stream) void scan(Scanner *s) { - int state = EStateR1; + int cond = EStateR1; fill(s, 0); @@ -71,7 +71,8 @@ re2c:define:YYMARKER = s->tok; re2c:define:YYFILL@len = #; re2c:define:YYFILL:naked= 1; re2c:define:YYFILL = "{ if(fill(s, #) >= 0) break; }"; -re2c:define:YYCONDITION = state; +re2c:define:YYGETCONDITION = cond; +re2c:define:YYGETCONDITION:naked = 1; re2c:yyfill:parameter = 0; re2c:indent:top = 2; re2c:condenumprefix = EState; diff --git a/re2c/test/condition_08.cbi.re b/re2c/test/condition_08.cbi.re index 1e4fb32d..975632e9 100755 --- a/re2c/test/condition_08.cbi.re +++ b/re2c/test/condition_08.cbi.re @@ -76,7 +76,8 @@ re2c:define:YYSETSTATE@state = #; re2c:define:YYSETSTATE = "s->state = #;"; re2c:define:YYGETSTATE = "s->state"; re2c:define:YYGETSTATE:naked = 1; -re2c:define:YYCONDITION = s->cond; +re2c:define:YYGETCONDITION = s->cond; +re2c:define:YYGETCONDITION:naked = 1; re2c:define:YYCONDTYPE = ScanContition; re2c:variable:yych = s->yych; re2c:yych:emit = 0; diff --git a/re2c/test/condition_08.cbif.re b/re2c/test/condition_08.cbif.re index 1e4fb32d..975632e9 100755 --- a/re2c/test/condition_08.cbif.re +++ b/re2c/test/condition_08.cbif.re @@ -76,7 +76,8 @@ re2c:define:YYSETSTATE@state = #; re2c:define:YYSETSTATE = "s->state = #;"; re2c:define:YYGETSTATE = "s->state"; re2c:define:YYGETSTATE:naked = 1; -re2c:define:YYCONDITION = s->cond; +re2c:define:YYGETCONDITION = s->cond; +re2c:define:YYGETCONDITION:naked = 1; re2c:define:YYCONDTYPE = ScanContition; re2c:variable:yych = s->yych; re2c:yych:emit = 0; diff --git a/re2c/test/condition_09.cbif.re b/re2c/test/condition_09.cbif.re index 2480b934..40b60303 100755 --- a/re2c/test/condition_09.cbif.re +++ b/re2c/test/condition_09.cbif.re @@ -76,7 +76,10 @@ re2c:define:YYSETSTATE@state = #; re2c:define:YYSETSTATE = "s->state = #;"; re2c:define:YYGETSTATE = "s->state"; re2c:define:YYGETSTATE:naked = 1; -re2c:define:YYCONDITION = s->cond; +re2c:define:YYSETCONDITION = "s->cond = #;"; +re2c:define:YYSETCONDITION@cond = #; +re2c:define:YYGETCONDITION = s->cond; +re2c:define:YYGETCONDITION:naked = 1; re2c:define:YYCONDTYPE = ScanContition; re2c:variable:yych = s->yych; re2c:yych:emit = 0; diff --git a/re2c/test/condition_09.cgif.re b/re2c/test/condition_09.cgif.re index 2480b934..40b60303 100755 --- a/re2c/test/condition_09.cgif.re +++ b/re2c/test/condition_09.cgif.re @@ -76,7 +76,10 @@ re2c:define:YYSETSTATE@state = #; re2c:define:YYSETSTATE = "s->state = #;"; re2c:define:YYGETSTATE = "s->state"; re2c:define:YYGETSTATE:naked = 1; -re2c:define:YYCONDITION = s->cond; +re2c:define:YYSETCONDITION = "s->cond = #;"; +re2c:define:YYSETCONDITION@cond = #; +re2c:define:YYGETCONDITION = s->cond; +re2c:define:YYGETCONDITION:naked = 1; re2c:define:YYCONDTYPE = ScanContition; re2c:variable:yych = s->yych; re2c:yych:emit = 0;