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.

@@ -78,11 +78,11 @@ static VALUE attributes_eh(VALUE self)
78
78
 
79
79
  /*
80
80
  * call-seq:
81
- * attributes
81
+ * namespaces
82
82
  *
83
- * Get a Hash of attributes for this node
83
+ * Get a hash of namespaces for this Node
84
84
  */
85
- static VALUE attributes(VALUE self)
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, "attributes", attributes, 0);
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);
@@ -26,6 +26,7 @@ void init_xml_text()
26
26
  {
27
27
  VALUE nokogiri = rb_define_module("Nokogiri");
28
28
  VALUE xml = rb_define_module_under(nokogiri, "XML");
29
+ /* */
29
30
  VALUE node = rb_define_class_under(xml, "Node", rb_cObject);
30
31
 
31
32
  /*
@@ -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->node);
164
- assert(ctx->node->doc);
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->node->doc->_private
171
- );
169
+ (VALUE)ctx->doc->_private
170
+ );
172
171
  return xpath_object;
173
172
  }
174
173
 
@@ -5,7 +5,6 @@ require 'nokogiri/css/generated_tokenizer'
5
5
  require 'nokogiri/css/tokenizer'
6
6
  require 'nokogiri/css/parser'
7
7
  require 'nokogiri/css/syntax_error'
8
- require 'nokogiri/css/selector_handler'
9
8
 
10
9
  module Nokogiri
11
10
  module CSS
@@ -1,88 +1,16 @@
1
1
  #
2
2
  # DO NOT MODIFY!!!!
3
- # This file is automatically generated by racc 1.4.5
4
- # from racc grammer file "lib/nokogiri/css/parser.y".
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
- racc_token_table = {
174
- false => 0,
175
- Object.new => 1,
176
- :FUNCTION => 2,
177
- :INCLUDES => 3,
178
- :DASHMATCH => 4,
179
- :LBRACE => 5,
180
- :HASH => 6,
181
- :PLUS => 7,
182
- :GREATER => 8,
183
- :S => 9,
184
- :STRING => 10,
185
- :IDENT => 11,
186
- :COMMA => 12,
187
- :URI => 13,
188
- :CDO => 14,
189
- :CDC => 15,
190
- :NUMBER => 16,
191
- :PERCENTAGE => 17,
192
- :LENGTH => 18,
193
- :EMS => 19,
194
- :EXS => 20,
195
- :ANGLE => 21,
196
- :TIME => 22,
197
- :FREQ => 23,
198
- :IMPORTANT_SYM => 24,
199
- :IMPORT_SYM => 25,
200
- :MEDIA_SYM => 26,
201
- :PAGE_SYM => 27,
202
- :CHARSET_SYM => 28,
203
- :DIMENSION => 29,
204
- :PREFIXMATCH => 30,
205
- :SUFFIXMATCH => 31,
206
- :SUBSTRINGMATCH => 32,
207
- :TILDE => 33,
208
- :NOT_EQUAL => 34,
209
- :SLASH => 35,
210
- :DOUBLESLASH => 36,
211
- :NOT => 37,
212
- "." => 38,
213
- "*" => 39,
214
- "[" => 40,
215
- "]" => 41,
216
- ")" => 42,
217
- ":" => 43,
218
- "=" => 44 }
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
- racc_use_result_var = true
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
- racc_action_table,
226
- racc_action_check,
227
- racc_action_default,
228
- racc_action_pointer,
229
- racc_goto_table,
230
- racc_goto_check,
231
- racc_goto_default,
232
- racc_goto_pointer,
233
- racc_nt_base,
234
- racc_reduce_table,
235
- racc_token_table,
236
- racc_shift_n,
237
- racc_reduce_n,
238
- racc_use_result_var ]
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
- '$end',
242
- 'error',
243
- 'FUNCTION',
244
- 'INCLUDES',
245
- 'DASHMATCH',
246
- 'LBRACE',
247
- 'HASH',
248
- 'PLUS',
249
- 'GREATER',
250
- 'S',
251
- 'STRING',
252
- 'IDENT',
253
- 'COMMA',
254
- 'URI',
255
- 'CDO',
256
- 'CDC',
257
- 'NUMBER',
258
- 'PERCENTAGE',
259
- 'LENGTH',
260
- 'EMS',
261
- 'EXS',
262
- 'ANGLE',
263
- 'TIME',
264
- 'FREQ',
265
- 'IMPORTANT_SYM',
266
- 'IMPORT_SYM',
267
- 'MEDIA_SYM',
268
- 'PAGE_SYM',
269
- 'CHARSET_SYM',
270
- 'DIMENSION',
271
- 'PREFIXMATCH',
272
- 'SUFFIXMATCH',
273
- 'SUBSTRINGMATCH',
274
- 'TILDE',
275
- 'NOT_EQUAL',
276
- 'SLASH',
277
- 'DOUBLESLASH',
278
- 'NOT',
279
- '"."',
280
- '"*"',
281
- '"["',
282
- '"]"',
283
- '")"',
284
- '":"',
285
- '"="',
286
- '$start',
287
- 'selector',
288
- 's_0toN',
289
- 'simple_selector_1toN',
290
- 'combinator',
291
- 'simple_selector',
292
- 'element_name',
293
- 'hcap_0toN',
294
- 'hcap_1toN',
295
- 'negation',
296
- 'function',
297
- 'attrib',
298
- 'class',
299
- 'attrib_val_0or1',
300
- 'expr',
301
- 'an_plus_b',
302
- 'pseudo',
303
- 'attribute_id',
304
- 'eql_incl_dash',
305
- 'negation_arg']
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
- ##### racc system variables end #####
306
+ ##### State transition tables end #####
310
307
 
311
- # reduce 0 omitted
308
+ # reduce 0 omitted
312
309
 
313
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 13
314
- def _reduce_1( val, _values, result )
315
- result = [val.first, val.last].flatten
316
- result
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 <<'.,.,', 'lib/nokogiri/css/parser.y', 13
321
- def _reduce_2( val, _values, result )
322
- result = val.flatten
323
- result
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 <<'.,.,', 'lib/nokogiri/css/parser.y', 16
328
- def _reduce_3( val, _values, result )
329
- result = :DIRECT_ADJACENT_SELECTOR
330
- result
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 <<'.,.,', 'lib/nokogiri/css/parser.y', 17
335
- def _reduce_4( val, _values, result )
336
- result = :CHILD_SELECTOR
337
- result
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 <<'.,.,', 'lib/nokogiri/css/parser.y', 18
342
- def _reduce_5( val, _values, result )
343
- result = :PRECEDING_SELECTOR
344
- result
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 <<'.,.,', 'lib/nokogiri/css/parser.y', 19
349
- def _reduce_6( val, _values, result )
350
- result = :DESCENDANT_SELECTOR
351
- result
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 <<'.,.,', 'lib/nokogiri/css/parser.y', 20
356
- def _reduce_7( val, _values, result )
357
- result = :DESCENDANT_SELECTOR
358
- result
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 <<'.,.,', 'lib/nokogiri/css/parser.y', 21
363
- def _reduce_8( val, _values, result )
364
- result = :CHILD_SELECTOR
365
- result
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 <<'.,.,', 'lib/nokogiri/css/parser.y', 31
370
- def _reduce_9( val, _values, result )
371
- result = if val[1].nil?
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
- result
374
+
375
+ result
377
376
  end
378
377
  .,.,
379
378
 
380
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 39
381
- def _reduce_10( val, _values, result )
382
- result = Node.new(:CONDITIONAL_SELECTOR,
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
- result
387
+
388
+ result
389
389
  end
390
390
  .,.,
391
391
 
392
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 42
393
- def _reduce_11( val, _values, result )
394
- result = Node.new(:CONDITIONAL_SELECTOR, val)
395
- result
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
- # reduce 12 omitted
400
+ # reduce 12 omitted
400
401
 
401
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 46
402
- def _reduce_13( val, _values, result )
403
- result = Node.new(:CONDITIONAL_SELECTOR, val)
404
- result
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 <<'.,.,', 'lib/nokogiri/css/parser.y', 54
409
- def _reduce_14( val, _values, result )
410
- result = Node.new(:CONDITIONAL_SELECTOR,
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
- result
418
+
419
+ result
417
420
  end
418
421
  .,.,
419
422
 
420
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 59
421
- def _reduce_15( val, _values, result )
422
- result = Node.new(:CONDITIONAL_SELECTOR,
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
- result
428
+
429
+ result
426
430
  end
427
431
  .,.,
428
432
 
429
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 64
430
- def _reduce_16( val, _values, result )
431
- result = Node.new(val[1], [val.first, val.last])
432
- result
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
- # reduce 17 omitted
441
+ # reduce 17 omitted
437
442
 
438
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 67
439
- def _reduce_18( val, _values, result )
440
- result = Node.new(:CLASS_CONDITION, [val[1]])
441
- result
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 <<'.,.,', 'lib/nokogiri/css/parser.y', 70
446
- def _reduce_19( val, _values, result )
447
- result = Node.new(:ELEMENT_NAME, val)
448
- result
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 <<'.,.,', 'lib/nokogiri/css/parser.y', 71
453
- def _reduce_20( val, _values, result )
454
- result = Node.new(:ELEMENT_NAME, val)
455
- result
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 <<'.,.,', 'lib/nokogiri/css/parser.y', 79
460
- def _reduce_21( val, _values, result )
461
- result = Node.new(:ATTRIBUTE_CONDITION,
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
- result
469
+
470
+ result
465
471
  end
466
472
  .,.,
467
473
 
468
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 84
469
- def _reduce_22( val, _values, result )
470
- result = Node.new(:ATTRIBUTE_CONDITION,
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
- result
479
+
480
+ result
474
481
  end
475
482
  .,.,
476
483
 
477
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 90
478
- def _reduce_23( val, _values, result )
479
- # Non standard, but hpricot supports it.
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
- result
490
+
491
+ result
484
492
  end
485
493
  .,.,
486
494
 
487
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 95
488
- def _reduce_24( val, _values, result )
489
- result = Node.new(:FUNCTION, [val.first.strip])
490
- result
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 <<'.,.,', 'lib/nokogiri/css/parser.y', 98
495
- def _reduce_25( val, _values, result )
496
- result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
497
- result
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 <<'.,.,', 'lib/nokogiri/css/parser.y', 101
502
- def _reduce_26( val, _values, result )
503
- result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
504
- result
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 <<'.,.,', 'lib/nokogiri/css/parser.y', 104
509
- def _reduce_27( val, _values, result )
510
- result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
511
- result
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 <<'.,.,', 'lib/nokogiri/css/parser.y', 106
516
- def _reduce_28( val, _values, result )
517
- result = [val.first, val.last]
518
- result
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 <<'.,.,', 'lib/nokogiri/css/parser.y', 107
523
- def _reduce_29( val, _values, result )
524
- result = [val.first, val.last]
525
- result
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
- # reduce 30 omitted
541
+ # reduce 30 omitted
530
542
 
531
- # reduce 31 omitted
543
+ # reduce 31 omitted
532
544
 
533
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 120
534
- def _reduce_32( val, _values, result )
535
- if val[1] == 'n'
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
- result
552
+
553
+ result
541
554
  end
542
555
  .,.,
543
556
 
544
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 131
545
- def _reduce_33( val, _values, result )
546
- # n+3, -n+3
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
- result
570
+
571
+ result
558
572
  end
559
573
  .,.,
560
574
 
561
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 142
562
- def _reduce_34( val, _values, result )
563
- if val[1] == 'n'
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
- result
584
+
585
+ result
571
586
  end
572
587
  .,.,
573
588
 
574
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 154
575
- def _reduce_35( val, _values, result )
576
- if val[0] == 'even'
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
- result
600
+
601
+ result
586
602
  end
587
603
  .,.,
588
604
 
589
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 159
590
- def _reduce_36( val, _values, result )
591
- result = Node.new(:PSEUDO_CLASS, [val[1]])
592
- result
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 <<'.,.,', 'lib/nokogiri/css/parser.y', 159
597
- def _reduce_37( val, _values, result )
598
- result = Node.new(:PSEUDO_CLASS, [val[1]])
599
- result
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
- # reduce 38 omitted
620
+ # reduce 38 omitted
604
621
 
605
- # reduce 39 omitted
622
+ # reduce 39 omitted
606
623
 
607
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 169
608
- def _reduce_40( val, _values, result )
609
- result = Node.new(:COMBINATOR, val)
610
- result
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 <<'.,.,', 'lib/nokogiri/css/parser.y', 172
615
- def _reduce_41( val, _values, result )
616
- result = Node.new(:COMBINATOR, val)
617
- result
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 <<'.,.,', 'lib/nokogiri/css/parser.y', 175
622
- def _reduce_42( val, _values, result )
623
- result = Node.new(:COMBINATOR, val)
624
- result
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 <<'.,.,', 'lib/nokogiri/css/parser.y', 178
629
- def _reduce_43( val, _values, result )
630
- result = Node.new(:COMBINATOR, val)
631
- result
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
- # reduce 44 omitted
656
+ # reduce 44 omitted
636
657
 
637
- # reduce 45 omitted
658
+ # reduce 45 omitted
638
659
 
639
- # reduce 46 omitted
660
+ # reduce 46 omitted
640
661
 
641
- # reduce 47 omitted
662
+ # reduce 47 omitted
642
663
 
643
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 184
644
- def _reduce_48( val, _values, result )
645
- result = Node.new(:ID, val)
646
- result
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 <<'.,.,', 'lib/nokogiri/css/parser.y', 187
651
- def _reduce_49( val, _values, result )
652
- result = [val.first, val[2]]
653
- result
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 <<'.,.,', 'lib/nokogiri/css/parser.y', 188
658
- def _reduce_50( val, _values, result )
659
- result = [val.first, val[2]]
660
- result
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
- # reduce 51 omitted
685
+ # reduce 51 omitted
665
686
 
666
- # reduce 52 omitted
687
+ # reduce 52 omitted
667
688
 
668
- # reduce 53 omitted
689
+ # reduce 53 omitted
669
690
 
670
- # reduce 54 omitted
691
+ # reduce 54 omitted
671
692
 
672
- # reduce 55 omitted
693
+ # reduce 55 omitted
673
694
 
674
- # reduce 56 omitted
695
+ # reduce 56 omitted
675
696
 
676
- # reduce 57 omitted
697
+ # reduce 57 omitted
677
698
 
678
- # reduce 58 omitted
699
+ # reduce 58 omitted
679
700
 
680
- module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 204
681
- def _reduce_59( val, _values, result )
682
- result = Node.new(:NOT, [val[2]])
683
- result
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
- # reduce 60 omitted
709
+ # reduce 60 omitted
688
710
 
689
- # reduce 61 omitted
711
+ # reduce 61 omitted
690
712
 
691
- # reduce 62 omitted
713
+ # reduce 62 omitted
692
714
 
693
- def _reduce_none( val, _values, result )
694
- result
695
- end
715
+ def _reduce_none(val, _values, result)
716
+ val[0]
717
+ end
696
718
 
697
719
  end # class GeneratedParser
698
-
699
- end # module CSS
700
-
701
- end # module Nokogiri
720
+ end # module CSS
721
+ end # module Nokogiri