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

require 'racc/parser.rb'


module Nokogiri
  module CSS
    class GeneratedParser < Racc::Parser
##### State transition tables begin ###

racc_action_table = [
     4,    56,    27,    22,    12,    24,    57,     4,    65,     1,
    41,    12,    75,    57,     4,    23,     1,    82,    12,    19,
    93,    92,     5,     1,     9,    10,    19,    13,    16,     5,
    12,     9,    10,    19,    13,    16,     5,     5,     9,    10,
     4,    13,    16,    16,    12,    41,    64,     4,     5,     1,
    60,    10,    12,    59,    16,    59,    28,     1,    29,    19,
    12,    12,     5,    62,     9,    10,    19,    13,    16,    12,
     5,     9,    83,    10,    12,    13,    16,    84,     5,     5,
    63,    10,    10,    12,    16,    16,    58,     5,    61,    62,
    10,     4,     5,    16,    87,    10,    27,    53,    16,    54,
    49,     5,    88,    41,    10,    68,    70,    16,    27,    53,
    19,    54,    44,    91,    21,     9,    69,    71,    72,    94,
    74,    68,    70,   -23,    66,    33,    35,    37,    27,    53,
    96,    54,    69,    71,    72,    32,    74,    34,    36,    97,
    66,    27,    53,   nil,    54 ]

racc_action_check = [
     0,    20,     4,     4,     0,     4,    43,     9,    27,     0,
    39,     9,    29,    20,    31,     4,     9,    43,    31,     0,
    73,    73,     0,    31,     0,     0,     9,     0,     0,     9,
     7,     9,     9,    31,     9,     9,    31,    14,    31,    31,
    57,    31,    31,    14,    57,     7,    26,     5,     7,    57,
    22,     7,    41,    53,     7,    22,     5,    41,     5,    57,
     8,    79,    57,    54,    57,    57,     5,    57,    57,    18,
    41,     5,    55,    41,    17,    41,    41,    56,     8,    79,
    25,     8,    79,    15,     8,    79,    21,    18,    24,    24,
    18,    16,    17,    18,    60,    17,    59,    59,    17,    59,
    16,    15,    61,    11,    15,    30,    30,    15,    19,    19,
    16,    19,    10,    67,     2,    16,    30,    30,    30,    76,
    30,    28,    28,     1,    30,     6,     6,     6,    62,    62,
    81,    62,    28,    28,    28,     6,    28,     6,     6,    88,
    28,    65,    65,   nil,    65 ]

racc_action_pointer = [
    -2,    95,    86,   nil,    -8,    45,   118,    24,    54,     5,
   101,    82,   nil,   nil,    13,    77,    89,    68,    63,    98,
     1,    75,    43,   nil,    77,    57,    23,    -4,   118,   -13,
   102,    12,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   -11,
   nil,    46,   nil,    -6,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,    41,    51,    49,    77,    38,   nil,    86,
    81,    95,   118,   nil,   nil,   131,   nil,    88,   nil,   nil,
   nil,   nil,   nil,    10,   nil,   nil,    94,   nil,   nil,    55,
   nil,   107,   nil,   nil,   nil,   nil,   nil,   nil,   126,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil ]

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

racc_goto_table = [
    39,    42,    25,    40,    77,    30,    20,    45,    48,    79,
    51,    52,    67,    46,    76,    43,    50,    55,    47,    38,
    31,    26,    81,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    85,   nil,   nil,   nil,    80,    78,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,    86,   nil,   nil,
    89,   nil,   nil,    90,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,    95 ]

racc_goto_check = [
     7,     7,    15,     8,     2,     9,     1,     8,     7,     5,
     7,     7,    14,    10,    14,     1,     9,    15,    11,     6,
     3,    16,    19,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
     2,   nil,   nil,   nil,     7,     8,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,    15,   nil,   nil,
    15,   nil,   nil,    15,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,     7 ]

racc_goto_pointer = [
   nil,     6,   -27,    14,   nil,   -32,    12,    -7,    -4,     0,
    -1,     4,   nil,   nil,   -16,    -2,    17,   nil,   nil,   -19 ]

racc_goto_default = [
   nil,   nil,     3,   nil,     6,     7,   nil,    11,   nil,    14,
    15,    17,    18,     2,   nil,   nil,   nil,     8,    73,   nil ]

racc_reduce_table = [
  0, 0, :racc_error,
  3, 32, :_reduce_1,
  1, 32, :_reduce_2,
  1, 34, :_reduce_3,
  1, 34, :_reduce_4,
  1, 34, :_reduce_5,
  1, 34, :_reduce_6,
  1, 34, :_reduce_7,
  1, 34, :_reduce_8,
  2, 35, :_reduce_9,
  3, 35, :_reduce_10,
  2, 35, :_reduce_11,
  1, 35, :_reduce_none,
  2, 35, :_reduce_13,
  2, 35, :_reduce_14,
  2, 35, :_reduce_15,
  1, 35, :_reduce_16,
  3, 33, :_reduce_17,
  1, 33, :_reduce_none,
  2, 43, :_reduce_19,
  3, 36, :_reduce_20,
  1, 36, :_reduce_21,
  1, 36, :_reduce_22,
  1, 44, :_reduce_23,
  0, 44, :_reduce_none,
  4, 42, :_reduce_25,
  4, 42, :_reduce_26,
  3, 42, :_reduce_27,
  2, 40, :_reduce_28,
  3, 40, :_reduce_29,
  3, 40, :_reduce_30,
  3, 40, :_reduce_31,
  3, 40, :_reduce_32,
  3, 46, :_reduce_33,
  3, 46, :_reduce_34,
  3, 46, :_reduce_35,
  1, 46, :_reduce_none,
  1, 46, :_reduce_none,
  1, 46, :_reduce_38,
  4, 47, :_reduce_39,
  3, 47, :_reduce_40,
  2, 47, :_reduce_41,
  2, 41, :_reduce_42,
  2, 41, :_reduce_43,
  1, 37, :_reduce_none,
  0, 37, :_reduce_none,
  2, 38, :_reduce_46,
  2, 38, :_reduce_47,
  2, 38, :_reduce_48,
  2, 38, :_reduce_49,
  1, 38, :_reduce_none,
  1, 38, :_reduce_none,
  1, 38, :_reduce_none,
  1, 38, :_reduce_none,
  1, 48, :_reduce_54,
  2, 45, :_reduce_55,
  2, 45, :_reduce_56,
  0, 45, :_reduce_none,
  1, 49, :_reduce_58,
  1, 49, :_reduce_59,
  1, 49, :_reduce_60,
  1, 49, :_reduce_61,
  1, 49, :_reduce_62,
  1, 49, :_reduce_63,
  1, 49, :_reduce_64,
  3, 39, :_reduce_65,
  1, 50, :_reduce_none,
  2, 50, :_reduce_none,
  1, 50, :_reduce_none ]

racc_reduce_n = 69

racc_shift_n = 98

racc_token_table = {
  false => 0,
  :error => 1,
  :FUNCTION => 2,
  :INCLUDES => 3,
  :DASHMATCH => 4,
  :LBRACE => 5,
  :HASH => 6,
  :PLUS => 7,
  :GREATER => 8,
  :S => 9,
  :STRING => 10,
  :IDENT => 11,
  :COMMA => 12,
  :NUMBER => 13,
  :PREFIXMATCH => 14,
  :SUFFIXMATCH => 15,
  :SUBSTRINGMATCH => 16,
  :TILDE => 17,
  :NOT_EQUAL => 18,
  :SLASH => 19,
  :DOUBLESLASH => 20,
  :NOT => 21,
  :EQUAL => 22,
  :RPAREN => 23,
  :LSQUARE => 24,
  :RSQUARE => 25,
  :HAS => 26,
  "." => 27,
  "|" => 28,
  "*" => 29,
  ":" => 30 }

racc_nt_base = 31

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",
  "FUNCTION",
  "INCLUDES",
  "DASHMATCH",
  "LBRACE",
  "HASH",
  "PLUS",
  "GREATER",
  "S",
  "STRING",
  "IDENT",
  "COMMA",
  "NUMBER",
  "PREFIXMATCH",
  "SUFFIXMATCH",
  "SUBSTRINGMATCH",
  "TILDE",
  "NOT_EQUAL",
  "SLASH",
  "DOUBLESLASH",
  "NOT",
  "EQUAL",
  "RPAREN",
  "LSQUARE",
  "RSQUARE",
  "HAS",
  "\".\"",
  "\"|\"",
  "\"*\"",
  "\":\"",
  "$start",
  "selector",
  "simple_selector_1toN",
  "combinator",
  "simple_selector",
  "element_name",
  "hcap_0toN",
  "hcap_1toN",
  "negation",
  "function",
  "pseudo",
  "attrib",
  "class",
  "namespace",
  "attrib_val_0or1",
  "expr",
  "an_plus_b",
  "attribute_id",
  "eql_incl_dash",
  "negation_arg" ]

Racc_debug_parser = false

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

# reduce 0 omitted

def _reduce_1(val, _values, result)
        result = [val.first, val.last].flatten
      
    result
end

def _reduce_2(val, _values, result)
 result = val.flatten 
    result
end

def _reduce_3(val, _values, result)
 result = :DIRECT_ADJACENT_SELECTOR 
    result
end

def _reduce_4(val, _values, result)
 result = :CHILD_SELECTOR 
    result
end

def _reduce_5(val, _values, result)
 result = :PRECEDING_SELECTOR 
    result
end

def _reduce_6(val, _values, result)
 result = :DESCENDANT_SELECTOR 
    result
end

def _reduce_7(val, _values, result)
 result = :DESCENDANT_SELECTOR 
    result
end

def _reduce_8(val, _values, result)
 result = :CHILD_SELECTOR 
    result
end

def _reduce_9(val, _values, result)
        result =  if val[1].nil?
                    val.first
                  else
                    Node.new(:CONDITIONAL_SELECTOR, [val.first, val[1]])
                  end
      
    result
end

def _reduce_10(val, _values, result)
        result = Node.new(:CONDITIONAL_SELECTOR,
          [
            val.first,
            Node.new(:COMBINATOR, [val[1], val.last])
          ]
        )
      
    result
end

def _reduce_11(val, _values, result)
        result = Node.new(:CONDITIONAL_SELECTOR, val)
      
    result
end

# reduce 12 omitted

def _reduce_13(val, _values, result)
        result = Node.new(:CONDITIONAL_SELECTOR, val)
      
    result
end

def _reduce_14(val, _values, result)
        result = Node.new(:CONDITIONAL_SELECTOR, val)
      
    result
end

def _reduce_15(val, _values, result)
        result = Node.new(:CONDITIONAL_SELECTOR,
          [
            Node.new(:ELEMENT_NAME, ['*']),
            Node.new(:COMBINATOR, val)
          ]
        )
      
    result
end

def _reduce_16(val, _values, result)
        result = Node.new(:CONDITIONAL_SELECTOR,
          [Node.new(:ELEMENT_NAME, ['*']), val.first]
        )
      
    result
end

def _reduce_17(val, _values, result)
        result = Node.new(val[1], [val.first, val.last])
      
    result
end

# reduce 18 omitted

def _reduce_19(val, _values, result)
 result = Node.new(:CLASS_CONDITION, [val[1]]) 
    result
end

def _reduce_20(val, _values, result)
        result = Node.new(:ELEMENT_NAME,
          [[val.first, val.last].compact.join(':')]
        )
      
    result
end

def _reduce_21(val, _values, result)
        name = @namespaces.key?('xmlns') ? "xmlns:#{val.first}" : val.first
        result = Node.new(:ELEMENT_NAME, [name])
      
    result
end

def _reduce_22(val, _values, result)
 result = Node.new(:ELEMENT_NAME, val) 
    result
end

def _reduce_23(val, _values, result)
 result = val[0] 
    result
end

# reduce 24 omitted

def _reduce_25(val, _values, result)
        result = Node.new(:ATTRIBUTE_CONDITION,
          [Node.new(:ELEMENT_NAME, [val[1]])] + (val[2] || [])
        )
      
    result
end

def _reduce_26(val, _values, result)
        result = Node.new(:ATTRIBUTE_CONDITION,
          [val[1]] + (val[2] || [])
        )
      
    result
end

def _reduce_27(val, _values, result)
        # Non standard, but hpricot supports it.
        result = Node.new(:PSEUDO_CLASS,
          [Node.new(:FUNCTION, ['nth-child(', val[1]])]
        )
      
    result
end

def _reduce_28(val, _values, result)
        result = Node.new(:FUNCTION, [val.first.strip])
      
    result
end

def _reduce_29(val, _values, result)
        result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
      
    result
end

def _reduce_30(val, _values, result)
        result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
      
    result
end

def _reduce_31(val, _values, result)
        result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
      
    result
end

def _reduce_32(val, _values, result)
        result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
      
    result
end

def _reduce_33(val, _values, result)
 result = [val.first, val.last] 
    result
end

def _reduce_34(val, _values, result)
 result = [val.first, val.last] 
    result
end

def _reduce_35(val, _values, result)
 result = [val.first, val.last] 
    result
end

# reduce 36 omitted

# reduce 37 omitted

def _reduce_38(val, _values, result)
        if val[0] == 'even'
          val = ["2","n","+","0"]
          result = Node.new(:AN_PLUS_B, val)
        elsif val[0] == 'odd'
          val = ["2","n","+","1"]
          result = Node.new(:AN_PLUS_B, val)
        else
          # This is not CSS standard.  It allows us to support this:
          # assert_xpath("//a[foo(., @href)]", @parser.parse('a:foo(@href)'))
          # assert_xpath("//a[foo(., @a, b)]", @parser.parse('a:foo(@a, b)'))
          # assert_xpath("//a[foo(., a, 10)]", @parser.parse('a:foo(a, 10)'))
          result = val
        end
      
    result
end

def _reduce_39(val, _values, result)
        if val[1] == 'n'
          result = Node.new(:AN_PLUS_B, val)
        else
          raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
        end
      
    result
end

def _reduce_40(val, _values, result)
               # n+3, -n+3
        if val[0] == 'n'
          val.unshift("1")
          result = Node.new(:AN_PLUS_B, val)
        elsif val[0] == '-n'
          val[0] = 'n'
          val.unshift("-1")
          result = Node.new(:AN_PLUS_B, val)
        else
          raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
        end
      
    result
end

def _reduce_41(val, _values, result)
        if val[1] == 'n'
          val << "+"
          val << "0"
          result = Node.new(:AN_PLUS_B, val)
        else
          raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
        end
      
    result
end

def _reduce_42(val, _values, result)
        result = Node.new(:PSEUDO_CLASS, [val[1]])
      
    result
end

def _reduce_43(val, _values, result)
 result = Node.new(:PSEUDO_CLASS, [val[1]]) 
    result
end

# reduce 44 omitted

# reduce 45 omitted

def _reduce_46(val, _values, result)
        result = Node.new(:COMBINATOR, val)
      
    result
end

def _reduce_47(val, _values, result)
        result = Node.new(:COMBINATOR, val)
      
    result
end

def _reduce_48(val, _values, result)
        result = Node.new(:COMBINATOR, val)
      
    result
end

def _reduce_49(val, _values, result)
        result = Node.new(:COMBINATOR, val)
      
    result
end

# reduce 50 omitted

# reduce 51 omitted

# reduce 52 omitted

# reduce 53 omitted

def _reduce_54(val, _values, result)
 result = Node.new(:ID, val) 
    result
end

def _reduce_55(val, _values, result)
 result = [val.first, val[1]] 
    result
end

def _reduce_56(val, _values, result)
 result = [val.first, val[1]] 
    result
end

# reduce 57 omitted

def _reduce_58(val, _values, result)
 result = :equal 
    result
end

def _reduce_59(val, _values, result)
 result = :prefix_match 
    result
end

def _reduce_60(val, _values, result)
 result = :suffix_match 
    result
end

def _reduce_61(val, _values, result)
 result = :substring_match 
    result
end

def _reduce_62(val, _values, result)
 result = :not_equal 
    result
end

def _reduce_63(val, _values, result)
 result = :includes 
    result
end

def _reduce_64(val, _values, result)
 result = :dash_match 
    result
end

def _reduce_65(val, _values, result)
        result = Node.new(:NOT, [val[1]])
      
    result
end

# reduce 66 omitted

# reduce 67 omitted

# reduce 68 omitted

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

    end   # class GeneratedParser
    end   # module CSS
  end   # module Nokogiri
