return str;
}
-static void genYyfill(std::ostream &o, uint ind, uint need)
+static void genYYFill(std::ostream &o, uint ind, uint need)
{
if (bUseYYFillParam)
{
- o << mapCodeName["YYFILL"] << "(" << need << ");\n";
+ o << mapCodeName["YYFILL"];
+ if (!bUseYYFillNaked)
+ {
+ o << "(" << need << ");";
+ }
+ o << "\n";
}
else
{
- o << replaceParam(mapCodeName["YYFILL"], yyFillLength, need) << "\n";
+ o << replaceParam(mapCodeName["YYFILL"], yyFillLength, need);
+ if (!bUseYYFillNaked)
+ {
+ o << ";";
+ }
+ o << "\n";
}
}
if (n == 1)
{
o << indent(ind) << "if(" << mapCodeName["YYLIMIT"] << " == " << mapCodeName["YYCURSOR"] << ") ";
- genYyfill(o, ind, n);
+ genYYFill(o, ind, n);
}
else
{
o << indent(ind) << "if((" << mapCodeName["YYLIMIT"] << " - " << mapCodeName["YYCURSOR"] << ") < " << n << ") ";
- genYyfill(o, ind, n);
+ genYYFill(o, ind, n);
}
}
{
vUsedLabels.insert(start_label);
o << indent(ind) << "switch(" << mapCodeName["YYGETSTATE"];
- if (bUseYYGetStateFunc)
+ if (!bUseYYGetStateNaked)
{
o << "()";
}
{
bUseYYFillParam = num != 0;
}
+ else if (cfg.to_string() == "define:YYFILL:naked")
+ {
+ bUseYYFillNaked = num != 0;
+ }
else if (cfg.to_string() == "cgoto:threshold")
{
cGotoThreshold = num;
{
bEmitYYCh = num != 0;
}
- else if (cfg.to_string() == "define:YYGETSTATE:func")
+ else if (cfg.to_string() == "define:YYGETSTATE:naked")
{
- bUseYYGetStateFunc = num != 0;
+ bUseYYGetStateNaked = num != 0;
}
else
{
extern bool bUseStateNext;
extern bool bUseYYFill;
extern bool bUseYYFillParam;
+extern bool bUseYYFillNaked;
extern bool bUseYYSetStateParam;
-extern bool bUseYYGetStateFunc;
+extern bool bUseYYGetStateNaked;
extern bool bWroteGetState;
extern bool bWroteCondCheck;
bool bUseStateNext = false;
bool bUseYYFill = true;
bool bUseYYFillParam = true;
+bool bUseYYFillNaked = false;
bool bUseYYSetStateParam = true;
-bool bUseYYGetStateFunc = true;
+bool bUseYYGetStateNaked = false;
std::string startLabelName;
std::string labelPrefix("yy");
++s->cur;
if((yych = *s->cur) == '/') goto yy5;
yy3:
-#line 80 "condition_05.cg.re"
+#line 82 "condition_05.cg.re"
{
goto yyc_comment;
}
goto yy3;
yy5:
++s->cur;
-#line 76 "condition_05.cg.re"
+#line 78 "condition_05.cg.re"
{
continue;
}
++s->cur;
if((yych = *s->cur) == '*') goto yy12;
yy10:
-#line 71 "condition_05.cg.re"
+#line 73 "condition_05.cg.re"
{
fputc(*s->tok, stdout);
continue;
goto yy10;
yy12:
++s->cur;
-#line 67 "condition_05.cg.re"
+#line 69 "condition_05.cg.re"
{
goto yyc_comment;
}
#line 114 "<stdout>"
}
-#line 84 "condition_05.cg.re"
+#line 86 "condition_05.cg.re"
}
}
re2c:define:YYCURSOR = s->cur;
re2c:define:YYLIMIT = s->lim;
re2c:define:YYMARKER = s->ptr;
-re2c:define:YYFILL = "{ if(fill(s, 2) >= 0) break; }";
+re2c:define:YYFILL:len = #;
+re2c:define:YYFILL:naked= 1;
+re2c:define:YYFILL = "{ if(fill(s, #) >= 0) break; }";
re2c:define:YYCONDITION = state;
re2c:yyfill:parameter = 0;
re2c:indent:top = 2;
re2c:define:YYCURSOR = s->cur;
re2c:define:YYLIMIT = s->lim;
re2c:define:YYMARKER = s->ptr;
-re2c:define:YYFILL = "{ if(fill(s, 2) >= 0) break; }";
+re2c:define:YYFILL:len = #;
+re2c:define:YYFILL:naked= 1;
+re2c:define:YYFILL = "{ if(fill(s, #) >= 0) break; }";
re2c:define:YYCONDITION = state;
re2c:yyfill:parameter = 0;
re2c:indent:top = 2;
++s->cur;
if((yych = *s->cur) == '/') goto yy5;
yy3:
-#line 80 "condition_05.cgtcondition_05.cgt.h.re"
+#line 82 "condition_05.cgtcondition_05.cgt.h.re"
{
goto yyc_comment;
}
goto yy3;
yy5:
++s->cur;
-#line 76 "condition_05.cgtcondition_05.cgt.h.re"
+#line 78 "condition_05.cgtcondition_05.cgt.h.re"
{
continue;
}
++s->cur;
if((yych = *s->cur) == '*') goto yy12;
yy10:
-#line 71 "condition_05.cgtcondition_05.cgt.h.re"
+#line 73 "condition_05.cgtcondition_05.cgt.h.re"
{
fputc(*s->tok, stdout);
continue;
goto yy10;
yy12:
++s->cur;
-#line 67 "condition_05.cgtcondition_05.cgt.h.re"
+#line 69 "condition_05.cgtcondition_05.cgt.h.re"
{
goto yyc_comment;
}
#line 114 "<stdout>"
}
-#line 84 "condition_05.cgtcondition_05.cgt.h.re"
+#line 86 "condition_05.cgtcondition_05.cgt.h.re"
}
}
re2c:define:YYCURSOR = s->cur;
re2c:define:YYLIMIT = s->lim;
re2c:define:YYMARKER = s->ptr;
-re2c:define:YYFILL = "{ if(fill(s, 2) >= 0) break; }";
+re2c:define:YYFILL:len = #;
+re2c:define:YYFILL:naked= 1;
+re2c:define:YYFILL = "{ if(fill(s, #) >= 0) break; }";
re2c:define:YYCONDITION = state;
re2c:yyfill:parameter = 0;
re2c:indent:top = 2;
++s->cur;
if((yych = *s->cur) == '/') goto yy5;
yy3:
-#line 80 "condition_05.cs.re"
+#line 82 "condition_05.cs.re"
{
goto yyc_comment;
}
goto yy3;
yy5:
++s->cur;
-#line 76 "condition_05.cs.re"
+#line 78 "condition_05.cs.re"
{
continue;
}
++s->cur;
if((yych = *s->cur) == '*') goto yy12;
yy10:
-#line 71 "condition_05.cs.re"
+#line 73 "condition_05.cs.re"
{
fputc(*s->tok, stdout);
continue;
goto yy10;
yy12:
++s->cur;
-#line 67 "condition_05.cs.re"
+#line 69 "condition_05.cs.re"
{
goto yyc_comment;
}
#line 114 "<stdout>"
}
-#line 84 "condition_05.cs.re"
+#line 86 "condition_05.cs.re"
}
}
re2c:define:YYCURSOR = s->cur;
re2c:define:YYLIMIT = s->lim;
re2c:define:YYMARKER = s->ptr;
-re2c:define:YYFILL = "{ if(fill(s, 2) >= 0) break; }";
+re2c:define:YYFILL:len = #;
+re2c:define:YYFILL:naked= 1;
+re2c:define:YYFILL = "{ if(fill(s, #) >= 0) break; }";
re2c:define:YYCONDITION = state;
re2c:yyfill:parameter = 0;
re2c:indent:top = 2;
++s->cur;
if((yych = *s->cur) == '/') goto yy5;
yy3:
-#line 147 "condition_06.cs.re"
+#line 148 "condition_06.cs.re"
{
goto yyc_Comment;
}
goto yy3;
yy5:
++s->cur;
-#line 143 "condition_06.cs.re"
+#line 144 "condition_06.cs.re"
{
continue;
}
yych = *(s->tok = ++s->cur);
if(yych == '?') goto yy19;
yy10:
-#line 138 "condition_06.cs.re"
+#line 139 "condition_06.cs.re"
{
fputc(*s->tok, stdout);
continue;
goto yy10;
yy12:
++s->cur;
-#line 132 "condition_06.cs.re"
+#line 133 "condition_06.cs.re"
{
fputc(*s->tok, stdout);
state = EStateString;
goto yy10;
yy15:
++s->cur;
-#line 128 "condition_06.cs.re"
+#line 129 "condition_06.cs.re"
{
goto yyc_Skiptoeol;
}
#line 161 "<stdout>"
yy17:
++s->cur;
-#line 124 "condition_06.cs.re"
+#line 125 "condition_06.cs.re"
{
goto yyc_Comment;
}
goto yy10;
yy21:
++s->cur;
-#line 79 "condition_06.cs.re"
+#line 80 "condition_06.cs.re"
{
fputc('[', stdout);
continue;
#line 193 "<stdout>"
yy23:
++s->cur;
-#line 84 "condition_06.cs.re"
+#line 85 "condition_06.cs.re"
{
fputc(']', stdout);
continue;
#line 201 "<stdout>"
yy25:
++s->cur;
-#line 89 "condition_06.cs.re"
+#line 90 "condition_06.cs.re"
{
fputc('{', stdout);
continue;
#line 209 "<stdout>"
yy27:
++s->cur;
-#line 94 "condition_06.cs.re"
+#line 95 "condition_06.cs.re"
{
fputc('}', stdout);
continue;
#line 217 "<stdout>"
yy29:
++s->cur;
-#line 99 "condition_06.cs.re"
+#line 100 "condition_06.cs.re"
{
fputc('#', stdout);
continue;
#line 225 "<stdout>"
yy31:
++s->cur;
-#line 104 "condition_06.cs.re"
+#line 105 "condition_06.cs.re"
{
fputc('\\', stdout);
continue;
#line 233 "<stdout>"
yy33:
++s->cur;
-#line 109 "condition_06.cs.re"
+#line 110 "condition_06.cs.re"
{
fputc('^', stdout);
continue;
#line 241 "<stdout>"
yy35:
++s->cur;
-#line 114 "condition_06.cs.re"
+#line 115 "condition_06.cs.re"
{
fputc('|', stdout);
continue;
#line 249 "<stdout>"
yy37:
++s->cur;
-#line 119 "condition_06.cs.re"
+#line 120 "condition_06.cs.re"
{
fputc('~', stdout);
continue;
yych = *(s->tok = ++s->cur);
if(yych == '?') goto yy51;
yy42:
-#line 163 "condition_06.cs.re"
+#line 164 "condition_06.cs.re"
{
goto yyc_Skiptoeol;
}
goto yy42;
yy44:
++s->cur;
-#line 159 "condition_06.cs.re"
+#line 160 "condition_06.cs.re"
{
continue;
}
goto yy42;
yy49:
++s->cur;
-#line 155 "condition_06.cs.re"
+#line 156 "condition_06.cs.re"
{
goto yyc_Skiptoeol;
}
if(yych != 0x0A) goto yy48;
yy54:
++s->cur;
-#line 151 "condition_06.cs.re"
+#line 152 "condition_06.cs.re"
{
goto yyc_Skiptoeol;
}
++s->cur;
if((yych = *s->cur) != 0x0A) goto yy63;
yy59:
-#line 177 "condition_06.cs.re"
+#line 178 "condition_06.cs.re"
{
fputc(*s->tok, stdout);
continue;
#line 336 "<stdout>"
yy60:
++s->cur;
-#line 172 "condition_06.cs.re"
+#line 173 "condition_06.cs.re"
{
fputc(*s->tok, stdout);
continue;
goto yy59;
yy63:
++s->cur;
-#line 167 "condition_06.cs.re"
+#line 168 "condition_06.cs.re"
{
fputl((const char*)s->tok, 2, stdout);
continue;
}
#line 355 "<stdout>"
}
-#line 181 "condition_06.cs.re"
+#line 182 "condition_06.cs.re"
}
}
re2c:define:YYLIMIT = s->lim;
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:yyfill:parameter = 0;
re2c:define:YYLIMIT = s->lim;
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:yyfill:parameter = 0;
re2c:define:YYLIMIT = s->lim;
re2c:define:YYMARKER = s->tok;
re2c:define:YYFILL:len = #;
+re2c:define:YYFILL:naked = 1;
re2c:define:YYFILL = "if(fill(s, #) >= 0) break;";
re2c:define:YYSETSTATE:state = #;
re2c:define:YYSETSTATE = "s->state = #;";
re2c:define:YYGETSTATE = "s->state";
-re2c:define:YYGETSTATE:func = 0;
+re2c:define:YYGETSTATE:naked = 1;
re2c:define:YYCONDITION = s->cond;
re2c:define:YYCONDTYPE = ScanContition;
re2c:variable:yych = s->yych;
re2c:define:YYLIMIT = s->lim;
re2c:define:YYMARKER = s->tok;
re2c:define:YYFILL:len = #;
+re2c:define:YYFILL:naked = 1;
re2c:define:YYFILL = "if(fill(s, #) >= 0) break;";
re2c:define:YYSETSTATE:state = #;
re2c:define:YYSETSTATE = "s->state = #;";
re2c:define:YYGETSTATE = "s->state";
-re2c:define:YYGETSTATE:func = 0;
+re2c:define:YYGETSTATE:naked = 1;
re2c:define:YYCONDITION = s->cond;
re2c:define:YYCONDTYPE = ScanContition;
re2c:variable:yych = s->yych;
re2c:define:YYLIMIT = s->lim;
re2c:define:YYMARKER = s->tok;
re2c:define:YYFILL:len = #;
+re2c:define:YYFILL:naked = 1;
re2c:define:YYFILL = "if(fill(s, #) >= 0) break;";
re2c:define:YYSETSTATE:state = #;
re2c:define:YYSETSTATE = "s->state = #;";
re2c:define:YYGETSTATE = "s->state";
-re2c:define:YYGETSTATE:func = 0;
+re2c:define:YYGETSTATE:naked = 1;
re2c:define:YYCONDITION = s->cond;
re2c:define:YYCONDTYPE = ScanContition;
re2c:variable:yych = s->yych;
re2c:define:YYLIMIT = s->lim;
re2c:define:YYMARKER = s->tok;
re2c:define:YYFILL:len = #;
+re2c:define:YYFILL:naked = 1;
re2c:define:YYFILL = "if(fill(s, #) >= 0) break;";
re2c:define:YYSETSTATE:state = #;
re2c:define:YYSETSTATE = "s->state = #;";
re2c:define:YYGETSTATE = "s->state";
-re2c:define:YYGETSTATE:func = 0;
+re2c:define:YYGETSTATE:naked = 1;
re2c:define:YYCONDITION = s->cond;
re2c:define:YYCONDTYPE = ScanContition;
re2c:variable:yych = s->yych;
re2c:define:YYLIMIT = s.lim;
re2c:define:YYMARKER = s.ptr;
re2c:define:YYCTXMARKER = s.ctx;
-re2c:define:YYFILL = "fill();";
+re2c:define:YYFILL = "fill()";
re2c:yyfill:parameter = 0;
re2c:variable:yych = curr;