Class: Dhaka::Production

### Home Classes Methods

### In Files

- lib/dhaka/grammar/production.rb

### Parent

Object

### Methods

- ::new
- #<=>
- #precedence

### Included Modules

- Comparable

### Class/Module Index

Quicksearch

- Dhaka
- Dhaka::CompiledLexer
- Dhaka::CompiledParser
- Dhaka::Evaluator
- Dhaka::Grammar
- Dhaka::GrammarSymbol
- Dhaka::Lexeme
- Dhaka::Lexer
- Dhaka::LexerRun
- Dhaka::LexerSpecification
- Dhaka::LexerSupport
- Dhaka::LexerSupport::AcceptAction
- Dhaka::LexerSupport::CheckpointAction
- Dhaka::LexerSupport::DFARun
- Dhaka::LexerSupport::InvalidRegexException
- Dhaka::LexerSupport::LookaheadAcceptAction
- Dhaka::LexerSupport::RegexParser
- Dhaka::LexerSupport::RegexTokenizer
- Dhaka::LexerSupport::State
- Dhaka::LexerSupport::StateMachine
- Dhaka::NoStartProductionsError
- Dhaka::ParseErrorResult
- Dhaka::ParseSuccessResult
- Dhaka::ParseTreeCompositeNode
- Dhaka::ParseTreeLeafNode
- Dhaka::Parser
- Dhaka::ParserMethods
- Dhaka::PrecedenceBuilder
- Dhaka::Production
- Dhaka::ProductionBuilder
- Dhaka::Token
- Dhaka::Tokenizer
- Dhaka::TokenizerErrorResult
- Dhaka::TokenizerState
- Dhaka::TokenizerSuccessResult

No matching classes.

# 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.