37 std::vector<std::pair<Node*, uint32_t> >::const_iterator
43 const uint32_t ub = i->second - 1;
50 const uint32_t step = 1 + (ub - lb) / 0x100;
51 for (uint32_t c = lb; c < ub; c += step)
53 arcs[n].push_back (c);
55 arcs[n].push_back (ub);
57 arcsets[n].push_back (std::make_pair (lb, ub));
69 return arcs.size () == 0;
76 ,
const std::string &dfa_name
77 ,
const std::string &dfa_cond
83 , nodes_count (dfa.
states.size())
84 , nodes (
new Node [nodes_count + 1])
88 const size_t nc = cs.size() - 1;
91 Node *nil = &nodes[nodes_count];
92 for (
size_t i = 0; i < nodes_count; ++i)
95 std::vector<std::pair<Node*, uint32_t> > arcs;
96 for (
size_t c = 0; c < nc;)
98 const size_t j = s->
arcs[c];
99 for (;++c < nc && s->
arcs[c] == j;);
103 arcs.push_back(std::make_pair(to, cs[c]));
106 if (arcs.size() == 1 && arcs[0].first == nil)
115 const uint32_t maxlen = nodes->dist;
118 error (
"DFA path %sis too long",
incond (cond).c_str ());
123 uint32_t maxrule = 0;
124 for (uint32_t i = 0; i < nodes_count; ++i)
129 maxrule = std::max (maxrule, r.
uint32 ());
136 const uint32_t max = std::max (maxlen, maxrule);
137 if (max <= std::numeric_limits<uint8_t>::max())
141 else if (max <= std::numeric_limits<uint16_t>::max())
157 case 4:
return rule2key<uint32_t> (r);
158 case 2:
return rule2key<uint16_t> (r);
159 case 1:
return rule2key<uint8_t> (r);
std::vector< uint32_t > charset_t
void error(const char *fmt,...)
std::vector< dfa_state_t * > states
Skeleton(const dfa_t &dfa, const charset_t &cs, const rules_t &rs, const std::string &dfa_name, const std::string &dfa_cond, uint32_t dfa_line)
static key_t rule2key(rule_rank_t r)
std::map< rule_rank_t, rule_info_t > rules_t
void init(bool b, RuleOp *r, const std::vector< std::pair< Node *, uint32_t > > &arcs)
virtual uint32_t fixedLength()
static const uint32_t DIST_MAX
std::string incond(const std::string &cond)