#
# DO NOT MODIFY!!!!
# This file is automatically generated by Racc 1.4.9
# from Racc grammer file "".
#

require 'racc/parser.rb'
module EdifactParser
  class Parser < Racc::Parser


  require_relative 'handler'

  attr_reader :handler

  def initialize(tokenizer, handler = Handler.new)
    @tokenizer = tokenizer
    @handler   = handler
    super()
  end

  def next_token
    @tokenizer.next_token
  end

  def parse
    do_parse
    handler
  end
##### State transition tables begin ###

racc_action_table = [
     7,    28,    27,     4,    20,    18,    19,    20,    18,    19,
    28,    27,     7,     7,     7,     8,    21 ]

racc_action_check = [
     0,    16,    16,     0,    11,    11,    11,     6,     6,     6,
    17,    17,     3,    10,     2,     1,     8 ]

racc_action_pointer = [
    -2,    15,    12,    10,   nil,   nil,     1,   nil,    16,   nil,
    11,    -2,   nil,   nil,   nil,   nil,    -2,     7,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil ]

racc_action_default = [
   -24,   -24,    -1,   -24,    -3,    -5,   -24,   -14,   -24,    -4,
    -2,   -24,    -7,    -9,   -10,   -11,   -12,   -13,   -21,   -22,
   -23,    30,    -6,    -8,   -15,   -17,   -18,   -19,   -20,   -16 ]

racc_goto_table = [
     9,    12,    13,    24,    29,    11,    22,    23,     9,     2,
     3,     1,    10 ]

racc_goto_check = [
     4,     7,     8,    13,    13,     6,     7,     8,     4,     2,
     3,     1,     2 ]

racc_goto_pointer = [
   nil,    11,     9,    10,    -2,   nil,    -1,    -5,    -4,   nil,
   nil,   nil,   nil,   -13,   nil,   nil ]

racc_goto_default = [
   nil,   nil,   nil,   nil,     5,     6,   nil,   nil,   nil,    14,
    15,    16,    17,   nil,    25,    26 ]

racc_reduce_table = [
  0, 0, :racc_error,
  1, 10, :_reduce_none,
  2, 10, :_reduce_none,
  1, 12, :_reduce_none,
  2, 11, :_reduce_none,
  1, 11, :_reduce_none,
  3, 13, :_reduce_none,
  2, 13, :_reduce_none,
  2, 15, :_reduce_none,
  1, 15, :_reduce_none,
  1, 17, :_reduce_none,
  1, 17, :_reduce_none,
  1, 17, :_reduce_none,
  1, 17, :_reduce_none,
  1, 14, :_reduce_14,
  2, 18, :_reduce_none,
  2, 19, :_reduce_none,
  1, 22, :_reduce_none,
  1, 22, :_reduce_none,
  1, 24, :_reduce_19,
  1, 23, :_reduce_20,
  1, 20, :_reduce_21,
  1, 21, :_reduce_22,
  1, 16, :_reduce_23 ]

racc_reduce_n = 24

racc_shift_n = 30

racc_token_table = {
  false => 0,
  :error => 1,
  :QUALIFIER => 2,
  :STRING => 3,
  :NUMBER => 4,
  :OPTIONAL_BEGIN => 5,
  :SEGMENT_END => 6,
  :PLUS => 7,
  :COLON => 8 }

racc_nt_base = 9

racc_use_result_var = true

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",
  "QUALIFIER",
  "STRING",
  "NUMBER",
  "OPTIONAL_BEGIN",
  "SEGMENT_END",
  "PLUS",
  "COLON",
  "$start",
  "document",
  "segments",
  "beginning",
  "segment",
  "qual",
  "values",
  "segment_end",
  "value",
  "p_scalar",
  "c_scalar",
  "plus",
  "col",
  "scalar",
  "string",
  "number" ]

Racc_debug_parser = true

##### State transition tables end #####

# reduce 0 omitted

# reduce 1 omitted

# reduce 2 omitted

# reduce 3 omitted

# reduce 4 omitted

# reduce 5 omitted

# reduce 6 omitted

# reduce 7 omitted

# reduce 8 omitted

# reduce 9 omitted

# reduce 10 omitted

# reduce 11 omitted

# reduce 12 omitted

# reduce 13 omitted

def _reduce_14(val, _values, result)
 @handler.start_segment; @handler.qualifier val[0] 
    result
end

# reduce 15 omitted

# reduce 16 omitted

# reduce 17 omitted

# reduce 18 omitted

def _reduce_19(val, _values, result)
 @handler.scalar val[0] 
    result
end

def _reduce_20(val, _values, result)
 @handler.scalar val[0].gsub("?", "") 
    result
end

def _reduce_21(val, _values, result)
 @handler.end_element; @handler.start_element 
    result
end

def _reduce_22(val, _values, result)
 @handler.colon 
    result
end

def _reduce_23(val, _values, result)
 @handler.end_element; @handler.end_segment 
    result
end

def _reduce_none(val, _values, result)
  val[0]
end

  end   # class Parser
  end   # module EdifactParser
