class Racc::ParserClassGenerator

Public Class Methods

new(states) click to toggle source
# File racc/statetransitiontable.rb, line 269
def initialize(states)
  @states = states
  @grammar = states.grammar
end

Public Instance Methods

generate() click to toggle source
# File racc/statetransitiontable.rb, line 274
def generate
  table = @states.state_transition_table
  c = Class.new(::Racc::Parser)
  c.const_set :Racc_arg, [table.action_table,
                          table.action_check,
                          table.action_default,
                          table.action_pointer,
                          table.goto_table,
                          table.goto_check,
                          table.goto_default,
                          table.goto_pointer,
                          table.nt_base,
                          table.reduce_table,
                          table.token_value_table,
                          table.shift_n,
                          table.reduce_n,
                          false]
  c.const_set :Racc_token_to_s_table, table.token_to_s_table
  c.const_set :Racc_debug_parser, true
  define_actions c
  c
end