nokogiri 1.0.6 → 1.0.7

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 (44) hide show
  1. data/History.ja.txt +11 -0
  2. data/History.txt +11 -0
  3. data/Manifest.txt +7 -0
  4. data/README.txt +7 -0
  5. data/Rakefile +43 -2
  6. data/ext/nokogiri/native.c +1 -0
  7. data/ext/nokogiri/native.h +1 -2
  8. data/ext/nokogiri/xml_cdata.c +3 -1
  9. data/ext/nokogiri/xml_comment.c +42 -0
  10. data/ext/nokogiri/xml_comment.h +9 -0
  11. data/ext/nokogiri/xml_document.c +1 -0
  12. data/ext/nokogiri/xml_node.c +21 -7
  13. data/ext/nokogiri/xml_sax_parser.c +26 -0
  14. data/ext/nokogiri/xml_syntax_error.c +4 -0
  15. data/ext/nokogiri/xml_text.c +16 -1
  16. data/ext/nokogiri/xml_xpath_context.c +4 -0
  17. data/ext/nokogiri/xslt_stylesheet.c +1 -1
  18. data/lib/action-nokogiri.rb +30 -0
  19. data/lib/nokogiri.rb +25 -4
  20. data/lib/nokogiri/css.rb +9 -4
  21. data/lib/nokogiri/css/generated_parser.rb +199 -171
  22. data/lib/nokogiri/css/parser.rb +11 -0
  23. data/lib/nokogiri/css/parser.y +16 -0
  24. data/lib/nokogiri/decorators.rb +1 -0
  25. data/lib/nokogiri/decorators/slop.rb +31 -0
  26. data/lib/nokogiri/hpricot.rb +2 -4
  27. data/lib/nokogiri/version.rb +1 -1
  28. data/lib/nokogiri/xml.rb +15 -0
  29. data/lib/nokogiri/xml/builder.rb +1 -1
  30. data/lib/nokogiri/xml/comment.rb +6 -0
  31. data/lib/nokogiri/xml/document.rb +22 -8
  32. data/lib/nokogiri/xml/sax/parser.rb +7 -3
  33. data/test/css/test_parser.rb +9 -0
  34. data/test/helper.rb +4 -1
  35. data/test/hpricot/load_files.rb +8 -4
  36. data/test/test_css_cache.rb +17 -10
  37. data/test/test_memory_leak.rb +38 -0
  38. data/test/test_nokogiri.rb +61 -0
  39. data/test/xml/sax/test_parser.rb +2 -0
  40. data/test/xml/test_comment.rb +16 -0
  41. data/test/xml/test_document.rb +2 -4
  42. data/test/xml/test_node.rb +13 -0
  43. data/vendor/hoe.rb +8 -22
  44. metadata +12 -3
@@ -8,9 +8,9 @@ require 'nokogiri/html/builder'
8
8
  require 'nokogiri/hpricot'
9
9
 
10
10
  # Modify the PATH on windows so that the external DLLs will get loaded.
11
- ENV['PATH'] = [ENV['PATH'], File.expand_path(
11
+ ENV['PATH'] = [File.expand_path(
12
12
  File.join(File.dirname(__FILE__), "..", "ext", "nokogiri")
13
- )].compact.join(';') if RUBY_PLATFORM =~ /mswin/i
13
+ ), ENV['PATH']].compact.join(';') if RUBY_PLATFORM =~ /mswin/i
14
14
 
15
15
  require 'nokogiri/native' unless RUBY_PLATFORM =~ /java/
16
16
 
@@ -18,6 +18,8 @@ module Nokogiri
18
18
  class << self
19
19
  attr_accessor :error_handler
20
20
 
21
+ ###
22
+ # Parse an HTML or XML document. +string+ contains the document.
21
23
  def parse string, url = nil, encoding = nil, options = nil
22
24
  doc =
23
25
  if string =~ /^\s*<[^Hh>]*html/i # Probably html
@@ -36,9 +38,28 @@ module Nokogiri
36
38
  Nokogiri(&blk)
37
39
  end
38
40
  end
41
+
42
+ ###
43
+ # Parse a document and add the Slop decorator. The Slop decorator
44
+ # implements method_missing such that methods may be used instead of CSS
45
+ # or XPath. For example:
46
+ #
47
+ # doc = Nokogiri::Slop(<<-eohtml)
48
+ # <html>
49
+ # <body>
50
+ # <p>first</p>
51
+ # <p>second</p>
52
+ # </body>
53
+ # </html>
54
+ # eohtml
55
+ # assert_equal('second', doc.html.body.p[1].text)
56
+ #
57
+ def Slop(*args, &block)
58
+ Nokogiri(*args, &block).slop!
59
+ end
39
60
  end
40
61
 
41
- self.error_handler = lambda { |syntax_error| }
62
+ self.error_handler = lambda { |syntax_error| }
42
63
  end
43
64
 
44
65
  def Nokogiri(*args, &block)
@@ -46,6 +67,6 @@ def Nokogiri(*args, &block)
46
67
  builder = Nokogiri::HTML::Builder.new(&block)
47
68
  return builder.doc
48
69
  else
49
- Nokogiri::HTML.parse(*args)
70
+ Nokogiri.parse(*args)
50
71
  end
51
72
  end
@@ -9,11 +9,16 @@ require 'nokogiri/css/syntax_error'
9
9
  module Nokogiri
10
10
  module CSS
11
11
  class << self
12
- def parse string
13
- Parser.new.parse string
12
+ ###
13
+ # Parse this CSS selector in +selector+. Returns an AST.
14
+ def parse selector
15
+ Parser.new.parse selector
14
16
  end
15
- def xpath_for string, options={}
16
- Parser.new.xpath_for string, options
17
+
18
+ ###
19
+ # Get the XPath for +selector+.
20
+ def xpath_for selector, options={}
21
+ Parser.new.xpath_for selector, options
17
22
  end
18
23
  end
19
24
  end
@@ -26,43 +26,45 @@ racc_reduce_table = [
26
26
  2, 49, :_reduce_7,
27
27
  2, 49, :_reduce_8,
28
28
  2, 50, :_reduce_9,
29
- 2, 50, :_reduce_10,
29
+ 3, 50, :_reduce_10,
30
+ 2, 50, :_reduce_11,
30
31
  1, 50, :_reduce_none,
31
- 2, 50, :_reduce_12,
32
- 1, 50, :_reduce_13,
33
- 3, 48, :_reduce_14,
32
+ 2, 50, :_reduce_13,
33
+ 2, 50, :_reduce_14,
34
+ 1, 50, :_reduce_15,
35
+ 3, 48, :_reduce_16,
34
36
  1, 48, :_reduce_none,
35
- 2, 57, :_reduce_16,
36
- 1, 51, :_reduce_17,
37
- 1, 51, :_reduce_18,
38
- 6, 55, :_reduce_19,
39
- 6, 55, :_reduce_20,
40
- 5, 55, :_reduce_21,
41
- 2, 54, :_reduce_22,
42
- 3, 54, :_reduce_23,
43
- 3, 54, :_reduce_24,
44
- 3, 54, :_reduce_25,
37
+ 2, 57, :_reduce_18,
38
+ 1, 51, :_reduce_19,
39
+ 1, 51, :_reduce_20,
40
+ 6, 56, :_reduce_21,
41
+ 6, 56, :_reduce_22,
42
+ 5, 56, :_reduce_23,
43
+ 2, 55, :_reduce_24,
44
+ 3, 55, :_reduce_25,
45
+ 3, 55, :_reduce_26,
46
+ 3, 55, :_reduce_27,
45
47
  1, 59, :_reduce_none,
46
48
  1, 59, :_reduce_none,
47
- 4, 60, :_reduce_28,
48
- 3, 60, :_reduce_29,
49
- 2, 60, :_reduce_30,
50
- 1, 60, :_reduce_31,
51
- 2, 61, :_reduce_32,
52
- 2, 61, :_reduce_33,
49
+ 4, 60, :_reduce_30,
50
+ 3, 60, :_reduce_31,
51
+ 2, 60, :_reduce_32,
52
+ 1, 60, :_reduce_33,
53
+ 2, 61, :_reduce_34,
54
+ 2, 61, :_reduce_35,
53
55
  1, 52, :_reduce_none,
54
56
  0, 52, :_reduce_none,
55
- 2, 56, :_reduce_36,
56
- 2, 56, :_reduce_37,
57
- 2, 56, :_reduce_38,
58
- 2, 56, :_reduce_39,
59
- 1, 56, :_reduce_none,
60
- 1, 56, :_reduce_none,
61
- 1, 56, :_reduce_none,
62
- 1, 56, :_reduce_none,
63
- 1, 62, :_reduce_44,
64
- 4, 58, :_reduce_45,
65
- 4, 58, :_reduce_46,
57
+ 2, 53, :_reduce_38,
58
+ 2, 53, :_reduce_39,
59
+ 2, 53, :_reduce_40,
60
+ 2, 53, :_reduce_41,
61
+ 1, 53, :_reduce_none,
62
+ 1, 53, :_reduce_none,
63
+ 1, 53, :_reduce_none,
64
+ 1, 53, :_reduce_none,
65
+ 1, 62, :_reduce_46,
66
+ 4, 58, :_reduce_47,
67
+ 4, 58, :_reduce_48,
66
68
  0, 58, :_reduce_none,
67
69
  1, 63, :_reduce_none,
68
70
  1, 63, :_reduce_none,
@@ -71,94 +73,96 @@ racc_reduce_table = [
71
73
  1, 63, :_reduce_none,
72
74
  1, 63, :_reduce_none,
73
75
  1, 63, :_reduce_none,
74
- 5, 53, :_reduce_55,
76
+ 5, 54, :_reduce_57,
75
77
  1, 64, :_reduce_none,
76
78
  2, 47, :_reduce_none,
77
79
  0, 47, :_reduce_none ]
78
80
 
79
- racc_reduce_n = 59
81
+ racc_reduce_n = 61
80
82
 
81
- racc_shift_n = 97
83
+ racc_shift_n = 99
82
84
 
83
85
  racc_action_table = [
84
- 5, 79, 81, 27, 10, 26, 94, 93, 42, 2,
85
- 42, 30, 56, 5, 5, 28, 79, 81, 10, 42,
86
- 42, 42, 47, 2, 51, 42, 42, 10, 82, 84,
87
- 85, 52, 78, 10, 10, 7, 9, 12, 15, 42,
88
- 10, 17, 77, 82, 84, 85, 10, 78, 7, 7,
89
- 9, 12, 15, 42, 5, 17, 68, 77, 10, 9,
90
- 69, 15, 10, 2, 17, 9, 9, 15, 15, 50,
91
- 17, 17, 9, 5, 15, 26, 21, 17, 9, 54,
92
- 15, 23, 63, 17, 37, 38, 39, 64, 42, 7,
93
- 9, 12, 15, 44, 9, 17, 15, 42, 15, 17,
94
- 76, 42, 86, 31, 42, 89, 42, 25, 7, 91,
95
- 33, 92, 34, 35, 53, 42, 42 ]
86
+ 5, 81, 83, 28, 10, 71, 27, 27, 22, 1,
87
+ 55, 5, 31, 24, 5, 29, 81, 83, 10, 43,
88
+ 65, 96, 95, 1, 57, 66, 43, 10, 84, 86,
89
+ 87, 43, 80, 10, 10, 7, 9, 12, 15, 26,
90
+ 10, 18, 79, 84, 86, 87, 7, 80, 10, 7,
91
+ 9, 12, 15, 43, 5, 18, 44, 79, 10, 9,
92
+ 43, 15, 10, 1, 18, 9, 9, 15, 15, 5,
93
+ 18, 18, 9, 43, 15, 51, 43, 18, 49, 44,
94
+ 9, 43, 15, 44, 70, 18, 38, 39, 40, 7,
95
+ 9, 12, 15, 54, 9, 18, 15, 43, 43, 18,
96
+ 43, 43, 32, 78, 7, 52, 15, 89, 43, 91,
97
+ 43, 93, 34, 94, 35, 36, 53, 43, 43 ]
96
98
 
97
99
  racc_action_check = [
98
- 0, 73, 73, 6, 0, 7, 90, 90, 63, 0,
99
- 28, 7, 29, 17, 55, 6, 71, 71, 55, 33,
100
- 34, 35, 17, 55, 22, 37, 38, 4, 73, 73,
101
- 73, 23, 73, 1, 11, 0, 0, 0, 0, 42,
102
- 67, 0, 73, 71, 71, 71, 14, 71, 17, 55,
103
- 55, 55, 55, 44, 36, 55, 50, 71, 36, 4,
104
- 52, 4, 16, 36, 4, 1, 11, 1, 11, 21,
105
- 1, 11, 67, 41, 67, 5, 5, 67, 14, 27,
106
- 14, 5, 41, 14, 13, 13, 13, 41, 64, 36,
107
- 36, 36, 36, 16, 16, 36, 16, 65, 18, 16,
108
- 69, 15, 72, 9, 75, 80, 83, 5, 41, 87,
109
- 13, 88, 13, 13, 24, 93, 94 ]
100
+ 0, 74, 74, 6, 0, 53, 7, 5, 5, 0,
101
+ 28, 42, 7, 5, 56, 6, 73, 73, 56, 29,
102
+ 42, 92, 92, 56, 30, 42, 34, 14, 74, 74,
103
+ 74, 35, 74, 3, 68, 0, 0, 0, 0, 5,
104
+ 11, 0, 74, 73, 73, 73, 42, 73, 16, 56,
105
+ 56, 56, 56, 36, 37, 56, 17, 73, 37, 14,
106
+ 38, 14, 4, 37, 14, 3, 68, 3, 68, 18,
107
+ 3, 68, 11, 39, 11, 22, 43, 11, 18, 16,
108
+ 16, 44, 16, 46, 51, 16, 13, 13, 13, 37,
109
+ 37, 37, 37, 25, 4, 37, 4, 15, 64, 4,
110
+ 65, 66, 9, 71, 18, 23, 2, 75, 77, 82,
111
+ 85, 88, 13, 90, 13, 13, 24, 95, 96 ]
110
112
 
111
113
  racc_action_pointer = [
112
- -2, 27, nil, nil, 21, 65, 3, -5, nil, 92,
113
- nil, 28, nil, 77, 40, 92, 56, 11, 58, nil,
114
- nil, 62, -18, 20, 72, nil, nil, 79, 1, -30,
115
- nil, nil, nil, 10, 11, 12, 52, 16, 17, nil,
116
- nil, 71, 30, nil, 44, nil, nil, nil, nil, nil,
117
- 40, nil, 53, nil, nil, 12, nil, nil, nil, nil,
118
- nil, nil, nil, -1, 79, 88, nil, 34, nil, 84,
119
- nil, 13, 61, -2, nil, 95, nil, nil, nil, nil,
120
- 64, nil, nil, 97, nil, nil, nil, 68, 69, nil,
121
- -4, nil, nil, 106, 107, nil, nil ]
114
+ -2, nil, 66, 27, 56, -3, 3, -4, nil, 91,
115
+ nil, 34, nil, 79, 21, 88, 42, 19, 67, nil,
116
+ nil, nil, 68, 63, 105, 51, nil, nil, 10, 10,
117
+ -18, nil, nil, nil, 17, 22, 44, 52, 51, 64,
118
+ nil, nil, 9, 67, 72, nil, 46, nil, nil, nil,
119
+ nil, 68, nil, -2, nil, nil, 12, nil, nil, nil,
120
+ nil, nil, nil, nil, 89, 91, 92, nil, 28, nil,
121
+ nil, 87, nil, 13, -2, 66, nil, 99, nil, nil,
122
+ nil, nil, 68, nil, nil, 101, nil, nil, 70, nil,
123
+ 71, nil, 11, nil, nil, 108, 109, nil, nil ]
122
124
 
123
125
  racc_action_default = [
124
- -59, -42, -17, -13, -41, -59, -59, -59, -2, -59,
125
- -44, -43, -18, -15, -40, -58, -35, -59, -11, -38,
126
- -37, -31, -59, -26, -59, -22, -27, -59, -58, -59,
127
- -26, -16, -39, -58, -58, -58, -59, -58, -58, -6,
128
- -36, -59, -58, -34, -58, -9, -10, -33, -32, -12,
129
- -59, -23, -30, -24, 97, -59, -25, -5, -8, -7,
130
- -14, -3, -4, -58, -58, -58, -57, -59, -29, -59,
131
- -1, -47, -59, -47, -56, -58, -28, -48, -52, -53,
132
- -59, -54, -49, -58, -50, -51, -21, -59, -59, -19,
133
- -59, -20, -55, -58, -58, -45, -46 ]
126
+ -61, -19, -12, -44, -43, -61, -61, -61, -2, -61,
127
+ -46, -45, -20, -17, -42, -60, -37, -15, -61, -13,
128
+ -40, -39, -33, -61, -28, -61, -24, -29, -61, -60,
129
+ -61, -28, -18, -41, -60, -60, -60, -61, -60, -60,
130
+ -6, -38, -61, -60, -60, -9, -36, -11, -14, -35,
131
+ -34, -61, -25, -32, -26, 99, -61, -27, -5, -8,
132
+ -7, -16, -3, -4, -60, -60, -60, -59, -61, -10,
133
+ -31, -61, -1, -49, -49, -61, -58, -60, -30, -50,
134
+ -54, -55, -61, -56, -51, -60, -52, -53, -61, -23,
135
+ -61, -22, -61, -21, -57, -60, -60, -47, -48 ]
134
136
 
135
137
  racc_goto_table = [
136
- 41, 19, 8, 80, 20, 87, 48, 22, 6, 29,
137
- 49, 32, 46, 55, 40, 45, 43, 36, 57, 58,
138
- 59, 24, 61, 62, 75, nil, nil, 66, nil, 67,
139
- 65, nil, nil, nil, nil, nil, nil, nil, 60, nil,
140
- nil, nil, nil, nil, nil, nil, nil, nil, 71, 72,
141
- 73, nil, nil, nil, nil, nil, nil, 70, nil, nil,
142
- 88, nil, nil, nil, nil, nil, nil, 74, 90, nil,
143
- nil, nil, nil, nil, nil, nil, nil, nil, 95, 96 ]
138
+ 42, 8, 20, 21, 47, 48, 50, 23, 6, 30,
139
+ 33, 82, 88, 41, 56, 46, 19, 45, 37, 58,
140
+ 59, 60, 25, 62, 63, 77, nil, nil, 67, 68,
141
+ 64, nil, nil, nil, 69, nil, nil, nil, 61, nil,
142
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, 73,
143
+ 74, 75, nil, nil, nil, nil, nil, 72, nil, nil,
144
+ nil, nil, 90, nil, nil, nil, nil, 76, nil, nil,
145
+ 92, nil, nil, nil, nil, nil, nil, nil, nil, nil,
146
+ 97, 98 ]
144
147
 
145
148
  racc_goto_check = [
146
- 2, 11, 3, 13, 11, 13, 9, 14, 1, 14,
147
- 10, 11, 8, 2, 11, 7, 11, 4, 2, 2,
148
- 2, 15, 2, 2, 19, nil, nil, 2, nil, 2,
149
- 9, nil, nil, nil, nil, nil, nil, nil, 3, nil,
150
- nil, nil, nil, nil, nil, nil, nil, nil, 2, 2,
151
- 2, nil, nil, nil, nil, nil, nil, 3, nil, nil,
152
- 2, nil, nil, nil, nil, nil, nil, 11, 2, nil,
153
- nil, nil, nil, nil, nil, nil, nil, nil, 2, 2 ]
149
+ 2, 3, 8, 8, 9, 9, 10, 14, 1, 14,
150
+ 8, 13, 13, 8, 2, 8, 11, 7, 4, 2,
151
+ 2, 2, 15, 2, 2, 19, nil, nil, 2, 2,
152
+ 10, nil, nil, nil, 9, nil, nil, nil, 3, nil,
153
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, 2,
154
+ 2, 2, nil, nil, nil, nil, nil, 3, nil, nil,
155
+ nil, nil, 2, nil, nil, nil, nil, 8, nil, nil,
156
+ 2, nil, nil, nil, nil, nil, nil, nil, nil, nil,
157
+ 2, 2 ]
154
158
 
155
159
  racc_goto_pointer = [
156
- nil, 8, -15, 2, 4, nil, nil, -1, -4, -11,
157
- -8, 0, nil, -68, 2, 16, nil, nil, nil, -43 ]
160
+ nil, 8, -15, 1, 5, nil, nil, 1, -1, -12,
161
+ -12, 14, nil, -62, 2, 17, nil, nil, nil, -43 ]
158
162
 
159
163
  racc_goto_default = [
160
- nil, nil, nil, nil, nil, 13, 16, nil, nil, 18,
161
- 1, 3, 4, nil, nil, nil, 11, 14, 83, nil ]
164
+ nil, nil, nil, nil, nil, 13, 16, nil, 17, nil,
165
+ 2, 3, 4, nil, nil, nil, 11, 14, 85, nil ]
162
166
 
163
167
  racc_token_table = {
164
168
  false => 0,
@@ -281,10 +285,10 @@ Racc_token_to_s_table = [
281
285
  'simple_selector',
282
286
  'element_name',
283
287
  'hcap_0toN',
288
+ 'hcap_1toN',
284
289
  'negation',
285
290
  'function',
286
291
  'attrib',
287
- 'hcap_1toN',
288
292
  'class',
289
293
  'attrib_val_0or1',
290
294
  'expr',
@@ -367,24 +371,48 @@ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 31
367
371
  end
368
372
  .,.,
369
373
 
370
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 34
374
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 39
371
375
  def _reduce_10( val, _values, result )
376
+ result = Node.new(:CONDITIONAL_SELECTOR,
377
+ [
378
+ val.first,
379
+ Node.new(:COMBINATOR, [val[1], val.last])
380
+ ]
381
+ )
382
+ result
383
+ end
384
+ .,.,
385
+
386
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 42
387
+ def _reduce_11( val, _values, result )
372
388
  result = Node.new(:CONDITIONAL_SELECTOR, val)
373
389
  result
374
390
  end
375
391
  .,.,
376
392
 
377
- # reduce 11 omitted
393
+ # reduce 12 omitted
378
394
 
379
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 38
380
- def _reduce_12( val, _values, result )
395
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 46
396
+ def _reduce_13( val, _values, result )
381
397
  result = Node.new(:CONDITIONAL_SELECTOR, val)
382
398
  result
383
399
  end
384
400
  .,.,
385
401
 
386
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 43
387
- def _reduce_13( val, _values, result )
402
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 54
403
+ def _reduce_14( val, _values, result )
404
+ result = Node.new(:CONDITIONAL_SELECTOR,
405
+ [
406
+ Node.new(:ELEMENT_NAME, ['*']),
407
+ Node.new(:COMBINATOR, val)
408
+ ]
409
+ )
410
+ result
411
+ end
412
+ .,.,
413
+
414
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 59
415
+ def _reduce_15( val, _values, result )
388
416
  result = Node.new(:CONDITIONAL_SELECTOR,
389
417
  [Node.new(:ELEMENT_NAME, ['*']), val.first]
390
418
  )
@@ -392,38 +420,38 @@ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 43
392
420
  end
393
421
  .,.,
394
422
 
395
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 48
396
- def _reduce_14( val, _values, result )
423
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 64
424
+ def _reduce_16( val, _values, result )
397
425
  result = Node.new(val[1], [val.first, val.last])
398
426
  result
399
427
  end
400
428
  .,.,
401
429
 
402
- # reduce 15 omitted
430
+ # reduce 17 omitted
403
431
 
404
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 51
405
- def _reduce_16( val, _values, result )
432
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 67
433
+ def _reduce_18( val, _values, result )
406
434
  result = Node.new(:CLASS_CONDITION, [val[1]])
407
435
  result
408
436
  end
409
437
  .,.,
410
438
 
411
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 54
412
- def _reduce_17( val, _values, result )
439
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 70
440
+ def _reduce_19( val, _values, result )
413
441
  result = Node.new(:ELEMENT_NAME, val)
414
442
  result
415
443
  end
416
444
  .,.,
417
445
 
418
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 55
419
- def _reduce_18( val, _values, result )
446
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 71
447
+ def _reduce_20( val, _values, result )
420
448
  result = Node.new(:ELEMENT_NAME, val)
421
449
  result
422
450
  end
423
451
  .,.,
424
452
 
425
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 63
426
- def _reduce_19( val, _values, result )
453
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 79
454
+ def _reduce_21( val, _values, result )
427
455
  result = Node.new(:ATTRIBUTE_CONDITION,
428
456
  [Node.new(:ELEMENT_NAME, [val[2]])] + (val[4] || [])
429
457
  )
@@ -431,8 +459,8 @@ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 63
431
459
  end
432
460
  .,.,
433
461
 
434
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 68
435
- def _reduce_20( val, _values, result )
462
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 84
463
+ def _reduce_22( val, _values, result )
436
464
  result = Node.new(:ATTRIBUTE_CONDITION,
437
465
  [val[2]] + (val[4] || [])
438
466
  )
@@ -440,8 +468,8 @@ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 68
440
468
  end
441
469
  .,.,
442
470
 
443
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 74
444
- def _reduce_21( val, _values, result )
471
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 90
472
+ def _reduce_23( val, _values, result )
445
473
  # Non standard, but hpricot supports it.
446
474
  result = Node.new(:PSEUDO_CLASS,
447
475
  [Node.new(:FUNCTION, ['nth-child(', val[2]])]
@@ -450,40 +478,40 @@ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 74
450
478
  end
451
479
  .,.,
452
480
 
453
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 79
454
- def _reduce_22( val, _values, result )
481
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 95
482
+ def _reduce_24( val, _values, result )
455
483
  result = Node.new(:FUNCTION, [val.first.strip])
456
484
  result
457
485
  end
458
486
  .,.,
459
487
 
460
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 82
461
- def _reduce_23( val, _values, result )
488
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 98
489
+ def _reduce_25( val, _values, result )
462
490
  result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
463
491
  result
464
492
  end
465
493
  .,.,
466
494
 
467
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 85
468
- def _reduce_24( val, _values, result )
495
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 101
496
+ def _reduce_26( val, _values, result )
469
497
  result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
470
498
  result
471
499
  end
472
500
  .,.,
473
501
 
474
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 88
475
- def _reduce_25( val, _values, result )
502
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 104
503
+ def _reduce_27( val, _values, result )
476
504
  result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
477
505
  result
478
506
  end
479
507
  .,.,
480
508
 
481
- # reduce 26 omitted
509
+ # reduce 28 omitted
482
510
 
483
- # reduce 27 omitted
511
+ # reduce 29 omitted
484
512
 
485
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 102
486
- def _reduce_28( val, _values, result )
513
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 118
514
+ def _reduce_30( val, _values, result )
487
515
  if val[1] == 'n'
488
516
  result = Node.new(:AN_PLUS_B, val)
489
517
  else
@@ -493,8 +521,8 @@ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 102
493
521
  end
494
522
  .,.,
495
523
 
496
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 113
497
- def _reduce_29( val, _values, result )
524
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 129
525
+ def _reduce_31( val, _values, result )
498
526
  # n+3, -n+3
499
527
  if val[0] == 'n'
500
528
  val.unshift("1")
@@ -510,8 +538,8 @@ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 113
510
538
  end
511
539
  .,.,
512
540
 
513
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 124
514
- def _reduce_30( val, _values, result )
541
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 140
542
+ def _reduce_32( val, _values, result )
515
543
  if val[1] == 'n'
516
544
  val << "+"
517
545
  val << "0"
@@ -523,8 +551,8 @@ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 124
523
551
  end
524
552
  .,.,
525
553
 
526
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 136
527
- def _reduce_31( val, _values, result )
554
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 152
555
+ def _reduce_33( val, _values, result )
528
556
  if val[0] == 'even'
529
557
  val = ["2","n","+","0"]
530
558
  result = Node.new(:AN_PLUS_B, val)
@@ -538,85 +566,81 @@ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 136
538
566
  end
539
567
  .,.,
540
568
 
541
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 141
542
- def _reduce_32( val, _values, result )
569
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 157
570
+ def _reduce_34( val, _values, result )
543
571
  result = Node.new(:PSEUDO_CLASS, [val[1]])
544
572
  result
545
573
  end
546
574
  .,.,
547
575
 
548
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 141
549
- def _reduce_33( val, _values, result )
576
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 157
577
+ def _reduce_35( val, _values, result )
550
578
  result = Node.new(:PSEUDO_CLASS, [val[1]])
551
579
  result
552
580
  end
553
581
  .,.,
554
582
 
555
- # reduce 34 omitted
583
+ # reduce 36 omitted
556
584
 
557
- # reduce 35 omitted
585
+ # reduce 37 omitted
558
586
 
559
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 151
560
- def _reduce_36( val, _values, result )
587
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 167
588
+ def _reduce_38( val, _values, result )
561
589
  result = Node.new(:COMBINATOR, val)
562
590
  result
563
591
  end
564
592
  .,.,
565
593
 
566
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 154
567
- def _reduce_37( val, _values, result )
594
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 170
595
+ def _reduce_39( val, _values, result )
568
596
  result = Node.new(:COMBINATOR, val)
569
597
  result
570
598
  end
571
599
  .,.,
572
600
 
573
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 157
574
- def _reduce_38( val, _values, result )
601
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 173
602
+ def _reduce_40( val, _values, result )
575
603
  result = Node.new(:COMBINATOR, val)
576
604
  result
577
605
  end
578
606
  .,.,
579
607
 
580
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 160
581
- def _reduce_39( val, _values, result )
608
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 176
609
+ def _reduce_41( val, _values, result )
582
610
  result = Node.new(:COMBINATOR, val)
583
611
  result
584
612
  end
585
613
  .,.,
586
614
 
587
- # reduce 40 omitted
588
-
589
- # reduce 41 omitted
590
-
591
615
  # reduce 42 omitted
592
616
 
593
617
  # reduce 43 omitted
594
618
 
595
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 166
596
- def _reduce_44( val, _values, result )
619
+ # reduce 44 omitted
620
+
621
+ # reduce 45 omitted
622
+
623
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 182
624
+ def _reduce_46( val, _values, result )
597
625
  result = Node.new(:ID, val)
598
626
  result
599
627
  end
600
628
  .,.,
601
629
 
602
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 169
603
- def _reduce_45( val, _values, result )
630
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 185
631
+ def _reduce_47( val, _values, result )
604
632
  result = [val.first, val[2]]
605
633
  result
606
634
  end
607
635
  .,.,
608
636
 
609
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 170
610
- def _reduce_46( val, _values, result )
637
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 186
638
+ def _reduce_48( val, _values, result )
611
639
  result = [val.first, val[2]]
612
640
  result
613
641
  end
614
642
  .,.,
615
643
 
616
- # reduce 47 omitted
617
-
618
- # reduce 48 omitted
619
-
620
644
  # reduce 49 omitted
621
645
 
622
646
  # reduce 50 omitted
@@ -629,18 +653,22 @@ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 170
629
653
 
630
654
  # reduce 54 omitted
631
655
 
632
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 186
633
- def _reduce_55( val, _values, result )
656
+ # reduce 55 omitted
657
+
658
+ # reduce 56 omitted
659
+
660
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 202
661
+ def _reduce_57( val, _values, result )
634
662
  result = Node.new(:NOT, [val[2]])
635
663
  result
636
664
  end
637
665
  .,.,
638
666
 
639
- # reduce 56 omitted
667
+ # reduce 58 omitted
640
668
 
641
- # reduce 57 omitted
669
+ # reduce 59 omitted
642
670
 
643
- # reduce 58 omitted
671
+ # reduce 60 omitted
644
672
 
645
673
  def _reduce_none( val, _values, result )
646
674
  result