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

require 'racc/parser'



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


module LaTeX

  class Parser < Racc::Parser

module_eval <<'..end lib/latex/parser.y modeval..id46c158b43e', 'lib/latex/parser.y', 94

  class Error < StandardError; end

  attr_reader :seen

  def parse_file(file)
    parse_string(File.read(file))
  end
  
  def parse_string(str,debug=false)
    @yydebug = true
    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 lib/latex/parser.y modeval..id46c158b43e

##### racc 1.4.4 generates ###

racc_reduce_table = [
 0, 0, :racc_error,
 3, 31, :_reduce_1,
 2, 32, :_reduce_2,
 0, 32, :_reduce_3,
 3, 33, :_reduce_4,
 2, 34, :_reduce_5,
 0, 34, :_reduce_6,
 1, 35, :_reduce_none,
 1, 35, :_reduce_none,
 1, 35, :_reduce_none,
 1, 35, :_reduce_none,
 1, 35, :_reduce_none,
 1, 35, :_reduce_none,
 1, 35, :_reduce_none,
 1, 35, :_reduce_none,
 1, 35, :_reduce_15,
 3, 42, :_reduce_16,
 1, 43, :_reduce_none,
 1, 43, :_reduce_none,
 1, 43, :_reduce_none,
 1, 43, :_reduce_none,
 1, 43, :_reduce_none,
 1, 44, :_reduce_none,
 1, 44, :_reduce_none,
 1, 44, :_reduce_none,
 1, 44, :_reduce_none,
 1, 44, :_reduce_none,
 1, 44, :_reduce_none,
 1, 45, :_reduce_none,
 1, 45, :_reduce_none,
 1, 45, :_reduce_none,
 1, 45, :_reduce_none,
 1, 45, :_reduce_none,
 1, 45, :_reduce_none,
 1, 45, :_reduce_none,
 1, 45, :_reduce_35,
 2, 46, :_reduce_36,
 0, 46, :_reduce_37,
 2, 47, :_reduce_38,
 0, 47, :_reduce_39,
 2, 48, :_reduce_40,
 0, 48, :_reduce_41,
 3, 40, :_reduce_42,
 3, 41, :_reduce_43,
 1, 36, :_reduce_none,
 1, 36, :_reduce_none,
 1, 36, :_reduce_none,
 1, 36, :_reduce_none,
 1, 36, :_reduce_none,
 1, 36, :_reduce_none,
 1, 36, :_reduce_none,
 1, 36, :_reduce_none,
 1, 36, :_reduce_none,
 1, 36, :_reduce_53,
 1, 53, :_reduce_54,
 1, 50, :_reduce_55,
 1, 52, :_reduce_56,
 1, 51, :_reduce_57,
 3, 37, :_reduce_58,
 2, 54, :_reduce_59,
 0, 54, :_reduce_60,
 3, 38, :_reduce_61,
 2, 55, :_reduce_none,
 0, 55, :_reduce_none,
 4, 39, :_reduce_64,
 1, 49, :_reduce_none,
 1, 49, :_reduce_none,
 1, 49, :_reduce_none,
 1, 49, :_reduce_none,
 1, 59, :_reduce_69,
 1, 60, :_reduce_70,
 2, 58, :_reduce_71,
 3, 57, :_reduce_72,
 1, 61, :_reduce_none,
 0, 61, :_reduce_74,
 2, 56, :_reduce_75,
 0, 56, :_reduce_76,
 3, 62, :_reduce_77,
 3, 62, :_reduce_78 ]

racc_reduce_n = 79

racc_shift_n = 97

racc_action_table = [
    13,     5,     6,    59,    92,    93,    61,    47,    96,    87,
    89,    90,    19,    22,    26,    31,    36,    40,    44,    48,
    11,    12,     7,    13,     5,    24,    30,    35,    84,    50,
    47,    65,    10,    56,    15,    19,    22,    26,    31,    36,
    40,    44,    48,    11,    12,    66,    18,    13,    24,    30,
    35,    33,    38,    42,    47,     3,    10,    76,    15,    19,
    22,    26,    31,    36,    40,    44,    48,    11,    12,    63,
    18,    13,    24,    30,    35,    33,    38,    42,    47,    75,
    10,    64,    15,    19,    22,    26,    31,    36,    40,    44,
    48,    11,    12,   nil,    18,    13,    24,    30,    35,    70,
    72,   nil,    47,    59,    10,   nil,    61,    67,   nil,    26,
    31,    36,    40,    44,    48,    11,    12,   nil,    18,    13,
    24,    30,    35,    70,    72,   nil,    47,   nil,    10,   nil,
   nil,   nil,    74,    26,    31,    36,    40,    44,    48,    11,
    12,   nil,    18,   nil,    24,    30,    35,    13,   nil,   nil,
    29,    33,    38,    42,    47,   nil,    10,   nil,    15,    19,
    22,    26,    31,    36,    40,    44,    48,    11,    12,   nil,
    18,   nil,    24,    30,    35 ]

racc_action_check = [
    78,     2,     2,    49,    78,    78,    49,    78,    78,    78,
    78,    78,    78,    78,    78,    78,    78,    78,    78,    78,
    78,    78,     3,    77,     8,    78,    78,    78,    77,    13,
    77,    53,    77,    35,    77,    77,    77,    77,    77,    77,
    77,    77,    77,    77,    77,    53,    77,    58,    77,    77,
    77,    58,    58,    58,    58,     1,    58,    58,    58,    58,
    58,    58,    58,    58,    58,    58,    58,    58,    58,    52,
    58,    57,    58,    58,    58,    57,    57,    57,    57,    57,
    57,    52,    57,    57,    57,    57,    57,    57,    57,    57,
    57,    57,    57,   nil,    57,    54,    57,    57,    57,    54,
    54,   nil,    54,    62,    54,   nil,    62,    54,   nil,    54,
    54,    54,    54,    54,    54,    54,    54,   nil,    54,    55,
    54,    54,    54,    55,    55,   nil,    55,   nil,    55,   nil,
   nil,   nil,    55,    55,    55,    55,    55,    55,    55,    55,
    55,   nil,    55,   nil,    55,    55,    55,     9,   nil,   nil,
     9,     9,     9,     9,     9,   nil,     9,   nil,     9,     9,
     9,     9,     9,     9,     9,     9,     9,     9,     9,   nil,
     9,   nil,     9,     9,     9 ]

racc_action_pointer = [
   nil,    55,    -2,    22,   nil,   nil,   nil,   nil,    21,   145,
   nil,   nil,   nil,    27,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,    31,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,    -3,
   nil,   nil,    57,    19,    93,   117,   nil,    69,    45,   nil,
   nil,   nil,    97,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,    21,    -2,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil ]

racc_action_default = [
    -3,   -79,   -79,   -79,    -3,    -2,    -6,    97,    -1,   -79,
   -76,   -56,   -57,   -74,   -65,   -60,    -5,   -66,   -63,   -37,
    -7,   -67,   -37,    -8,   -69,   -68,   -48,   -44,    -9,    -4,
   -70,   -49,   -45,   -13,   -10,   -79,   -51,   -46,   -14,   -11,
   -53,   -47,   -15,   -12,   -54,   -52,   -50,    -6,   -55,    -6,
   -73,   -76,   -79,   -79,   -79,   -79,   -71,   -79,   -79,   -39,
   -75,   -41,   -72,   -58,   -59,   -61,   -62,   -42,   -17,   -19,
   -20,   -18,   -21,   -36,   -43,   -16,   -64,   -79,   -79,   -38,
   -22,   -23,   -25,   -24,   -78,   -27,   -26,   -29,   -40,   -30,
   -35,   -28,   -33,   -34,   -31,   -32,   -77 ]

racc_goto_table = [
     9,    49,    68,    68,    69,    69,    71,    71,     2,     1,
    54,    79,     8,    55,    86,    95,    85,    94,    88,    81,
    77,    78,    52,    53,     4,    80,    91,    82,    51,    83,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,    57,    62,    58 ]

racc_goto_check = [
     4,    26,     6,     6,     8,     8,     9,     9,     2,     1,
    16,    14,     2,    16,    11,    11,    10,    10,    15,     7,
    17,    18,    24,    25,     3,     6,     6,     8,    31,     9,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,     4,    26,     4 ]

racc_goto_pointer = [
   nil,     9,     8,    22,    -6,   nil,   -52,   -58,   -50,   -48,
   -61,   -63,   nil,   nil,   -66,   -60,    -9,   -39,   -40,   nil,
   nil,   nil,   nil,   nil,     7,     5,    -9,   nil,   nil,   nil,
   nil,    15,   nil ]

racc_goto_default = [
   nil,   nil,   nil,   nil,   nil,    16,    20,    23,    28,    34,
    39,    43,    45,    73,   nil,   nil,   nil,   nil,   nil,    27,
    32,    37,    41,    46,   nil,   nil,   nil,    14,    17,    21,
    25,   nil,    60 ]

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

racc_use_result_var = true

racc_nt_base = 30

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',
'LBRACKET',
'RBRACKET',
'AMP',
'LBRACE',
'RBRACE',
'BEGIN_ENV',
'END_ENV',
'BEGIN_VERBATIM',
'DISPLAY_MATH',
'INLINE_MATH',
'BR',
'COMMENT',
'PUNCT',
'STANDALONE_PUNCT',
'VERB',
'WORD',
'SPACE',
'PAR',
'VERB_LINE',
'BEGIN_COMMENT',
'COMMENT_LINE',
'LET',
'SKIP',
'CATCODE',
'$start',
'document',
'nonbody',
'body',
'primaries',
'primary',
'secondary',
'verbatim_env',
'comment_env',
'environment',
'display_math',
'inline_math',
'braced_primary',
'no_math',
'no_bracket',
'ignore_env',
'no_maths',
'no_brackets',
'ignore_envs',
'control_sequence',
'word',
'par',
'space',
'inline_verb',
'verbatim_env_lines',
'comment_env_lines',
'macro_args',
'macro',
'catcode',
'let',
'skip',
'cs_arg',
'macro_arg']

Racc_debug_parser = false

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

 # reduce 0 omitted

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

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

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

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

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

module_eval <<'.,.,', 'lib/latex/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

 # reduce 12 omitted

 # reduce 13 omitted

 # reduce 14 omitted

module_eval <<'.,.,', 'lib/latex/parser.y', 22
  def _reduce_15( val, _values, result )
 result = StandalonePunctuation.new(val[0])
   result
  end
.,.,

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

 # reduce 17 omitted

 # reduce 18 omitted

 # reduce 19 omitted

 # reduce 20 omitted

 # reduce 21 omitted

 # reduce 22 omitted

 # reduce 23 omitted

 # 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

module_eval <<'.,.,', 'lib/latex/parser.y', 28
  def _reduce_35( val, _values, result )
 raise Racc::ParseError, "Can't have verbatim inside macro argument"
   result
  end
.,.,

module_eval <<'.,.,', 'lib/latex/parser.y', 31
  def _reduce_36( val, _values, result )
 result = (val[0] << val[1])
   result
  end
.,.,

module_eval <<'.,.,', 'lib/latex/parser.y', 32
  def _reduce_37( val, _values, result )
 result = []
   result
  end
.,.,

module_eval <<'.,.,', 'lib/latex/parser.y', 34
  def _reduce_38( val, _values, result )
 result = (val[0] << val[1])
   result
  end
.,.,

module_eval <<'.,.,', 'lib/latex/parser.y', 35
  def _reduce_39( val, _values, result )
 result = []
   result
  end
.,.,

module_eval <<'.,.,', 'lib/latex/parser.y', 37
  def _reduce_40( val, _values, result )
 result = (val[0] << val[1])
   result
  end
.,.,

module_eval <<'.,.,', 'lib/latex/parser.y', 38
  def _reduce_41( val, _values, result )
 result = []
   result
  end
.,.,

module_eval <<'.,.,', 'lib/latex/parser.y', 41
  def _reduce_42( val, _values, result )
 result = Group.new(val[0],val[1],val[2])
   result
  end
.,.,

module_eval <<'.,.,', 'lib/latex/parser.y', 42
  def _reduce_43( val, _values, result )
 result = Group.new(val[0],val[1],val[2])
   result
  end
.,.,

 # reduce 44 omitted

 # reduce 45 omitted

 # reduce 46 omitted

 # reduce 47 omitted

 # reduce 48 omitted

 # reduce 49 omitted

 # reduce 50 omitted

 # reduce 51 omitted

 # reduce 52 omitted

module_eval <<'.,.,', 'lib/latex/parser.y', 45
  def _reduce_53( val, _values, result )
 result = StandalonePunctuation.new(val[0])
   result
  end
.,.,

module_eval <<'.,.,', 'lib/latex/parser.y', 47
  def _reduce_54( val, _values, result )
 result = ControlSequence.new( val[0], nil, [])
   result
  end
.,.,

module_eval <<'.,.,', 'lib/latex/parser.y', 48
  def _reduce_55( val, _values, result )
 result = Word.create(val[0])
   result
  end
.,.,

module_eval <<'.,.,', 'lib/latex/parser.y', 49
  def _reduce_56( val, _values, result )
 result = Whitespace.create(val[0])
   result
  end
.,.,

module_eval <<'.,.,', 'lib/latex/parser.y', 50
  def _reduce_57( val, _values, result )
 result = ParagraphBreak.new(val[0])
   result
  end
.,.,

module_eval <<'.,.,', 'lib/latex/parser.y', 53
  def _reduce_58( val, _values, result )
 result = Environment.new(val[0],[],val[1], val[2],true)
   result
  end
.,.,

module_eval <<'.,.,', 'lib/latex/parser.y', 54
  def _reduce_59( val, _values, result )
 result = (val[0] << val[1])
   result
  end
.,.,

module_eval <<'.,.,', 'lib/latex/parser.y', 55
  def _reduce_60( val, _values, result )
 result = []
   result
  end
.,.,

module_eval <<'.,.,', 'lib/latex/parser.y', 58
  def _reduce_61( val, _values, result )
 result = nil
   result
  end
.,.,

 # reduce 62 omitted

 # reduce 63 omitted

module_eval <<'.,.,', 'lib/latex/parser.y', 61
  def _reduce_64( val, _values, result )
 result = Environment.new(val[0],val[1],val[2],val[3])
   result
  end
.,.,

 # reduce 65 omitted

 # reduce 66 omitted

 # reduce 67 omitted

 # reduce 68 omitted

module_eval <<'.,.,', 'lib/latex/parser.y', 66
  def _reduce_69( val, _values, result )
 result = ControlSequence.new(val[0],nil,[])
   result
  end
.,.,

module_eval <<'.,.,', 'lib/latex/parser.y', 68
  def _reduce_70( val, _values, result )
 result = ControlSequence.new(val[0],nil,[])
   result
  end
.,.,

module_eval <<'.,.,', 'lib/latex/parser.y', 70
  def _reduce_71( val, _values, result )
 result = ControlSequence.new(val[0],val[1],[])
   result
  end
.,.,

module_eval <<'.,.,', 'lib/latex/parser.y', 74
  def _reduce_72( val, _values, result )
 result = ControlSequence.new(val[0], val[1], val[2])
   result
  end
.,.,

 # reduce 73 omitted

module_eval <<'.,.,', 'lib/latex/parser.y', 76
  def _reduce_74( val, _values, result )
 result = nil
   result
  end
.,.,

module_eval <<'.,.,', 'lib/latex/parser.y', 78
  def _reduce_75( val, _values, result )
 result = (val[0] << val[1])
   result
  end
.,.,

module_eval <<'.,.,', 'lib/latex/parser.y', 79
  def _reduce_76( val, _values, result )
 result = []
   result
  end
.,.,

module_eval <<'.,.,', 'lib/latex/parser.y', 81
  def _reduce_77( val, _values, result )
 result = Argument.new(val[0],val[1],val[2])
   result
  end
.,.,

module_eval <<'.,.,', 'lib/latex/parser.y', 82
  def _reduce_78( val, _values, result )
 result = Argument.new(val[0],val[1],val[2])
   result
  end
.,.,

 def _reduce_none( val, _values, result )
  result
 end

  end   # class Parser

end   # module LaTeX
