Class: RLTK::Parser::Reduce

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

Overview

The Reduce class indicates to the parser that it should reduce the input stack by the rule specified by Reduce.id.

Instance Attribute Summary

Attributes inherited from Action

#id

Instance Method Summary collapse

Constructor Details

#initialize(production) ⇒ Reduce

Returns a new instance of Reduce.

Parameters:

  • production (Production)

    Production to reduce by



1618
1619
1620
1621
1622
# File 'lib/rltk/parser.rb', line 1618

def initialize(production)
	super(production.id)
	
	@production = production
end

Instance Method Details

#to_sString

Returns String representation of this action.

Returns:

  • (String)

    String representation of this action.



1625
1626
1627
# File 'lib/rltk/parser.rb', line 1625

def to_s
	"Reduce by Production #{self.id} : #{@production}"
end