Class: Racc::States

### Home Classes Methods

### In Files

- lib/racc/state.rb

### Parent

Object

### Methods

- ::new
- #[]
- #dfa
- #each
- #each_index
- #each_state
- #inspect
- #n_rrconflicts
- #n_srconflicts
- #nfa
- #rrconflict_exist?
- #should_report_srconflict?
- #size
- #srconflict_exist?
- #state_transition_table
- #to_s

### Included Modules

- Enumerable

### 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::States

A table of LALR states.

### Constants

ASSOC

### Attributes

actions[R]
grammar[R]

### Public Class Methods

new(grammar, debug_flags = DebugFlags.new) click to toggle source

    # File lib/racc/state.rb, line 24
    def initialize(grammar, debug_flags = DebugFlags.new)
      @grammar = grammar
      @symboltable = grammar.symboltable
      @d_state = debug_flags.state
      @d_la    = debug_flags.la
      @d_prec  = debug_flags.prec
      @states = []
      @statecache = {}
      @actions = ActionTable.new(@grammar, self)
      @nfa_computed = false
      @dfa_computed = false
    end

### Public Instance Methods

[](i) click to toggle source

    # File lib/racc/state.rb, line 50
    def [](i)
      @states[i]
    end

dfa() click to toggle source

DFA (Deterministic Finite Automaton) Generation

    # File lib/racc/state.rb, line 195
    def dfa
      return self if @dfa_computed
      nfa
      compute_dfa
      @dfa_computed = true
      self
    end

each(&block) click to toggle source
Alias for: each_state
each_index(&block) click to toggle source

    # File lib/racc/state.rb, line 60
    def each_index(&block)
      @states.each_index(&block)
    end

each_state(&block) click to toggle source

    # File lib/racc/state.rb, line 54
    def each_state(&block)
      @states.each(&block)
    end

Also aliased as: each
inspect() click to toggle source

    # File lib/racc/state.rb, line 44
    def inspect
      '#<state table>'
    end

Also aliased as: to_s
n_rrconflicts() click to toggle source

    # File lib/racc/state.rb, line 87
    def n_rrconflicts
      @n_rrconflicts ||= inject(0) {|sum, st| sum + st.n_rrconflicts }
    end

n_srconflicts() click to toggle source

    # File lib/racc/state.rb, line 79
    def n_srconflicts
      @n_srconflicts ||= inject(0) {|sum, st| sum + st.n_srconflicts }
    end

nfa() click to toggle source

NFA (Non-deterministic Finite Automaton) Computation

    # File lib/racc/state.rb, line 101
    def nfa
      return self if @nfa_computed
      compute_nfa
      @nfa_computed = true
      self
    end

rrconflict_exist?() click to toggle source

    # File lib/racc/state.rb, line 83
    def rrconflict_exist?
      n_rrconflicts() != 0
    end

should_report_srconflict?() click to toggle source

    # File lib/racc/state.rb, line 70
    def should_report_srconflict?
      srconflict_exist? and
          (n_srconflicts() != @grammar.n_expected_srconflicts)
    end

size() click to toggle source

    # File lib/racc/state.rb, line 40
    def size
      @states.size
    end

srconflict_exist?() click to toggle source

    # File lib/racc/state.rb, line 75
    def srconflict_exist?
      n_srconflicts() != 0
    end

state_transition_table() click to toggle source

    # File lib/racc/state.rb, line 91
    def state_transition_table
      @state_transition_table ||= StateTransitionTable.generate(self.dfa)
    end

to_s() click to toggle source
Alias for: inspect

[Validate]

Generated with the Darkfish Rdoc Generator 2.