Class: Kleene::DFATransition

Inherits:
Object
  • Object
show all
Defined in:
lib/kleene/dfa.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token, from_state, to_state) ⇒ DFATransition

Returns a new instance of DFATransition.



7
8
9
10
11
# File 'lib/kleene/dfa.rb', line 7

def initialize(token, from_state, to_state)
  @token = token
  @from = from_state
  @to = to_state
end

Instance Attribute Details

#fromObject

: State



4
5
6
# File 'lib/kleene/dfa.rb', line 4

def from
  @from
end

#toObject

: State



5
6
7
# File 'lib/kleene/dfa.rb', line 5

def to
  @to
end

#tokenObject

: Char



3
4
5
# File 'lib/kleene/dfa.rb', line 3

def token
  @token
end

Instance Method Details

#accept?(input) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/kleene/dfa.rb', line 13

def accept?(input)
  @token == input
end