Normally re2c generates single 'yyaccept' variable for all conditions.
With '--skeleton' re2c handles conditions separately, so each condition
needs (or needs not) its own 'yyaccept'.
Prior to this commit re2c used the same criterion to determine if
'yyaccept' is needed with '--skeleton' as it uses generally: whether
'yyaccept' was used in any of conditions. Now re2c looks if 'yyaccept'
was used with this particular condition.
if (flag_skeleton)
{
skeleton->emit_data (o.file_name);
- skeleton->emit_start (o, output.max_fill);
+ skeleton->emit_start (o, output.max_fill, accepts.size () > 1);
uint32_t i = 2;
emit_body (o, i, used_labels);
skeleton->emit_end (o);
o << "\n";
}
-void Skeleton::emit_start (OutputFile & o, uint32_t maxfill) const
+void Skeleton::emit_start (OutputFile & o, uint32_t maxfill, bool yyaccept) const
{
const uint32_t default_rule = maxkey ();
o << "\n" << indString << "{";
o << "\n" << indString << indString << "const YYCTYPE * token = cursor;";
o << "\n" << indString << indString << "YYCTYPE yych;";
- o.insert_yyaccept_init (2);
- o << "\n";
+ if (yyaccept)
+ {
+ o << "\n" << indString << indString << "unsigned int yyaccept = 0;";
+ }
if (bFlag && BitMap::first)
{
BitMap::gen (o, 2, 0, std::min (0xFFu, encoding.nCodeUnits ()));
void warn_undefined_control_flow ();
void emit_data (const char * fname);
static void emit_prolog (OutputFile & o);
- void emit_start (OutputFile & o, uint32_t maxfill) const;
+ void emit_start (OutputFile & o, uint32_t maxfill, bool yyaccept) const;
void emit_end (OutputFile & o) const;
static void emit_epilog (OutputFile & o, const std::vector<std::string> & names);
static void emit_action (OutputFile & o, uint32_t ind, rule_rank_t rank, const std::string & name);