Class: Racc::ActionTable

### Home Classes Methods

### In Files

- lib/racc/state.rb

### Parent

Object

### Methods

- ::new
- #each_reduce
- #each_shift
- #init
- #reduce
- #reduce_n
- #shift
- #shift_n

### Files

- Manifest.txt
- README.rdoc
- pre-setup
- NEWS.en.rdoc
- grammar.en.rdoc

### Class/Module Index

Quicksearch

- Racc
- Racc::Accept
- Racc::ActionTable
- Racc::CompileError
- Racc::DebugFlags
- Racc::Error
- Racc::Goto
- Racc::Grammar
- Racc::Grammar::DefinitionEnv
- Racc::Grammar::PrecedenceDefinitionEnv
- Racc::GrammarFileParser
- Racc::GrammarFileParser::Result
- Racc::GrammarFileScanner
- Racc::ISet
- Racc::Item
- Racc::LocationPointer
- Racc::LogFileGenerator
- Racc::OrMark
- Racc::ParseError
- Racc::ParseError
- Racc::Parser
- Racc::ParserClassGenerator
- Racc::ParserFileGenerator
- Racc::ParserFileGenerator::Params
- Racc::Prec
- Racc::RRconflict
- Racc::Reduce
- Racc::Rule
- Racc::SRconflict
- Racc::Shift
- Racc::SourceText
- Racc::State
- Racc::StateTransitionTable
- Racc::StateTransitionTableGenerator
- Racc::States
- Racc::Sym
- Racc::SymbolTable
- Racc::UserAction
- Object
- Object::ParseError
- Array

No matching classes.

# Racc::ActionTable

The table of LALR actions. Actions are either of Shift, Reduce, Accept and Error.

### Attributes

accept[R]
error[R]

### Public Class Methods

new(rt, st) click to toggle source

    # File lib/racc/state.rb, line 812
    def initialize(rt, st)
      @grammar = rt
      @statetable = st

      @reduce = []
      @shift = []
      @accept = nil
      @error = nil
    end

### Public Instance Methods

each_reduce(&block) click to toggle source

    # File lib/racc/state.rb, line 850
    def each_reduce(&block)
      @reduce.each(&block)
    end

each_shift(&block) click to toggle source

    # File lib/racc/state.rb, line 869
    def each_shift(&block)
      @shift.each(&block)
    end

init() click to toggle source

    # File lib/racc/state.rb, line 822
    def init
      @grammar.each do |rule|
        @reduce.push Reduce.new(rule)
      end
      @statetable.each do |state|
        @shift.push Shift.new(state)
      end
      @accept = Accept.new
      @error = Error.new
    end

reduce(i) click to toggle source

    # File lib/racc/state.rb, line 837
    def reduce(i)
      case i
      when Rule    then i = i.ident
      when Integer then ;
      else
        raise "racc: fatal: wrong class #{i.class} for reduce"
      end

      r = @reduce[i] or raise "racc: fatal: reduce action #{i.inspect} not exist"
      r.incref
      r
    end

reduce_n() click to toggle source

    # File lib/racc/state.rb, line 833
    def reduce_n
      @reduce.size
    end

shift(i) click to toggle source

    # File lib/racc/state.rb, line 858
    def shift(i)
      case i
      when State   then i = i.ident
      when Integer then ;
      else
        raise "racc: fatal: wrong class #{i.class} for shift"
      end

      @shift[i] or raise "racc: fatal: shift action #{i} does not exist"
    end

shift_n() click to toggle source

    # File lib/racc/state.rb, line 854
    def shift_n
      @shift.size
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.