Class: Dhaka::ReduceAction
Overview
:nodoc:
Instance Attribute Summary collapse
-
#production ⇒ Object
readonly
Returns the value of attribute production.
Attributes inherited from Action
Instance Method Summary collapse
- #compile_to_ruby_source ⇒ Object
-
#initialize(production) ⇒ ReduceAction
constructor
A new instance of ReduceAction.
- #to_s ⇒ Object
Constructor Details
#initialize(production) ⇒ ReduceAction
Returns a new instance of ReduceAction.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/parser/action.rb', line 26 def initialize(production) @production = production @action_code = Proc.new do composite_node = ParseTreeCompositeNode.new(production) production.expansion.each { |symbol| state_stack.pop composite_node.child_nodes.unshift(node_stack.pop) } node_stack << composite_node unless composite_node.head_node? @symbol_queue += [@current_token.symbol_name, production.symbol.name] end end end |
Instance Attribute Details
#production ⇒ Object (readonly)
Returns the value of attribute production.
25 26 27 |
# File 'lib/parser/action.rb', line 25 def production @production end |
Instance Method Details
#compile_to_ruby_source ⇒ Object
43 44 45 |
# File 'lib/parser/action.rb', line 43 def compile_to_ruby_source "reduce_with '#{@production.name}'" end |
#to_s ⇒ Object
46 47 48 |
# File 'lib/parser/action.rb', line 46 def to_s "Reduce with #{production}" end |