Class: Dhaka::ShiftAction

Inherits:
Action
  • Object
show all
Defined in:
lib/dhaka/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/dhaka/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/dhaka/parser/action.rb', line 8

def destination_state
  @destination_state
end

Instance Method Details

#compile_to_ruby_sourceObject



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

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

#to_sObject



21
22
23
# File 'lib/dhaka/parser/action.rb', line 21

def to_s
  "Shift"
end