operator delete (span);
}
-void DFA::prepare(OutputFile & o, uint32_t & max_fill)
+void DFA::prepare(OutputFile & o, uint32_t & max_fill, const std::string & cond)
{
bUsedYYBitmap = false;
// warn if default case is not handled
if (default_state && !stray_cunits.empty () && !empty_rule)
{
- warn.naked_default (o.get_block_line (), stray_cunits);
+ warn.naked_default (o.get_block_line (), stray_cunits, cond);
}
// warn about not shadowed rule that matches empty string
}
}
-void Warn::naked_default (uint32_t line, const std::vector<std::pair<uint32_t, uint32_t> > & stray_cunits)
+void Warn::naked_default (uint32_t line, const std::vector<std::pair<uint32_t, uint32_t> > & stray_cunits, const std::string & cond)
{
if (mask[NAKED_DEFAULT] & WARNING)
{
{
error_accuml = true;
}
- std::ostringstream s;
+ std::ostringstream cunits;
for (uint32_t i = 0; i < stray_cunits.size (); ++i)
{
- printSpan (s, stray_cunits[i].first, stray_cunits[i].second);
+ printSpan (cunits, stray_cunits[i].first, stray_cunits[i].second);
}
- warning (names[NAKED_DEFAULT], line, "naked default case (stray code units: %s), better add default rule *", s.str ().c_str ());
+ const char * cond_prefix = cond == ""
+ ? ""
+ : " in condition ";
+ warning
+ ( names[NAKED_DEFAULT]
+ , line
+ , "naked default case%s%s (stray code units: %s), better add default rule *"
+ , cond_prefix
+ , cond.c_str ()
+ , cunits.str ().c_str ()
+ );
}
}
void set_all (option_t o);
void empty_class (uint32_t line);
void match_empty_string (uint32_t line);
- void naked_default (uint32_t line, const std::vector<std::pair<uint32_t, uint32_t> > & stray_cunits);
+ void naked_default (uint32_t line, const std::vector<std::pair<uint32_t, uint32_t> > & stray_cunits, const std::string & cond);
};
} // namespace re2c
static void optimize (Ins * i);
-smart_ptr<DFA> genCode (RegExp *re, Output & output, uint32_t ind)
+smart_ptr<DFA> genCode (RegExp *re, Output & output, uint32_t ind, const std::string & cond)
{
CharSet cs;
re->split(cs);
skeleton.emit_data (output.data);
skeleton::emit_prolog (output.source, ind, output.data.file_name.c_str ());
}
- dfa->prepare (output.source, output.max_fill);
+ dfa->prepare (output.source, output.max_fill, cond);
return dfa;
}
namespace re2c
{
-smart_ptr<DFA> genCode (RegExp * re, Output & output, uint32_t ind);
+smart_ptr<DFA> genCode (RegExp * re, Output & output, uint32_t ind, const std::string & cond);
} // namespace re2c
void findSCCs ();
void findBaseState ();
- void prepare (OutputFile & o, uint32_t &);
+ void prepare (OutputFile & o, uint32_t &, const std::string & cond);
void count_used_labels (std::set<label_t> & used, label_t prolog, label_t start, bool force_start) const;
void emit (Output &, uint32_t &, const RegExpMap *, const std::string &, bool, bool &);
it->second.second = it->second.second ? mkAlt(def, it->second.second) : def;
}
}
- dfa_map[it->first] = genCode(it->second.second, o, topIndent);
+ dfa_map[it->first] = genCode(it->second.second, o, topIndent, it->first);
}
if (parseMode != Scanner::Rules && dfa_map.find(it->first) != dfa_map.end())
{
{
if (parseMode != Scanner::Reuse)
{
- dfa_map[""] = genCode(spec, o, topIndent);
+ dfa_map[""] = genCode(spec, o, topIndent, "");
}
if (parseMode != Scanner::Rules && dfa_map.find("") != dfa_map.end())
{
-re2c: warning: line 10: naked default case (stray code units: [0x00-a][c-0xFF]), better add default rule * [-Wnaked-default]
-re2c: warning: line 10: naked default case (stray code units: [0x00-`][b-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 10: naked default case in condition c1 (stray code units: [0x00-a][c-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 10: naked default case in condition c2 (stray code units: [0x00-`][b-0xFF]), better add default rule * [-Wnaked-default]
/* Generated by re2c */
{
-re2c: warning: line 9: naked default case (stray code units: [0x00-c][e-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 9: naked default case in condition c2 (stray code units: [0x00-c][e-0xFF]), better add default rule * [-Wnaked-default]
/* Generated by re2c */
{
-re2c: warning: line 8: naked default case (stray code units: [0x00-`][b-0xFF]), better add default rule * [-Wnaked-default]
-re2c: warning: line 8: naked default case (stray code units: [0x00-a][c-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 8: naked default case in condition a (stray code units: [0x00-`][b-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 8: naked default case in condition b (stray code units: [0x00-a][c-0xFF]), better add default rule * [-Wnaked-default]
re2c: error: line 6, column 1: setup for non existing rule 'c' found
-re2c: warning: line 9: naked default case (stray code units: [0x00-`][b-0xFF]), better add default rule * [-Wnaked-default]
-re2c: warning: line 9: naked default case (stray code units: [0x00-a][c-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 9: naked default case in condition a (stray code units: [0x00-`][b-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 9: naked default case in condition b (stray code units: [0x00-a][c-0xFF]), better add default rule * [-Wnaked-default]
re2c: error: line 7, column 1: setup for all rules with '*' not possible when all rules are setup explicitly
-re2c: warning: line 5: naked default case (stray code units: [0x00-`][a][b-0xFF]), better add default rule * [-Wnaked-default]
-re2c: warning: line 5: naked default case (stray code units: [0x00-`][a][b-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 5: naked default case in condition a (stray code units: [0x00-`][a][b-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 5: naked default case in condition b (stray code units: [0x00-`][a][b-0xFF]), better add default rule * [-Wnaked-default]
/* Generated by re2c */
#line 1 "condition_01.c.re"
-re2c: warning: line 5: naked default case (stray code units: [0x00-`][a][b-0xFF]), better add default rule * [-Wnaked-default]
-re2c: warning: line 5: naked default case (stray code units: [0x00-`][a][b-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 5: naked default case in condition a (stray code units: [0x00-`][a][b-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 5: naked default case in condition b (stray code units: [0x00-`][a][b-0xFF]), better add default rule * [-Wnaked-default]
/* Generated by re2c */
#line 1 "condition_01a.c.re"
-re2c: warning: line 5: naked default case (stray code units: [0x00-`][a][b-0xFF]), better add default rule * [-Wnaked-default]
-re2c: warning: line 5: naked default case (stray code units: [0x00-`][a][b-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 5: naked default case in condition a (stray code units: [0x00-`][a][b-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 5: naked default case in condition b (stray code units: [0x00-`][a][b-0xFF]), better add default rule * [-Wnaked-default]
/* Generated by re2c */
#line 1 "condition_01b.c.re"
re2c: warning: line 3: rule matches empty string [-Wmatch-empty-string]
-re2c: warning: line 7: naked default case (stray code units: [0x00-`][c-0xFF]), better add default rule * [-Wnaked-default]
-re2c: warning: line 7: naked default case (stray code units: [0x00-a][c-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 7: naked default case in condition r1 (stray code units: [0x00-`][c-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 7: naked default case in condition r2 (stray code units: [0x00-a][c-0xFF]), better add default rule * [-Wnaked-default]
/* Generated by re2c */
#line 1 "condition_02.c.re"
re2c: warning: line 3: rule matches empty string [-Wmatch-empty-string]
-re2c: warning: line 7: naked default case (stray code units: [0x00-`][c-0xFF]), better add default rule * [-Wnaked-default]
-re2c: warning: line 7: naked default case (stray code units: [0x00-a][c-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 7: naked default case in condition r1 (stray code units: [0x00-`][c-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 7: naked default case in condition r2 (stray code units: [0x00-a][c-0xFF]), better add default rule * [-Wnaked-default]
/* Generated by re2c */
#line 1 "condition_02.cg.re"
re2c: warning: line 3: rule matches empty string [-Wmatch-empty-string]
-re2c: warning: line 9: naked default case (stray code units: [0x00-0][3-`][c-0xFF]), better add default rule * [-Wnaked-default]
-re2c: warning: line 9: naked default case (stray code units: [0x00-0][3-a][c-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 9: naked default case in condition r1 (stray code units: [0x00-0][3-`][c-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 9: naked default case in condition r2 (stray code units: [0x00-0][3-a][c-0xFF]), better add default rule * [-Wnaked-default]
/* Generated by re2c */
#line 1 "condition_03.cg.re"
-re2c: warning: line 8: naked default case (stray code units: [0x00-0][3-`][c-0xFF]), better add default rule * [-Wnaked-default]
-re2c: warning: line 8: naked default case (stray code units: [0x00-0][3-a][c-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 8: naked default case in condition r1 (stray code units: [0x00-0][3-`][c-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 8: naked default case in condition r2 (stray code units: [0x00-0][3-a][c-0xFF]), better add default rule * [-Wnaked-default]
/* Generated by re2c */
#line 1 "condition_04.cg.re"
re2c: warning: line 3: rule matches empty string [-Wmatch-empty-string]
-re2c: warning: line 9: naked default case (stray code units: [0x00-0][3-`][c-0xFF]), better add default rule * [-Wnaked-default]
-re2c: warning: line 9: naked default case (stray code units: [0x00-0][3-a][c-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 9: naked default case in condition r1 (stray code units: [0x00-0][3-`][c-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 9: naked default case in condition r2 (stray code units: [0x00-0][3-a][c-0xFF]), better add default rule * [-Wnaked-default]
/* Generated by re2c */
#line 1 "condition_11.cg.re"
re2c: warning: line 3: rule matches empty string [-Wmatch-empty-string]
-re2c: warning: line 9: naked default case (stray code units: [0x00-0][3-`][c-0xFF]), better add default rule * [-Wnaked-default]
-re2c: warning: line 9: naked default case (stray code units: [0x00-0][3-a][c-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 9: naked default case in condition r1 (stray code units: [0x00-0][3-`][c-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 9: naked default case in condition r2 (stray code units: [0x00-0][3-a][c-0xFF]), better add default rule * [-Wnaked-default]
/* Generated by re2c */
#line 1 "condition_13.cg.re"
-re2c: warning: line 10: naked default case (stray code units: [0x00-`][a][b-e][f][g-0xFF]), better add default rule * [-Wnaked-default]
-re2c: warning: line 10: naked default case (stray code units: [0x00-`][a][b-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 10: naked default case in condition state1 (stray code units: [0x00-`][a][b-e][f][g-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 10: naked default case in condition state2 (stray code units: [0x00-`][a][b-0xFF]), better add default rule * [-Wnaked-default]
/* Generated by re2c */
digraph re2c {
-re2c: warning: line 13: naked default case (stray code units: [0x00-0][3-`][c-0xFF]), better add default rule * [-Wnaked-default]
-re2c: warning: line 13: naked default case (stray code units: [0x00-0][3-a][c-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 13: naked default case in condition r1 (stray code units: [0x00-0][3-`][c-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 13: naked default case in condition r2 (stray code units: [0x00-0][3-a][c-0xFF]), better add default rule * [-Wnaked-default]
/* Generated by re2c */
// multiple scanners
-re2c: warning: line 13: naked default case (stray code units: [0x00-0][3-`][c-0xFF]), better add default rule * [-Wnaked-default]
-re2c: warning: line 13: naked default case (stray code units: [0x00-0][3-a][c-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 13: naked default case in condition r1 (stray code units: [0x00-0][3-`][c-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 13: naked default case in condition r2 (stray code units: [0x00-0][3-a][c-0xFF]), better add default rule * [-Wnaked-default]
/* Generated by re2c */
// multiple scanners
-re2c: warning: line 14: naked default case (stray code units: [0x0A]), better add default rule * [-Wnaked-default]
-re2c: warning: line 14: naked default case (stray code units: [0x0A]), better add default rule * [-Wnaked-default]
-re2c: warning: line 18: naked default case (stray code units: [0x0A]), better add default rule * [-Wnaked-default]
-re2c: warning: line 18: naked default case (stray code units: [0x0A]), better add default rule * [-Wnaked-default]
-re2c: warning: line 28: naked default case (stray code units: [0x0A]), better add default rule * [-Wnaked-default]
-re2c: warning: line 28: naked default case (stray code units: [0x0A]), better add default rule * [-Wnaked-default]
+re2c: warning: line 14: naked default case in condition r1 (stray code units: [0x0A]), better add default rule * [-Wnaked-default]
+re2c: warning: line 14: naked default case in condition r2 (stray code units: [0x0A]), better add default rule * [-Wnaked-default]
+re2c: warning: line 18: naked default case in condition r1 (stray code units: [0x0A]), better add default rule * [-Wnaked-default]
+re2c: warning: line 18: naked default case in condition r2 (stray code units: [0x0A]), better add default rule * [-Wnaked-default]
+re2c: warning: line 28: naked default case in condition r1 (stray code units: [0x0A]), better add default rule * [-Wnaked-default]
+re2c: warning: line 28: naked default case in condition r2 (stray code units: [0x0A]), better add default rule * [-Wnaked-default]
/* Generated by re2c */
// multiple scanners
-re2c: warning: line 14: naked default case (stray code units: [0x00-0][3-`][c-0xFF]), better add default rule * [-Wnaked-default]
-re2c: warning: line 14: naked default case (stray code units: [0x00-0][3-a][c-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 14: naked default case in condition r1 (stray code units: [0x00-0][3-`][c-0xFF]), better add default rule * [-Wnaked-default]
+re2c: warning: line 14: naked default case in condition r2 (stray code units: [0x00-0][3-a][c-0xFF]), better add default rule * [-Wnaked-default]
re2c: error: line 20, column 1: cannot have a second 'rules:re2c' block
-re2c: warning: line 10: naked default case (stray code units: [0x0A]), better add default rule * [-Wnaked-default]
-re2c: warning: line 10: naked default case (stray code units: [0x0A]), better add default rule * [-Wnaked-default]
+re2c: warning: line 10: naked default case in condition r1 (stray code units: [0x0A]), better add default rule * [-Wnaked-default]
+re2c: warning: line 10: naked default case in condition r2 (stray code units: [0x0A]), better add default rule * [-Wnaked-default]
re2c: error: line 13, column 9: code to default rule 'r1' is already defined
-re2c: warning: line 17: naked default case (stray code units: [0x0A]), better add default rule * [-Wnaked-default]
+re2c: warning: line 17: naked default case in condition r2 (stray code units: [0x0A]), better add default rule * [-Wnaked-default]
re2c: error: line 11, column 9: code to default rule 'r1' is already defined
-re2c: warning: line 10: naked default case (stray code units: [0x0A]), better add default rule * [-Wnaked-default]
-re2c: warning: line 10: naked default case (stray code units: [0x0A]), better add default rule * [-Wnaked-default]
+re2c: warning: line 10: naked default case in condition r1 (stray code units: [0x0A]), better add default rule * [-Wnaked-default]
+re2c: warning: line 10: naked default case in condition r2 (stray code units: [0x0A]), better add default rule * [-Wnaked-default]
re2c: error: line 13, column 9: code to setup rule 'r1' is already defined
-re2c: warning: line 17: naked default case (stray code units: [0x0A]), better add default rule * [-Wnaked-default]
-re2c: warning: line 17: naked default case (stray code units: [0x0A]), better add default rule * [-Wnaked-default]
+re2c: warning: line 17: naked default case in condition r1 (stray code units: [0x0A]), better add default rule * [-Wnaked-default]
+re2c: warning: line 17: naked default case in condition r2 (stray code units: [0x0A]), better add default rule * [-Wnaked-default]
re2c: error: line 11, column 9: code to setup rule 'r1' is already defined