#
# This file is automatically generated. DO NOT MODIFY!!
#
# raccp.rb
#
#   Copyright (c) 1999-2002 Minero Aoki <aamine@loveruby.net>
#
#   This program is free software.
#   You can distribute/modify this program under the terms of
#   the GNU Lesser General Public License version 2.
#

require 'racc/parser'
require 'racc/raccs'
require 'racc/ucodep'


module Racc

  class GrammarFileParser < Parser

    def initialize( racc )
      @yydebug     = racc.d_parse && Racc_debug_parser
      @ruletable   = racc.ruletable
      @symboltable = racc.symboltable

      @class_name = nil
      @super_class = nil
    end

    attr :class_name
    attr :super_class

    def parse( str )
      @scanner = GrammarFileScanner.new( str )
      @scanner.debug = @yydebug

      do_parse
    end


    private

    def next_token
      @scanner.scan
    end

    def on_error( tok, val, _values )
      if val.respond_to? :id2name then
        v = val.id2name
      elsif String === val then
        v = val
      else
        v = val.inspect
      end
      raise ParseError, "#{@scanner.lineno}: unexpected token '#{v}'"
    end


##### racc 1.4.2 generates ###

racc_reduce_table = [
 0, 0, :racc_error,
 6, 25, :_reduce_1,
 1, 26, :_reduce_2,
 3, 26, :_reduce_3,
 1, 29, :_reduce_4,
 4, 29, :_reduce_5,
 0, 27, :_reduce_none,
 2, 27, :_reduce_none,
 3, 30, :_reduce_8,
 1, 30, :_reduce_none,
 2, 30, :_reduce_10,
 2, 30, :_reduce_11,
 2, 30, :_reduce_12,
 2, 30, :_reduce_13,
 2, 31, :_reduce_14,
 3, 31, :_reduce_15,
 3, 32, :_reduce_16,
 3, 32, :_reduce_17,
 1, 36, :_reduce_none,
 2, 36, :_reduce_none,
 2, 37, :_reduce_20,
 2, 37, :_reduce_21,
 2, 37, :_reduce_22,
 1, 34, :_reduce_23,
 2, 34, :_reduce_24,
 2, 34, :_reduce_none,
 1, 33, :_reduce_26,
 1, 33, :_reduce_27,
 1, 28, :_reduce_28,
 0, 28, :_reduce_none,
 1, 38, :_reduce_30,
 2, 38, :_reduce_31,
 2, 38, :_reduce_32,
 2, 38, :_reduce_33,
 1, 39, :_reduce_none,
 1, 39, :_reduce_35,
 2, 39, :_reduce_36,
 1, 39, :_reduce_37,
 1, 35, :_reduce_38,
 2, 35, :_reduce_39 ]

racc_reduce_n = 40

racc_shift_n = 65

racc_action_table = [
    26,    51,    26,    26,    26,    26,    42,     8,    24,     9,
    24,    24,    24,    24,    46,    47,    48,    49,    43,    43,
    26,    26,    61,    53,    26,    26,    45,     9,    24,    24,
    29,    16,    24,    24,    43,    43,    19,    20,    11,    13,
    14,    26,    26,    17,    18,    26,    26,    26,    28,    24,
    24,    22,     3,    24,    24,    24,    59,    62,    34,    36,
    37,    54,    34,    36,    37,    34,    36,    37,    34,    36,
    37,    10,     1,     6,     3,    64 ]

racc_action_check = [
    31,    31,    37,    11,    58,    57,    22,     5,    31,     5,
    37,    11,    58,    57,    31,    31,    31,    31,    58,    57,
    56,    25,    39,    32,    39,    48,    27,    21,    56,    25,
    14,     7,    39,    48,    56,    25,     7,     7,     7,     7,
     7,    19,    16,     7,     7,    34,    20,    36,    13,    19,
    16,     9,     8,    34,    20,    36,    38,    40,    38,    38,
    38,    33,    33,    33,    33,    18,    18,    18,    17,    17,
    17,     6,     0,     2,     1,    60 ]

racc_action_pointer = [
    70,    68,    73,   nil,   nil,     2,    71,    28,    46,    44,
   nil,    -3,   nil,    42,    17,   nil,    36,    51,    48,    35,
    40,    20,     0,   nil,   nil,    15,   nil,    20,   nil,   nil,
   nil,    -6,    19,    45,    39,   nil,    41,    -4,    41,    18,
    43,   nil,   nil,   nil,   nil,   nil,   nil,   nil,    19,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,    14,    -1,    -2,   nil,
    61,   nil,   nil,   nil,   nil ]

racc_action_default = [
   -40,   -40,   -40,    -4,    -6,    -2,   -40,   -40,   -40,   -40,
    65,   -40,    -7,   -40,   -40,    -9,   -29,   -40,   -40,   -40,
   -40,    -3,   -40,   -23,   -27,   -11,   -26,   -12,   -38,   -13,
   -30,   -28,   -40,   -40,   -40,   -18,   -40,   -40,   -40,   -40,
   -40,   -10,    -5,   -25,   -24,   -39,   -35,   -32,   -40,   -37,
   -34,   -33,   -31,    -1,   -16,   -19,   -20,   -21,   -22,   -17,
   -40,    -8,   -14,   -36,   -15 ]

racc_goto_table = [
    30,    25,    55,    40,    41,     5,    15,    55,    39,    44,
    33,    38,    21,    12,     2,    50,    32,    27,     7,     4,
    31,    52,   nil,    60,    56,   nil,    57,    58,   nil,   nil,
   nil,   nil,    63,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    44,    44,    44 ]

racc_goto_check = [
     9,    10,    13,     9,     9,     5,     8,    13,     7,     9,
    12,    12,     5,     6,     1,     9,     4,    11,     3,     2,
    14,    15,   nil,     9,    10,   nil,    10,    10,   nil,   nil,
   nil,   nil,     9,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
     9,     9,     9 ]

racc_goto_pointer = [
   nil,    14,    18,    14,     0,     4,     6,   -11,    -1,   -16,
   -10,     4,    -7,   -31,     4,   -10 ]

racc_goto_default = [
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,    23,
   nil,   nil,   nil,    35,   nil,   nil ]

racc_token_table = {
 false => 0,
 Object.new => 1,
 :XCLASS => 2,
 :XRULE => 3,
 :XEND => 4,
 "<" => 5,
 :XSYMBOL => 6,
 ":" => 7,
 :XCONV => 8,
 :XSTART => 9,
 :XTOKEN => 10,
 :XOPTION => 11,
 :XEXPECT => 12,
 :DIGIT => 13,
 :STRING => 14,
 :XPRECHIGH => 15,
 :XPRECLOW => 16,
 :XLEFT => 17,
 :XRIGHT => 18,
 :XNONASSOC => 19,
 "|" => 20,
 ";" => 21,
 "=" => 22,
 :ACTION => 23 }

racc_use_result_var = true

racc_nt_base = 24

Racc_arg = [
 racc_action_table,
 racc_action_check,
 racc_action_default,
 racc_action_pointer,
 racc_goto_table,
 racc_goto_check,
 racc_goto_default,
 racc_goto_pointer,
 racc_nt_base,
 racc_reduce_table,
 racc_token_table,
 racc_shift_n,
 racc_reduce_n,
 racc_use_result_var ]

Racc_token_to_s_table = [
'$end',
'error',
'XCLASS',
'XRULE',
'XEND',
'"<"',
'XSYMBOL',
'":"',
'XCONV',
'XSTART',
'XTOKEN',
'XOPTION',
'XEXPECT',
'DIGIT',
'STRING',
'XPRECHIGH',
'XPRECLOW',
'XLEFT',
'XRIGHT',
'XNONASSOC',
'"|"',
'";"',
'"="',
'ACTION',
'$start',
'xclass',
'class',
'params',
'rules',
'rubyconst',
'param_seg',
'convdefs',
'xprec',
'symbol',
'symbol_list',
'bare_symlist',
'preclines',
'precline',
'rules_core',
'rule_item']

Racc_debug_parser = false

##### racc system variables end #####

 # reduce 0 omitted

module_eval <<'.,.,', '(boot.rb)', 86
  def _reduce_1( val, _values, result )
    @ruletable.end_register_rule
   result
  end
.,.,

module_eval <<'.,.,', '(boot.rb)', 91
  def _reduce_2( val, _values, result )
    @class_name = val[0]
   result
  end
.,.,

module_eval <<'.,.,', '(boot.rb)', 95
  def _reduce_3( val, _values, result )
    @class_name = val[0]
    @super_class = val[2]
   result
  end
.,.,

module_eval <<'.,.,', '(boot.rb)', 101
  def _reduce_4( val, _values, result )
    result = result.id2name
   result
  end
.,.,

module_eval <<'.,.,', '(boot.rb)', 105
  def _reduce_5( val, _values, result )
    result << '::' << val[3].id2name
   result
  end
.,.,

 # reduce 6 omitted

 # reduce 7 omitted

module_eval <<'.,.,', '(boot.rb)', 113
  def _reduce_8( val, _values, result )
    @symboltable.end_register_conv
   result
  end
.,.,

 # reduce 9 omitted

module_eval <<'.,.,', '(boot.rb)', 118
  def _reduce_10( val, _values, result )
    @ruletable.register_start val[1]
   result
  end
.,.,

module_eval <<'.,.,', '(boot.rb)', 122
  def _reduce_11( val, _values, result )
    @symboltable.register_token val[1]
   result
  end
.,.,

module_eval <<'.,.,', '(boot.rb)', 126
  def _reduce_12( val, _values, result )
    val[1].each do |s|
      @ruletable.register_option s.to_s
    end
   result
  end
.,.,

module_eval <<'.,.,', '(boot.rb)', 132
  def _reduce_13( val, _values, result )
    @ruletable.expect val[1]
   result
  end
.,.,

module_eval <<'.,.,', '(boot.rb)', 137
  def _reduce_14( val, _values, result )
    @symboltable.register_conv val[0], val[1]
   result
  end
.,.,

module_eval <<'.,.,', '(boot.rb)', 141
  def _reduce_15( val, _values, result )
    @symboltable.register_conv val[1], val[2]
   result
  end
.,.,

module_eval <<'.,.,', '(boot.rb)', 146
  def _reduce_16( val, _values, result )
    @symboltable.end_register_prec true
   result
  end
.,.,

module_eval <<'.,.,', '(boot.rb)', 150
  def _reduce_17( val, _values, result )
    @symboltable.end_register_prec false
   result
  end
.,.,

 # reduce 18 omitted

 # reduce 19 omitted

module_eval <<'.,.,', '(boot.rb)', 158
  def _reduce_20( val, _values, result )
    @symboltable.register_prec :Left, val[1]
   result
  end
.,.,

module_eval <<'.,.,', '(boot.rb)', 162
  def _reduce_21( val, _values, result )
    @symboltable.register_prec :Right, val[1]
   result
  end
.,.,

module_eval <<'.,.,', '(boot.rb)', 166
  def _reduce_22( val, _values, result )
    @symboltable.register_prec :Nonassoc, val[1]
   result
  end
.,.,

module_eval <<'.,.,', '(boot.rb)', 171
  def _reduce_23( val, _values, result )
    result = val
   result
  end
.,.,

module_eval <<'.,.,', '(boot.rb)', 175
  def _reduce_24( val, _values, result )
    result.push val[1]
   result
  end
.,.,

 # reduce 25 omitted

module_eval <<'.,.,', '(boot.rb)', 181
  def _reduce_26( val, _values, result )
    result = @symboltable.get(result)
   result
  end
.,.,

module_eval <<'.,.,', '(boot.rb)', 185
  def _reduce_27( val, _values, result )
    result = @symboltable.get(eval(%Q<"#{result}">))
   result
  end
.,.,

module_eval <<'.,.,', '(boot.rb)', 190
  def _reduce_28( val, _values, result )
    unless result.empty? then
      @ruletable.register_rule_from_array result
    end
   result
  end
.,.,

 # reduce 29 omitted

module_eval <<'.,.,', '(boot.rb)', 198
  def _reduce_30( val, _values, result )
    result = val
   result
  end
.,.,

module_eval <<'.,.,', '(boot.rb)', 202
  def _reduce_31( val, _values, result )
    result.push val[1]
   result
  end
.,.,

module_eval <<'.,.,', '(boot.rb)', 206
  def _reduce_32( val, _values, result )
    unless result.empty? then
      @ruletable.register_rule_from_array result
    end
    result.clear
   result
  end
.,.,

module_eval <<'.,.,', '(boot.rb)', 213
  def _reduce_33( val, _values, result )
    pre = result.pop
    unless result.empty? then
      @ruletable.register_rule_from_array result
    end
    result = [pre]
   result
  end
.,.,

 # reduce 34 omitted

module_eval <<'.,.,', '(boot.rb)', 223
  def _reduce_35( val, _values, result )
    result = OrMark.new( @scanner.lineno )
   result
  end
.,.,

module_eval <<'.,.,', '(boot.rb)', 227
  def _reduce_36( val, _values, result )
    result = Prec.new( val[1], @scanner.lineno )
   result
  end
.,.,

module_eval <<'.,.,', '(boot.rb)', 231
  def _reduce_37( val, _values, result )
    result = UserAction.new( *result )
   result
  end
.,.,

module_eval <<'.,.,', '(boot.rb)', 236
  def _reduce_38( val, _values, result )
    result = [ result.id2name ]
   result
  end
.,.,

module_eval <<'.,.,', '(boot.rb)', 240
  def _reduce_39( val, _values, result )
    result.push val[1].id2name
   result
  end
.,.,

 def _reduce_none( val, _values, result )
  result
 end


  end

end   # module Racc
