#
# DO NOT MODIFY!!!!
# This file is automatically generated by racc 1.4.4
# from racc grammer file "parser.y".
#

require 'racc/parser'



    require 'latex/scanner'
    require 'latex/parser_support'


module LaTeX

  class Parser < Racc::Parser

module_eval <<'..end parser.y modeval..id586c0cfe8b', 'parser.y', 81

  class Error < StandardError; end

  attr_reader :seen

  def parse_file(file)
    parse_string(File.read(file))
  end
  
  def parse_string(str)
    tokens = Scanner.new.scan(str)
    tokens.reject! { |t| t.first == :COMMENT }
    begin
      tree = parse(tokens)
    rescue
      $stderr.puts seen[-20,20].inspect
      raise
    end
    tree
  end
  
  def parse( tokens )
    @tokens = tokens.dup
    @seen = []
    @tokens.push [false, '$']   # DO NOT FORGET THIS!!!

    do_parse
  end

  def next_token
    @seen << @tokens.shift
    @seen.last
  end

..end parser.y modeval..id586c0cfe8b

##### racc 1.4.4 generates ###

racc_reduce_table = [
 0, 0, :racc_error,
 3, 28, :_reduce_1,
 2, 29, :_reduce_2,
 0, 29, :_reduce_3,
 3, 30, :_reduce_4,
 2, 31, :_reduce_5,
 0, 31, :_reduce_6,
 1, 32, :_reduce_none,
 1, 32, :_reduce_none,
 1, 32, :_reduce_none,
 1, 32, :_reduce_none,
 1, 32, :_reduce_none,
 3, 38, :_reduce_12,
 3, 37, :_reduce_13,
 2, 39, :_reduce_14,
 0, 39, :_reduce_15,
 1, 33, :_reduce_none,
 1, 33, :_reduce_none,
 1, 33, :_reduce_none,
 1, 40, :_reduce_none,
 1, 40, :_reduce_none,
 1, 40, :_reduce_none,
 2, 42, :_reduce_22,
 0, 42, :_reduce_23,
 1, 41, :_reduce_none,
 1, 41, :_reduce_none,
 1, 41, :_reduce_none,
 1, 41, :_reduce_none,
 1, 41, :_reduce_none,
 1, 41, :_reduce_none,
 1, 41, :_reduce_none,
 1, 41, :_reduce_none,
 1, 41, :_reduce_none,
 1, 41, :_reduce_none,
 1, 41, :_reduce_none,
 1, 41, :_reduce_none,
 1, 47, :_reduce_36,
 1, 45, :_reduce_37,
 1, 46, :_reduce_38,
 1, 48, :_reduce_none,
 3, 34, :_reduce_40,
 2, 51, :_reduce_41,
 0, 51, :_reduce_42,
 3, 35, :_reduce_43,
 2, 52, :_reduce_none,
 0, 52, :_reduce_none,
 1, 44, :_reduce_46,
 3, 43, :_reduce_47,
 1, 53, :_reduce_none,
 0, 53, :_reduce_49,
 2, 50, :_reduce_50,
 2, 54, :_reduce_51,
 0, 54, :_reduce_52,
 3, 49, :_reduce_53,
 3, 56, :_reduce_54,
 1, 55, :_reduce_none,
 3, 55, :_reduce_56,
 4, 36, :_reduce_57 ]

racc_reduce_n = 58

racc_shift_n = 77

racc_action_table = [
    17,    63,    63,    46,    34,     4,    38,    40,    74,    70,
    13,    18,    23,    25,    28,    32,    35,    66,    62,    62,
     7,    12,    16,    21,    72,    17,     4,     5,    65,    34,
    36,    38,    40,    41,    58,    13,    18,    23,    25,    28,
    32,    35,    37,    59,    42,    45,    12,    16,    21,    55,
    17,     3,   nil,    31,    34,    36,    38,    40,    41,   nil,
    13,    18,    23,    25,    28,    32,    35,    37,   nil,    42,
    17,    12,    16,    21,    34,    36,    38,    40,    41,    69,
    13,    18,    23,    25,    28,    32,    35,    37,   nil,    42,
    17,    12,    16,    21,    34,   nil,   nil,    76,   nil,   nil,
    13,    18,    23,    25,    28,    32,    35,   nil,   nil,   nil,
    17,    12,    16,    21,    56,    36,    38,    40,    41,   nil,
    13,    18,    23,    25,    28,    32,    35,    37,   nil,    42,
    17,    12,    16,    21,    34,    57,    38,    40,    41,   nil,
    13,    18,    23,    25,    28,    32,    35,    37,   -12,    42,
   -13,    12,    16,    21,   -12,   nil,   -13,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   -12,
   nil,   -13 ]

racc_action_check = [
    67,    52,    54,    17,    67,     9,    67,    67,    67,    67,
    67,    67,    67,    67,    67,    67,    67,    53,    52,    54,
     3,    67,    67,    67,    67,    48,     2,     2,    53,    48,
    48,    48,    48,    48,    51,    48,    48,    48,    48,    48,
    48,    48,    48,    51,    48,    16,    48,    48,    48,    48,
     8,     1,   nil,     8,     8,     8,     8,     8,     8,   nil,
     8,     8,     8,     8,     8,     8,     8,     8,   nil,     8,
    64,     8,     8,     8,    64,    64,    64,    64,    64,    64,
    64,    64,    64,    64,    64,    64,    64,    64,   nil,    64,
    68,    64,    64,    64,    68,   nil,   nil,    68,   nil,   nil,
    68,    68,    68,    68,    68,    68,    68,   nil,   nil,   nil,
    49,    68,    68,    68,    49,    49,    49,    49,    49,   nil,
    49,    49,    49,    49,    49,    49,    49,    49,   nil,    49,
    50,    49,    49,    49,    50,    50,    50,    50,    50,   nil,
    50,    50,    50,    50,    50,    50,    50,    50,    56,    50,
    57,    50,    50,    50,    56,   nil,    57,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,    56,
   nil,    57 ]

racc_action_pointer = [
   nil,    51,    23,    20,   nil,   nil,   nil,   nil,    48,     2,
   nil,   nil,   nil,   nil,   nil,   nil,    43,     1,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,    23,   108,
   128,    23,    -7,     6,    -6,   nil,   143,   145,   nil,   nil,
   nil,   nil,   nil,   nil,    68,   nil,   nil,    -2,    88,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil ]

racc_action_default = [
    -3,   -58,   -58,   -58,    -2,    -6,    -3,    77,   -58,    -1,
   -25,    -7,   -46,   -27,   -26,    -8,   -58,   -49,   -29,   -28,
    -9,    -6,   -31,   -30,   -10,   -36,   -32,   -11,   -37,   -34,
   -33,    -4,   -38,   -35,    -6,   -39,    -6,   -42,   -17,   -16,
   -18,   -52,   -45,   -24,    -5,   -50,   -48,   -52,   -58,   -58,
   -58,   -58,    -6,   -58,   -47,   -53,    -6,    -6,   -40,   -41,
   -51,   -55,   -15,   -23,   -58,   -44,   -43,   -58,   -58,   -57,
   -21,   -19,   -54,   -14,   -20,   -22,   -56 ]

racc_goto_table = [
     8,     2,    52,    73,    71,    67,     6,     9,    54,    75,
    68,    51,    53,    47,     1,   nil,    48,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,    50,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,    64,   nil,   nil,
   nil,   nil,    50 ]

racc_goto_check = [
     4,     2,    27,    13,     6,    12,     3,     2,    27,    14,
    15,    24,    25,    26,     1,   nil,     4,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,     4,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,     4,   nil,   nil,
   nil,   nil,     4 ]

racc_goto_pointer = [
   nil,    14,     1,     4,    -5,   nil,   -63,   nil,   nil,   nil,
   nil,   nil,   -57,   -64,   -59,   -53,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   -26,   -30,    -4,   -39,   nil,   nil ]

racc_goto_default = [
   nil,   nil,   nil,   nil,    49,    44,    11,    15,    20,    24,
    27,    29,   nil,   nil,    39,   nil,    43,    10,    14,    19,
    22,    26,    30,    33,   nil,   nil,   nil,   nil,    60,    61 ]

racc_token_table = {
 false => 0,
 Object.new => 1,
 :CS => 2,
 :NONBODY_LINE => 3,
 :BEGIN_DOCUMENT => 4,
 :END_DOCUMENT => 5,
 :INLINE_MATH => 6,
 :DISPLAY_MATH => 7,
 :LBRACKET => 8,
 :RBRACKET => 9,
 :BEGIN_ENV => 10,
 :END_ENV => 11,
 :PAR => 12,
 :BR => 13,
 :COMMENT => 14,
 :VERB => 15,
 :WORD => 16,
 :SPACE => 17,
 :PUNCT => 18,
 :BEGIN_VERBATIM => 19,
 :VERB_LINE => 20,
 :BEGIN_COMMENT => 21,
 :COMMENT_LINE => 22,
 :LET => 23,
 :CATCODE => 24,
 :LBRACE => 25,
 :RBRACE => 26 }

racc_use_result_var = true

racc_nt_base = 27

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',
'CS',
'NONBODY_LINE',
'BEGIN_DOCUMENT',
'END_DOCUMENT',
'INLINE_MATH',
'DISPLAY_MATH',
'LBRACKET',
'RBRACKET',
'BEGIN_ENV',
'END_ENV',
'PAR',
'BR',
'COMMENT',
'VERB',
'WORD',
'SPACE',
'PUNCT',
'BEGIN_VERBATIM',
'VERB_LINE',
'BEGIN_COMMENT',
'COMMENT_LINE',
'LET',
'CATCODE',
'LBRACE',
'RBRACE',
'$start',
'document',
'nonbody',
'body',
'paras',
'para',
'text_bracket',
'verbatim',
'comment',
'environment',
'display_math',
'inline_math',
'texts_bracket',
'text_bracket_env',
'text',
'texts_no_bracket',
'control',
'let',
'word',
'space',
'inline_verb',
'punct',
'braced_para',
'catcode',
'verb_lines',
'comment_lines',
'cs_arg',
'control_args',
'control_arg',
'braced_block']

Racc_debug_parser = true

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

 # reduce 0 omitted

module_eval <<'.,.,', 'parser.y', 12
  def _reduce_1( val, _values, result )
 result = [val[0],val[1],val[2]]
   result
  end
.,.,

module_eval <<'.,.,', 'parser.y', 14
  def _reduce_2( val, _values, result )
 result = (val[0] << val[1])
   result
  end
.,.,

module_eval <<'.,.,', 'parser.y', 15
  def _reduce_3( val, _values, result )
 result = []
   result
  end
.,.,

module_eval <<'.,.,', 'parser.y', 17
  def _reduce_4( val, _values, result )
 result = [val[0]] + val[1] + [val[2]]
   result
  end
.,.,

module_eval <<'.,.,', 'parser.y', 19
  def _reduce_5( val, _values, result )
 if val[1] then val[0] << val[1] end; val[0]
   result
  end
.,.,

module_eval <<'.,.,', 'parser.y', 20
  def _reduce_6( val, _values, result )
 result = []
   result
  end
.,.,

 # reduce 7 omitted

 # reduce 8 omitted

 # reduce 9 omitted

 # reduce 10 omitted

 # reduce 11 omitted

module_eval <<'.,.,', 'parser.y', 24
  def _reduce_12( val, _values, result )
 result = Group.new(val[0],val[1],val[2])
   result
  end
.,.,

module_eval <<'.,.,', 'parser.y', 25
  def _reduce_13( val, _values, result )
 result = Group.new(val[0],val[1],val[2])
   result
  end
.,.,

module_eval <<'.,.,', 'parser.y', 27
  def _reduce_14( val, _values, result )
 result = (val[0] << val[1])
   result
  end
.,.,

module_eval <<'.,.,', 'parser.y', 28
  def _reduce_15( val, _values, result )
 result = []
   result
  end
.,.,

 # reduce 16 omitted

 # reduce 17 omitted

 # reduce 18 omitted

 # reduce 19 omitted

 # reduce 20 omitted

 # reduce 21 omitted

module_eval <<'.,.,', 'parser.y', 33
  def _reduce_22( val, _values, result )
 result = (val[0] << val[1])
   result
  end
.,.,

module_eval <<'.,.,', 'parser.y', 34
  def _reduce_23( val, _values, result )
 result = []
   result
  end
.,.,

 # reduce 24 omitted

 # reduce 25 omitted

 # reduce 26 omitted

 # reduce 27 omitted

 # reduce 28 omitted

 # reduce 29 omitted

 # reduce 30 omitted

 # reduce 31 omitted

 # reduce 32 omitted

 # reduce 33 omitted

 # reduce 34 omitted

 # reduce 35 omitted

module_eval <<'.,.,', 'parser.y', 37
  def _reduce_36( val, _values, result )
 result = ControlSequence.new( val[0], nil, [])
   result
  end
.,.,

module_eval <<'.,.,', 'parser.y', 39
  def _reduce_37( val, _values, result )
 result = Word.create(val[0])
   result
  end
.,.,

module_eval <<'.,.,', 'parser.y', 41
  def _reduce_38( val, _values, result )
 result = Whitespace.create(val[0])
   result
  end
.,.,

 # reduce 39 omitted

module_eval <<'.,.,', 'parser.y', 45
  def _reduce_40( val, _values, result )
 result = [val[0], val[1], val[2]]
   result
  end
.,.,

module_eval <<'.,.,', 'parser.y', 46
  def _reduce_41( val, _values, result )
 result = (val[0] << val[1])
   result
  end
.,.,

module_eval <<'.,.,', 'parser.y', 47
  def _reduce_42( val, _values, result )
 result = []
   result
  end
.,.,

module_eval <<'.,.,', 'parser.y', 49
  def _reduce_43( val, _values, result )
 result = nil
   result
  end
.,.,

 # reduce 44 omitted

 # reduce 45 omitted

module_eval <<'.,.,', 'parser.y', 52
  def _reduce_46( val, _values, result )
 result = ControlSequence.new(val[0],nil,[])
   result
  end
.,.,

module_eval <<'.,.,', 'parser.y', 54
  def _reduce_47( val, _values, result )
 result = ControlSequence.new(val[0], val[1], val[2])
   result
  end
.,.,

 # reduce 48 omitted

module_eval <<'.,.,', 'parser.y', 56
  def _reduce_49( val, _values, result )
 result = nil
   result
  end
.,.,

module_eval <<'.,.,', 'parser.y', 58
  def _reduce_50( val, _values, result )
 result = ControlSequence.new(val[0],val[1],[])
   result
  end
.,.,

module_eval <<'.,.,', 'parser.y', 60
  def _reduce_51( val, _values, result )
 result = (val[0] << val[1])
   result
  end
.,.,

module_eval <<'.,.,', 'parser.y', 61
  def _reduce_52( val, _values, result )
 result = []
   result
  end
.,.,

module_eval <<'.,.,', 'parser.y', 63
  def _reduce_53( val, _values, result )
 result = Group.new(val[0],val[1],val[2])
   result
  end
.,.,

module_eval <<'.,.,', 'parser.y', 65
  def _reduce_54( val, _values, result )
 result = Argument.new(val[0],val[1],val[2])
   result
  end
.,.,

 # reduce 55 omitted

module_eval <<'.,.,', 'parser.y', 68
  def _reduce_56( val, _values, result )
 result = Argument.new(val[0],val[1],val[2])
   result
  end
.,.,

module_eval <<'.,.,', 'parser.y', 70
  def _reduce_57( val, _values, result )
 result = Environment.new(val[0],val[1],val[2],val[3])
   result
  end
.,.,

 def _reduce_none( val, _values, result )
  result
 end

  end   # class Parser

end   # module LaTeX
