class Pegasus::Nfa::Nfa
- Pegasus::Nfa::Nfa
- Pegasus::Automata::Automaton(Int64?, Pegasus::Nfa::Transition)
- Reference
- Object
Overview
A nondeterministic finite automaton, to be created from regular expressions.
Defined in:
pegasus/nfa.crpegasus/nfa_to_dfa.cr
pegasus/regex.cr
Constant Summary
-
ESCAPES =
{'\'' => 39_u8, '"' => 34_u8, '?' => 63_u8, '\\' => 92_u8, 'a' => 7_u8, 'b' => 8_u8, 'f' => 12_u8, 'n' => 10_u8, 'r' => 13_u8, 't' => 9_u8, 'v' => 11_u8, '*' => 42_u8, '+' => 43_u8, '-' => 45_u8, '|' => 124_u8, '[' => 91_u8, ']' => 93_u8, '(' => 40_u8, ')' => 41_u8, '.' => 46_u8, '/' => 47_u8}
Constructors
-
.new
Creates a new Nfa with a start state.
Instance Method Summary
-
#add_regex(str, id)
Adds a regular expression branch to this Nfa.
-
#dfa
Creates a
Pegasus::Dfa::Dfa
for this Nfa. -
#find_lambda_states(s : Set(NState))
Finds the lambda states connected to any of the states of the given set.
-
#state
Creates a new state for no value (aka, a set with nil as the value)
Instance methods inherited from class Pegasus::Automata::Automaton(Int64?, Pegasus::Nfa::Transition)
last_id : Int64
last_id,
start : State(V?, T) | Nil
start,
start=(start : State(V?, T) | Nil)
start=,
state_for(*, data : V?)
state_for,
states : Set(State(V?, T))
states
Constructor methods inherited from class Pegasus::Automata::Automaton(Int64?, Pegasus::Nfa::Transition)
new
new
Constructor Detail
Instance Method Detail
Finds the lambda states connected to any of the states of the given set.