96 ,
nchars(charset.size() - 1)
98 std::map<size_t, std::set<RuleOp*> > s2rules;
99 ord_hash_set_t kernels;
100 nfa_state_t **
const buffer =
new nfa_state_t*[nfa.size];
101 std::vector<std::vector<nfa_state_t*> > arcs(
nchars);
104 for (
size_t i = 0; i < kernels.size(); ++i)
106 dfa_state_t *s =
new dfa_state_t;
109 nfa_state_t **kernel;
110 const size_t kernel_size = kernels.deref<nfa_state_t*>(i, kernel);
111 for (
size_t j = 0; j < kernel_size; ++j)
113 nfa_state_t *n = kernel[j];
118 nfa_state_t *m = n->value.ran.out;
120 for (Range *r = n->value.ran.ran; r; r = r->next ())
122 for (; charset[c] != r->lower(); ++c);
123 for (; charset[c] != r->upper(); ++c)
125 arcs[c].push_back(m);
134 s2rules[i].insert(n->value.fin.rule);
141 s->arcs =
new size_t[
nchars];
142 for(
size_t c = 0; c <
nchars; ++c)
144 nfa_state_t **end = buffer;
145 for (std::vector<nfa_state_t*>::const_iterator j = arcs[c].begin(); j != arcs[c].end(); ++j)
149 s->arcs[c] =
find_state(buffer, end, kernels);
152 for(
size_t c = 0; c <
nchars; ++c)
159 const size_t count =
states.size();
160 for (
size_t i = 0; i < count; ++i)
162 dfa_state_t *s =
states[i];
163 std::set<RuleOp*> &rs = s2rules[i];
165 for (std::set<RuleOp*>::const_iterator j = rs.begin(); j != rs.end(); ++j)
168 if (!s->rule || rule->rank < s->rule->rank)
174 for (std::set<RuleOp*>::const_iterator j = rs.begin(); j != rs.end(); ++j)
179 rules[rule->rank].shadow.insert(s->rule->rank);
std::vector< dfa_state_t * > states
static nfa_state_t ** closure(nfa_state_t **cP, nfa_state_t *n)
static size_t find_state(nfa_state_t **kernel, nfa_state_t **end, ord_hash_set_t &kernels)