nokogiri 1.5.2-java → 1.5.3-java

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of nokogiri might be problematic. Click here for more details.

Files changed (70) hide show
  1. data/CHANGELOG.ja.rdoc +35 -0
  2. data/CHANGELOG.rdoc +37 -2
  3. data/Manifest.txt +11 -3
  4. data/README.rdoc +1 -1
  5. data/ROADMAP.md +86 -0
  6. data/{nokogiri_help_responses.md → STANDARD_RESPONSES.md} +11 -4
  7. data/Y_U_NO_GEMSPEC.md +155 -0
  8. data/build_all +58 -0
  9. data/ext/java/nokogiri/HtmlDocument.java +10 -1
  10. data/ext/java/nokogiri/XmlAttr.java +11 -1
  11. data/ext/java/nokogiri/XmlDocument.java +4 -0
  12. data/ext/java/nokogiri/XmlNamespace.java +25 -0
  13. data/ext/java/nokogiri/XmlNode.java +6 -6
  14. data/ext/java/nokogiri/XmlReader.java +19 -4
  15. data/ext/java/nokogiri/XmlSaxPushParser.java +88 -57
  16. data/ext/java/nokogiri/XmlSyntaxError.java +15 -3
  17. data/ext/java/nokogiri/XmlXpathContext.java +3 -3
  18. data/ext/java/nokogiri/internals/HtmlDomParserContext.java +2 -1
  19. data/ext/java/nokogiri/internals/NokogiriHelpers.java +89 -1
  20. data/ext/java/nokogiri/internals/ParserContext.java +23 -2
  21. data/ext/java/nokogiri/internals/SaveContextVisitor.java +18 -1
  22. data/ext/java/nokogiri/internals/XmlDomParserContext.java +2 -3
  23. data/ext/nokogiri/extconf.rb +1 -1
  24. data/ext/nokogiri/xml_io.c +1 -1
  25. data/ext/nokogiri/xml_namespace.c +0 -6
  26. data/ext/nokogiri/xml_node.c +11 -11
  27. data/ext/nokogiri/xml_node_set.c +1 -1
  28. data/ext/nokogiri/xml_xpath_context.c +20 -16
  29. data/ext/nokogiri/xml_xpath_context.h +1 -0
  30. data/ext/nokogiri/xslt_stylesheet.c +7 -64
  31. data/lib/nokogiri/css/node.rb +3 -0
  32. data/lib/nokogiri/css/parser.rb +244 -203
  33. data/lib/nokogiri/css/parser.y +20 -2
  34. data/lib/nokogiri/css/xpath_visitor.rb +2 -2
  35. data/lib/nokogiri/html/document.rb +2 -1
  36. data/lib/nokogiri/html/element_description_defaults.rb +1 -1
  37. data/lib/nokogiri/nokogiri.jar +0 -0
  38. data/lib/nokogiri/version.rb +1 -1
  39. data/lib/nokogiri/xml/document.rb +1 -1
  40. data/lib/nokogiri/xml/parse_options.rb +2 -2
  41. data/lib/nokogiri/xml/sax/document.rb +1 -1
  42. data/lib/nokogiri/xml/sax/parser.rb +1 -1
  43. data/lib/nokogiri/xslt.rb +1 -1
  44. data/test/css/test_parser.rb +38 -0
  45. data/test/files/to_be_xincluded.xml +2 -0
  46. data/test/files/xinclude.xml +4 -0
  47. data/test/helper.rb +18 -45
  48. data/test/html/sax/test_parser.rb +5 -3
  49. data/test/html/sax/test_parser_context.rb +8 -10
  50. data/test/html/test_document.rb +19 -5
  51. data/test/html/test_node.rb +2 -4
  52. data/test/test_reader.rb +63 -0
  53. data/test/test_xslt_transforms.rb +3 -1
  54. data/test/xml/sax/test_parser_context.rb +10 -17
  55. data/test/xml/sax/test_push_parser.rb +1 -0
  56. data/test/xml/test_attr.rb +5 -6
  57. data/test/xml/test_builder.rb +5 -6
  58. data/test/xml/test_cdata.rb +1 -3
  59. data/test/xml/test_document.rb +11 -14
  60. data/test/xml/test_document_encoding.rb +3 -1
  61. data/test/xml/test_document_fragment.rb +27 -8
  62. data/test/xml/test_node.rb +21 -0
  63. data/test/xml/test_node_set.rb +2 -2
  64. data/test/xml/test_text.rb +1 -3
  65. data/test/xml/test_unparented_node.rb +2 -2
  66. data/test/xml/test_xpath.rb +15 -6
  67. data/test/xslt/test_custom_functions.rb +35 -0
  68. data/test_all +84 -0
  69. metadata +13 -8
  70. data/ext/java/nokogiri/internals/PushInputStream.java +0 -411
@@ -1,6 +1,8 @@
1
1
  module Nokogiri
2
2
  module CSS
3
3
  class Node
4
+ ALLOW_COMBINATOR_ON_SELF = [:DIRECT_ADJACENT_SELECTOR, :FOLLOWING_SELECTOR, :CHILD_SELECTOR]
5
+
4
6
  # Get the type of this node
5
7
  attr_accessor :type
6
8
  # Get the value of this node
@@ -21,6 +23,7 @@ module Nokogiri
21
23
  # Convert this CSS node to xpath with +prefix+ using +visitor+
22
24
  def to_xpath prefix = '//', visitor = XPathVisitor.new
23
25
  self.preprocess!
26
+ prefix = '.' if ALLOW_COMBINATOR_ON_SELF.include?(type) && value.first.nil?
24
27
  prefix + visitor.accept(self)
25
28
  end
26
29
 
@@ -14,168 +14,180 @@ module Nokogiri
14
14
  ##### State transition tables begin ###
15
15
 
16
16
  racc_action_table = [
17
- 5, 57, 28, 23, 13, 25, 61, 58, 5, 1,
18
- 6, 60, 13, 58, 66, 24, 17, 1, 83, 20,
19
- 94, 93, 6, 13, 9, 11, 14, 20, 17, 42,
20
- 6, 5, 9, 11, 14, 13, 17, 76, 42, 5,
21
- 1, 6, 65, 13, 11, 62, 63, 17, 1, 60,
22
- 20, 5, 63, 6, 84, 9, 11, 14, 20, 17,
23
- 1, 6, 30, 9, 11, 14, 13, 17, 13, 85,
24
- 20, 1, 64, 13, 59, 9, 88, 13, 13, 89,
25
- 28, 54, 13, 55, 6, 42, 6, 11, 14, 11,
26
- 17, 6, 17, 45, 11, 6, 6, 17, 11, 11,
27
- 6, 17, 17, 11, 5, 92, 17, 69, 71, 28,
28
- 54, 22, 55, 50, 28, 54, 95, 55, 70, 72,
29
- 73, -24, 75, 20, 69, 71, 67, 97, 9, 98,
30
- nil, nil, 34, 36, 38, 70, 72, 73, nil, 75,
31
- nil, nil, 33, 67, 35, 37, 28, 54, nil, 55 ]
17
+ 6, 62, 7, 63, 14, 19, 23, 26, 20, 2,
18
+ 71, 14, 6, 63, 85, 17, 14, 22, 25, 28,
19
+ 83, 2, 7, 72, 11, 13, 15, -26, 20, 7,
20
+ 49, 28, 13, 70, 7, 20, 11, 13, 15, 6,
21
+ 20, 64, 65, 14, 19, 23, 26, 64, 2, 36,
22
+ 59, 6, 60, 67, 17, 14, 22, 25, 28, 90,
23
+ 2, 7, 6, 11, 13, 15, 14, 20, 66, 67,
24
+ 28, 2, 91, 7, 14, 11, 13, 15, 14, 20,
25
+ 69, 28, 6, 2, 7, 68, 11, 13, 15, 14,
26
+ 20, 37, 7, 39, 94, 13, 7, 14, 20, 13,
27
+ 15, 28, 20, 6, 49, 14, 11, 7, 36, 59,
28
+ 13, 60, 53, 20, 14, 7, 36, 59, 13, 60,
29
+ 95, 20, 28, 7, 101, 100, 13, 11, 49, 20,
30
+ 74, 76, 7, 36, 31, 13, 33, 50, 20, 74,
31
+ 76, 75, 77, 79, 98, 80, 32, 99, 42, 73,
32
+ 75, 77, 79, 102, 80, 19, 23, 26, 73, 36,
33
+ 59, -26, 60, 104, 105, 17, nil, 22, 25 ]
32
34
 
33
35
  racc_action_check = [
34
- 0, 21, 5, 5, 0, 5, 23, 43, 9, 0,
35
- 15, 23, 9, 21, 28, 5, 15, 9, 43, 0,
36
- 74, 74, 0, 8, 0, 0, 0, 9, 0, 40,
37
- 9, 32, 9, 9, 9, 32, 9, 30, 8, 58,
38
- 32, 8, 27, 58, 8, 25, 25, 8, 58, 54,
39
- 32, 6, 55, 32, 56, 32, 32, 32, 58, 32,
40
- 6, 58, 6, 58, 58, 58, 42, 58, 80, 57,
41
- 6, 42, 26, 10, 22, 6, 61, 19, 18, 62,
42
- 60, 60, 16, 60, 42, 12, 80, 42, 42, 80,
43
- 42, 10, 80, 11, 10, 19, 18, 10, 19, 18,
44
- 16, 19, 18, 16, 17, 68, 16, 31, 31, 20,
45
- 20, 4, 20, 17, 63, 63, 77, 63, 31, 31,
46
- 31, 1, 31, 17, 29, 29, 31, 82, 17, 89,
47
- nil, nil, 7, 7, 7, 29, 29, 29, nil, 29,
48
- nil, nil, 7, 29, 7, 7, 66, 66, nil, 66 ]
36
+ 0, 29, 21, 45, 0, 0, 0, 0, 21, 0,
37
+ 38, 24, 63, 29, 45, 0, 63, 0, 0, 0,
38
+ 42, 63, 0, 39, 0, 0, 0, 37, 0, 24,
39
+ 47, 63, 24, 36, 63, 24, 63, 63, 63, 11,
40
+ 63, 59, 31, 11, 11, 11, 11, 31, 11, 70,
41
+ 70, 9, 70, 60, 11, 9, 11, 11, 11, 61,
42
+ 9, 11, 44, 11, 11, 11, 44, 11, 33, 33,
43
+ 9, 44, 62, 9, 87, 9, 9, 9, 49, 9,
44
+ 35, 44, 7, 49, 44, 34, 44, 44, 44, 12,
45
+ 44, 7, 87, 7, 65, 87, 49, 27, 87, 49,
46
+ 49, 7, 49, 20, 12, 18, 7, 12, 64, 64,
47
+ 12, 64, 20, 12, 1, 27, 28, 28, 27, 28,
48
+ 66, 27, 20, 18, 81, 81, 18, 20, 16, 18,
49
+ 41, 41, 1, 6, 6, 1, 6, 13, 1, 40,
50
+ 40, 41, 41, 41, 71, 41, 6, 78, 8, 41,
51
+ 40, 40, 40, 82, 40, 10, 10, 10, 40, 67,
52
+ 67, 2, 67, 89, 95, 10, nil, 10, 10 ]
49
53
 
50
54
  racc_action_pointer = [
51
- -2, 92, nil, nil, 82, -8, 49, 125, 17, 6,
52
- 67, 82, 64, nil, nil, -14, 76, 102, 72, 71,
53
- 99, 1, 63, -1, nil, 34, 49, 19, 2, 121,
54
- 12, 104, 29, nil, nil, nil, nil, nil, nil, nil,
55
- 8, nil, 60, -5, nil, nil, nil, nil, nil, nil,
56
- nil, nil, nil, nil, 37, 40, 31, 69, 37, nil,
57
- 70, 63, 72, 104, nil, nil, 136, nil, 80, nil,
58
- nil, nil, nil, nil, 10, nil, nil, 91, nil, nil,
59
- 62, nil, 104, nil, nil, nil, nil, nil, nil, 116,
60
- nil, nil, nil, nil, nil, nil, nil, nil, nil ]
55
+ -2, 108, 132, nil, nil, nil, 123, 80, 119, 49,
56
+ 148, 37, 83, 126, nil, nil, 107, nil, 99, nil,
57
+ 101, -22, nil, nil, 5, nil, nil, 91, 106, 1,
58
+ nil, 35, nil, 57, 62, 57, 21, -2, -19, -2,
59
+ 136, 127, 9, nil, 60, -9, nil, 9, nil, 72,
60
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, 29,
61
+ 41, 36, 72, 10, 98, 81, 113, 149, nil, nil,
62
+ 39, 133, nil, nil, nil, nil, nil, nil, 122, nil,
63
+ nil, 114, 128, nil, nil, nil, nil, 68, nil, 140,
64
+ nil, nil, nil, nil, nil, 151, nil, nil, nil, nil,
65
+ nil, nil, nil, nil, nil, nil ]
61
66
 
62
67
  racc_action_default = [
63
- -25, -23, -20, -2, -70, -70, -25, -18, -46, -25,
64
- -51, -70, -16, -55, -21, -12, -54, -70, -53, -52,
65
- -70, -70, -70, -39, -29, -37, -70, -70, -38, -58,
66
- -70, -58, -25, -5, -3, -8, -4, -7, -6, -9,
67
- -45, -11, -25, -70, -47, -19, -15, -13, -14, -50,
68
- -44, -43, -49, -48, -39, -37, -70, -70, -25, -22,
69
- -70, -70, -42, -70, -30, -31, -70, -59, -70, -64,
70
- -60, -65, -61, -62, -70, -63, -28, -70, -17, -10,
71
- -67, -69, -70, -33, -32, 99, -1, -36, -41, -70,
72
- -34, -35, -26, -56, -57, -27, -68, -66, -40 ]
68
+ -27, -56, -25, -3, -22, -2, -74, -27, -74, -27,
69
+ -20, -27, -50, -74, -59, -23, -17, -6, -55, -4,
70
+ -74, -13, -9, -5, -58, -8, -7, -57, -74, -74,
71
+ -52, -43, -33, -41, -74, -74, -42, -32, -74, -74,
72
+ -62, -62, -74, -18, -27, -74, -10, -49, -12, -27,
73
+ -21, -16, -51, -48, -47, -14, -15, -54, -53, -43,
74
+ -41, -74, -74, -27, -74, -74, -46, -74, -34, -35,
75
+ -74, -74, -30, -63, -68, -64, -69, -65, -74, -66,
76
+ -67, -74, -74, -24, -19, -37, -11, -71, -73, -74,
77
+ -36, 106, -1, -40, -45, -74, -38, -39, -31, -28,
78
+ -60, -61, -29, -72, -70, -44 ]
73
79
 
74
80
  racc_goto_table = [
75
- 40, 26, 44, 41, 78, 21, 31, 46, 49, 29,
76
- 52, 53, 47, 68, 43, 77, 56, 51, 48, 39,
77
- 80, 32, 27, 82, nil, nil, nil, nil, nil, nil,
78
- 86, nil, nil, nil, 81, 79, nil, nil, nil, nil,
81
+ 30, 43, 34, 48, 29, 41, 55, 51, 78, 82,
82
+ 46, 47, 56, 38, 40, 45, 87, 52, 54, 44,
83
+ 35, 89, nil, 57, 61, nil, 58, nil, nil, nil,
84
+ nil, nil, nil, nil, nil, nil, 84, nil, 86, nil,
85
+ nil, nil, nil, nil, nil, nil, nil, nil, 88, nil,
86
+ nil, nil, nil, nil, nil, 92, nil, nil, nil, nil,
87
+ 93, nil, nil, 96, nil, nil, 97, nil, nil, nil,
79
88
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
80
- nil, nil, nil, nil, nil, nil, 87, nil, nil, 90,
81
- nil, nil, 91, nil, nil, nil, nil, nil, nil, nil,
82
- nil, nil, 96 ]
89
+ nil, nil, nil, nil, nil, nil, 103 ]
83
90
 
84
91
  racc_goto_check = [
85
- 7, 16, 7, 8, 2, 1, 9, 8, 7, 13,
86
- 7, 7, 10, 15, 1, 15, 16, 9, 11, 6,
87
- 5, 3, 17, 20, nil, nil, nil, nil, nil, nil,
88
- 2, nil, nil, nil, 7, 8, nil, nil, nil, nil,
92
+ 8, 2, 18, 9, 1, 10, 11, 9, 17, 17,
93
+ 7, 8, 12, 15, 16, 1, 6, 8, 10, 4,
94
+ 19, 22, nil, 8, 18, nil, 8, nil, nil, nil,
95
+ nil, nil, nil, nil, nil, nil, 2, nil, 9, nil,
96
+ nil, nil, nil, nil, nil, nil, nil, nil, 8, nil,
97
+ nil, nil, nil, nil, nil, 2, nil, nil, nil, nil,
98
+ 18, nil, nil, 18, nil, nil, 18, nil, nil, nil,
89
99
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
90
- nil, nil, nil, nil, nil, nil, 16, nil, nil, 16,
91
- nil, nil, 16, nil, nil, nil, nil, nil, nil, nil,
92
- nil, nil, 7 ]
100
+ nil, nil, nil, nil, nil, nil, 8 ]
93
101
 
94
102
  racc_goto_pointer = [
95
- nil, 5, -28, 14, nil, -22, 11, -8, -5, 0,
96
- -3, 3, nil, 3, nil, -16, -4, 17, nil, nil,
97
- -19 ]
103
+ nil, 4, -8, nil, 9, nil, -33, -2, -1, -9,
104
+ -2, -15, -9, nil, nil, 6, 7, -32, -4, 14,
105
+ nil, nil, -28 ]
98
106
 
99
107
  racc_goto_default = [
100
- nil, nil, 3, nil, 7, 8, nil, 12, nil, 15,
101
- 16, 18, 19, 2, 4, nil, nil, nil, 10, 74,
102
- nil ]
108
+ nil, nil, 3, 5, 9, 10, 12, nil, 16, nil,
109
+ 21, 24, 27, 1, 4, 8, nil, nil, nil, nil,
110
+ 18, 81, nil ]
103
111
 
104
112
  racc_reduce_table = [
105
113
  0, 0, :racc_error,
106
114
  3, 32, :_reduce_1,
107
115
  1, 32, :_reduce_2,
108
- 1, 34, :_reduce_3,
109
- 1, 34, :_reduce_4,
110
- 1, 34, :_reduce_5,
111
- 1, 34, :_reduce_6,
112
- 1, 34, :_reduce_7,
113
- 1, 34, :_reduce_8,
114
- 2, 35, :_reduce_9,
115
- 3, 35, :_reduce_10,
116
- 2, 35, :_reduce_11,
117
- 1, 35, :_reduce_none,
118
- 2, 35, :_reduce_13,
119
- 2, 35, :_reduce_14,
120
- 2, 35, :_reduce_15,
121
- 1, 35, :_reduce_16,
122
- 3, 33, :_reduce_17,
123
- 1, 33, :_reduce_none,
124
- 2, 43, :_reduce_19,
116
+ 1, 32, :_reduce_3,
117
+ 1, 35, :_reduce_4,
118
+ 1, 35, :_reduce_5,
119
+ 1, 35, :_reduce_6,
120
+ 1, 35, :_reduce_7,
121
+ 1, 35, :_reduce_8,
122
+ 1, 35, :_reduce_9,
123
+ 2, 36, :_reduce_10,
124
+ 3, 36, :_reduce_11,
125
+ 2, 36, :_reduce_12,
125
126
  1, 36, :_reduce_none,
126
- 1, 36, :_reduce_21,
127
- 3, 44, :_reduce_22,
128
- 1, 44, :_reduce_23,
129
- 1, 45, :_reduce_24,
130
- 0, 45, :_reduce_none,
131
- 4, 42, :_reduce_26,
132
- 4, 42, :_reduce_27,
133
- 3, 42, :_reduce_28,
134
- 2, 40, :_reduce_29,
135
- 3, 40, :_reduce_30,
136
- 3, 40, :_reduce_31,
137
- 3, 40, :_reduce_32,
138
- 3, 40, :_reduce_33,
139
- 3, 47, :_reduce_34,
140
- 3, 47, :_reduce_35,
141
- 3, 47, :_reduce_36,
142
- 1, 47, :_reduce_none,
143
- 1, 47, :_reduce_none,
144
- 1, 47, :_reduce_39,
145
- 4, 48, :_reduce_40,
146
- 3, 48, :_reduce_41,
147
- 2, 48, :_reduce_42,
148
- 2, 41, :_reduce_43,
149
- 2, 41, :_reduce_44,
127
+ 2, 36, :_reduce_14,
128
+ 2, 36, :_reduce_15,
129
+ 2, 36, :_reduce_16,
130
+ 1, 36, :_reduce_17,
131
+ 2, 34, :_reduce_18,
132
+ 3, 33, :_reduce_19,
133
+ 1, 33, :_reduce_none,
134
+ 2, 44, :_reduce_21,
150
135
  1, 37, :_reduce_none,
151
- 0, 37, :_reduce_none,
152
- 2, 38, :_reduce_47,
153
- 2, 38, :_reduce_48,
154
- 2, 38, :_reduce_49,
155
- 2, 38, :_reduce_50,
156
- 1, 38, :_reduce_none,
157
- 1, 38, :_reduce_none,
158
- 1, 38, :_reduce_none,
159
- 1, 38, :_reduce_none,
160
- 1, 49, :_reduce_55,
161
- 2, 46, :_reduce_56,
162
- 2, 46, :_reduce_57,
136
+ 1, 37, :_reduce_23,
137
+ 3, 45, :_reduce_24,
138
+ 1, 45, :_reduce_25,
139
+ 1, 46, :_reduce_26,
163
140
  0, 46, :_reduce_none,
164
- 1, 50, :_reduce_59,
165
- 1, 50, :_reduce_60,
166
- 1, 50, :_reduce_61,
167
- 1, 50, :_reduce_62,
168
- 1, 50, :_reduce_63,
169
- 1, 50, :_reduce_64,
170
- 1, 50, :_reduce_65,
171
- 3, 39, :_reduce_66,
172
- 1, 51, :_reduce_none,
173
- 2, 51, :_reduce_none,
174
- 1, 51, :_reduce_none ]
175
-
176
- racc_reduce_n = 70
177
-
178
- racc_shift_n = 99
141
+ 4, 43, :_reduce_28,
142
+ 4, 43, :_reduce_29,
143
+ 3, 43, :_reduce_30,
144
+ 3, 47, :_reduce_31,
145
+ 1, 47, :_reduce_32,
146
+ 2, 41, :_reduce_33,
147
+ 3, 41, :_reduce_34,
148
+ 3, 41, :_reduce_35,
149
+ 3, 41, :_reduce_36,
150
+ 3, 41, :_reduce_37,
151
+ 3, 49, :_reduce_38,
152
+ 3, 49, :_reduce_39,
153
+ 3, 49, :_reduce_40,
154
+ 1, 49, :_reduce_none,
155
+ 1, 49, :_reduce_none,
156
+ 1, 49, :_reduce_43,
157
+ 4, 50, :_reduce_44,
158
+ 3, 50, :_reduce_45,
159
+ 2, 50, :_reduce_46,
160
+ 2, 42, :_reduce_47,
161
+ 2, 42, :_reduce_48,
162
+ 1, 38, :_reduce_none,
163
+ 0, 38, :_reduce_none,
164
+ 2, 39, :_reduce_51,
165
+ 2, 39, :_reduce_52,
166
+ 2, 39, :_reduce_53,
167
+ 2, 39, :_reduce_54,
168
+ 1, 39, :_reduce_none,
169
+ 1, 39, :_reduce_none,
170
+ 1, 39, :_reduce_none,
171
+ 1, 39, :_reduce_none,
172
+ 1, 51, :_reduce_59,
173
+ 2, 48, :_reduce_60,
174
+ 2, 48, :_reduce_61,
175
+ 0, 48, :_reduce_none,
176
+ 1, 52, :_reduce_63,
177
+ 1, 52, :_reduce_64,
178
+ 1, 52, :_reduce_65,
179
+ 1, 52, :_reduce_66,
180
+ 1, 52, :_reduce_67,
181
+ 1, 52, :_reduce_68,
182
+ 1, 52, :_reduce_69,
183
+ 3, 40, :_reduce_70,
184
+ 1, 53, :_reduce_none,
185
+ 2, 53, :_reduce_none,
186
+ 1, 53, :_reduce_none ]
187
+
188
+ racc_reduce_n = 74
189
+
190
+ racc_shift_n = 106
179
191
 
180
192
  racc_token_table = {
181
193
  false => 0,
@@ -265,6 +277,7 @@ Racc_token_to_s_table = [
265
277
  "$start",
266
278
  "selector",
267
279
  "simple_selector_1toN",
280
+ "prefixless_combinator_selector",
268
281
  "combinator",
269
282
  "simple_selector",
270
283
  "element_name",
@@ -277,6 +290,7 @@ Racc_token_to_s_table = [
277
290
  "class",
278
291
  "namespaced_ident",
279
292
  "namespace",
293
+ "attrib_name",
280
294
  "attrib_val_0or1",
281
295
  "expr",
282
296
  "an_plus_b",
@@ -302,22 +316,22 @@ def _reduce_2(val, _values, result)
302
316
  end
303
317
 
304
318
  def _reduce_3(val, _values, result)
305
- result = :DIRECT_ADJACENT_SELECTOR
319
+ result = val.flatten
306
320
  result
307
321
  end
308
322
 
309
323
  def _reduce_4(val, _values, result)
310
- result = :CHILD_SELECTOR
324
+ result = :DIRECT_ADJACENT_SELECTOR
311
325
  result
312
326
  end
313
327
 
314
328
  def _reduce_5(val, _values, result)
315
- result = :PRECEDING_SELECTOR
329
+ result = :CHILD_SELECTOR
316
330
  result
317
331
  end
318
332
 
319
333
  def _reduce_6(val, _values, result)
320
- result = :DESCENDANT_SELECTOR
334
+ result = :FOLLOWING_SELECTOR
321
335
  result
322
336
  end
323
337
 
@@ -327,11 +341,16 @@ def _reduce_7(val, _values, result)
327
341
  end
328
342
 
329
343
  def _reduce_8(val, _values, result)
330
- result = :CHILD_SELECTOR
344
+ result = :DESCENDANT_SELECTOR
331
345
  result
332
346
  end
333
347
 
334
348
  def _reduce_9(val, _values, result)
349
+ result = :CHILD_SELECTOR
350
+ result
351
+ end
352
+
353
+ def _reduce_10(val, _values, result)
335
354
  result = if val[1].nil?
336
355
  val.first
337
356
  else
@@ -341,7 +360,7 @@ def _reduce_9(val, _values, result)
341
360
  result
342
361
  end
343
362
 
344
- def _reduce_10(val, _values, result)
363
+ def _reduce_11(val, _values, result)
345
364
  result = Node.new(:CONDITIONAL_SELECTOR,
346
365
  [
347
366
  val.first,
@@ -352,27 +371,27 @@ def _reduce_10(val, _values, result)
352
371
  result
353
372
  end
354
373
 
355
- def _reduce_11(val, _values, result)
374
+ def _reduce_12(val, _values, result)
356
375
  result = Node.new(:CONDITIONAL_SELECTOR, val)
357
376
 
358
377
  result
359
378
  end
360
379
 
361
- # reduce 12 omitted
380
+ # reduce 13 omitted
362
381
 
363
- def _reduce_13(val, _values, result)
382
+ def _reduce_14(val, _values, result)
364
383
  result = Node.new(:CONDITIONAL_SELECTOR, val)
365
384
 
366
385
  result
367
386
  end
368
387
 
369
- def _reduce_14(val, _values, result)
388
+ def _reduce_15(val, _values, result)
370
389
  result = Node.new(:CONDITIONAL_SELECTOR, val)
371
390
 
372
391
  result
373
392
  end
374
393
 
375
- def _reduce_15(val, _values, result)
394
+ def _reduce_16(val, _values, result)
376
395
  result = Node.new(:CONDITIONAL_SELECTOR,
377
396
  [
378
397
  Node.new(:ELEMENT_NAME, ['*']),
@@ -383,7 +402,7 @@ def _reduce_15(val, _values, result)
383
402
  result
384
403
  end
385
404
 
386
- def _reduce_16(val, _values, result)
405
+ def _reduce_17(val, _values, result)
387
406
  result = Node.new(:CONDITIONAL_SELECTOR,
388
407
  [Node.new(:ELEMENT_NAME, ['*']), val.first]
389
408
  )
@@ -391,27 +410,33 @@ def _reduce_16(val, _values, result)
391
410
  result
392
411
  end
393
412
 
394
- def _reduce_17(val, _values, result)
395
- result = Node.new(val[1], [val.first, val.last])
413
+ def _reduce_18(val, _values, result)
414
+ result = Node.new(val.first, [nil, val.last])
396
415
 
397
416
  result
398
417
  end
399
418
 
400
- # reduce 18 omitted
401
-
402
419
  def _reduce_19(val, _values, result)
403
- result = Node.new(:CLASS_CONDITION, [val[1]])
420
+ result = Node.new(val[1], [val.first, val.last])
421
+
404
422
  result
405
423
  end
406
424
 
407
425
  # reduce 20 omitted
408
426
 
409
427
  def _reduce_21(val, _values, result)
428
+ result = Node.new(:CLASS_CONDITION, [val[1]])
429
+ result
430
+ end
431
+
432
+ # reduce 22 omitted
433
+
434
+ def _reduce_23(val, _values, result)
410
435
  result = Node.new(:ELEMENT_NAME, val)
411
436
  result
412
437
  end
413
438
 
414
- def _reduce_22(val, _values, result)
439
+ def _reduce_24(val, _values, result)
415
440
  result = Node.new(:ELEMENT_NAME,
416
441
  [[val.first, val.last].compact.join(':')]
417
442
  )
@@ -419,21 +444,21 @@ def _reduce_22(val, _values, result)
419
444
  result
420
445
  end
421
446
 
422
- def _reduce_23(val, _values, result)
447
+ def _reduce_25(val, _values, result)
423
448
  name = @namespaces.key?('xmlns') ? "xmlns:#{val.first}" : val.first
424
449
  result = Node.new(:ELEMENT_NAME, [name])
425
450
 
426
451
  result
427
452
  end
428
453
 
429
- def _reduce_24(val, _values, result)
454
+ def _reduce_26(val, _values, result)
430
455
  result = val[0]
431
456
  result
432
457
  end
433
458
 
434
- # reduce 25 omitted
459
+ # reduce 27 omitted
435
460
 
436
- def _reduce_26(val, _values, result)
461
+ def _reduce_28(val, _values, result)
437
462
  result = Node.new(:ATTRIBUTE_CONDITION,
438
463
  [val[1]] + (val[2] || [])
439
464
  )
@@ -441,7 +466,7 @@ def _reduce_26(val, _values, result)
441
466
  result
442
467
  end
443
468
 
444
- def _reduce_27(val, _values, result)
469
+ def _reduce_29(val, _values, result)
445
470
  result = Node.new(:ATTRIBUTE_CONDITION,
446
471
  [val[1]] + (val[2] || [])
447
472
  )
@@ -449,7 +474,7 @@ def _reduce_27(val, _values, result)
449
474
  result
450
475
  end
451
476
 
452
- def _reduce_28(val, _values, result)
477
+ def _reduce_30(val, _values, result)
453
478
  # Non standard, but hpricot supports it.
454
479
  result = Node.new(:PSEUDO_CLASS,
455
480
  [Node.new(:FUNCTION, ['nth-child(', val[1]])]
@@ -458,56 +483,72 @@ def _reduce_28(val, _values, result)
458
483
  result
459
484
  end
460
485
 
461
- def _reduce_29(val, _values, result)
486
+ def _reduce_31(val, _values, result)
487
+ result = Node.new(:ELEMENT_NAME,
488
+ [[val.first, val.last].compact.join(':')]
489
+ )
490
+
491
+ result
492
+ end
493
+
494
+ def _reduce_32(val, _values, result)
495
+ # Default namespace is not applied to attributes.
496
+ # So we don't add prefix "xmlns:" as in namespaced_ident.
497
+ result = Node.new(:ELEMENT_NAME, [val.first])
498
+
499
+ result
500
+ end
501
+
502
+ def _reduce_33(val, _values, result)
462
503
  result = Node.new(:FUNCTION, [val.first.strip])
463
504
 
464
505
  result
465
506
  end
466
507
 
467
- def _reduce_30(val, _values, result)
508
+ def _reduce_34(val, _values, result)
468
509
  result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
469
510
 
470
511
  result
471
512
  end
472
513
 
473
- def _reduce_31(val, _values, result)
514
+ def _reduce_35(val, _values, result)
474
515
  result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
475
516
 
476
517
  result
477
518
  end
478
519
 
479
- def _reduce_32(val, _values, result)
520
+ def _reduce_36(val, _values, result)
480
521
  result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
481
522
 
482
523
  result
483
524
  end
484
525
 
485
- def _reduce_33(val, _values, result)
526
+ def _reduce_37(val, _values, result)
486
527
  result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
487
528
 
488
529
  result
489
530
  end
490
531
 
491
- def _reduce_34(val, _values, result)
532
+ def _reduce_38(val, _values, result)
492
533
  result = [val.first, val.last]
493
534
  result
494
535
  end
495
536
 
496
- def _reduce_35(val, _values, result)
537
+ def _reduce_39(val, _values, result)
497
538
  result = [val.first, val.last]
498
539
  result
499
540
  end
500
541
 
501
- def _reduce_36(val, _values, result)
542
+ def _reduce_40(val, _values, result)
502
543
  result = [val.first, val.last]
503
544
  result
504
545
  end
505
546
 
506
- # reduce 37 omitted
547
+ # reduce 41 omitted
507
548
 
508
- # reduce 38 omitted
549
+ # reduce 42 omitted
509
550
 
510
- def _reduce_39(val, _values, result)
551
+ def _reduce_43(val, _values, result)
511
552
  if val[0] == 'even'
512
553
  val = ["2","n","+","0"]
513
554
  result = Node.new(:AN_PLUS_B, val)
@@ -525,7 +566,7 @@ def _reduce_39(val, _values, result)
525
566
  result
526
567
  end
527
568
 
528
- def _reduce_40(val, _values, result)
569
+ def _reduce_44(val, _values, result)
529
570
  if val[1] == 'n'
530
571
  result = Node.new(:AN_PLUS_B, val)
531
572
  else
@@ -535,7 +576,7 @@ def _reduce_40(val, _values, result)
535
576
  result
536
577
  end
537
578
 
538
- def _reduce_41(val, _values, result)
579
+ def _reduce_45(val, _values, result)
539
580
  # n+3, -n+3
540
581
  if val[0] == 'n'
541
582
  val.unshift("1")
@@ -551,7 +592,7 @@ def _reduce_41(val, _values, result)
551
592
  result
552
593
  end
553
594
 
554
- def _reduce_42(val, _values, result)
595
+ def _reduce_46(val, _values, result)
555
596
  if val[1] == 'n'
556
597
  val << "+"
557
598
  val << "0"
@@ -563,116 +604,116 @@ def _reduce_42(val, _values, result)
563
604
  result
564
605
  end
565
606
 
566
- def _reduce_43(val, _values, result)
607
+ def _reduce_47(val, _values, result)
567
608
  result = Node.new(:PSEUDO_CLASS, [val[1]])
568
609
 
569
610
  result
570
611
  end
571
612
 
572
- def _reduce_44(val, _values, result)
613
+ def _reduce_48(val, _values, result)
573
614
  result = Node.new(:PSEUDO_CLASS, [val[1]])
574
615
  result
575
616
  end
576
617
 
577
- # reduce 45 omitted
618
+ # reduce 49 omitted
578
619
 
579
- # reduce 46 omitted
620
+ # reduce 50 omitted
580
621
 
581
- def _reduce_47(val, _values, result)
622
+ def _reduce_51(val, _values, result)
582
623
  result = Node.new(:COMBINATOR, val)
583
624
 
584
625
  result
585
626
  end
586
627
 
587
- def _reduce_48(val, _values, result)
628
+ def _reduce_52(val, _values, result)
588
629
  result = Node.new(:COMBINATOR, val)
589
630
 
590
631
  result
591
632
  end
592
633
 
593
- def _reduce_49(val, _values, result)
634
+ def _reduce_53(val, _values, result)
594
635
  result = Node.new(:COMBINATOR, val)
595
636
 
596
637
  result
597
638
  end
598
639
 
599
- def _reduce_50(val, _values, result)
640
+ def _reduce_54(val, _values, result)
600
641
  result = Node.new(:COMBINATOR, val)
601
642
 
602
643
  result
603
644
  end
604
645
 
605
- # reduce 51 omitted
646
+ # reduce 55 omitted
606
647
 
607
- # reduce 52 omitted
648
+ # reduce 56 omitted
608
649
 
609
- # reduce 53 omitted
650
+ # reduce 57 omitted
610
651
 
611
- # reduce 54 omitted
652
+ # reduce 58 omitted
612
653
 
613
- def _reduce_55(val, _values, result)
654
+ def _reduce_59(val, _values, result)
614
655
  result = Node.new(:ID, val)
615
656
  result
616
657
  end
617
658
 
618
- def _reduce_56(val, _values, result)
659
+ def _reduce_60(val, _values, result)
619
660
  result = [val.first, val[1]]
620
661
  result
621
662
  end
622
663
 
623
- def _reduce_57(val, _values, result)
664
+ def _reduce_61(val, _values, result)
624
665
  result = [val.first, val[1]]
625
666
  result
626
667
  end
627
668
 
628
- # reduce 58 omitted
669
+ # reduce 62 omitted
629
670
 
630
- def _reduce_59(val, _values, result)
671
+ def _reduce_63(val, _values, result)
631
672
  result = :equal
632
673
  result
633
674
  end
634
675
 
635
- def _reduce_60(val, _values, result)
676
+ def _reduce_64(val, _values, result)
636
677
  result = :prefix_match
637
678
  result
638
679
  end
639
680
 
640
- def _reduce_61(val, _values, result)
681
+ def _reduce_65(val, _values, result)
641
682
  result = :suffix_match
642
683
  result
643
684
  end
644
685
 
645
- def _reduce_62(val, _values, result)
686
+ def _reduce_66(val, _values, result)
646
687
  result = :substring_match
647
688
  result
648
689
  end
649
690
 
650
- def _reduce_63(val, _values, result)
691
+ def _reduce_67(val, _values, result)
651
692
  result = :not_equal
652
693
  result
653
694
  end
654
695
 
655
- def _reduce_64(val, _values, result)
696
+ def _reduce_68(val, _values, result)
656
697
  result = :includes
657
698
  result
658
699
  end
659
700
 
660
- def _reduce_65(val, _values, result)
701
+ def _reduce_69(val, _values, result)
661
702
  result = :dash_match
662
703
  result
663
704
  end
664
705
 
665
- def _reduce_66(val, _values, result)
706
+ def _reduce_70(val, _values, result)
666
707
  result = Node.new(:NOT, [val[1]])
667
708
 
668
709
  result
669
710
  end
670
711
 
671
- # reduce 67 omitted
712
+ # reduce 71 omitted
672
713
 
673
- # reduce 68 omitted
714
+ # reduce 72 omitted
674
715
 
675
- # reduce 69 omitted
716
+ # reduce 73 omitted
676
717
 
677
718
  def _reduce_none(val, _values, result)
678
719
  val[0]