match.states module¶
Classes used in Thompson’s Construction.
-
class
match.states.
Fragment
(start: match.states.State, accept: match.states.State)[source]¶ Bases:
object
This class represents a fragment of a non-deterministic finite automaton.
A NFA fragment is composed of multiple states, each with a start
State
and an acceptState
.Parameters: - start – The Fragment’s start state.
- accept – The Fragment’s accept state.
-
class
match.states.
State
(label: str = None, edges: list = None)[source]¶ Bases:
object
This class represents a state of a non-deterministic finite automaton (NFA).
Every State has a label, as well as 0, 1, or 2 edges branching from it.
Parameters: - label – The character represented by this State of the automaton. By
default each State is labelled by an
EPSILON
. - edges – The edges this State points to. Each State will have between 0 and 2 edges.
- label – The character represented by this State of the automaton. By
default each State is labelled by an