Flutter Engine
The Flutter Engine
|
#include <NFA.h>
Public Member Functions | |
int | addRegex (const RegexNode ®ex) |
int | addState (NFAState s) |
int | match (std::string s) const |
Public Attributes | |
int | fRegexCount = 0 |
std::vector< NFAState > | fStates |
std::vector< int > | fStartStates |
A nondeterministic finite automaton for matching regular expressions. The NFA is initialized with a number of regular expressions, and then matches a string against all of them simultaneously.
Adds a new regular expression to the set of expressions matched by this automaton, returning its index.
Definition at line 27 of file NFA.h.
int NFA::match | ( | std::string | s | ) | const |
Matches a string against all of the regexes added to this NFA. Returns the index of the first (in addRegex order) matching expression, or -1 if no match. This is relatively slow and used only for debugging purposes; the NFA should be converted to a DFA before actual use.
Definition at line 13 of file NFA.cpp.