From 34b7df3ae8cabd250c93a3b2f88ac43ec0bb82b3 Mon Sep 17 00:00:00 2001 From: Ulya Trofimovich Date: Thu, 18 Jul 2019 17:26:27 +0100 Subject: [PATCH] Don't generate 'YYFILL' calls when EOF rule is used with 're2c:yyfill:enable = 0;' configuration. Note: in the non-EOF-rule case 're2c:yyfill:enable = 0;' results in suppression of the whole 'YYLIMIT' check together with 'YYFILL' call. In case of EOF rule, however, we are not bound by backward compatibility and can do a more logical thing. --- src/codegen/emit_action.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/codegen/emit_action.cc b/src/codegen/emit_action.cc index 1c20d24f..0201946a 100644 --- a/src/codegen/emit_action.cc +++ b/src/codegen/emit_action.cc @@ -243,7 +243,7 @@ void need(Output &o, uint32_t ind, size_t some) void gen_rescan_label(Output &o, const State *s) { const opt_t *opts = o.block().opts; - if (opts->eof == NOEOF || endstate(s)) { + if (opts->eof == NOEOF || !opts->fill_use || endstate(s)) { // no rescan label } else if (opts->fFlag) { @@ -364,9 +364,11 @@ void gen_on_eof(code_lines_t &code, const opt_t *opts, const DFA &dfa flushln(code, o); } else { - o << opts->indString << "if (" << opts->fill << " () == 0) " - << "goto " << opts->labelPrefix << retry->label << "_;"; - flushln(code, o); + if (opts->fill_use) { + o << opts->indString << "if (" << opts->fill << " () == 0) " + << "goto " << opts->labelPrefix << retry->label << "_;"; + flushln(code, o); + } if (from->action.type == Action::INITIAL) { o << opts->indString << "goto " << opts->labelPrefix << "eof;"; -- 2.40.0