- Added re2c:define:YYSETSTATE:naked inplace configuration.
Version 0.13.4 (2008-??-??)
---------------------------
+- Added re2c:yyfill:check inplace configuration.
+- Added re2c:define:YYSETSTATE:naked inplace configuration.
Version 0.13.3 (2008-03-14)
---------------------------
if (bUseYYFill && n > 0)
{
+ o << indent(ind);
if (n == 1)
{
- o << indent(ind) << "if (" << mapCodeName["YYLIMIT"] << " == " << mapCodeName["YYCURSOR"] << ") ";
+ if (bUseYYFillCheck)
+ {
+ o << "if (" << mapCodeName["YYLIMIT"] << " == " << mapCodeName["YYCURSOR"] << ") ";
+ }
genYYFill(o, ind, n);
}
else
{
- o << indent(ind) << "if ((" << mapCodeName["YYLIMIT"] << " - " << mapCodeName["YYCURSOR"] << ") < " << n << ") ";
+ if (bUseYYFillCheck)
+ {
+ o << "if ((" << mapCodeName["YYLIMIT"] << " - " << mapCodeName["YYCURSOR"] << ") < " << n << ") ";
+ }
genYYFill(o, ind, n);
}
}
{
bUseYYFillParam = num != 0;
}
+ else if (cfg.to_string() == "yyfill:check")
+ {
+ bUseYYFillCheck = num != 0;
+ }
else if (cfg.to_string() == "cgoto:threshold")
{
cGotoThreshold = num;
{
bUseYYGetStateNaked = num != 0;
}
+ else if (cfg.to_string() == "define:YYSETSTATE:naked")
+ {
+ bUseYYSetStateNaked = num != 0;
+ }
else
{
std::string msg = "unrecognized configuration name '";
extern bool bUseStateNext;
extern bool bUseYYFill;
extern bool bUseYYFillParam;
+extern bool bUseYYFillCheck;
extern bool bUseYYFillNaked;
extern bool bUseYYSetConditionParam;
extern bool bUseYYGetConditionNaked;
extern bool bUseYYSetStateParam;
+extern bool bUseYYSetStateNaked;
extern bool bUseYYGetStateNaked;
extern bool bWroteGetState;
extern bool bWroteCondCheck;
<hr />
<h1>Changelog</h1>
<h2>2008-??-??: 0.13.4</h2>
+<li>Added re2c:yyfill:check inplace configuration.</li>
+<li>Added re2c:define:YYSETSTATE:naked inplace configuration.</li>
<ul>
</ul>
<h2>2008-03-14: 0.13.3</h2>
<dd>Set this to zero to suppress generation of YYFILL(n). When using this be sure
to verify that the generated scanner does not read behind input. Allowing
this behavior might introduce sever security issues to you programs.</dd>
+<dt><i>re2c:yyfill:check</i> <b>=</b> 1 </b>;</b></dt>
+<dd>This can be set 0 to suppress output of the pre condition using YYCURSOR and
+YYLIMIT which becomes usefull when YYLIMIT + max(YYFILL) is always accessible.</dd>
<dt><i>re2c:yyfill:parameter</i> <b>=</b> 1 <b>;</b></dt>
<dd>Allows to suppress parameter passing to <b>YYFILL</b> calls. If set to zero
then no parameter is passed to <b>YYFILL</b>. However <b>define:YYFILL@LEN</b>
<dt><i>re2c:define:YYSETSTATE</i> <b>=</b> YYSETSTATE <b>;</b></dt>
<dd>Allows to overwrite the define <b>YYSETSTATE</b> and thus avoiding it by setting the
value to the actual code needed.</dd>
+<dt><i>re2c:define:YYSETSTATE:naked</i> <b>=</b> 0 <b>;</b></dt>
+<dt>Wehn set to 1 neither braces, parameter nor semicolon gets emitted.</dt>
<dt><i>re2c:define:YYSETSTATE@state</i> <b>=</b> @@ <b>;</b></dt>
<dd>When using <b>re2c:define:YYSETSTATE</b> then any occurence of this text
inside <b>YYSETSTATE</b> will be replaced with the actual new state value.</dd>
bool bUseStateNext = false;
bool bUseYYFill = true;
bool bUseYYFillParam = true;
+bool bUseYYFillCheck = true;
bool bUseYYFillNaked = false;
bool bUseYYSetConditionParam = true;
bool bUseYYGetConditionNaked = false;
bool bUseYYSetStateParam = true;
+bool bUseYYSetStateNaked = false;
bool bUseYYGetStateNaked = false;
std::string startLabelName;
to verify that the generated scanner does not read behind input. Allowing
this behavior might introduce sever security issues to you programs.
.TP
+\fIre2c:yyfill:check\fP \fB=\fP 1 \fB;\fP
+This can be set 0 to suppress output of the pre condition using YYCURSOR and
+YYLIMIT which becomes usefull when YYLIMIT + max(YYFILL) is always accessible.
+.TP
\fIre2c:yyfill:parameter\fP \fB=\fP 1 \fB;\fP
Allows to suppress parameter passing to \fBYYFILL\fP calls. If set to zero
then no parameter is passed to \fBYYFILL\fP. However \fBdefine:YYFILL@LEN\fP
Allows to overwrite the define \fBYYSETSTATE\fP and thus avoiding it by setting the
value to the actual code needed.
.TP
+\fIre2c:define:YYSETSTATE:naked\fP \fB=\fP 0 \fB;\fP
+Wehn set to 1 neither braces, parameter nor semicolon gets emitted.
+.TP
\fIre2c:define:YYSETSTATE@state\fP \fB=\fP @@ \fB;\fP
When using \fIre2c:define:YYSETSTATE\fP then any occurence of this text
inside \fBYYSETSTATE\fP will be replaced with the actual new state value.
--- /dev/null
+/* Generated by re2c */
+#define NULL ((char*) 0)
+
+const unsigned char *scan(const unsigned char *p, unsigned int len, int *state)
+{
+ unsigned char c;
+ const unsigned char *q;
+ const unsigned char * const e = p + len;
+
+ switch (*state) {
+ default: goto yy0;
+ case 0: goto yyFillLabel0;
+ case 1: goto yyFillLabel1;
+ }
+
+
+yy0:
+ *state = 0;
+ if (p >= e) {
+ return NULL;
+ }
+yyFillLabel0:
+ c = *p;
+ if (c <= '/') goto yy4;
+ if (c >= ':') goto yy4;
+ ++p;
+ c = *p;
+ goto yy7;
+yy3:
+ { return p; }
+yy4:
+ ++p;
+ { return NULL; }
+yy6:
+ ++p;
+ *state = 1;
+ if (p >= e) {
+ return NULL;
+ }
+yyFillLabel1:
+ c = *p;
+yy7:
+ if (c <= '/') goto yy3;
+ if (c <= '9') goto yy6;
+ goto yy3;
+
+}
--- /dev/null
+#define NULL ((char*) 0)
+
+const unsigned char *scan(const unsigned char *p, unsigned int len, int *state)
+{
+ unsigned char c;
+ const unsigned char *q;
+ const unsigned char * const e = p + len;
+/*!re2c
+re2c:variable:yych = c;
+re2c:indent:top = 1;
+re2c:state:abort = 0;
+re2c:state:nextlabel = 0;
+re2c:define:YYCTYPE = char;
+re2c:define:YYCURSOR = p;
+re2c:define:YYLIMIT = e;
+re2c:define:YYMARKER = q;
+re2c:yyfill:check = 0;
+re2c:define:YYFILL:naked = 1;
+re2c:define:YYFILL = "if (p >= e) {\n\t\treturn NULL;\n\t}";
+re2c:define:YYSETSTATE = "*state = @;";
+re2c:define:YYSETSTATE:naked = 1;
+re2c:define:YYSETSTATE@state = "@";
+re2c:define:YYGETSTATE = "*state";
+re2c:define:YYGETSTATE:naked = 1;
+*/
+/*!getstate:re2c */
+/*!re2c
+ [0-9]+ { return p; }
+ [\000-\377] { return NULL; }
+*/
+}