void gen_rescan_label(Output &o, const State *s)
{
const opt_t *opts = o.block().opts;
-
- if (opts->eof == NOEOF || endstate(s)) return;
-
- o.wstring(opts->labelPrefix).wlabel(s->label).ws("_:\n");
-
- if (opts->fFlag) {
+ if (opts->eof == NOEOF || endstate(s)) {
+ ; // no rescan label
+ }
+ else if (opts->fFlag) {
o.wstring(opts->yyfilllabel).wu32(o.fill_index).ws(":\n");
++o.fill_index;
}
+ else {
+ o.wstring(opts->labelPrefix).wlabel(s->label).ws("_:\n");
+ }
}
void gen_goto_case(Output &o, uint32_t ind, const State *from, const State *to,
// usually 'end' states are final states (not all final states are 'end'
// states), but sometimes 'end' state happens to be initial non-accepting
// state, e.g. in case of rule '[]'
+ DASSERT(s->go.nSpans > 0);
const Action::type_t &a = s->go.span[0].to->action.type;
return s->go.nSpans == 1
&& (a == Action::RULE || a == Action::ACCEPT);
void emit_state (Output & o, uint32_t ind, const State * s, bool used_label)
{
const opt_t *opts = o.block().opts;
- used_label |= opts->eof != NOEOF
- && (s->action.type == Action::MOVE
- || s->action.type == Action::INITIAL);
if (used_label)
{
o.wstring(opts->labelPrefix).wlabel(s->label).ws(":\n");
size_t nbranches;
Branch *branches;
+ const State *def;
Linear(const Span *s, uint32_t n, const State *next, bool skip, uint32_t eof);
~Linear();
, bool skip, uint32_t eof)
: nbranches(0)
, branches(new Branch[n])
+ , def(eof == NOEOF ? NULL : next)
{
for (;;) {
if (n == 1 && s[0].to == next) {
used.insert(to->label);
}
}
+ if (def) {
+ used.insert(def->label);
+ }
}
void If::used_labels (std::set<label_t> & used) const
{
char yych;
-yy1:
yy1_:
yych = *in.cur++;
switch (yych) {
yy4:
yy4_:
yych = *in.cur;
-yy5:
switch (yych) {
case '\n':
++in.cur;
{ continue; }
yy7:
yy7_:
- yych = *in.cur;
-yy8:
- ++in.cur;
+ yych = *in.cur++;
switch (yych) {
case '"': goto yy26;
case '\\': goto yy28;
}
yy9:
yy9_:
- yych = *in.cur;
-yy10:
- ++in.cur;
+ yych = *in.cur++;
switch (yych) {
case '\'': goto yy29;
case '\\': goto yy31;
{
char yych;
-yy1:
yy1_:
yych = *in.cur;
switch (yych) {
++in.cur;
yy4_:
yych = *in.cur;
-yy5:
switch (yych) {
case '\n': goto yy4;
default:
++in.cur;
yy7_:
yych = *in.cur;
-yy8:
switch (yych) {
case '"': goto yy26;
case '\\': goto yy28;
++in.cur;
yy9_:
yych = *in.cur;
-yy10:
switch (yych) {
case '\'': goto yy29;
case '\\': goto yy31;
{
char yych;
-yy1:
yy1_:
yych = *in.cur;
switch (yych) {
++in.cur;
yy4_:
yych = *in.cur;
-yy5:
switch (yych) {
case '\n': goto yy4;
default:
++in.cur;
yy7_:
yych = *in.cur;
-yy8:
switch (yych) {
case '0':
case '1':
{
char yych;
-yy1:
yy1_:
yych = *in.cur;
switch (yych) {
++in.cur;
yy4_:
yych = *in.cur;
-yy5:
switch (yych) {
case '\n': goto yy4;
default:
++in.cur;
yy7_:
yych = *in.cur;
-yy8:
switch (yych) {
case '0':
case '1':
{
uint8_t yych;
unsigned int yyaccept = 0;
-yy1:
yy1_:
yych = *in.cur;
switch (yych) {
in.mar = ++in.cur;
yy2_:
yych = *in.cur;
-yy3:
switch (yych) {
case 0x00:
case 0x01:
++in.cur;
yy5_:
yych = *in.cur;
-yy6:
switch (yych) {
case '\n': goto yy5;
default:
-yy1:
yy0:
-yy1_:
yyFillLabel0:
in.yych = *in.cur;
switch (in.yych) {
{ printf("< Unexpected character >%c<\n", in.yych); return FAIL; }
yy6:
++in.cur;
-yy6_:
yyFillLabel1:
in.yych = *in.cur;
-yy7:
switch (in.yych) {
case '\n':
case ' ': goto yy6;
{ printf("< whitespace\n"); return WHITESPACE; }
yy9:
++in.cur;
-yy9_:
yyFillLabel2:
in.yych = *in.cur;
yy10:
{ printf("< word\n"); return WORD; }
yy12:
++in.cur;
-yy12_:
yyFillLabel3:
in.yych = *in.cur;
switch (in.yych) {
}
yy13:
++in.cur;
-yy13_:
yyFillLabel4:
in.yych = *in.cur;
switch (in.yych) {
}
yy14:
++in.cur;
-yy14_:
yyFillLabel5:
in.yych = *in.cur;
switch (in.yych) {
}
yy15:
++in.cur;
-yy15_:
yyFillLabel6:
in.yych = *in.cur;
switch (in.yych) {
}
yy16:
in.mark = ++in.cur;
-yy16_:
yyFillLabel7:
in.yych = *in.cur;
switch (in.yych) {
}
yy17:
++in.cur;
-yy17_:
yyFillLabel8:
in.yych = *in.cur;
switch (in.yych) {
goto yy11;
yy19:
++in.cur;
-yy19_:
yyFillLabel9:
in.yych = *in.cur;
switch (in.yych) {
}
yy20:
++in.cur;
-yy20_:
yyFillLabel10:
in.yych = *in.cur;
switch (in.yych) {
}
yy21:
++in.cur;
-yy21_:
yyFillLabel11:
in.yych = *in.cur;
switch (in.yych) {
}
yy22:
++in.cur;
-yy22_:
yyFillLabel12:
in.yych = *in.cur;
switch (in.yych) {
}
yy23:
++in.cur;
-yy23_:
yyFillLabel13:
in.yych = *in.cur;
switch (in.yych) {
}
yy24:
++in.cur;
-yy24_:
yyFillLabel14:
in.yych = *in.cur;
switch (in.yych) {
}
yy25:
++in.cur;
-yy25_:
yyFillLabel15:
in.yych = *in.cur;
switch (in.yych) {
}
yy26:
++in.cur;
-yy26_:
yyFillLabel16:
in.yych = *in.cur;
switch (in.yych) {
}
yy27:
++in.cur;
-yy27_:
yyFillLabel17:
in.yych = *in.cur;
switch (in.yych) {
}
yy28:
++in.cur;
-yy28_:
yyFillLabel18:
in.yych = *in.cur;
switch (in.yych) {
}
yy29:
++in.cur;
-yy29_:
yyFillLabel19:
in.yych = *in.cur;
switch (in.yych) {
}
yy30:
++in.cur;
-yy30_:
yyFillLabel20:
in.yych = *in.cur;
switch (in.yych) {
{
uint8_t yych;
-yy31:
yy31_:
yych = *cur;
switch (yych) {