25 static void genCondGotoSub (OutputFile & o, uint32_t ind,
const std::vector<std::string> & condnames, uint32_t cMin, uint32_t cMax);
26 static void genCondTable (OutputFile & o, uint32_t ind,
const std::vector<std::string> & condnames);
27 static void genCondGoto (OutputFile & o, uint32_t ind,
const std::vector<std::string> & condnames);
28 static void emit_state (OutputFile & o, uint32_t ind,
const State * s,
bool used_label);
45 if (readCh && from->
next != to)
69 void DFA::count_used_labels (std::set<label_t> & used, label_t start, label_t initial,
bool force_start)
const
80 for (State * s =
head; s; s = s->
next)
82 s->go.used_labels (used);
84 for (uint32_t i = 0; i < accepts.
size (); ++i)
86 used.insert (accepts[i]->label);
91 used.insert (initial);
95 void DFA::emit_body (OutputFile & o, uint32_t& ind,
const std::set<label_t> & used_labels, label_t initial)
const
105 const bool save_yyaccept = accepts.
size () > 1;
106 for (State * s =
head; s; s = s->
next)
109 emit_state (o, ind, s, used_labels.count (s->label));
110 emit_action (s->action, o, ind, readCh, s,
cond, skeleton, used_labels, save_yyaccept);
111 s->go.emit(o, ind, readCh);
134 std::set<label_t> used_labels;
150 emit_body (o, i, used_labels, initial_label);
163 o.
ws(
"digraph re2c {\n");
205 if (used_labels.count(start_label))
237 emit_body (o, ind, used_labels, initial_label);
243 if ((!
opts->
cFlag || isLastCond) && bPrologBrace)
259 const size_t conds = condnames.size ();
261 for (
size_t i = 0; i < conds; ++i)
276 uint32_t cMid = cMin + ((cMax - cMin + 1) / 2);
280 o.
wind(ind).
ws(
"} else {\n");
311 const size_t conds = condnames.size ();
315 for (
size_t i = 0; i < conds; ++i)
317 const std::string cond = condnames[i];
331 genCondGotoSub(o, ind, condnames, 0, static_cast<uint32_t> (conds) - 1);
337 for (
size_t i = 0; i < conds; ++i)
339 const std::string & cond = condnames[i];
void emit_action(const Action &action, OutputFile &o, uint32_t ind, bool &readCh, const State *const s, const std::string &condName, const Skeleton *skeleton, const std::set< label_t > &used_labels, bool save_yyaccept)
OutputFile & wdelay_warn_condition_order()
bool get_used_yyaccept() const
std::string replaceParam(std::string str, const std::string ¶m, const _Ty &value)
OutputFile & wuser_start_label()
std::vector< std::string > types
static void genCondGotoSub(OutputFile &o, uint32_t ind, const std::vector< std::string > &condnames, uint32_t cMin, uint32_t cMax)
static void genCondTable(OutputFile &o, uint32_t ind, const std::vector< std::string > &condnames)
static void genCondGoto(OutputFile &o, uint32_t ind, const std::vector< std::string > &condnames)
static void gen(OutputFile &, uint32_t ind, uint32_t, uint32_t)
OutputFile & ws(const char *s)
OutputFile & wu32(uint32_t n)
OutputFile & wdelay_state_goto(uint32_t ind)
void emit_end(OutputFile &o, bool backup, bool backupctx) const
OutputFile & wind(uint32_t ind)
OutputFile & wlabel(label_t l)
void emit_start(OutputFile &o, size_t maxfill, bool backup, bool backupctx, bool accept) const
std::string condEnumPrefix
OutputFile & wdelay_line_info()
OutputFile & wu64(uint64_t n)
void emit(Output &, uint32_t &, bool, bool &)
bool warn_condition_order
static void emit_state(OutputFile &o, uint32_t ind, const State *s, bool used_label)
static std::string genGetCondition()
OutputFile & wdelay_yyaccept_init(uint32_t ind)
void genGoTo(OutputFile &o, uint32_t ind, const State *from, const State *to, bool &readCh)
void emit_data(const char *fname)
bool get_force_start_label() const
void warn_unreachable_rules()
void warn_undefined_control_flow()
counter_t< label_t > label_counter
void set_initial(label_t label, bool used_marker)
enum re2c::Action::type_t type
std::set< std::string > skeletons
OutputFile & wstring(const std::string &s)
std::string condDividerParam