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.
- data/History.ja.txt +11 -0
- data/History.txt +11 -0
- data/Manifest.txt +7 -0
- data/README.txt +7 -0
- data/Rakefile +43 -2
- data/ext/nokogiri/native.c +1 -0
- data/ext/nokogiri/native.h +1 -2
- data/ext/nokogiri/xml_cdata.c +3 -1
- data/ext/nokogiri/xml_comment.c +42 -0
- data/ext/nokogiri/xml_comment.h +9 -0
- data/ext/nokogiri/xml_document.c +1 -0
- data/ext/nokogiri/xml_node.c +21 -7
- data/ext/nokogiri/xml_sax_parser.c +26 -0
- data/ext/nokogiri/xml_syntax_error.c +4 -0
- data/ext/nokogiri/xml_text.c +16 -1
- data/ext/nokogiri/xml_xpath_context.c +4 -0
- data/ext/nokogiri/xslt_stylesheet.c +1 -1
- data/lib/action-nokogiri.rb +30 -0
- data/lib/nokogiri.rb +25 -4
- data/lib/nokogiri/css.rb +9 -4
- data/lib/nokogiri/css/generated_parser.rb +199 -171
- data/lib/nokogiri/css/parser.rb +11 -0
- data/lib/nokogiri/css/parser.y +16 -0
- data/lib/nokogiri/decorators.rb +1 -0
- data/lib/nokogiri/decorators/slop.rb +31 -0
- data/lib/nokogiri/hpricot.rb +2 -4
- data/lib/nokogiri/version.rb +1 -1
- data/lib/nokogiri/xml.rb +15 -0
- data/lib/nokogiri/xml/builder.rb +1 -1
- data/lib/nokogiri/xml/comment.rb +6 -0
- data/lib/nokogiri/xml/document.rb +22 -8
- data/lib/nokogiri/xml/sax/parser.rb +7 -3
- data/test/css/test_parser.rb +9 -0
- data/test/helper.rb +4 -1
- data/test/hpricot/load_files.rb +8 -4
- data/test/test_css_cache.rb +17 -10
- data/test/test_memory_leak.rb +38 -0
- data/test/test_nokogiri.rb +61 -0
- data/test/xml/sax/test_parser.rb +2 -0
- data/test/xml/test_comment.rb +16 -0
- data/test/xml/test_document.rb +2 -4
- data/test/xml/test_node.rb +13 -0
- data/vendor/hoe.rb +8 -22
- metadata +12 -3
data/lib/nokogiri.rb
CHANGED
@@ -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'] = [
|
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
|
70
|
+
Nokogiri.parse(*args)
|
50
71
|
end
|
51
72
|
end
|
data/lib/nokogiri/css.rb
CHANGED
@@ -9,11 +9,16 @@ require 'nokogiri/css/syntax_error'
|
|
9
9
|
module Nokogiri
|
10
10
|
module CSS
|
11
11
|
class << self
|
12
|
-
|
13
|
-
|
12
|
+
###
|
13
|
+
# Parse this CSS selector in +selector+. Returns an AST.
|
14
|
+
def parse selector
|
15
|
+
Parser.new.parse selector
|
14
16
|
end
|
15
|
-
|
16
|
-
|
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
|
-
|
29
|
+
3, 50, :_reduce_10,
|
30
|
+
2, 50, :_reduce_11,
|
30
31
|
1, 50, :_reduce_none,
|
31
|
-
2, 50, :
|
32
|
-
|
33
|
-
|
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, :
|
36
|
-
1, 51, :
|
37
|
-
1, 51, :
|
38
|
-
6,
|
39
|
-
6,
|
40
|
-
5,
|
41
|
-
2,
|
42
|
-
3,
|
43
|
-
3,
|
44
|
-
3,
|
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, :
|
48
|
-
3, 60, :
|
49
|
-
2, 60, :
|
50
|
-
1, 60, :
|
51
|
-
2, 61, :
|
52
|
-
2, 61, :
|
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
|
-
2,
|
57
|
-
2,
|
58
|
-
2,
|
59
|
-
1,
|
60
|
-
1,
|
61
|
-
1,
|
62
|
-
1,
|
63
|
-
1, 62, :
|
64
|
-
4, 58, :
|
65
|
-
4, 58, :
|
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,
|
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 =
|
81
|
+
racc_reduce_n = 61
|
80
82
|
|
81
|
-
racc_shift_n =
|
83
|
+
racc_shift_n = 99
|
82
84
|
|
83
85
|
racc_action_table = [
|
84
|
-
5,
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
10,
|
89
|
-
9, 12, 15,
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
9, 12, 15,
|
94
|
-
|
95
|
-
|
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,
|
99
|
-
28, 7,
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
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,
|
113
|
-
nil,
|
114
|
-
nil,
|
115
|
-
nil, nil, nil,
|
116
|
-
nil,
|
117
|
-
|
118
|
-
nil, nil, nil,
|
119
|
-
nil,
|
120
|
-
|
121
|
-
|
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
|
-
-
|
125
|
-
-
|
126
|
-
-
|
127
|
-
-
|
128
|
-
|
129
|
-
-
|
130
|
-
-
|
131
|
-
|
132
|
-
-
|
133
|
-
-
|
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
|
-
|
137
|
-
|
138
|
-
59,
|
139
|
-
|
140
|
-
nil, nil, nil, nil, nil, nil, nil, nil,
|
141
|
-
|
142
|
-
|
143
|
-
nil, nil, nil, nil, nil, nil, nil, nil,
|
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,
|
147
|
-
|
148
|
-
2, 15, 2, 2, 19, nil, nil, 2,
|
149
|
-
|
150
|
-
nil, nil, nil, nil, nil, nil, nil, nil,
|
151
|
-
2,
|
152
|
-
|
153
|
-
nil, nil, nil, nil, nil, nil, nil, nil,
|
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,
|
157
|
-
|
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,
|
161
|
-
|
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',
|
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
|
393
|
+
# reduce 12 omitted
|
378
394
|
|
379
|
-
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y',
|
380
|
-
def
|
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',
|
387
|
-
def
|
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',
|
396
|
-
def
|
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
|
430
|
+
# reduce 17 omitted
|
403
431
|
|
404
|
-
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y',
|
405
|
-
def
|
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',
|
412
|
-
def
|
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',
|
419
|
-
def
|
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',
|
426
|
-
def
|
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',
|
435
|
-
def
|
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',
|
444
|
-
def
|
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',
|
454
|
-
def
|
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',
|
461
|
-
def
|
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',
|
468
|
-
def
|
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',
|
475
|
-
def
|
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
|
509
|
+
# reduce 28 omitted
|
482
510
|
|
483
|
-
# reduce
|
511
|
+
# reduce 29 omitted
|
484
512
|
|
485
|
-
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y',
|
486
|
-
def
|
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',
|
497
|
-
def
|
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',
|
514
|
-
def
|
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',
|
527
|
-
def
|
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',
|
542
|
-
def
|
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',
|
549
|
-
def
|
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
|
583
|
+
# reduce 36 omitted
|
556
584
|
|
557
|
-
# reduce
|
585
|
+
# reduce 37 omitted
|
558
586
|
|
559
|
-
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y',
|
560
|
-
def
|
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',
|
567
|
-
def
|
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',
|
574
|
-
def
|
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',
|
581
|
-
def
|
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
|
-
|
596
|
-
|
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',
|
603
|
-
def
|
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',
|
610
|
-
def
|
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
|
-
|
633
|
-
|
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
|
667
|
+
# reduce 58 omitted
|
640
668
|
|
641
|
-
# reduce
|
669
|
+
# reduce 59 omitted
|
642
670
|
|
643
|
-
# reduce
|
671
|
+
# reduce 60 omitted
|
644
672
|
|
645
673
|
def _reduce_none( val, _values, result )
|
646
674
|
result
|