nokogiri 1.1.0 → 1.1.1
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 +24 -6
- data/History.txt +17 -0
- data/Manifest.txt +3 -2
- data/Rakefile +28 -9
- data/ext/nokogiri/extconf.rb +27 -30
- data/ext/nokogiri/xml_node.c +79 -42
- data/ext/nokogiri/xml_reader.c +39 -4
- data/ext/nokogiri/xml_text.c +1 -0
- data/ext/nokogiri/xml_xpath_context.c +5 -6
- data/lib/nokogiri/css.rb +0 -1
- data/lib/nokogiri/css/generated_parser.rb +416 -396
- data/lib/nokogiri/decorators/slop.rb +2 -2
- data/lib/nokogiri/version.rb +1 -1
- data/lib/nokogiri/xml.rb +1 -1
- data/lib/nokogiri/xml/attr.rb +10 -0
- data/lib/nokogiri/xml/document.rb +0 -1
- data/lib/nokogiri/xml/node.rb +64 -16
- data/lib/nokogiri/xml/node_set.rb +10 -0
- data/lib/nokogiri/xml/reader.rb +6 -0
- data/test/hpricot/test_alter.rb +7 -7
- data/test/hpricot/test_parser.rb +7 -6
- data/test/hpricot/test_preserved.rb +0 -1
- data/test/html/test_node.rb +21 -0
- data/test/xml/test_attr.rb +15 -0
- data/test/xml/test_node.rb +113 -2
- data/test/xml/test_node_set.rb +22 -0
- data/test/xml/test_xpath.rb +8 -1
- data/vendor/hoe.rb +1 -0
- metadata +7 -4
- data/lib/nokogiri/css/selector_handler.rb +0 -6
- data/lib/nokogiri/xml/xpath_handler.rb +0 -6
data/ext/nokogiri/xml_reader.c
CHANGED
@@ -78,11 +78,11 @@ static VALUE attributes_eh(VALUE self)
|
|
78
78
|
|
79
79
|
/*
|
80
80
|
* call-seq:
|
81
|
-
*
|
81
|
+
* namespaces
|
82
82
|
*
|
83
|
-
* Get a
|
83
|
+
* Get a hash of namespaces for this Node
|
84
84
|
*/
|
85
|
-
static VALUE
|
85
|
+
static VALUE namespaces(VALUE self)
|
86
86
|
{
|
87
87
|
xmlTextReaderPtr reader;
|
88
88
|
VALUE attr ;
|
@@ -98,6 +98,40 @@ static VALUE attributes(VALUE self)
|
|
98
98
|
if(ptr == NULL) return Qnil;
|
99
99
|
|
100
100
|
Nokogiri_xml_node_namespaces(ptr, attr);
|
101
|
+
|
102
|
+
return attr ;
|
103
|
+
}
|
104
|
+
|
105
|
+
/*
|
106
|
+
* call-seq:
|
107
|
+
* attribute_nodes
|
108
|
+
*
|
109
|
+
* Get a list of attributes for this Node
|
110
|
+
*/
|
111
|
+
static VALUE attribute_nodes(VALUE self)
|
112
|
+
{
|
113
|
+
xmlTextReaderPtr reader;
|
114
|
+
VALUE attr ;
|
115
|
+
|
116
|
+
Data_Get_Struct(self, xmlTextReader, reader);
|
117
|
+
|
118
|
+
attr = rb_ary_new() ;
|
119
|
+
|
120
|
+
if (! has_attributes(reader))
|
121
|
+
return attr ;
|
122
|
+
|
123
|
+
xmlNodePtr ptr = xmlTextReaderExpand(reader);
|
124
|
+
if(ptr == NULL) return Qnil;
|
125
|
+
|
126
|
+
// FIXME I'm not sure if this is correct..... I don't really like pointing
|
127
|
+
// at this document, but I have to because of the assertions in
|
128
|
+
// the node wrapping code.
|
129
|
+
if(!ptr->doc->_private) {
|
130
|
+
VALUE rb_doc = Data_Wrap_Struct(cNokogiriXmlDocument, 0, 0, ptr->doc);
|
131
|
+
rb_iv_set(rb_doc, "@decorators", Qnil);
|
132
|
+
ptr->doc->_private = (void *)rb_doc;
|
133
|
+
}
|
134
|
+
|
101
135
|
Nokogiri_xml_node_properties(ptr, attr);
|
102
136
|
|
103
137
|
return attr ;
|
@@ -422,8 +456,9 @@ void init_xml_reader()
|
|
422
456
|
rb_define_method(klass, "depth", depth, 0);
|
423
457
|
rb_define_method(klass, "attribute_count", attribute_count, 0);
|
424
458
|
rb_define_method(klass, "attribute", reader_attribute, 1);
|
459
|
+
rb_define_method(klass, "namespaces", namespaces, 0);
|
425
460
|
rb_define_method(klass, "attribute_at", attribute_at, 1);
|
426
|
-
rb_define_method(klass, "
|
461
|
+
rb_define_method(klass, "attribute_nodes", attribute_nodes, 0);
|
427
462
|
rb_define_method(klass, "attributes?", attributes_eh, 0);
|
428
463
|
rb_define_method(klass, "value?", value_eh, 0);
|
429
464
|
rb_define_method(klass, "default?", default_eh, 0);
|
data/ext/nokogiri/xml_text.c
CHANGED
@@ -83,7 +83,7 @@ static void ruby_funcall(xmlXPathParserContextPtr ctx, int nargs)
|
|
83
83
|
case T_STRING:
|
84
84
|
xmlXPathReturnString(
|
85
85
|
ctx,
|
86
|
-
xmlXPathWrapCString(StringValuePtr(result))
|
86
|
+
(xmlChar *)xmlXPathWrapCString(StringValuePtr(result))
|
87
87
|
);
|
88
88
|
break;
|
89
89
|
case T_TRUE:
|
@@ -160,15 +160,14 @@ static VALUE evaluate(int argc, VALUE *argv, VALUE self)
|
|
160
160
|
|
161
161
|
VALUE xpath_object = Nokogiri_wrap_xml_xpath(xpath);
|
162
162
|
|
163
|
-
assert(ctx->
|
164
|
-
assert(ctx->
|
165
|
-
assert(ctx->node->doc->_private);
|
163
|
+
assert(ctx->doc);
|
164
|
+
assert(ctx->doc->_private);
|
166
165
|
|
167
166
|
rb_funcall( xpath_object,
|
168
167
|
rb_intern("document="),
|
169
168
|
1,
|
170
|
-
(VALUE)ctx->
|
171
|
-
|
169
|
+
(VALUE)ctx->doc->_private
|
170
|
+
);
|
172
171
|
return xpath_object;
|
173
172
|
}
|
174
173
|
|
data/lib/nokogiri/css.rb
CHANGED
@@ -1,88 +1,16 @@
|
|
1
1
|
#
|
2
2
|
# DO NOT MODIFY!!!!
|
3
|
-
# This file is automatically generated by
|
4
|
-
# from
|
3
|
+
# This file is automatically generated by Racc 1.4.6
|
4
|
+
# from Racc grammer file "".
|
5
5
|
#
|
6
6
|
|
7
|
-
require 'racc/parser'
|
7
|
+
require 'racc/parser.rb'
|
8
8
|
|
9
9
|
|
10
10
|
module Nokogiri
|
11
|
-
|
12
11
|
module CSS
|
13
|
-
|
14
12
|
class GeneratedParser < Racc::Parser
|
15
|
-
|
16
|
-
##### racc 1.4.5 generates ###
|
17
|
-
|
18
|
-
racc_reduce_table = [
|
19
|
-
0, 0, :racc_error,
|
20
|
-
4, 46, :_reduce_1,
|
21
|
-
1, 46, :_reduce_2,
|
22
|
-
2, 49, :_reduce_3,
|
23
|
-
2, 49, :_reduce_4,
|
24
|
-
2, 49, :_reduce_5,
|
25
|
-
1, 49, :_reduce_6,
|
26
|
-
2, 49, :_reduce_7,
|
27
|
-
2, 49, :_reduce_8,
|
28
|
-
2, 50, :_reduce_9,
|
29
|
-
3, 50, :_reduce_10,
|
30
|
-
2, 50, :_reduce_11,
|
31
|
-
1, 50, :_reduce_none,
|
32
|
-
2, 50, :_reduce_13,
|
33
|
-
2, 50, :_reduce_14,
|
34
|
-
1, 50, :_reduce_15,
|
35
|
-
3, 48, :_reduce_16,
|
36
|
-
1, 48, :_reduce_none,
|
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,
|
47
|
-
4, 59, :_reduce_28,
|
48
|
-
4, 59, :_reduce_29,
|
49
|
-
1, 59, :_reduce_none,
|
50
|
-
1, 59, :_reduce_none,
|
51
|
-
4, 60, :_reduce_32,
|
52
|
-
3, 60, :_reduce_33,
|
53
|
-
2, 60, :_reduce_34,
|
54
|
-
1, 60, :_reduce_35,
|
55
|
-
2, 61, :_reduce_36,
|
56
|
-
2, 61, :_reduce_37,
|
57
|
-
1, 52, :_reduce_none,
|
58
|
-
0, 52, :_reduce_none,
|
59
|
-
2, 53, :_reduce_40,
|
60
|
-
2, 53, :_reduce_41,
|
61
|
-
2, 53, :_reduce_42,
|
62
|
-
2, 53, :_reduce_43,
|
63
|
-
1, 53, :_reduce_none,
|
64
|
-
1, 53, :_reduce_none,
|
65
|
-
1, 53, :_reduce_none,
|
66
|
-
1, 53, :_reduce_none,
|
67
|
-
1, 62, :_reduce_48,
|
68
|
-
4, 58, :_reduce_49,
|
69
|
-
4, 58, :_reduce_50,
|
70
|
-
0, 58, :_reduce_none,
|
71
|
-
1, 63, :_reduce_none,
|
72
|
-
1, 63, :_reduce_none,
|
73
|
-
1, 63, :_reduce_none,
|
74
|
-
1, 63, :_reduce_none,
|
75
|
-
1, 63, :_reduce_none,
|
76
|
-
1, 63, :_reduce_none,
|
77
|
-
1, 63, :_reduce_none,
|
78
|
-
5, 54, :_reduce_59,
|
79
|
-
1, 64, :_reduce_none,
|
80
|
-
2, 47, :_reduce_none,
|
81
|
-
0, 47, :_reduce_none ]
|
82
|
-
|
83
|
-
racc_reduce_n = 63
|
84
|
-
|
85
|
-
racc_shift_n = 105
|
13
|
+
##### State transition tables begin ###
|
86
14
|
|
87
15
|
racc_action_table = [
|
88
16
|
5, 28, 27, 22, 10, 5, 27, 5, 24, 1,
|
@@ -170,380 +98,465 @@ racc_goto_default = [
|
|
170
98
|
nil, nil, nil, nil, nil, 13, 16, nil, 17, nil,
|
171
99
|
2, 3, 4, nil, nil, nil, 11, 14, 91, nil ]
|
172
100
|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
:
|
177
|
-
:
|
178
|
-
:
|
179
|
-
:
|
180
|
-
:
|
181
|
-
:
|
182
|
-
:
|
183
|
-
:
|
184
|
-
:
|
185
|
-
:
|
186
|
-
:
|
187
|
-
:
|
188
|
-
:
|
189
|
-
:
|
190
|
-
:
|
191
|
-
:
|
192
|
-
:
|
193
|
-
:
|
194
|
-
:
|
195
|
-
:
|
196
|
-
:
|
197
|
-
:
|
198
|
-
:
|
199
|
-
:
|
200
|
-
:
|
201
|
-
:
|
202
|
-
:
|
203
|
-
:
|
204
|
-
:
|
205
|
-
:
|
206
|
-
:
|
207
|
-
:
|
208
|
-
:
|
209
|
-
:
|
210
|
-
:
|
211
|
-
:
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
101
|
+
racc_reduce_table = [
|
102
|
+
0, 0, :racc_error,
|
103
|
+
4, 46, :_reduce_1,
|
104
|
+
1, 46, :_reduce_2,
|
105
|
+
2, 49, :_reduce_3,
|
106
|
+
2, 49, :_reduce_4,
|
107
|
+
2, 49, :_reduce_5,
|
108
|
+
1, 49, :_reduce_6,
|
109
|
+
2, 49, :_reduce_7,
|
110
|
+
2, 49, :_reduce_8,
|
111
|
+
2, 50, :_reduce_9,
|
112
|
+
3, 50, :_reduce_10,
|
113
|
+
2, 50, :_reduce_11,
|
114
|
+
1, 50, :_reduce_none,
|
115
|
+
2, 50, :_reduce_13,
|
116
|
+
2, 50, :_reduce_14,
|
117
|
+
1, 50, :_reduce_15,
|
118
|
+
3, 48, :_reduce_16,
|
119
|
+
1, 48, :_reduce_none,
|
120
|
+
2, 57, :_reduce_18,
|
121
|
+
1, 51, :_reduce_19,
|
122
|
+
1, 51, :_reduce_20,
|
123
|
+
6, 56, :_reduce_21,
|
124
|
+
6, 56, :_reduce_22,
|
125
|
+
5, 56, :_reduce_23,
|
126
|
+
2, 55, :_reduce_24,
|
127
|
+
3, 55, :_reduce_25,
|
128
|
+
3, 55, :_reduce_26,
|
129
|
+
3, 55, :_reduce_27,
|
130
|
+
4, 59, :_reduce_28,
|
131
|
+
4, 59, :_reduce_29,
|
132
|
+
1, 59, :_reduce_none,
|
133
|
+
1, 59, :_reduce_none,
|
134
|
+
4, 60, :_reduce_32,
|
135
|
+
3, 60, :_reduce_33,
|
136
|
+
2, 60, :_reduce_34,
|
137
|
+
1, 60, :_reduce_35,
|
138
|
+
2, 61, :_reduce_36,
|
139
|
+
2, 61, :_reduce_37,
|
140
|
+
1, 52, :_reduce_none,
|
141
|
+
0, 52, :_reduce_none,
|
142
|
+
2, 53, :_reduce_40,
|
143
|
+
2, 53, :_reduce_41,
|
144
|
+
2, 53, :_reduce_42,
|
145
|
+
2, 53, :_reduce_43,
|
146
|
+
1, 53, :_reduce_none,
|
147
|
+
1, 53, :_reduce_none,
|
148
|
+
1, 53, :_reduce_none,
|
149
|
+
1, 53, :_reduce_none,
|
150
|
+
1, 62, :_reduce_48,
|
151
|
+
4, 58, :_reduce_49,
|
152
|
+
4, 58, :_reduce_50,
|
153
|
+
0, 58, :_reduce_none,
|
154
|
+
1, 63, :_reduce_none,
|
155
|
+
1, 63, :_reduce_none,
|
156
|
+
1, 63, :_reduce_none,
|
157
|
+
1, 63, :_reduce_none,
|
158
|
+
1, 63, :_reduce_none,
|
159
|
+
1, 63, :_reduce_none,
|
160
|
+
1, 63, :_reduce_none,
|
161
|
+
5, 54, :_reduce_59,
|
162
|
+
1, 64, :_reduce_none,
|
163
|
+
2, 47, :_reduce_none,
|
164
|
+
0, 47, :_reduce_none ]
|
219
165
|
|
220
|
-
|
166
|
+
racc_reduce_n = 63
|
167
|
+
|
168
|
+
racc_shift_n = 105
|
169
|
+
|
170
|
+
racc_token_table = {
|
171
|
+
false => 0,
|
172
|
+
:error => 1,
|
173
|
+
:FUNCTION => 2,
|
174
|
+
:INCLUDES => 3,
|
175
|
+
:DASHMATCH => 4,
|
176
|
+
:LBRACE => 5,
|
177
|
+
:HASH => 6,
|
178
|
+
:PLUS => 7,
|
179
|
+
:GREATER => 8,
|
180
|
+
:S => 9,
|
181
|
+
:STRING => 10,
|
182
|
+
:IDENT => 11,
|
183
|
+
:COMMA => 12,
|
184
|
+
:URI => 13,
|
185
|
+
:CDO => 14,
|
186
|
+
:CDC => 15,
|
187
|
+
:NUMBER => 16,
|
188
|
+
:PERCENTAGE => 17,
|
189
|
+
:LENGTH => 18,
|
190
|
+
:EMS => 19,
|
191
|
+
:EXS => 20,
|
192
|
+
:ANGLE => 21,
|
193
|
+
:TIME => 22,
|
194
|
+
:FREQ => 23,
|
195
|
+
:IMPORTANT_SYM => 24,
|
196
|
+
:IMPORT_SYM => 25,
|
197
|
+
:MEDIA_SYM => 26,
|
198
|
+
:PAGE_SYM => 27,
|
199
|
+
:CHARSET_SYM => 28,
|
200
|
+
:DIMENSION => 29,
|
201
|
+
:PREFIXMATCH => 30,
|
202
|
+
:SUFFIXMATCH => 31,
|
203
|
+
:SUBSTRINGMATCH => 32,
|
204
|
+
:TILDE => 33,
|
205
|
+
:NOT_EQUAL => 34,
|
206
|
+
:SLASH => 35,
|
207
|
+
:DOUBLESLASH => 36,
|
208
|
+
:NOT => 37,
|
209
|
+
"." => 38,
|
210
|
+
"*" => 39,
|
211
|
+
"[" => 40,
|
212
|
+
"]" => 41,
|
213
|
+
")" => 42,
|
214
|
+
":" => 43,
|
215
|
+
"=" => 44 }
|
221
216
|
|
222
217
|
racc_nt_base = 45
|
223
218
|
|
219
|
+
racc_use_result_var = true
|
220
|
+
|
224
221
|
Racc_arg = [
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
222
|
+
racc_action_table,
|
223
|
+
racc_action_check,
|
224
|
+
racc_action_default,
|
225
|
+
racc_action_pointer,
|
226
|
+
racc_goto_table,
|
227
|
+
racc_goto_check,
|
228
|
+
racc_goto_default,
|
229
|
+
racc_goto_pointer,
|
230
|
+
racc_nt_base,
|
231
|
+
racc_reduce_table,
|
232
|
+
racc_token_table,
|
233
|
+
racc_shift_n,
|
234
|
+
racc_reduce_n,
|
235
|
+
racc_use_result_var ]
|
239
236
|
|
240
237
|
Racc_token_to_s_table = [
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
238
|
+
"$end",
|
239
|
+
"error",
|
240
|
+
"FUNCTION",
|
241
|
+
"INCLUDES",
|
242
|
+
"DASHMATCH",
|
243
|
+
"LBRACE",
|
244
|
+
"HASH",
|
245
|
+
"PLUS",
|
246
|
+
"GREATER",
|
247
|
+
"S",
|
248
|
+
"STRING",
|
249
|
+
"IDENT",
|
250
|
+
"COMMA",
|
251
|
+
"URI",
|
252
|
+
"CDO",
|
253
|
+
"CDC",
|
254
|
+
"NUMBER",
|
255
|
+
"PERCENTAGE",
|
256
|
+
"LENGTH",
|
257
|
+
"EMS",
|
258
|
+
"EXS",
|
259
|
+
"ANGLE",
|
260
|
+
"TIME",
|
261
|
+
"FREQ",
|
262
|
+
"IMPORTANT_SYM",
|
263
|
+
"IMPORT_SYM",
|
264
|
+
"MEDIA_SYM",
|
265
|
+
"PAGE_SYM",
|
266
|
+
"CHARSET_SYM",
|
267
|
+
"DIMENSION",
|
268
|
+
"PREFIXMATCH",
|
269
|
+
"SUFFIXMATCH",
|
270
|
+
"SUBSTRINGMATCH",
|
271
|
+
"TILDE",
|
272
|
+
"NOT_EQUAL",
|
273
|
+
"SLASH",
|
274
|
+
"DOUBLESLASH",
|
275
|
+
"NOT",
|
276
|
+
"\".\"",
|
277
|
+
"\"*\"",
|
278
|
+
"\"[\"",
|
279
|
+
"\"]\"",
|
280
|
+
"\")\"",
|
281
|
+
"\":\"",
|
282
|
+
"\"=\"",
|
283
|
+
"$start",
|
284
|
+
"selector",
|
285
|
+
"s_0toN",
|
286
|
+
"simple_selector_1toN",
|
287
|
+
"combinator",
|
288
|
+
"simple_selector",
|
289
|
+
"element_name",
|
290
|
+
"hcap_0toN",
|
291
|
+
"hcap_1toN",
|
292
|
+
"negation",
|
293
|
+
"function",
|
294
|
+
"attrib",
|
295
|
+
"class",
|
296
|
+
"attrib_val_0or1",
|
297
|
+
"expr",
|
298
|
+
"an_plus_b",
|
299
|
+
"pseudo",
|
300
|
+
"attribute_id",
|
301
|
+
"eql_incl_dash",
|
302
|
+
"negation_arg" ]
|
306
303
|
|
307
304
|
Racc_debug_parser = false
|
308
305
|
|
309
|
-
#####
|
306
|
+
##### State transition tables end #####
|
310
307
|
|
311
|
-
|
308
|
+
# reduce 0 omitted
|
312
309
|
|
313
|
-
module_eval
|
314
|
-
def _reduce_1(
|
315
|
-
|
316
|
-
|
310
|
+
module_eval(<<'.,.,', 'parser.y', 11)
|
311
|
+
def _reduce_1(val, _values, result)
|
312
|
+
result = [val.first, val.last].flatten
|
313
|
+
|
314
|
+
result
|
317
315
|
end
|
318
316
|
.,.,
|
319
317
|
|
320
|
-
module_eval
|
321
|
-
def _reduce_2(
|
322
|
-
|
323
|
-
|
318
|
+
module_eval(<<'.,.,', 'parser.y', 13)
|
319
|
+
def _reduce_2(val, _values, result)
|
320
|
+
result = val.flatten
|
321
|
+
result
|
324
322
|
end
|
325
323
|
.,.,
|
326
324
|
|
327
|
-
module_eval
|
328
|
-
def _reduce_3(
|
329
|
-
|
330
|
-
|
325
|
+
module_eval(<<'.,.,', 'parser.y', 16)
|
326
|
+
def _reduce_3(val, _values, result)
|
327
|
+
result = :DIRECT_ADJACENT_SELECTOR
|
328
|
+
result
|
331
329
|
end
|
332
330
|
.,.,
|
333
331
|
|
334
|
-
module_eval
|
335
|
-
def _reduce_4(
|
336
|
-
|
337
|
-
|
332
|
+
module_eval(<<'.,.,', 'parser.y', 17)
|
333
|
+
def _reduce_4(val, _values, result)
|
334
|
+
result = :CHILD_SELECTOR
|
335
|
+
result
|
338
336
|
end
|
339
337
|
.,.,
|
340
338
|
|
341
|
-
module_eval
|
342
|
-
def _reduce_5(
|
343
|
-
|
344
|
-
|
339
|
+
module_eval(<<'.,.,', 'parser.y', 18)
|
340
|
+
def _reduce_5(val, _values, result)
|
341
|
+
result = :PRECEDING_SELECTOR
|
342
|
+
result
|
345
343
|
end
|
346
344
|
.,.,
|
347
345
|
|
348
|
-
module_eval
|
349
|
-
def _reduce_6(
|
350
|
-
|
351
|
-
|
346
|
+
module_eval(<<'.,.,', 'parser.y', 19)
|
347
|
+
def _reduce_6(val, _values, result)
|
348
|
+
result = :DESCENDANT_SELECTOR
|
349
|
+
result
|
352
350
|
end
|
353
351
|
.,.,
|
354
352
|
|
355
|
-
module_eval
|
356
|
-
def _reduce_7(
|
357
|
-
|
358
|
-
|
353
|
+
module_eval(<<'.,.,', 'parser.y', 20)
|
354
|
+
def _reduce_7(val, _values, result)
|
355
|
+
result = :DESCENDANT_SELECTOR
|
356
|
+
result
|
359
357
|
end
|
360
358
|
.,.,
|
361
359
|
|
362
|
-
module_eval
|
363
|
-
def _reduce_8(
|
364
|
-
|
365
|
-
|
360
|
+
module_eval(<<'.,.,', 'parser.y', 21)
|
361
|
+
def _reduce_8(val, _values, result)
|
362
|
+
result = :CHILD_SELECTOR
|
363
|
+
result
|
366
364
|
end
|
367
365
|
.,.,
|
368
366
|
|
369
|
-
module_eval
|
370
|
-
def _reduce_9(
|
371
|
-
|
367
|
+
module_eval(<<'.,.,', 'parser.y', 25)
|
368
|
+
def _reduce_9(val, _values, result)
|
369
|
+
result = if val[1].nil?
|
372
370
|
val.first
|
373
371
|
else
|
374
372
|
Node.new(:CONDITIONAL_SELECTOR, [val.first, val[1]])
|
375
373
|
end
|
376
|
-
|
374
|
+
|
375
|
+
result
|
377
376
|
end
|
378
377
|
.,.,
|
379
378
|
|
380
|
-
module_eval
|
381
|
-
def _reduce_10(
|
382
|
-
|
379
|
+
module_eval(<<'.,.,', 'parser.y', 32)
|
380
|
+
def _reduce_10(val, _values, result)
|
381
|
+
result = Node.new(:CONDITIONAL_SELECTOR,
|
383
382
|
[
|
384
383
|
val.first,
|
385
384
|
Node.new(:COMBINATOR, [val[1], val.last])
|
386
385
|
]
|
387
386
|
)
|
388
|
-
|
387
|
+
|
388
|
+
result
|
389
389
|
end
|
390
390
|
.,.,
|
391
391
|
|
392
|
-
module_eval
|
393
|
-
def _reduce_11(
|
394
|
-
|
395
|
-
|
392
|
+
module_eval(<<'.,.,', 'parser.y', 40)
|
393
|
+
def _reduce_11(val, _values, result)
|
394
|
+
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
395
|
+
|
396
|
+
result
|
396
397
|
end
|
397
398
|
.,.,
|
398
399
|
|
399
|
-
|
400
|
+
# reduce 12 omitted
|
400
401
|
|
401
|
-
module_eval
|
402
|
-
def _reduce_13(
|
403
|
-
|
404
|
-
|
402
|
+
module_eval(<<'.,.,', 'parser.y', 44)
|
403
|
+
def _reduce_13(val, _values, result)
|
404
|
+
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
405
|
+
|
406
|
+
result
|
405
407
|
end
|
406
408
|
.,.,
|
407
409
|
|
408
|
-
module_eval
|
409
|
-
def _reduce_14(
|
410
|
-
|
410
|
+
module_eval(<<'.,.,', 'parser.y', 47)
|
411
|
+
def _reduce_14(val, _values, result)
|
412
|
+
result = Node.new(:CONDITIONAL_SELECTOR,
|
411
413
|
[
|
412
414
|
Node.new(:ELEMENT_NAME, ['*']),
|
413
415
|
Node.new(:COMBINATOR, val)
|
414
416
|
]
|
415
417
|
)
|
416
|
-
|
418
|
+
|
419
|
+
result
|
417
420
|
end
|
418
421
|
.,.,
|
419
422
|
|
420
|
-
module_eval
|
421
|
-
def _reduce_15(
|
422
|
-
|
423
|
+
module_eval(<<'.,.,', 'parser.y', 55)
|
424
|
+
def _reduce_15(val, _values, result)
|
425
|
+
result = Node.new(:CONDITIONAL_SELECTOR,
|
423
426
|
[Node.new(:ELEMENT_NAME, ['*']), val.first]
|
424
427
|
)
|
425
|
-
|
428
|
+
|
429
|
+
result
|
426
430
|
end
|
427
431
|
.,.,
|
428
432
|
|
429
|
-
module_eval
|
430
|
-
def _reduce_16(
|
431
|
-
|
432
|
-
|
433
|
+
module_eval(<<'.,.,', 'parser.y', 62)
|
434
|
+
def _reduce_16(val, _values, result)
|
435
|
+
result = Node.new(val[1], [val.first, val.last])
|
436
|
+
|
437
|
+
result
|
433
438
|
end
|
434
439
|
.,.,
|
435
440
|
|
436
|
-
|
441
|
+
# reduce 17 omitted
|
437
442
|
|
438
|
-
module_eval
|
439
|
-
def _reduce_18(
|
440
|
-
|
441
|
-
|
443
|
+
module_eval(<<'.,.,', 'parser.y', 67)
|
444
|
+
def _reduce_18(val, _values, result)
|
445
|
+
result = Node.new(:CLASS_CONDITION, [val[1]])
|
446
|
+
result
|
442
447
|
end
|
443
448
|
.,.,
|
444
449
|
|
445
|
-
module_eval
|
446
|
-
def _reduce_19(
|
447
|
-
|
448
|
-
|
450
|
+
module_eval(<<'.,.,', 'parser.y', 70)
|
451
|
+
def _reduce_19(val, _values, result)
|
452
|
+
result = Node.new(:ELEMENT_NAME, val)
|
453
|
+
result
|
449
454
|
end
|
450
455
|
.,.,
|
451
456
|
|
452
|
-
module_eval
|
453
|
-
def _reduce_20(
|
454
|
-
|
455
|
-
|
457
|
+
module_eval(<<'.,.,', 'parser.y', 71)
|
458
|
+
def _reduce_20(val, _values, result)
|
459
|
+
result = Node.new(:ELEMENT_NAME, val)
|
460
|
+
result
|
456
461
|
end
|
457
462
|
.,.,
|
458
463
|
|
459
|
-
module_eval
|
460
|
-
def _reduce_21(
|
461
|
-
|
464
|
+
module_eval(<<'.,.,', 'parser.y', 75)
|
465
|
+
def _reduce_21(val, _values, result)
|
466
|
+
result = Node.new(:ATTRIBUTE_CONDITION,
|
462
467
|
[Node.new(:ELEMENT_NAME, [val[2]])] + (val[4] || [])
|
463
468
|
)
|
464
|
-
|
469
|
+
|
470
|
+
result
|
465
471
|
end
|
466
472
|
.,.,
|
467
473
|
|
468
|
-
module_eval
|
469
|
-
def _reduce_22(
|
470
|
-
|
474
|
+
module_eval(<<'.,.,', 'parser.y', 80)
|
475
|
+
def _reduce_22(val, _values, result)
|
476
|
+
result = Node.new(:ATTRIBUTE_CONDITION,
|
471
477
|
[val[2]] + (val[4] || [])
|
472
478
|
)
|
473
|
-
|
479
|
+
|
480
|
+
result
|
474
481
|
end
|
475
482
|
.,.,
|
476
483
|
|
477
|
-
module_eval
|
478
|
-
def _reduce_23(
|
479
|
-
|
484
|
+
module_eval(<<'.,.,', 'parser.y', 85)
|
485
|
+
def _reduce_23(val, _values, result)
|
486
|
+
# Non standard, but hpricot supports it.
|
480
487
|
result = Node.new(:PSEUDO_CLASS,
|
481
488
|
[Node.new(:FUNCTION, ['nth-child(', val[2]])]
|
482
489
|
)
|
483
|
-
|
490
|
+
|
491
|
+
result
|
484
492
|
end
|
485
493
|
.,.,
|
486
494
|
|
487
|
-
module_eval
|
488
|
-
def _reduce_24(
|
489
|
-
|
490
|
-
|
495
|
+
module_eval(<<'.,.,', 'parser.y', 93)
|
496
|
+
def _reduce_24(val, _values, result)
|
497
|
+
result = Node.new(:FUNCTION, [val.first.strip])
|
498
|
+
|
499
|
+
result
|
491
500
|
end
|
492
501
|
.,.,
|
493
502
|
|
494
|
-
module_eval
|
495
|
-
def _reduce_25(
|
496
|
-
|
497
|
-
|
503
|
+
module_eval(<<'.,.,', 'parser.y', 96)
|
504
|
+
def _reduce_25(val, _values, result)
|
505
|
+
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
506
|
+
|
507
|
+
result
|
498
508
|
end
|
499
509
|
.,.,
|
500
510
|
|
501
|
-
module_eval
|
502
|
-
def _reduce_26(
|
503
|
-
|
504
|
-
|
511
|
+
module_eval(<<'.,.,', 'parser.y', 99)
|
512
|
+
def _reduce_26(val, _values, result)
|
513
|
+
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
514
|
+
|
515
|
+
result
|
505
516
|
end
|
506
517
|
.,.,
|
507
518
|
|
508
|
-
module_eval
|
509
|
-
def _reduce_27(
|
510
|
-
|
511
|
-
|
519
|
+
module_eval(<<'.,.,', 'parser.y', 102)
|
520
|
+
def _reduce_27(val, _values, result)
|
521
|
+
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
522
|
+
|
523
|
+
result
|
512
524
|
end
|
513
525
|
.,.,
|
514
526
|
|
515
|
-
module_eval
|
516
|
-
def _reduce_28(
|
517
|
-
|
518
|
-
|
527
|
+
module_eval(<<'.,.,', 'parser.y', 106)
|
528
|
+
def _reduce_28(val, _values, result)
|
529
|
+
result = [val.first, val.last]
|
530
|
+
result
|
519
531
|
end
|
520
532
|
.,.,
|
521
533
|
|
522
|
-
module_eval
|
523
|
-
def _reduce_29(
|
524
|
-
|
525
|
-
|
534
|
+
module_eval(<<'.,.,', 'parser.y', 107)
|
535
|
+
def _reduce_29(val, _values, result)
|
536
|
+
result = [val.first, val.last]
|
537
|
+
result
|
526
538
|
end
|
527
539
|
.,.,
|
528
540
|
|
529
|
-
|
541
|
+
# reduce 30 omitted
|
530
542
|
|
531
|
-
|
543
|
+
# reduce 31 omitted
|
532
544
|
|
533
|
-
module_eval
|
534
|
-
def _reduce_32(
|
535
|
-
|
545
|
+
module_eval(<<'.,.,', 'parser.y', 114)
|
546
|
+
def _reduce_32(val, _values, result)
|
547
|
+
if val[1] == 'n'
|
536
548
|
result = Node.new(:AN_PLUS_B, val)
|
537
549
|
else
|
538
550
|
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
539
551
|
end
|
540
|
-
|
552
|
+
|
553
|
+
result
|
541
554
|
end
|
542
555
|
.,.,
|
543
556
|
|
544
|
-
module_eval
|
545
|
-
def _reduce_33(
|
546
|
-
|
557
|
+
module_eval(<<'.,.,', 'parser.y', 120)
|
558
|
+
def _reduce_33(val, _values, result)
|
559
|
+
# n+3, -n+3
|
547
560
|
if val[0] == 'n'
|
548
561
|
val.unshift("1")
|
549
562
|
result = Node.new(:AN_PLUS_B, val)
|
@@ -554,26 +567,28 @@ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 131
|
|
554
567
|
else
|
555
568
|
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
556
569
|
end
|
557
|
-
|
570
|
+
|
571
|
+
result
|
558
572
|
end
|
559
573
|
.,.,
|
560
574
|
|
561
|
-
module_eval
|
562
|
-
def _reduce_34(
|
563
|
-
|
575
|
+
module_eval(<<'.,.,', 'parser.y', 134)
|
576
|
+
def _reduce_34(val, _values, result)
|
577
|
+
if val[1] == 'n'
|
564
578
|
val << "+"
|
565
579
|
val << "0"
|
566
580
|
result = Node.new(:AN_PLUS_B, val)
|
567
581
|
else
|
568
582
|
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
569
583
|
end
|
570
|
-
|
584
|
+
|
585
|
+
result
|
571
586
|
end
|
572
587
|
.,.,
|
573
588
|
|
574
|
-
module_eval
|
575
|
-
def _reduce_35(
|
576
|
-
|
589
|
+
module_eval(<<'.,.,', 'parser.y', 144)
|
590
|
+
def _reduce_35(val, _values, result)
|
591
|
+
if val[0] == 'even'
|
577
592
|
val = ["2","n","+","0"]
|
578
593
|
result = Node.new(:AN_PLUS_B, val)
|
579
594
|
elsif val[0] == 'odd'
|
@@ -582,120 +597,125 @@ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 154
|
|
582
597
|
else
|
583
598
|
raise Racc::ParseError, "parse error on IDENT '#{val[0]}'"
|
584
599
|
end
|
585
|
-
|
600
|
+
|
601
|
+
result
|
586
602
|
end
|
587
603
|
.,.,
|
588
604
|
|
589
|
-
module_eval
|
590
|
-
def _reduce_36(
|
591
|
-
|
592
|
-
|
605
|
+
module_eval(<<'.,.,', 'parser.y', 157)
|
606
|
+
def _reduce_36(val, _values, result)
|
607
|
+
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
608
|
+
|
609
|
+
result
|
593
610
|
end
|
594
611
|
.,.,
|
595
612
|
|
596
|
-
module_eval
|
597
|
-
def _reduce_37(
|
598
|
-
|
599
|
-
|
613
|
+
module_eval(<<'.,.,', 'parser.y', 159)
|
614
|
+
def _reduce_37(val, _values, result)
|
615
|
+
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
616
|
+
result
|
600
617
|
end
|
601
618
|
.,.,
|
602
619
|
|
603
|
-
|
620
|
+
# reduce 38 omitted
|
604
621
|
|
605
|
-
|
622
|
+
# reduce 39 omitted
|
606
623
|
|
607
|
-
module_eval
|
608
|
-
def _reduce_40(
|
609
|
-
|
610
|
-
|
624
|
+
module_eval(<<'.,.,', 'parser.y', 167)
|
625
|
+
def _reduce_40(val, _values, result)
|
626
|
+
result = Node.new(:COMBINATOR, val)
|
627
|
+
|
628
|
+
result
|
611
629
|
end
|
612
630
|
.,.,
|
613
631
|
|
614
|
-
module_eval
|
615
|
-
def _reduce_41(
|
616
|
-
|
617
|
-
|
632
|
+
module_eval(<<'.,.,', 'parser.y', 170)
|
633
|
+
def _reduce_41(val, _values, result)
|
634
|
+
result = Node.new(:COMBINATOR, val)
|
635
|
+
|
636
|
+
result
|
618
637
|
end
|
619
638
|
.,.,
|
620
639
|
|
621
|
-
module_eval
|
622
|
-
def _reduce_42(
|
623
|
-
|
624
|
-
|
640
|
+
module_eval(<<'.,.,', 'parser.y', 173)
|
641
|
+
def _reduce_42(val, _values, result)
|
642
|
+
result = Node.new(:COMBINATOR, val)
|
643
|
+
|
644
|
+
result
|
625
645
|
end
|
626
646
|
.,.,
|
627
647
|
|
628
|
-
module_eval
|
629
|
-
def _reduce_43(
|
630
|
-
|
631
|
-
|
648
|
+
module_eval(<<'.,.,', 'parser.y', 176)
|
649
|
+
def _reduce_43(val, _values, result)
|
650
|
+
result = Node.new(:COMBINATOR, val)
|
651
|
+
|
652
|
+
result
|
632
653
|
end
|
633
654
|
.,.,
|
634
655
|
|
635
|
-
|
656
|
+
# reduce 44 omitted
|
636
657
|
|
637
|
-
|
658
|
+
# reduce 45 omitted
|
638
659
|
|
639
|
-
|
660
|
+
# reduce 46 omitted
|
640
661
|
|
641
|
-
|
662
|
+
# reduce 47 omitted
|
642
663
|
|
643
|
-
module_eval
|
644
|
-
def _reduce_48(
|
645
|
-
|
646
|
-
|
664
|
+
module_eval(<<'.,.,', 'parser.y', 184)
|
665
|
+
def _reduce_48(val, _values, result)
|
666
|
+
result = Node.new(:ID, val)
|
667
|
+
result
|
647
668
|
end
|
648
669
|
.,.,
|
649
670
|
|
650
|
-
module_eval
|
651
|
-
def _reduce_49(
|
652
|
-
|
653
|
-
|
671
|
+
module_eval(<<'.,.,', 'parser.y', 187)
|
672
|
+
def _reduce_49(val, _values, result)
|
673
|
+
result = [val.first, val[2]]
|
674
|
+
result
|
654
675
|
end
|
655
676
|
.,.,
|
656
677
|
|
657
|
-
module_eval
|
658
|
-
def _reduce_50(
|
659
|
-
|
660
|
-
|
678
|
+
module_eval(<<'.,.,', 'parser.y', 188)
|
679
|
+
def _reduce_50(val, _values, result)
|
680
|
+
result = [val.first, val[2]]
|
681
|
+
result
|
661
682
|
end
|
662
683
|
.,.,
|
663
684
|
|
664
|
-
|
685
|
+
# reduce 51 omitted
|
665
686
|
|
666
|
-
|
687
|
+
# reduce 52 omitted
|
667
688
|
|
668
|
-
|
689
|
+
# reduce 53 omitted
|
669
690
|
|
670
|
-
|
691
|
+
# reduce 54 omitted
|
671
692
|
|
672
|
-
|
693
|
+
# reduce 55 omitted
|
673
694
|
|
674
|
-
|
695
|
+
# reduce 56 omitted
|
675
696
|
|
676
|
-
|
697
|
+
# reduce 57 omitted
|
677
698
|
|
678
|
-
|
699
|
+
# reduce 58 omitted
|
679
700
|
|
680
|
-
module_eval
|
681
|
-
def _reduce_59(
|
682
|
-
|
683
|
-
|
701
|
+
module_eval(<<'.,.,', 'parser.y', 202)
|
702
|
+
def _reduce_59(val, _values, result)
|
703
|
+
result = Node.new(:NOT, [val[2]])
|
704
|
+
|
705
|
+
result
|
684
706
|
end
|
685
707
|
.,.,
|
686
708
|
|
687
|
-
|
709
|
+
# reduce 60 omitted
|
688
710
|
|
689
|
-
|
711
|
+
# reduce 61 omitted
|
690
712
|
|
691
|
-
|
713
|
+
# reduce 62 omitted
|
692
714
|
|
693
|
-
|
694
|
-
|
695
|
-
|
715
|
+
def _reduce_none(val, _values, result)
|
716
|
+
val[0]
|
717
|
+
end
|
696
718
|
|
697
719
|
end # class GeneratedParser
|
698
|
-
|
699
|
-
end # module
|
700
|
-
|
701
|
-
end # module Nokogiri
|
720
|
+
end # module CSS
|
721
|
+
end # module Nokogiri
|