Parent

Included Modules

Dhaka::Production

Attributes

action[R]
expansion[R]
name[R]
priority[R]
symbol[R]

Public Class Methods

new(symbol, expansion, name, action, priority, precedence = nil) click to toggle source
# File lib/dhaka/grammar/production.rb, line 7
def initialize(symbol, expansion, name, action, priority, precedence = nil)
  @symbol     = symbol
  @expansion  = expansion
  @name       = name
  @precedence = precedence
  @action     = action || proc { self }
  @priority   = priority
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/dhaka/grammar/production.rb, line 32
def <=> other
  priority <=> other.priority
end
precedence() click to toggle source
# File lib/dhaka/grammar/production.rb, line 16
def precedence
  unless @precedence
    expansion.reverse_each do |symbol|
      if symbol.terminal
        @precedence = symbol.precedence
        break
      end
    end 
  end
  @precedence
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.