src/parse/loc.h \
src/parse/parser.h \
src/parse/scanner.h \
+ src/parse/spec.h \
src/parse/unescape.h \
src/util/allocate.h \
src/util/attribute.h \
static counter_t<rule_rank_t> rank_counter;
static std::vector<std::string> condnames;
static re2c::RegExpMap specMap;
-static RegExp *spec = NULL, *specNone = NULL;
+static Spec spec;
+static RegExp *specNone = NULL;
static RuleOpList specStar;
+static RuleOp * star_default = NULL;
static Scanner *in = NULL;
static Scanner::ParseMode parseMode;
static SetupMap ruleSetupMap;
-static const Code * ruleDefault = NULL;
-static DefaultMap ruleDefaultMap;
static bool foundRules;
static symbol_table_t symbol_table;
: RegExp::SHARED;
for(CondList::const_iterator it = clist->begin(); it != clist->end(); ++it)
{
+ if (specMap.find(*it) == specMap.end())
+ {
+ condnames.push_back (*it);
+ }
+
RuleOp * rule = new RuleOp
( loc
, expr
, code
, newcond
);
-
- RegExpMap::iterator itRE = specMap.find(*it);
-
- if (itRE != specMap.end())
- {
- itRE->second = mkAlt(itRE->second, rule);
- }
- else
- {
- specMap[*it] = rule;
- condnames.push_back (*it);
- }
-
+ specMap[*it].add (rule);
}
delete clist;
delete newcond;
context_check(clist);
for(CondList::const_iterator it = clist->begin(); it != clist->end(); ++it)
{
- if (ruleDefaultMap.find(*it) != ruleDefaultMap.end())
+ RuleOp * def = new RuleOp
+ ( code->loc
+ , in->mkDefault ()
+ , new NullOp
+ , rule_rank_t::def ()
+ , RegExp::SHARED
+ , code
+ , NULL
+ );
+ if (!specMap[*it].add_def (def))
{
in->fatalf_at(code->loc.line, "code to default rule '%s' is already defined", it->c_str());
}
- ruleDefaultMap[*it] = code;
}
delete clist;
}
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 242, 242, 244, 248, 252, 261, 270, 274, 278,
- 283, 288, 293, 298, 303, 308, 316, 321, 326, 331,
- 336, 341, 346, 351, 356, 361, 366, 371, 376, 381,
- 386, 391, 396, 401, 405, 410, 415, 419, 424, 428,
- 432, 437, 441, 446, 459, 464, 472, 477, 482, 487,
- 491, 496, 500, 504, 509, 514, 519, 524, 529, 534,
- 538, 542, 546, 550, 554, 561, 578, 587, 591, 597,
- 602, 608, 612, 627, 644, 649, 655, 661, 679, 699,
- 705, 713, 716, 723, 729, 739, 742, 750, 753, 760,
- 764, 771, 775, 782, 786, 793, 797, 812, 832, 836,
- 840, 844, 851, 861, 865
+ 0, 243, 243, 245, 249, 253, 262, 271, 275, 279,
+ 284, 289, 294, 299, 304, 309, 317, 322, 327, 332,
+ 337, 342, 347, 352, 357, 362, 367, 372, 377, 382,
+ 387, 392, 397, 402, 406, 411, 416, 420, 425, 429,
+ 433, 438, 442, 447, 460, 465, 473, 478, 483, 488,
+ 492, 497, 501, 505, 510, 515, 520, 525, 530, 535,
+ 539, 543, 547, 551, 555, 562, 579, 597, 601, 607,
+ 612, 618, 622, 637, 654, 659, 665, 681, 699, 719,
+ 725, 733, 736, 743, 749, 759, 762, 770, 773, 780,
+ 784, 791, 795, 802, 806, 813, 817, 832, 852, 856,
+ 860, 864, 871, 881, 885
};
#endif
, (yyvsp[(3) - (3)].code)
, NULL
);
- spec = spec? mkAlt(spec, (yyval.regexp)) : (yyval.regexp);
+ spec.add ((yyval.regexp));
;}
break;
{
if (opts->cFlag)
in->fatal("condition or '<*>' required when using -c switch");
- if (ruleDefault != NULL)
+ RuleOp * def = new RuleOp
+ ( (yyvsp[(2) - (2)].code)->loc
+ , in->mkDefault ()
+ , new NullOp
+ , rule_rank_t::def ()
+ , RegExp::SHARED
+ , (yyvsp[(2) - (2)].code)
+ , NULL
+ );
+ if (!spec.add_def (def))
+ {
in->fatal("code to default rule is already defined");
- else
- ruleDefault = (yyvsp[(2) - (2)].code);
+ }
;}
break;
case 76:
{
- CondList *clist = new CondList();
- clist->insert("*");
- default_rule(clist, (yyvsp[(5) - (5)].code));
+ if (star_default)
+ {
+ in->fatal ("code to default rule '*' is already defined");
+ }
+ star_default = new RuleOp
+ ( (yyvsp[(5) - (5)].code)->loc
+ , in->mkDefault ()
+ , new NullOp
+ , rule_rank_t::def ()
+ , RegExp::PRIVATE
+ , (yyvsp[(5) - (5)].code)
+ , NULL
+ );
;}
break;
dfa_map.clear();
}
rank_counter.reset ();
- spec = NULL;
- ruleDefault = NULL;
+ spec.clear ();
in->set_in_parse(true);
yyparse();
in->set_in_parse(false);
i.reuse();
dfa_map.clear();
parse_cleanup();
- spec = NULL;
+ spec.clear ();
rank_counter.reset ();
- ruleDefault = NULL;
in->set_in_parse(true);
yyparse();
in->set_in_parse(false);
if (parseMode != Scanner::Reuse)
{
- if (!specStar.empty())
+ // <*> rules must have the lowest priority
+ // now that all rules have been parsed, we can fix it
+ for (RuleOpList::const_iterator itOp = specStar.begin(); itOp != specStar.end(); ++itOp)
+ {
+ (*itOp)->rank = rank_counter.next ();
+ }
+ // merge <*> rules to all conditions
+ // note that all conditions use the same regexp for <*> rules,
+ // but compile it separately because of RegExp::PRIVATE attribute
+ for (it = specMap.begin(); it != specMap.end(); ++it)
{
- // <*> rules must have the lowest priority
- // now that all rules have been parsed, we can fix it
for (RuleOpList::const_iterator itOp = specStar.begin(); itOp != specStar.end(); ++itOp)
{
- (*itOp)->rank = rank_counter.next ();
+ it->second.addl (*itOp);
}
- // merge <*> rules to all conditions
- // note that all conditions use the same regexp for <*> rules,
- // but compile it separately because of RegExp::PRIVATE attribute
- for (it = specMap.begin(); it != specMap.end(); ++it)
+ if (star_default)
{
- assert(it->second);
- for (RuleOpList::const_iterator itOp = specStar.begin(); itOp != specStar.end(); ++itOp)
- {
- it->second = mkAlt(*itOp, it->second);
- }
+ it->second.addl (star_default);
}
}
-
+
if (specNone)
{
- specMap["0"] = specNone;
+ specMap["0"].add (specNone);
// Note that "0" inserts first, which is important.
condnames.insert (condnames.begin (), "0");
}
for (it = specMap.begin(); it != specMap.end(); ++it)
{
- assert(it->second);
-
if (parseMode != Scanner::Reuse)
{
itRuleSetup = ruleSetupMap.find(it->first);
}
}
- DefaultMap::const_iterator def = ruleDefaultMap.find (it->first);
- if (def == ruleDefaultMap.end ())
- {
- def = ruleDefaultMap.find ("*");
- }
- if (def != ruleDefaultMap.end ())
- {
- RuleOp * def_rule = new RuleOp
- ( def->second->loc
- , in->mkDefault ()
- , new NullOp
- , rank_counter.next ()
- , RegExp::SHARED
- , def->second
- , NULL
- );
- it->second = it->second ? mkAlt (def_rule, it->second) : def_rule;
- }
-
dfa_map[it->first] = genCode(it->second, o, it->first, opts->encoding.nCodeUnits ());
}
if (parseMode != Scanner::Rules && dfa_map.find(it->first) != dfa_map.end())
}
else
{
- if (ruleDefault != NULL && parseMode != Scanner::Reuse)
- {
- RuleOp * def = new RuleOp
- ( ruleDefault->loc
- , in->mkDefault ()
- , new NullOp
- , rank_counter.next ()
- , RegExp::SHARED
- , ruleDefault
- , NULL
- );
- spec = spec ? mkAlt(def, spec) : def;
- }
- if (spec || !dfa_map.empty())
+ if (spec.re || !dfa_map.empty())
{
if (parseMode != Scanner::Reuse)
{
condnames.clear ();
specMap.clear();
specStar.clear();
+ star_default = NULL;
specNone = NULL;
}
static void optimize (Ins * i);
-smart_ptr<DFA> genCode (RegExp *re, Output & output, const std::string & cond, uint32_t cunits)
+smart_ptr<DFA> genCode (Spec & spec, Output & output, const std::string & cond, uint32_t cunits)
{
+ RegExp * re = spec.re;
+
CharSet cs (cunits);
re->split(cs);
#include "src/codegen/output.h"
#include "src/ir/dfa/dfa.h"
#include "src/ir/regexp/regexp.h"
+#include "src/parse/spec.h"
#include "src/util/smart_ptr.h"
namespace re2c
{
-smart_ptr<DFA> genCode (RegExp * re, Output & output, const std::string & cond, uint32_t cunits);
+smart_ptr<DFA> genCode (Spec & spec, Output & output, const std::string & cond, uint32_t cunits);
} // namespace re2c
+#include <assert.h>
#include <ostream>
#include "src/ir/rule_rank.h"
namespace re2c
{
-const uint32_t rule_rank_t::NONE = 0xFFFFffff;
+const uint32_t rule_rank_t::NONE = UINT32_MAX;
+const uint32_t rule_rank_t::DEF = rule_rank_t::NONE - 1;
rule_rank_t::rule_rank_t ()
: value (0)
void rule_rank_t::inc ()
{
+ assert (value < DEF - 1);
++value;
}
return r;
}
+rule_rank_t rule_rank_t::def ()
+{
+ rule_rank_t r;
+ r.value = DEF;
+ return r;
+}
+
bool rule_rank_t::is_none () const
{
return value == NONE;
}
+bool rule_rank_t::is_def () const
+{
+ return value == DEF;
+}
+
bool rule_rank_t::operator < (const rule_rank_t & r) const
{
return value < r.value;
{
// rule rank public API:
-// - get rule rank corresponding to nonexistent rule
-// - check if rank corresponds to nonexistent rule
+// - get rule rank corresponding to nonexistent/default rule
+// - check if rank corresponds to nonexistent/default rule
// - compare ranks
// - output rank to std::ostream
//
class rule_rank_t
{
static const uint32_t NONE;
+ static const uint32_t DEF;
uint32_t value;
rule_rank_t ();
void inc ();
public:
static rule_rank_t none ();
+ static rule_rank_t def ();
bool is_none () const;
+ bool is_def () const;
bool operator < (const rule_rank_t & r) const;
friend std::ostream & operator << (std::ostream & o, rule_rank_t r);
uint32_t uint32 () const;
#include "src/ir/regexp/regexp.h"
#include "src/ir/regexp/regexp_rule.h"
#include "src/parse/scanner.h"
+#include "src/parse/spec.h"
namespace re2c
{
typedef std::set<std::string> CondList;
typedef std::list<RuleOp*> RuleOpList;
-typedef std::map<std::string, RegExp *> RegExpMap;
+typedef std::map<std::string, Spec> RegExpMap;
typedef std::map<std::string, std::pair<uint32_t, std::string> > SetupMap;
typedef std::map<std::string, const Code *> DefaultMap;
typedef std::map<std::string, RegExp *> symbol_table_t;
static counter_t<rule_rank_t> rank_counter;
static std::vector<std::string> condnames;
static re2c::RegExpMap specMap;
-static RegExp *spec = NULL, *specNone = NULL;
+static Spec spec;
+static RegExp *specNone = NULL;
static RuleOpList specStar;
+static RuleOp * star_default = NULL;
static Scanner *in = NULL;
static Scanner::ParseMode parseMode;
static SetupMap ruleSetupMap;
-static const Code * ruleDefault = NULL;
-static DefaultMap ruleDefaultMap;
static bool foundRules;
static symbol_table_t symbol_table;
: RegExp::SHARED;
for(CondList::const_iterator it = clist->begin(); it != clist->end(); ++it)
{
+ if (specMap.find(*it) == specMap.end())
+ {
+ condnames.push_back (*it);
+ }
+
RuleOp * rule = new RuleOp
( loc
, expr
, code
, newcond
);
-
- RegExpMap::iterator itRE = specMap.find(*it);
-
- if (itRE != specMap.end())
- {
- itRE->second = mkAlt(itRE->second, rule);
- }
- else
- {
- specMap[*it] = rule;
- condnames.push_back (*it);
- }
-
+ specMap[*it].add (rule);
}
delete clist;
delete newcond;
context_check(clist);
for(CondList::const_iterator it = clist->begin(); it != clist->end(); ++it)
{
- if (ruleDefaultMap.find(*it) != ruleDefaultMap.end())
+ RuleOp * def = new RuleOp
+ ( code->loc
+ , in->mkDefault ()
+ , new NullOp
+ , rule_rank_t::def ()
+ , RegExp::SHARED
+ , code
+ , NULL
+ );
+ if (!specMap[*it].add_def (def))
{
in->fatalf_at(code->loc.line, "code to default rule '%s' is already defined", it->c_str());
}
- ruleDefaultMap[*it] = code;
}
delete clist;
}
, $3
, NULL
);
- spec = spec? mkAlt(spec, $$) : $$;
+ spec.add ($$);
}
| STAR CODE /* default rule */
{
if (opts->cFlag)
in->fatal("condition or '<*>' required when using -c switch");
- if (ruleDefault != NULL)
+ RuleOp * def = new RuleOp
+ ( $2->loc
+ , in->mkDefault ()
+ , new NullOp
+ , rule_rank_t::def ()
+ , RegExp::SHARED
+ , $2
+ , NULL
+ );
+ if (!spec.add_def (def))
+ {
in->fatal("code to default rule is already defined");
- else
- ruleDefault = $2;
+ }
}
| '<' cond '>' expr look newcond CODE
{
}
| '<' STAR '>' STAR CODE /* default rule for all conditions */
{
- CondList *clist = new CondList();
- clist->insert("*");
- default_rule(clist, $5);
+ if (star_default)
+ {
+ in->fatal ("code to default rule '*' is already defined");
+ }
+ star_default = new RuleOp
+ ( $5->loc
+ , in->mkDefault ()
+ , new NullOp
+ , rule_rank_t::def ()
+ , RegExp::PRIVATE
+ , $5
+ , NULL
+ );
}
| NOCOND newcond CODE
{
dfa_map.clear();
}
rank_counter.reset ();
- spec = NULL;
- ruleDefault = NULL;
+ spec.clear ();
in->set_in_parse(true);
yyparse();
in->set_in_parse(false);
i.reuse();
dfa_map.clear();
parse_cleanup();
- spec = NULL;
+ spec.clear ();
rank_counter.reset ();
- ruleDefault = NULL;
in->set_in_parse(true);
yyparse();
in->set_in_parse(false);
if (parseMode != Scanner::Reuse)
{
- if (!specStar.empty())
+ // <*> rules must have the lowest priority
+ // now that all rules have been parsed, we can fix it
+ for (RuleOpList::const_iterator itOp = specStar.begin(); itOp != specStar.end(); ++itOp)
+ {
+ (*itOp)->rank = rank_counter.next ();
+ }
+ // merge <*> rules to all conditions
+ // note that all conditions use the same regexp for <*> rules,
+ // but compile it separately because of RegExp::PRIVATE attribute
+ for (it = specMap.begin(); it != specMap.end(); ++it)
{
- // <*> rules must have the lowest priority
- // now that all rules have been parsed, we can fix it
for (RuleOpList::const_iterator itOp = specStar.begin(); itOp != specStar.end(); ++itOp)
{
- (*itOp)->rank = rank_counter.next ();
+ it->second.addl (*itOp);
}
- // merge <*> rules to all conditions
- // note that all conditions use the same regexp for <*> rules,
- // but compile it separately because of RegExp::PRIVATE attribute
- for (it = specMap.begin(); it != specMap.end(); ++it)
+ if (star_default)
{
- assert(it->second);
- for (RuleOpList::const_iterator itOp = specStar.begin(); itOp != specStar.end(); ++itOp)
- {
- it->second = mkAlt(*itOp, it->second);
- }
+ it->second.addl (star_default);
}
}
-
+
if (specNone)
{
- specMap["0"] = specNone;
+ specMap["0"].add (specNone);
// Note that "0" inserts first, which is important.
condnames.insert (condnames.begin (), "0");
}
for (it = specMap.begin(); it != specMap.end(); ++it)
{
- assert(it->second);
-
if (parseMode != Scanner::Reuse)
{
itRuleSetup = ruleSetupMap.find(it->first);
}
}
- DefaultMap::const_iterator def = ruleDefaultMap.find (it->first);
- if (def == ruleDefaultMap.end ())
- {
- def = ruleDefaultMap.find ("*");
- }
- if (def != ruleDefaultMap.end ())
- {
- RuleOp * def_rule = new RuleOp
- ( def->second->loc
- , in->mkDefault ()
- , new NullOp
- , rank_counter.next ()
- , RegExp::SHARED
- , def->second
- , NULL
- );
- it->second = it->second ? mkAlt (def_rule, it->second) : def_rule;
- }
-
dfa_map[it->first] = genCode(it->second, o, it->first, opts->encoding.nCodeUnits ());
}
if (parseMode != Scanner::Rules && dfa_map.find(it->first) != dfa_map.end())
}
else
{
- if (ruleDefault != NULL && parseMode != Scanner::Reuse)
- {
- RuleOp * def = new RuleOp
- ( ruleDefault->loc
- , in->mkDefault ()
- , new NullOp
- , rank_counter.next ()
- , RegExp::SHARED
- , ruleDefault
- , NULL
- );
- spec = spec ? mkAlt(def, spec) : def;
- }
- if (spec || !dfa_map.empty())
+ if (spec.re || !dfa_map.empty())
{
if (parseMode != Scanner::Reuse)
{
condnames.clear ();
specMap.clear();
specStar.clear();
+ star_default = NULL;
specNone = NULL;
}
--- /dev/null
+#ifndef _RE2C_PARSE_SPEC_
+#define _RE2C_PARSE_SPEC_
+
+#include "src/ir/regexp/regexp.h"
+
+namespace re2c
+{
+
+struct Spec
+{
+ RegExp * re;
+ bool def;
+
+ Spec ()
+ : re (NULL)
+ , def (false)
+ {}
+ bool add_def (RegExp * r)
+ {
+ if (def)
+ {
+ return false;
+ }
+ else
+ {
+ def = true;
+ addl (r);
+ return true;
+ }
+ }
+ void add (RegExp * r)
+ {
+ re = mkAlt (re, r);
+ }
+ void addl (RegExp * r)
+ {
+ re = mkAlt (r, re);
+ }
+ void clear ()
+ {
+ re = NULL;
+ def = false;
+ }
+};
+
+} // namespace re2c
+
+#endif // _RE2C_PARSE_SPEC_
--- /dev/null
+re2c: error: line 3, column 4: code to default rule is already defined
--- /dev/null
+/*!re2c
+ * { return DEFAULT-1; }
+ * { return DEFAULT-2; }
+*/
--- /dev/null
+re2c: error: line 3, column 9: code to default rule 'c1' is already defined
--- /dev/null
+/*!re2c
+ <c1> * { return DEFAULT-1; }
+ <c1> * { return DEFAULT-2; }
+*/
--- /dev/null
+/* Generated by re2c */
+
+{
+ YYCTYPE yych;
+ switch (YYGETCONDITION()) {
+ case yycc3: goto yyc_c3;
+ }
+/* *********************************** */
+yyc_c1:
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ ++YYCURSOR;
+ { return DEFAULT-1; }
+/* *********************************** */
+yyc_c2:
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ ++YYCURSOR;
+ { return DEFAULT-2; }
+/* *********************************** */
+yyc_c3:
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ goto yy12;
+ { return C3; }
+yy12:
+ ++YYCURSOR;
+ { return DEFAULT-*; }
+}
+
--- /dev/null
+/*!re2c
+ <c1> * { return DEFAULT-1; }
+ <c2> * { return DEFAULT-2; }
+ <c3> "" { return C3; }
+ <*> * { return DEFAULT-*; }
+*/
--- /dev/null
+re2c: error: line 3, column 8: code to default rule '*' is already defined
--- /dev/null
+/*!re2c
+ <*> * { return DEFAULT-1; }
+ <*> * { return DEFAULT-2; }
+*/
-re2c: error: line 13, column 9: code to default rule 'r1' is already defined
+re2c: warning: line 15: control flow in condition 'r2' is undefined for strings that match '\xA', use default rule '*' [-Wundefined-control-flow]
+re2c: warning: line 20: control flow in condition 'r1' is undefined for strings that match '\xA', use default rule '*' [-Wundefined-control-flow]
+re2c: warning: line 15: looks like you use hardcoded numbers instead of autogenerated condition names: better add '/*!types:re2c*/' directive or '-t, --type-header' option and don't rely on fixed condition order. [-Wcondition-order]
+re2c: warning: line 20: looks like you use hardcoded numbers instead of autogenerated condition names: better add '/*!types:re2c*/' directive or '-t, --type-header' option and don't rely on fixed condition order. [-Wcondition-order]
+/* Generated by re2c */
+// This test currently fails with error
+// 're2c: error: line 13, column 9: code to default rule 'r1' is already defined'
+// This must be fixed later
+
+
+
+
+{
+ YYCTYPE yych;
+ static void *yyctable[2] = {
+ &&yyc_r1,
+ &&yyc_r2,
+ };
+ goto *yyctable[YYGETCONDITION()];
+/* *********************************** */
+yyc_r1:
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ {
+ static void *yytarget[256] = {
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy13, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy5, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy7, &&yy9, &&yy11, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3
+ };
+ goto *yytarget[yych];
+ }
+yy3:
+ ++YYCURSOR;
+ { return "."; }
+yy5:
+ ++YYCURSOR;
+ { return "1"; }
+yy7:
+ ++YYCURSOR;
+ { return "a"; }
+yy9:
+ ++YYCURSOR;
+ { return "b"; }
+yy11:
+ ++YYCURSOR;
+ { return "c"; }
+yy13:
+ ++YYCURSOR;
+ { return "DEFAULT - r1"; }
+/* *********************************** */
+yyc_r2:
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ if (yych <= '`') {
+ if (yych != '\n') goto yy18;
+ } else {
+ if (yych <= 'a') goto yy20;
+ if (yych == 'c') goto yy22;
+ goto yy18;
+ }
+yy18:
+ ++YYCURSOR;
+ { return "."; }
+yy20:
+ ++YYCURSOR;
+ { return "a"; }
+yy22:
+ ++YYCURSOR;
+ { return "c"; }
+}
+
+
+
+{
+ YYCTYPE yych;
+ static void *yyctable[2] = {
+ &&yyc_r1,
+ &&yyc_r2,
+ };
+ goto *yyctable[YYGETCONDITION()];
+/* *********************************** */
+yyc_r1:
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ {
+ static void *yytarget[256] = {
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy3, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy6, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy8, &&yy10, &&yy12, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4,
+ &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4, &&yy4
+ };
+ goto *yytarget[yych];
+ }
+yy3:
+yy4:
+ ++YYCURSOR;
+ { return "."; }
+yy6:
+ ++YYCURSOR;
+ { return "2"; }
+yy8:
+ ++YYCURSOR;
+ { return "a"; }
+yy10:
+ ++YYCURSOR;
+ { return "b"; }
+yy12:
+ ++YYCURSOR;
+ { return "c"; }
+/* *********************************** */
+yyc_r2:
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ if (yych <= '`') {
+ if (yych == '\n') goto yy22;
+ } else {
+ if (yych <= 'a') goto yy18;
+ if (yych == 'c') goto yy20;
+ }
+ ++YYCURSOR;
+ { return "."; }
+yy18:
+ ++YYCURSOR;
+ { return "a"; }
+yy20:
+ ++YYCURSOR;
+ { return "c"; }
+yy22:
+ ++YYCURSOR;
+ { return "DEFAULT - r2"; }
+}
+
-re2c: error: line 11, column 9: code to default rule 'r1' is already defined
+re2c: warning: line 32: control flow in condition 'r2' is undefined for strings that match '\xA', use default rule '*' [-Wundefined-control-flow]
+/* Generated by re2c */
+// This test currently fails with error
+// 're2c: error: line 11, column 9: code to default rule 'r1' is already defined'
+// This must be fixed later
+
+
+enum YYCONDTYPE {
+ yycr2,
+};
+
+
+void scan(unsigned char* in)
+{
+
+{
+ YYCTYPE yych;
+ static void *yyctable[1] = {
+ &&yyc_r2,
+ };
+ goto *yyctable[YYGETCONDITION()];
+/* *********************************** */
+yyc_r1:
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ {
+ static void *yytarget[256] = {
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy13, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy5, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy7, &&yy9, &&yy11, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3
+ };
+ goto *yytarget[yych];
+ }
+yy3:
+ ++YYCURSOR;
+ { return "."; }
+yy5:
+ ++YYCURSOR;
+ { return "1"; }
+yy7:
+ ++YYCURSOR;
+ { return "a"; }
+yy9:
+ ++YYCURSOR;
+ { return "b"; }
+yy11:
+ ++YYCURSOR;
+ { return "c"; }
+yy13:
+ ++YYCURSOR;
+ { return "DEFAULT-r1"; }
+/* *********************************** */
+yyc_r2:
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ if (yych <= '`') {
+ if (yych == '\n') goto yy23;
+ } else {
+ if (yych <= 'a') goto yy19;
+ if (yych == 'c') goto yy21;
+ }
+ ++YYCURSOR;
+ { return "."; }
+yy19:
+ ++YYCURSOR;
+ { return "a"; }
+yy21:
+ ++YYCURSOR;
+ { return "c"; }
+yy23:
+ ++YYCURSOR;
+ { return "DEFAULT-r2"; }
+}
+
+
+}
+
+void scan(unsigned short* in)
+{
+
+{
+ YYCTYPE yych;
+ static void *yyctable[1] = {
+ &&yyc_r2,
+ };
+ goto *yyctable[YYGETCONDITION()];
+/* *********************************** */
+yyc_r1:
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ {
+ static void *yytarget[256] = {
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy13, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy5, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy7, &&yy9, &&yy11, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3,
+ &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3, &&yy3
+ };
+ goto *yytarget[yych];
+ }
+yy3:
+ ++YYCURSOR;
+ { return "."; }
+yy5:
+ ++YYCURSOR;
+ { return "2"; }
+yy7:
+ ++YYCURSOR;
+ { return "a"; }
+yy9:
+ ++YYCURSOR;
+ { return "b"; }
+yy11:
+ ++YYCURSOR;
+ { return "c"; }
+yy13:
+ ++YYCURSOR;
+ { return "DEFAULT-r1"; }
+/* *********************************** */
+yyc_r2:
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ if (yych <= '`') {
+ if (yych != '\n') goto yy18;
+ } else {
+ if (yych <= 'a') goto yy20;
+ if (yych == 'c') goto yy22;
+ goto yy18;
+ }
+yy18:
+ ++YYCURSOR;
+ { return "."; }
+yy20:
+ ++YYCURSOR;
+ { return "a"; }
+yy22:
+ ++YYCURSOR;
+ { return "c"; }
+}
+
+}