Skip to main content

validate_pattern

Function validate_pattern 

Source
fn validate_pattern(pattern: &MatchRecognizePattern) -> Result<()>
Expand description

Validates that a pattern can be expanded into an NFA, at bind time.

Three hazards, all of which otherwise survive planning: an inverted range ({5,3}) expands to an empty optional tail and silently degrades to {5}; a large bound (or a product of nested bounds) expands to an NFA that exhausts the compute node’s memory; and PERMUTE grows factorially in its arity. The expansion happens in Nfa::compile, which runs when the actor is built — after the DDL has been committed in meta — so the only place these can be reported to the author is here.

The arity and per-bound checks run before the whole-pattern budget so that the specific cause is named: a PERMUTE of 8 variables is over the budget too, but “PERMUTE supports at most 6 variables” is the useful thing to say about it.