#
# DO NOT MODIFY!!!!
# This file is automatically generated by Racc 1.5.0
# from Racc grammar file "".
#

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

module_eval(<<'...end parser.y/module_eval...', 'parser.y', 228)

  # 2.2 Characters (Extensible Markup Language (XML) 1.0 (Fifth Edition))
  #
  # This represents "Char" range defined in 2.2 Characters.
  # [2] Char ::=
  #   [#x1-#xD7FF] |
  #   [#xE000-#xFFFD] |
  #   [#x10000-#x10FFFF] /* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */
  #
  # @see https://www.w3.org/TR/xml11/#charsets
  CHAR = /[\x9\xA\xD\u{20}-\u{d7ff}\u{e000}-\u{fffd}\u{10000}-\u{10ffff}]/

  # 2.3 Common Syntactic Constructs (Extensible Markup Language (XML) 1.0 (Fifth Edition))
  #
  # [3] S ::= (#x20 | #x9 | #xD | #A)+
  #
  # @see https://www.w3.org/TR/xml11/#NT-S
  S = /[\x20\x9\xD\xA]/

  # [4] NameStartChar ::=
  #   ":" |
  #   [A-Z] |
  #   "_" |
  #   [a-z] |
  #   [#xC0-#xD6] |
  #   [#xD8-#xF6] |
  #   [#xF8-#x2FF] |
  #   [#x370-#x37D] |
  #   [#x37F-#x1FFF] |
  #   [#x200C-#x200D] |
  #   [#x2070-#x218F] |
  #   [#x2C00-#x2FEF] |
  #   [#x3001-#xD7FF] |
  #   [#xF900-#xFDCF] |
  #   [#xFDF0-#xFFFD] |
  #   [#x10000-#xEFFFF]
  #
  # @see https://www.w3.org/TR/xml11/#NT-NameStartChar
  name_start_chars = %w[
    :
    a-zA-Z_
    \\u00c0-\\u00d6
    \\u00d8-\\u00f6
    \\u00f8-\\u02ff
    \\u0370-\\u037d
    \\u037f-\\u1fff
    \\u200c-\\u200d
    \\u2070-\\u218f
    \\u2c00-\\u2fef
    \\u3001-\\ud7ff
    \\uf900-\\ufdcf
    \\ufdf0-\\ufffd
    \\u{10000}-\\u{effff}
  ]
  NAME_START_CHARS = /[#{name_start_chars.join}]/

  # [4a] NameChar ::=
  #   NameStartChar |
  #   "-" |
  #   "." |
  #   [0-9] |
  #   #xB7 |
  #   [#x0300-#x036F] |
  #   [#x203F-#x2040]
  #
  # @see https://www.w3.org/TR/xml11/#NT-NameChar
  name_chars = name_start_chars + %w[
    \\-
    \\.
    0-9
    \\u00b7
    \\u0300-\\u036f
    \\u203f-\\u2040
  ]
  NAME_CHARS = /[#{name_chars.join}]/

  # [5] Name ::= NameStartChar (NameChar)*
  #
  # @see https://www.w3.org/TR/1999/REC-xpath-19991116/#NT-Name
  NAME = /#{NAME_START_CHARS}#{NAME_CHARS}*/

  # 2.3. Axes
  #
  # [6] AxisName ::=
  #   'ancestor'
  #   | 'ancestor-or-self'
  #   | 'attribute'
  #   | 'child'
  #   | 'descendant'
  #   | 'descendant-or-self'
  #   | 'following'
  #   | 'following-sibling'
  #   | 'namespace'
  #   | 'parent'
  #   | 'preceding'
  #   | 'preceding-sibling'
  #   | 'self'
  #
  # @see https://www.w3.org/TR/1999/REC-xpath-19991116/#NT-AxisName
  AXES = /
    ancestor-or-self|
    ancestor|
    attribute|
    child|
    descendant-or-self|
    descendant|
    following-sibling|
    following|
    namespace|
    parent|
    preceding-sibling|
    preceding|
    self
  /x

  # 3 Declaring Namespaces
  #
  # The "NCName" is picked from the section.
  #
  # Note that we need to take care of exceptional handling.
  #
  # [4] NCName ::= NCNameStartChar NCNameChar* /* An XML Name, minus the ":" */
  # [5] NCNamrChar ::= NameChar - ':'
  # [6] NCNameStartChar ::= NameStartChar - ':'
  #
  # @see https://www.w3.org/TR/xml-names11/#ns-decl
  NC_NAME_CHARS       = /[#{(name_chars - [':']).join}]/
  NC_NAME_START_CHARS = /[#{(name_start_chars - [':']).join}]/
  NC_NAME             = /#{NC_NAME_START_CHARS}#{NC_NAME_CHARS}*/

  # 4. Qualified Names
  #
  # The rules for "QName", "PrefixedName", "UnprefixedName", "Prefix" and
  # "LocalPart" are picked from the section.
  #
  # [7] QName ::= PrefixedName | UnprefixedName
  # [8] PrefixedName ::= Prefix ':' LocalPart
  # [9] UnprefixedName ::= LocalPart
  # [10] Prefix ::= NCName
  # [11] LocalPart ::= NCName
  #
  # @see https://www.w3.org/TR/xml-names11/#ns-qualnames
  PREFIX          = NC_NAME
  LOCAL_PART      = NC_NAME
  PREFIXED_NAME   = /#{PREFIX}:#{LOCAL_PART}/
  UNPREFIXED_NAME = LOCAL_PART
  Q_NAME          = /#{PREFIXED_NAME}|#{UNPREFIXED_NAME}/

  # 3.7 Lexical Structure
  #
  # The rules for "NodeType" and "Digits" are picked from the section.
  # @see https://www.w3.org/TR/1999/REC-xpath-19991116/#exprlex
  DIGITS = /[0-9]+/
  NODE_TYPE = /comment|text|processing-instruction|node/

  # EXPR_TOKENS is defined for tokenizing primitive tokens for "ExprToken",
  # except other rules.
  # @see https://www.w3.org/TR/1999/REC-xpath-19991116/#NT-ExprToken
  EXPR_TOKENS = {
    '(' => :T_LPAREN,
    ')' => :T_RPAREN,
    '[' => :T_LBRACK,
    ']' => :T_RBRACK,
    '.' => :T_DOT,
    '..' => :T_DOTDOT,
    '@' => :T_AT,
    ',' => :T_COMMA,
    '::' => :T_COLONCOLON
  }.freeze
  # Declaring the regexp consisting of EXPR_TOKENS keys to keep the token order.
  EXPRS = /\(|\)|\[|\]|@|,|::|\.\.|\./

  # OPERATOR_TOKENS is defined for tokenizing primitive tokens for "Operator"
  # and "OperatorName" except other rules.
  # @see https://www.w3.org/TR/1999/REC-xpath-19991116/#NT-Operator
  OPERATOR_TOKENS = {
    'and' => :T_AND,
    'or'  => :T_OR,
    'mod' => :T_MOD,
    'div' => :T_DIV,
    '/'   => :T_SLASH,
    '//'  => :T_SLASHSLASH,
    "|"   => :T_PIPE,
    '+'   => :T_PLUS,
    '-'   => :T_MINUS,
    '='   => :T_EQ,
    '!='  => :T_NEQ,
    '<'   => :T_LT,
    '>'   => :T_GT,
    '<='  => :T_LTE,
    '>='  => :T_GTE
  }.freeze
  # Declaring the regexp consisting of OPERATOR_TOKENS keys to keep the token order.
  OPERATORS = /and|or|mod|div|\/\/|\/|\||\+|-|\=|!=|<=|>=|<|>/

  require 'strscan'
  require 'forwardable'
  require 'gammo/xpath/errors'
  require 'gammo/xpath/ast/axis'
  require 'gammo/xpath/ast/expression'
  require 'gammo/xpath/ast/function'
  require 'gammo/xpath/ast/node_test'
  require 'gammo/xpath/ast/path'
  require 'gammo/xpath/ast/value'

  extend Forwardable
  def_delegators :@scanner, :scan, :eos?

  def initialize(input)
    super()
    @yydebug = true
    @input = input
    @scanner = StringScanner.new(input)
  end

  def parse
    @query = []
    advance { |symbol, val| @query << [symbol, val] }
    do_parse
  end

  def next_token
    @query.shift
  end

  def lookup_namespace_uri(prefix)
    prefix == 'xml' ? 'http://www.w3.org/XML/1998/namespace' : nil
  end

  def expand_qname(qname)
    return [qname, nil] unless colon = qname.index(':')
    namespace_uri = lookup_namespace_uri(qname.slice(0..colon))
    fail ParseError, 'invalid qname: %s' % qname unless namespace_uri
    [qname.slice(colon..-1), namespace_uri]
  end

  def token(symbol, val, &block)
    @prev_token = symbol
    block.call(symbol, val)
  end

  def fetch(key, constraints)
    unless symbol = constraints[key]
      fail ParseError, "unexpected token: #{symbol}, want = #{constraints.keys}"
    end
    yield symbol
  end

  def advance(&block)
    @prev_token = nil
    until eos?
      case
      # Skip whitespace everywhere.
      when scan(/#{S}+/) then next
      when expr = scan(EXPRS)
        fetch(expr, EXPR_TOKENS) do |symbol|
          token(symbol, expr, &block)
        end
      when operator = scan(OPERATORS)
        fetch operator, OPERATOR_TOKENS do |symbol|
          # "div" is available in both operator and name_test tokens.
          if symbol == :T_DIV && @prev_token != :T_NUMBER
            token(:T_NAME_TEST, operator, &block)
            next
          end
          token(symbol, operator, &block)
        end
      when axis = scan(AXES) then token(:T_AXIS_NAME, axis, &block)
      when node_type = scan(NODE_TYPE)
        # NOTE: processing-instruction is not supported by Gammo.
        token(:T_NODE_TYPE, node_type, &block)
      when name = scan(/\*|#{NC_NAME}|#{Q_NAME}/)
        if name == ?* && @prev_token == :T_NUMBER
          token(:T_MUL, name, &block)
          next
        end
        # TODO: Stripping should be taken care by regexp.
        token @scanner.peek(1) == ?( ? :T_FUNCTION_NAME : :T_NAME_TEST, name.strip, &block
      when literal = scan(/"[^"]*"|'[^']*'/) then token(:T_LITERAL, literal, &block)
      when number = scan(/#{DIGITS}(\.(#{DIGITS})?)?/) then token(:T_NUMBER, number, &block)
      when ref = scan(/\$#{Q_NAME}/) then token(:T_VARIABLE_REFERENCE, ref, &block)
      else
        fail ParseError, "unexpected token: #{@scanner.string[@scanner.pos..-1]}"
      end
    end
  end
...end parser.y/module_eval...
##### State transition tables begin ###

racc_action_table = [
     4,    14,    98,    44,    35,    15,    16,    11,    99,    15,
    16,    11,    44,    12,    13,    10,    19,    12,    13,    10,
    15,    16,    11,    58,    59,    60,    61,    23,    12,    13,
    10,    18,    20,    21,     4,    14,    37,    38,    35,    15,
    16,    11,    44,    15,    16,    11,    55,    12,    13,    10,
    19,    12,    13,    10,    15,    16,    11,    58,    59,    60,
    61,    23,    12,    13,    10,    18,    20,    21,     4,    14,
    37,    38,    35,    15,    16,    11,    46,    15,    16,    11,
    47,    12,    13,    10,    19,    12,    13,    10,    15,    16,
    11,    58,    59,    60,    61,    23,    12,    13,    10,    18,
    20,    21,     4,    14,    62,    63,    35,    65,    66,    64,
    65,    66,    64,    65,    66,    64,    37,    38,    19,    37,
    38,    44,    15,    16,    11,    56,    57,    62,    63,    23,
    12,    13,    10,    18,    20,    21,     4,    14,    62,    63,
    35,    37,    38,    12,    13,    62,    63,    52,    14,    56,
    57,    55,    19,    62,    63,    48,    15,    16,    11,    68,
    50,    97,    77,    23,    12,    13,    10,    18,    20,    21,
     4,    14,    51,    44,    35,    36,    75,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,    19,    79,     4,    14,
    15,    16,    11,   nil,   nil,   nil,   nil,    23,    12,    13,
    10,    18,    20,    21,    19,   nil,   nil,   nil,    15,    16,
    11,   nil,   nil,   nil,   nil,    23,    12,    13,    10,    18,
    20,    21,     4,    14,   nil,   nil,    35,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,    19,   nil,
   nil,   nil,    15,    16,    11,   nil,   nil,   nil,   nil,    23,
    12,    13,    10,    18,    20,    21,     4,    14,   nil,   nil,
    35,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,    19,   nil,   nil,   nil,    15,    16,    11,   nil,
   nil,   nil,   nil,    23,    12,    13,    10,    18,    20,    21,
     4,    14,   nil,   nil,    35,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,    19,   nil,   nil,   nil,
    15,    16,    11,   nil,   nil,   nil,   nil,    23,    12,    13,
    10,    18,    20,    21,     4,    14,   nil,   nil,    35,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    19,   nil,   nil,   nil,    15,    16,    11,   nil,   nil,   nil,
   nil,    23,    12,    13,    10,    18,    20,    21,     4,    14,
   nil,   nil,    35,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,    19,   nil,   nil,   nil,    15,    16,
    11,   nil,   nil,   nil,   nil,    23,    12,    13,    10,    18,
    20,    21,     4,    14,   nil,   nil,    35,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,    19,   nil,
   nil,   nil,    15,    16,    11,   nil,   nil,   nil,   nil,    23,
    12,    13,    10,    18,    20,    21,     4,    14,   nil,   nil,
    35,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,    19,   nil,   nil,   nil,    15,    16,    11,   nil,
   nil,   nil,   nil,    23,    12,    13,    10,    18,    20,    21,
     4,    14,   nil,   nil,    35,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,    19,   nil,   nil,   nil,
    15,    16,    11,   nil,   nil,   nil,   nil,    23,    12,    13,
    10,    18,    20,    21,     4,    14,   nil,   nil,    35,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    19,   nil,   nil,   nil,    15,    16,    11,   nil,   nil,   nil,
   nil,    23,    12,    13,    10,    18,    20,    21,     4,    14,
   nil,   nil,    35,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,    19,   nil,   nil,   nil,    15,    16,
    11,   nil,   nil,   nil,   nil,    23,    12,    13,    10,    18,
    20,    21,     4,    14,   nil,   nil,    35,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,    19,   nil,
   nil,   nil,    15,    16,    11,   nil,   nil,   nil,   nil,    23,
    12,    13,    10,    18,    20,    21,     4,    14,   nil,   nil,
    35,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,    19,   nil,   nil,   nil,    15,    16,    11,   nil,
   nil,   nil,   nil,    23,    12,    13,    10,    18,    20,    21,
     4,    14,   nil,   nil,    35,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,    19,   nil,   nil,   nil,
    15,    16,    11,   nil,   nil,   nil,   nil,    23,    12,    13,
    10,    18,    20,    21 ]

racc_action_check = [
    65,    65,    78,    28,    65,     4,     4,     4,    78,     5,
     5,     5,    45,     4,     4,     4,    65,     5,     5,     5,
    65,    65,    65,    86,    86,    86,    86,    65,    65,    65,
    65,    65,    65,    65,    19,    19,    40,    40,    19,    53,
    53,    53,     7,    38,    38,    38,    29,    53,    53,    53,
    19,    38,    38,    38,    19,    19,    19,    31,    31,    31,
    31,    19,    19,    19,    19,    19,    19,    19,    35,    35,
    39,    39,    35,    37,    37,    37,    10,    52,    52,    52,
    13,    37,    37,    37,    35,    52,    52,    52,    35,    35,
    35,    87,    87,    87,    87,    35,    35,    35,    35,    35,
    35,    35,    44,    44,    91,    91,    44,    93,    93,    93,
    33,    33,    33,    92,    92,    92,    83,    83,    44,    84,
    84,    54,    44,    44,    44,    85,    85,    88,    88,    44,
    44,    44,    44,    44,    44,    44,    48,    48,    89,    89,
    48,     2,     2,     8,     8,    90,    90,    27,    27,    30,
    30,    76,    48,    32,    32,    17,    48,    48,    48,    36,
    23,    72,    49,    48,    48,    48,    48,    48,    48,    48,
    50,    50,    25,    43,    50,     1,    47,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,    50,    50,    51,    51,
    50,    50,    50,   nil,   nil,   nil,   nil,    50,    50,    50,
    50,    50,    50,    50,    51,   nil,   nil,   nil,    51,    51,
    51,   nil,   nil,   nil,   nil,    51,    51,    51,    51,    51,
    51,    51,    55,    55,   nil,   nil,    55,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,    55,   nil,
   nil,   nil,    55,    55,    55,   nil,   nil,   nil,   nil,    55,
    55,    55,    55,    55,    55,    55,    56,    56,   nil,   nil,
    56,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,    56,   nil,   nil,   nil,    56,    56,    56,   nil,
   nil,   nil,   nil,    56,    56,    56,    56,    56,    56,    56,
    57,    57,   nil,   nil,    57,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,    57,   nil,   nil,   nil,
    57,    57,    57,   nil,   nil,   nil,   nil,    57,    57,    57,
    57,    57,    57,    57,    58,    58,   nil,   nil,    58,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    58,   nil,   nil,   nil,    58,    58,    58,   nil,   nil,   nil,
   nil,    58,    58,    58,    58,    58,    58,    58,    59,    59,
   nil,   nil,    59,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,    59,   nil,   nil,   nil,    59,    59,
    59,   nil,   nil,   nil,   nil,    59,    59,    59,    59,    59,
    59,    59,    60,    60,   nil,   nil,    60,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,    60,   nil,
   nil,   nil,    60,    60,    60,   nil,   nil,   nil,   nil,    60,
    60,    60,    60,    60,    60,    60,    61,    61,   nil,   nil,
    61,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,    61,   nil,   nil,   nil,    61,    61,    61,   nil,
   nil,   nil,   nil,    61,    61,    61,    61,    61,    61,    61,
    62,    62,   nil,   nil,    62,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,    62,   nil,   nil,   nil,
    62,    62,    62,   nil,   nil,   nil,   nil,    62,    62,    62,
    62,    62,    62,    62,    63,    63,   nil,   nil,    63,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    63,   nil,   nil,   nil,    63,    63,    63,   nil,   nil,   nil,
   nil,    63,    63,    63,    63,    63,    63,    63,    64,    64,
   nil,   nil,    64,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,    64,   nil,   nil,   nil,    64,    64,
    64,   nil,   nil,   nil,   nil,    64,    64,    64,    64,    64,
    64,    64,     0,     0,   nil,   nil,     0,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,     0,   nil,
   nil,   nil,     0,     0,     0,   nil,   nil,   nil,   nil,     0,
     0,     0,     0,     0,     0,     0,    66,    66,   nil,   nil,
    66,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,    66,   nil,   nil,   nil,    66,    66,    66,   nil,
   nil,   nil,   nil,    66,    66,    66,    66,    66,    66,    66,
    99,    99,   nil,   nil,    99,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,    99,   nil,   nil,   nil,
    99,    99,    99,   nil,   nil,   nil,   nil,    99,    99,    99,
    99,    99,    99,    99 ]

racc_action_pointer = [
   560,   175,   139,   nil,   -17,   -13,   nil,    22,   113,   nil,
    50,   nil,   nil,    62,   nil,   nil,   nil,   141,   nil,    32,
   nil,   nil,   nil,   142,   nil,   168,   nil,   145,   -17,    33,
   142,    48,   148,    95,   nil,    66,   159,    51,    21,    68,
    34,   nil,   nil,   153,   100,    -8,   nil,   157,   134,   143,
   168,   186,    55,    17,   101,   220,   254,   288,   322,   356,
   390,   424,   458,   492,   526,    -2,   594,   nil,   nil,   nil,
   nil,   nil,   140,   nil,   nil,   nil,   138,   nil,   -17,   nil,
   nil,   nil,   nil,   114,   117,   118,    14,    82,   122,   133,
   140,    99,    98,    92,   nil,   nil,   nil,   nil,   nil,   628,
   nil ]

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

racc_goto_table = [
    39,    40,    81,     1,    41,    67,    71,    88,    89,    90,
    91,    86,    87,    92,    93,    69,    70,    71,    76,    85,
    45,    53,    49,    54,    72,    78,    82,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,    94,    95,    96,   nil,   nil,   nil,
   nil,   nil,    74,   nil,   nil,   nil,   nil,    73,    83,    84,
   nil,   100 ]

racc_goto_check = [
     3,     3,    18,     1,     8,    27,    12,    25,    25,    25,
    25,    24,    24,    26,    26,     6,     6,    12,    22,    23,
     7,     5,     1,    11,    13,    17,    20,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,    27,    27,    27,   nil,   nil,   nil,
   nil,   nil,     8,   nil,   nil,   nil,   nil,     1,     3,     3,
   nil,    18 ]

racc_goto_pointer = [
   nil,     3,   nil,    -4,   nil,    -6,   -22,    12,    -3,   nil,
   nil,    -5,   -37,   -20,   nil,   nil,   nil,   -25,   -48,   nil,
   -25,   nil,   -30,   -36,   -45,   -51,   -49,   -30 ]

racc_goto_default = [
   nil,    80,    26,     2,     3,     5,     6,     7,   nil,     8,
     9,    43,    42,   nil,    17,    28,    22,   nil,   nil,    25,
    24,    27,    29,    30,    31,    32,    33,    34 ]

racc_reduce_table = [
  0, 0, :racc_error,
  1, 38, :_reduce_1,
  1, 38, :_reduce_2,
  1, 40, :_reduce_3,
  2, 40, :_reduce_4,
  2, 40, :_reduce_5,
  1, 39, :_reduce_6,
  3, 39, :_reduce_7,
  3, 39, :_reduce_8,
  2, 42, :_reduce_9,
  3, 42, :_reduce_10,
  1, 42, :_reduce_none,
  2, 45, :_reduce_none,
  1, 45, :_reduce_13,
  1, 43, :_reduce_14,
  3, 43, :_reduce_15,
  1, 41, :_reduce_16,
  1, 47, :_reduce_17,
  2, 47, :_reduce_18,
  0, 44, :_reduce_none,
  1, 44, :_reduce_20,
  3, 48, :_reduce_21,
  1, 49, :_reduce_none,
  1, 46, :_reduce_23,
  1, 46, :_reduce_24,
  1, 37, :_reduce_none,
  1, 51, :_reduce_26,
  3, 51, :_reduce_27,
  1, 51, :_reduce_28,
  1, 51, :_reduce_29,
  1, 51, :_reduce_none,
  4, 52, :_reduce_31,
  3, 52, :_reduce_32,
  1, 54, :_reduce_none,
  1, 53, :_reduce_34,
  3, 53, :_reduce_35,
  1, 55, :_reduce_none,
  3, 55, :_reduce_37,
  1, 56, :_reduce_none,
  1, 56, :_reduce_none,
  3, 56, :_reduce_40,
  3, 56, :_reduce_41,
  1, 57, :_reduce_none,
  2, 57, :_reduce_43,
  1, 50, :_reduce_none,
  3, 50, :_reduce_45,
  1, 58, :_reduce_none,
  3, 58, :_reduce_47,
  1, 59, :_reduce_none,
  3, 59, :_reduce_49,
  3, 59, :_reduce_50,
  1, 60, :_reduce_none,
  3, 60, :_reduce_52,
  3, 60, :_reduce_53,
  3, 60, :_reduce_54,
  3, 60, :_reduce_55,
  1, 61, :_reduce_none,
  3, 61, :_reduce_57,
  3, 61, :_reduce_58,
  1, 62, :_reduce_none,
  3, 62, :_reduce_60,
  3, 62, :_reduce_61,
  3, 62, :_reduce_62,
  1, 63, :_reduce_none,
  2, 63, :_reduce_64 ]

racc_reduce_n = 65

racc_shift_n = 101

racc_token_table = {
  false => 0,
  :error => 1,
  :T_SLASH => 2,
  :T_SLASHSLASH => 3,
  :T_PIPE => 4,
  :T_PLUS => 5,
  :T_MINUS => 6,
  :T_EQ => 7,
  :T_NEQ => 8,
  :T_LT => 9,
  :T_GT => 10,
  :T_LTE => 11,
  :T_GTE => 12,
  :T_AND => 13,
  :T_OR => 14,
  :T_DIV => 15,
  :T_MOD => 16,
  :T_MUL => 17,
  :T_LPAREN => 18,
  :T_RPAREN => 19,
  :T_LBRACK => 20,
  :T_RBRACK => 21,
  :T_DOT => 22,
  :T_DOTDOT => 23,
  :T_AT => 24,
  :T_COMMA => 25,
  :T_COLONCOLON => 26,
  :T_NC_NAME => 27,
  :T_Q_NAME => 28,
  :T_FUNCTION_NAME => 29,
  :T_NAME_TEST => 30,
  :T_NODE_TYPE => 31,
  :T_AXIS_NAME => 32,
  :T_VARIABLE_REFERENCE => 33,
  :T_LITERAL => 34,
  :T_NUMBER => 35 }

racc_nt_base = 36

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",
  "T_SLASH",
  "T_SLASHSLASH",
  "T_PIPE",
  "T_PLUS",
  "T_MINUS",
  "T_EQ",
  "T_NEQ",
  "T_LT",
  "T_GT",
  "T_LTE",
  "T_GTE",
  "T_AND",
  "T_OR",
  "T_DIV",
  "T_MOD",
  "T_MUL",
  "T_LPAREN",
  "T_RPAREN",
  "T_LBRACK",
  "T_RBRACK",
  "T_DOT",
  "T_DOTDOT",
  "T_AT",
  "T_COMMA",
  "T_COLONCOLON",
  "T_NC_NAME",
  "T_Q_NAME",
  "T_FUNCTION_NAME",
  "T_NAME_TEST",
  "T_NODE_TYPE",
  "T_AXIS_NAME",
  "T_VARIABLE_REFERENCE",
  "T_LITERAL",
  "T_NUMBER",
  "$start",
  "expr",
  "location_path",
  "relative_location_path",
  "absolute_location_path",
  "descendant_or_self",
  "step",
  "node_test",
  "optional_predicates",
  "axis_specifier",
  "abbreviated_step",
  "repeatable_predicates",
  "predicate",
  "predicate_expr",
  "or_expr",
  "primary_expr",
  "function_call",
  "arguments",
  "argument",
  "union_expr",
  "path_expr",
  "filter_expr",
  "and_expr",
  "equality_expr",
  "relational_expr",
  "additive_expr",
  "multiplicative_expr",
  "unary_expr" ]

Racc_debug_parser = false

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

# reduce 0 omitted

module_eval(<<'.,.,', 'parser.y', 42)
  def _reduce_1(val, _values, result)
          result = val[0]
      result.absolute = false

    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 46)
  def _reduce_2(val, _values, result)
          result = val[0]
      result.absolute = true

    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 51)
  def _reduce_3(val, _values, result)
     result = AST::LocationPath.new
    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 52)
  def _reduce_4(val, _values, result)
     result = val[1]
    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 54)
  def _reduce_5(val, _values, result)
          result = val[1]
      result.insert_first_step(val[0])

    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 60)
  def _reduce_6(val, _values, result)
          result = AST::LocationPath.new
      result.append_step(val[0])

    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 64)
  def _reduce_7(val, _values, result)
          result = val[0]
      result.append_step(val[2])

    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 68)
  def _reduce_8(val, _values, result)
          result = val[0]
      result.append_step(val[1])
      result.append_step(val[2])

    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 75)
  def _reduce_9(val, _values, result)
          result = AST::Axis::Child.new(node_test: val[0], predicates: val[1])

    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 78)
  def _reduce_10(val, _values, result)
          axis_base_class = val[0]
      axis_base_class = AST::Axis.fetch(axis_base_class.gsub(/-/, '_')) if axis_base_class.instance_of?(String)
      result = axis_base_class.new(node_test: val[1], predicates: val[2])

    result
  end
.,.,

# reduce 11 omitted

# reduce 12 omitted

module_eval(<<'.,.,', 'parser.y', 85)
  def _reduce_13(val, _values, result)
     result = AST::Axis::Attribute
    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 89)
  def _reduce_14(val, _values, result)
          local, namespace = expand_qname(val[0])
      result = AST::NodeTest::Name.new(local: local, namespace: namespace)

    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 93)
  def _reduce_15(val, _values, result)
          result = AST::NodeTest.fetch(val[0]).new

    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 98)
  def _reduce_16(val, _values, result)
          result = AST::Axis::DescendantOrSelf.new(node_test: AST::NodeTest::Any.new)

    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 105)
  def _reduce_17(val, _values, result)
     result = [AST::Predicate.new(val[0])]
    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 107)
  def _reduce_18(val, _values, result)
          result = val[0]
      result << val[1]

    result
  end
.,.,

# reduce 19 omitted

module_eval(<<'.,.,', 'parser.y', 112)
  def _reduce_20(val, _values, result)
     result = val[0]
    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 114)
  def _reduce_21(val, _values, result)
     result = val[1]
    result
  end
.,.,

# reduce 22 omitted

module_eval(<<'.,.,', 'parser.y', 118)
  def _reduce_23(val, _values, result)
     result = AST::Axis::Self.new(node_test: AST::NodeTest::Any.new)
    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 119)
  def _reduce_24(val, _values, result)
     result = AST::Axis::Parent.new(node_test: AST::NodeTest::Any.new)
    result
  end
.,.,

# reduce 25 omitted

module_eval(<<'.,.,', 'parser.y', 124)
  def _reduce_26(val, _values, result)
     result = AST::Value::VariableReference.new(val[0])
    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 125)
  def _reduce_27(val, _values, result)
     result = val[1]
    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 126)
  def _reduce_28(val, _values, result)
     result = AST::Value::String.new(val[0].to_s)
    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 127)
  def _reduce_29(val, _values, result)
     result = AST::Value::Number.new(val[0].include?(?.) ? val[0].to_f : val[0].to_i)
    result
  end
.,.,

# reduce 30 omitted

module_eval(<<'.,.,', 'parser.y', 132)
  def _reduce_31(val, _values, result)
          result = AST::Function.fetch(val[0]).new(*val[2])

    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 135)
  def _reduce_32(val, _values, result)
          result = AST::Function.fetch(val[0]).new

    result
  end
.,.,

# reduce 33 omitted

module_eval(<<'.,.,', 'parser.y', 145)
  def _reduce_34(val, _values, result)
          result = []
      result << val[0]

    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 149)
  def _reduce_35(val, _values, result)
          result = val[0]
      result << val[2]

    result
  end
.,.,

# reduce 36 omitted

module_eval(<<'.,.,', 'parser.y', 156)
  def _reduce_37(val, _values, result)
          result = AST::UnionExpr.new(val[0], val[2])

    result
  end
.,.,

# reduce 38 omitted

# reduce 39 omitted

module_eval(<<'.,.,', 'parser.y', 163)
  def _reduce_40(val, _values, result)
          val[2].absolute = true
      result = AST::Path.new(val[0], val[2])

    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 167)
  def _reduce_41(val, _values, result)
          val[2].insert_first_step(val[1])
      val[2].absolute = true
      result = AST::Path.new(val[0], val[2])

    result
  end
.,.,

# reduce 42 omitted

module_eval(<<'.,.,', 'parser.y', 175)
  def _reduce_43(val, _values, result)
          result = AST::Filter.new(val[0], predicates: val[1])

    result
  end
.,.,

# reduce 44 omitted

module_eval(<<'.,.,', 'parser.y', 180)
  def _reduce_45(val, _values, result)
     result = AST::OrExpr.new(a: val[0], b: val[2])
    result
  end
.,.,

# reduce 46 omitted

module_eval(<<'.,.,', 'parser.y', 184)
  def _reduce_47(val, _values, result)
     result = AST::AndExpr.new(a: val[0], b: val[2])
    result
  end
.,.,

# reduce 48 omitted

module_eval(<<'.,.,', 'parser.y', 188)
  def _reduce_49(val, _values, result)
     result = AST::EqExpr.new(val[0], val[2])
    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 189)
  def _reduce_50(val, _values, result)
     result =  AST::NeqExpr.new(val[0], val[2])
    result
  end
.,.,

# reduce 51 omitted

module_eval(<<'.,.,', 'parser.y', 193)
  def _reduce_52(val, _values, result)
     result = AST::LtExpr.new(val[0], val[2])
    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 194)
  def _reduce_53(val, _values, result)
     result = AST::GtExpr.new(val[0], val[2])
    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 195)
  def _reduce_54(val, _values, result)
     result = AST::LteExpr.new(val[0], val[2])
    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 196)
  def _reduce_55(val, _values, result)
     result = AST::GteExpr.new(val[0], val[2])
    result
  end
.,.,

# reduce 56 omitted

module_eval(<<'.,.,', 'parser.y', 201)
  def _reduce_57(val, _values, result)
          result = AST::PlusExpr.new(val[0], val[2])

    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 204)
  def _reduce_58(val, _values, result)
          result = AST::MinusExpr.new(val[0], val[2])

    result
  end
.,.,

# reduce 59 omitted

module_eval(<<'.,.,', 'parser.y', 210)
  def _reduce_60(val, _values, result)
          result = AST::MultiplyExpr.new(val[0], val[2])

    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 213)
  def _reduce_61(val, _values, result)
          result = AST::DividedExpr.new(val[0], val[2])

    result
  end
.,.,

module_eval(<<'.,.,', 'parser.y', 216)
  def _reduce_62(val, _values, result)
          result = AST::ModuloExpr.new(val[0], val[2])

    result
  end
.,.,

# reduce 63 omitted

module_eval(<<'.,.,', 'parser.y', 222)
  def _reduce_64(val, _values, result)
          result = AST::Negative.new(val[1])

    result
  end
.,.,

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

    end   # class Parser
  end   # module XPath
end   # module Gammo
