mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
ng_mcclellan: reject determinise if NFA is too big
This commit is contained in:
parent
e8f09aa8c6
commit
2fba9bd16c
@ -558,11 +558,16 @@ unique_ptr<raw_dfa> buildMcClellan(const NGHolder &graph,
|
|||||||
= (graph.kind == NFA_OUTFIX || finalChance) ? FINAL_DFA_STATE_LIMIT
|
= (graph.kind == NFA_OUTFIX || finalChance) ? FINAL_DFA_STATE_LIMIT
|
||||||
: DFA_STATE_LIMIT;
|
: DFA_STATE_LIMIT;
|
||||||
|
|
||||||
unique_ptr<raw_dfa> rdfa = ue2::make_unique<raw_dfa>(graph.kind);
|
|
||||||
|
|
||||||
const u32 numStates = num_vertices(graph);
|
const u32 numStates = num_vertices(graph);
|
||||||
DEBUG_PRINTF("determinising nfa with %u vertices\n", numStates);
|
DEBUG_PRINTF("determinising nfa with %u vertices\n", numStates);
|
||||||
|
|
||||||
|
if (numStates > FINAL_DFA_STATE_LIMIT) {
|
||||||
|
DEBUG_PRINTF("rejecting nfa as too many vertices\n");
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto rdfa = ue2::make_unique<raw_dfa>(graph.kind);
|
||||||
|
|
||||||
if (numStates <= NFA_STATE_LIMIT) {
|
if (numStates <= NFA_STATE_LIMIT) {
|
||||||
/* Fast path. Automaton_Graph uses a bitfield internally to represent
|
/* Fast path. Automaton_Graph uses a bitfield internally to represent
|
||||||
* states and is quicker than Automaton_Big. */
|
* states and is quicker than Automaton_Big. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user