Before this commit, given the following example:
/*!re2c
re2c:startlabel = "start";
[^]* {}
*/
re2c would generate the following code:
{
YYCTYPE yych;
goto yy0;
yy1:
start:
++YYCURSOR;
yy0:
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy1;
{}
}
where "start:" falsely corresponds to "yy1:" rather to "yy0:".
(The important property of this example is that DFA has arrows
to initial state.) This commit fixes this behavior:
{
YYCTYPE yych;
start:
goto yy0;
yy1:
++YYCURSOR;
yy0:
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy1;
{}
}
return;
}
- if (!cFlag && !startLabelName.empty())
- {
- o << startLabelName << ":\n";
- }
-
if (vUsedLabels.count(s->label))
{
if (s->link)
{
o << labelPrefix << prolog_label << ":\n";
}
- if (!startLabelName.empty())
- {
- o << startLabelName << ":\n";
- }
+ }
+ if (!startLabelName.empty())
+ {
+ o << startLabelName << ":\n";
}
genCondGoto(o, ind, *specMap);
}
--- /dev/null
+/* Generated by re2c */
+
+{
+ YYCTYPE yych;
+start:
+ switch (YYGETCONDITION()) {
+ case yycc1: goto yyc_c1;
+ }
+/* *********************************** */
+yyc_c1:
+ goto yy1;
+yy2:
+ ++YYCURSOR;
+yy1:
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ goto yy2;
+ {}
+}
+
--- /dev/null
+/*!re2c
+ re2c:startlabel = "start";
+ <c1> [^]* {}
+*/
--- /dev/null
+/* Generated by re2c */
+
+{
+ YYCTYPE yych;
+start:
+ goto yy0;
+yy1:
+ ++YYCURSOR;
+yy0:
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ goto yy1;
+ {}
+}
+
--- /dev/null
+/*!re2c
+ re2c:startlabel = "start";
+ [^]* {}
+*/