| 4458 | } |
| 4459 | |
| 4460 | void Pattern::gen_predict_match(std::set<DFA::State*>& states) |
| 4461 | { |
| 4462 | // find min between 0 and Const::BITS then populate bitap and hashes (bounded by min) |
| 4463 | gen_min(states); |
| 4464 | std::map<DFA::State*,std::pair<ORanges<Hash>,ORanges<Char> > > hashes[Const::BITS]; |
| 4465 | gen_predict_match_start(states, hashes[0]); |
| 4466 | bool saturated = false; // PM hashes are saturated, e.g. \w{8,} explodes the hash space use and we can stop populating more |
| 4467 | for (uint16_t level = 1; level < Const::BITS && !hashes[level - 1].empty(); ++level) |
| 4468 | for (std::map<DFA::State*,std::pair<ORanges<Hash>,ORanges<Char> > >::iterator from = hashes[level - 1].begin(); from != hashes[level - 1].end(); ++from) |
| 4469 | gen_predict_match_transitions(level, from->first, from->second, hashes[level], saturated); |
| 4470 | } |
| 4471 | |
| 4472 | void Pattern::gen_predict_match_start(std::set<DFA::State*>& states, std::map<DFA::State*,std::pair<ORanges<Hash>,ORanges<Char> > >& first_hashes) |
| 4473 | { |