std::string s;
if (opts->fFlag) {
- strrreplace(s = opts->state_set, opts->state_set_arg, last_fill_index);
+ strrreplace(s = opts->state_set, opts->state_set_arg, o.fill_index);
o.wind(ind).wstring(s);
if (!opts->state_set_naked) {
- o.ws("(").wu32(last_fill_index).ws(");");
+ o.ws("(").wu32(o.fill_index).ws(");");
}
o.ws("\n");
}
}
if (opts->fFlag) {
- o.wstring(opts->yyfilllabel).wu32(last_fill_index).ws(":\n");
- ++last_fill_index;
+ o.wstring(opts->yyfilllabel).wu32(o.fill_index).ws(":\n");
+ ++o.fill_index;
}
}
OutputFile::OutputFile(Opt &o, Warn &w)
: blocks ()
, label_counter ()
+ , fill_index(0)
, warn_condition_order (!o->tFlag) // see note [condition order]
, opts(o)
, warn(w)
output_line_info(f.stream, line_count + 1, filename, opts);
break;
case OutputFragment::STATE_GOTO:
- output_state_goto(f.stream, f.indent, 0, opts);
+ output_state_goto(f.stream, f.indent, 0, fill_index, opts);
break;
case OutputFragment::TAGS:
output_tags(f.stream, *f.tags, global_tags);
}
}
-void output_state_goto (std::ostream & o, uint32_t ind, uint32_t start_label, Opt &opts)
+void output_state_goto(std::ostream & o, uint32_t ind,
+ uint32_t start_label, uint32_t fill_index, Opt &opts)
{
const std::string indstr = indent(ind, opts->indString);
o << indstr << "switch (" << output_get_state(opts) << ") {\n";
{
o << indstr << "default: goto " << opts->labelPrefix << start_label << ";\n";
}
- for (uint32_t i = 0; i < last_fill_index; ++i)
+ for (uint32_t i = 0; i < fill_index; ++i)
{
o << indstr << "case " << i << ": goto " << opts->yyfilllabel << i << ";\n";
}
public:
counter_t<label_t> label_counter;
+ uint32_t fill_index;
bool warn_condition_order;
Opt &opts;
Warn &warn;
bool emit();
};
-void output_tags(std::ostream &o, const ConfTags &conf, const std::set<std::string> &tags);
-void output_line_info (std::ostream &, uint32_t, const std::string&, Opt &opts);
-void output_state_goto (std::ostream &, uint32_t, uint32_t, Opt &opts);
-void output_types(std::ostream &o, uint32_t, const uniq_vector_t<std::string> &types, Opt &opts);
-void output_version_time (std::ostream &, Opt &opts);
-void output_yyaccept_init (std::ostream &, uint32_t, bool, Opt &opts);
-void output_yymaxfill (std::ostream &, size_t);
+void output_tags (std::ostream &o, const ConfTags &conf, const std::set<std::string> &tags);
+void output_line_info (std::ostream &o, uint32_t ind, const std::string &file_name, Opt &opts);
+void output_state_goto (std::ostream &o, uint32_t ind, uint32_t start_label, uint32_t fill_index, Opt &opts);
+void output_types (std::ostream &o, uint32_t ind, const uniq_vector_t<std::string> &types, Opt &opts);
+void output_version_time (std::ostream &o, Opt &opts);
+void output_yyaccept_init (std::ostream &o, uint32_t ind, bool, Opt &opts);
+void output_yymaxfill (std::ostream &o, size_t max_fill);
// helpers
std::string output_get_state (Opt &opts);
#ifndef _RE2C_GLOBALS_
#define _RE2C_GLOBALS_
-#include "src/util/c99_stdint.h"
-
namespace re2c
{
extern bool bUsedYYBitmap;
extern bool bWroteGetState;
extern bool bWroteCondCheck;
-extern uint32_t last_fill_index;
} // end namespace re2c
bool bUsedYYBitmap = false;
bool bWroteGetState = false;
bool bWroteCondCheck = false;
-uint32_t last_fill_index = 0;
} // end namespace re2c
void Scanner::reuse()
{
out.label_counter.reset ();
- last_fill_index = 0;
+ out.fill_index = 0;
bWroteGetState = false;
bWroteCondCheck = false;
opts.reset_mapCodeName ();