Class: Kleene::NFATransition
- Inherits:
-
Object
- Object
- Kleene::NFATransition
- Defined in:
- lib/kleene/nfa.rb
Constant Summary collapse
- Epsilon =
todo/hack: we use the null character as a sentinal character indicating epsilon transition
"\u0000"
Instance Attribute Summary collapse
-
#from ⇒ Object
: State.
-
#to ⇒ Object
: State.
-
#token ⇒ Object
: Char.
Instance Method Summary collapse
- #accept?(input) ⇒ Boolean
- #epsilon? ⇒ Boolean
-
#initialize(token, from_state, to_state) ⇒ NFATransition
constructor
A new instance of NFATransition.
Constructor Details
#initialize(token, from_state, to_state) ⇒ NFATransition
Returns a new instance of NFATransition.
9 10 11 12 13 |
# File 'lib/kleene/nfa.rb', line 9 def initialize(token, from_state, to_state) @token = token @from = from_state @to = to_state end |
Instance Attribute Details
#from ⇒ Object
: State
6 7 8 |
# File 'lib/kleene/nfa.rb', line 6 def from @from end |
#to ⇒ Object
: State
7 8 9 |
# File 'lib/kleene/nfa.rb', line 7 def to @to end |
#token ⇒ Object
: Char
5 6 7 |
# File 'lib/kleene/nfa.rb', line 5 def token @token end |
Instance Method Details
#accept?(input) ⇒ Boolean
15 16 17 |
# File 'lib/kleene/nfa.rb', line 15 def accept?(input) @token == input end |