Class: Dhaka::ShiftAction

Inherits:
Action
  • Object
show all
Defined in:
lib/parser/action.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Attributes inherited from Action

#action_code

Instance Method Summary collapse

Constructor Details

#initialize(destination_state) ⇒ ShiftAction

Returns a new instance of ShiftAction.



9
10
11
12
13
14
15
# File 'lib/parser/action.rb', line 9

def initialize destination_state
  @destination_state = destination_state
  @action_code = Proc.new do
    state_stack << destination_state
    []
  end
end

Instance Attribute Details

#destination_stateObject (readonly)

Returns the value of attribute destination_state.



8
9
10
# File 'lib/parser/action.rb', line 8

def destination_state
  @destination_state
end

Instance Method Details

#compile_to_ruby_sourceObject



16
17
18
# File 'lib/parser/action.rb', line 16

def compile_to_ruby_source
  "shift_to #{@destination_state.id}"
end

#to_sObject



19
20
21
# File 'lib/parser/action.rb', line 19

def to_s
  "Shift to #{@destination_state}"
end