nokogiri 1.5.0.beta.3-java → 1.5.0.beta.4-java

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

Potentially problematic release.


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

Files changed (88) hide show
  1. data/CHANGELOG.ja.rdoc +32 -16
  2. data/CHANGELOG.rdoc +18 -0
  3. data/Manifest.txt +1 -2
  4. data/README.rdoc +27 -3
  5. data/Rakefile +39 -83
  6. data/ext/java/nokogiri/EncodingHandler.java +1 -1
  7. data/ext/java/nokogiri/HtmlDocument.java +11 -14
  8. data/ext/java/nokogiri/HtmlElementDescription.java +1 -1
  9. data/ext/java/nokogiri/HtmlEntityLookup.java +1 -1
  10. data/ext/java/nokogiri/HtmlSaxParserContext.java +13 -10
  11. data/ext/java/nokogiri/NokogiriService.java +103 -34
  12. data/ext/java/nokogiri/XmlAttr.java +14 -6
  13. data/ext/java/nokogiri/XmlAttributeDecl.java +1 -1
  14. data/ext/java/nokogiri/XmlCdata.java +3 -1
  15. data/ext/java/nokogiri/XmlComment.java +3 -1
  16. data/ext/java/nokogiri/XmlDocument.java +29 -8
  17. data/ext/java/nokogiri/XmlDocumentFragment.java +14 -13
  18. data/ext/java/nokogiri/XmlDtd.java +5 -2
  19. data/ext/java/nokogiri/XmlElement.java +2 -1
  20. data/ext/java/nokogiri/XmlElementContent.java +1 -1
  21. data/ext/java/nokogiri/XmlElementDecl.java +2 -1
  22. data/ext/java/nokogiri/XmlEntityDecl.java +2 -1
  23. data/ext/java/nokogiri/XmlEntityReference.java +1 -1
  24. data/ext/java/nokogiri/XmlNamespace.java +3 -2
  25. data/ext/java/nokogiri/XmlNode.java +17 -10
  26. data/ext/java/nokogiri/XmlNodeSet.java +40 -13
  27. data/ext/java/nokogiri/XmlProcessingInstruction.java +1 -1
  28. data/ext/java/nokogiri/XmlReader.java +3 -1
  29. data/ext/java/nokogiri/XmlRelaxng.java +37 -92
  30. data/ext/java/nokogiri/XmlSaxParserContext.java +25 -11
  31. data/ext/java/nokogiri/XmlSaxPushParser.java +6 -4
  32. data/ext/java/nokogiri/XmlSchema.java +190 -46
  33. data/ext/java/nokogiri/XmlSyntaxError.java +42 -37
  34. data/ext/java/nokogiri/XmlText.java +3 -2
  35. data/ext/java/nokogiri/XmlXpathContext.java +8 -4
  36. data/ext/java/nokogiri/XsltStylesheet.java +12 -10
  37. data/ext/java/nokogiri/internals/HtmlDomParserContext.java +8 -7
  38. data/ext/java/nokogiri/internals/NokogiriDocumentCache.java +1 -1
  39. data/ext/java/nokogiri/internals/NokogiriErrorHandler.java +11 -5
  40. data/ext/java/nokogiri/internals/NokogiriHandler.java +36 -9
  41. data/ext/java/nokogiri/internals/NokogiriHelpers.java +21 -22
  42. data/ext/java/nokogiri/internals/NokogiriNamespaceCache.java +5 -4
  43. data/ext/java/nokogiri/internals/NokogiriNamespaceContext.java +1 -1
  44. data/ext/java/nokogiri/internals/NokogiriNonStrictErrorHandler.java +2 -1
  45. data/ext/java/nokogiri/internals/NokogiriNonStrictErrorHandler4NekoHtml.java +1 -1
  46. data/ext/java/nokogiri/internals/NokogiriStrictErrorHandler.java +2 -1
  47. data/ext/java/nokogiri/internals/NokogiriXPathFunction.java +15 -9
  48. data/ext/java/nokogiri/internals/NokogiriXPathFunctionResolver.java +1 -1
  49. data/ext/java/nokogiri/internals/ParserContext.java +18 -7
  50. data/ext/java/nokogiri/internals/PushInputStream.java +1 -1
  51. data/ext/java/nokogiri/internals/ReaderNode.java +7 -6
  52. data/ext/java/nokogiri/internals/SaveContext.java +16 -10
  53. data/ext/java/nokogiri/internals/SchemaErrorHandler.java +13 -5
  54. data/ext/java/nokogiri/internals/XmlDeclHandler.java +1 -1
  55. data/ext/java/nokogiri/internals/XmlDomParser.java +1 -1
  56. data/ext/java/nokogiri/internals/XmlDomParserContext.java +13 -8
  57. data/ext/java/nokogiri/internals/XmlSaxParser.java +1 -1
  58. data/ext/java/nokogiri/internals/XsltExtensionFunction.java +1 -1
  59. data/ext/nokogiri/extconf.rb +3 -3
  60. data/ext/nokogiri/xml_document.c +9 -0
  61. data/ext/nokogiri/xml_sax_parser.c +4 -2
  62. data/lib/nokogiri.rb +9 -6
  63. data/lib/nokogiri/css.rb +1 -3
  64. data/lib/nokogiri/css/parser.rb +665 -70
  65. data/lib/nokogiri/css/parser.y +3 -1
  66. data/lib/nokogiri/css/parser_extras.rb +91 -0
  67. data/lib/nokogiri/css/tokenizer.rb +148 -3
  68. data/lib/nokogiri/css/tokenizer.rex +1 -1
  69. data/lib/nokogiri/html/document.rb +138 -11
  70. data/lib/nokogiri/html/sax/parser.rb +6 -2
  71. data/lib/nokogiri/nokogiri.jar +0 -0
  72. data/lib/nokogiri/version.rb +1 -1
  73. data/lib/nokogiri/xml/node.rb +2 -2
  74. data/lib/nokogiri/xml/node/save_options.rb +3 -0
  75. data/lib/nokogiri/xml/node_set.rb +1 -1
  76. data/test/css/test_tokenizer.rb +8 -0
  77. data/test/helper.rb +2 -0
  78. data/test/html/sax/test_parser.rb +43 -0
  79. data/test/html/test_document.rb +59 -0
  80. data/test/html/test_document_encoding.rb +48 -0
  81. data/test/html/test_element_description.rb +1 -1
  82. data/test/xml/sax/test_parser.rb +16 -0
  83. data/test/xml/test_document.rb +3 -1
  84. data/test/xml/test_node.rb +4 -1
  85. data/test/xml/test_node_set.rb +10 -0
  86. metadata +73 -82
  87. data/lib/nokogiri/css/generated_parser.rb +0 -676
  88. data/lib/nokogiri/css/generated_tokenizer.rb +0 -145
@@ -1,676 +0,0 @@
1
- #
2
- # DO NOT MODIFY!!!!
3
- # This file is automatically generated by Racc 1.4.6
4
- # from Racc grammer file "".
5
- #
6
-
7
- require 'racc/parser.rb'
8
-
9
-
10
- module Nokogiri
11
- module CSS
12
- class GeneratedParser < Racc::Parser
13
- ##### State transition tables begin ###
14
-
15
- racc_action_table = [
16
- 4, 56, 27, 22, 12, 24, 57, 4, 65, 1,
17
- 41, 12, 75, 57, 4, 23, 1, 82, 12, 19,
18
- 93, 92, 5, 1, 9, 10, 19, 13, 16, 5,
19
- 12, 9, 10, 19, 13, 16, 5, 5, 9, 10,
20
- 4, 13, 16, 16, 12, 41, 64, 4, 5, 1,
21
- 60, 10, 12, 59, 16, 59, 28, 1, 29, 19,
22
- 12, 12, 5, 62, 9, 10, 19, 13, 16, 12,
23
- 5, 9, 83, 10, 12, 13, 16, 84, 5, 5,
24
- 63, 10, 10, 12, 16, 16, 58, 5, 61, 62,
25
- 10, 4, 5, 16, 87, 10, 27, 53, 16, 54,
26
- 49, 5, 88, 41, 10, 68, 70, 16, 27, 53,
27
- 19, 54, 44, 91, 21, 9, 69, 71, 72, 94,
28
- 74, 68, 70, -23, 66, 33, 35, 37, 27, 53,
29
- 96, 54, 69, 71, 72, 32, 74, 34, 36, 97,
30
- 66, 27, 53, nil, 54 ]
31
-
32
- racc_action_check = [
33
- 0, 20, 4, 4, 0, 4, 43, 9, 27, 0,
34
- 39, 9, 29, 20, 31, 4, 9, 43, 31, 0,
35
- 73, 73, 0, 31, 0, 0, 9, 0, 0, 9,
36
- 7, 9, 9, 31, 9, 9, 31, 14, 31, 31,
37
- 57, 31, 31, 14, 57, 7, 26, 5, 7, 57,
38
- 22, 7, 41, 53, 7, 22, 5, 41, 5, 57,
39
- 8, 79, 57, 54, 57, 57, 5, 57, 57, 18,
40
- 41, 5, 55, 41, 17, 41, 41, 56, 8, 79,
41
- 25, 8, 79, 15, 8, 79, 21, 18, 24, 24,
42
- 18, 16, 17, 18, 60, 17, 59, 59, 17, 59,
43
- 16, 15, 61, 11, 15, 30, 30, 15, 19, 19,
44
- 16, 19, 10, 67, 2, 16, 30, 30, 30, 76,
45
- 30, 28, 28, 1, 30, 6, 6, 6, 62, 62,
46
- 81, 62, 28, 28, 28, 6, 28, 6, 6, 88,
47
- 28, 65, 65, nil, 65 ]
48
-
49
- racc_action_pointer = [
50
- -2, 95, 86, nil, -8, 45, 118, 24, 54, 5,
51
- 101, 82, nil, nil, 13, 77, 89, 68, 63, 98,
52
- 1, 75, 43, nil, 77, 57, 23, -4, 118, -13,
53
- 102, 12, nil, nil, nil, nil, nil, nil, nil, -11,
54
- nil, 46, nil, -6, nil, nil, nil, nil, nil, nil,
55
- nil, nil, nil, 41, 51, 49, 77, 38, nil, 86,
56
- 81, 95, 118, nil, nil, 131, nil, 88, nil, nil,
57
- nil, nil, nil, 10, nil, nil, 94, nil, nil, 55,
58
- nil, 107, nil, nil, nil, nil, nil, nil, 126, nil,
59
- nil, nil, nil, nil, nil, nil, nil, nil ]
60
-
61
- racc_action_default = [
62
- -24, -21, -69, -2, -69, -69, -18, -45, -50, -24,
63
- -69, -16, -54, -22, -12, -53, -69, -52, -51, -69,
64
- -69, -69, -38, -28, -36, -69, -69, -37, -57, -69,
65
- -57, -24, -5, -3, -8, -4, -7, -6, -9, -44,
66
- -11, -24, -46, -69, -19, -15, -13, -14, -49, -43,
67
- -42, -48, -47, -38, -36, -69, -69, -24, -20, -69,
68
- -69, -41, -69, -29, -30, -69, -58, -69, -63, -59,
69
- -64, -60, -61, -69, -62, -27, -69, -17, -10, -66,
70
- -68, -69, -32, -31, 98, -1, -35, -40, -69, -33,
71
- -34, -25, -55, -56, -26, -67, -65, -39 ]
72
-
73
- racc_goto_table = [
74
- 39, 42, 25, 40, 77, 30, 20, 45, 48, 79,
75
- 51, 52, 67, 46, 76, 43, 50, 55, 47, 38,
76
- 31, 26, 81, nil, nil, nil, nil, nil, nil, nil,
77
- 85, nil, nil, nil, 80, 78, nil, nil, nil, nil,
78
- nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
79
- nil, nil, nil, nil, nil, nil, nil, 86, nil, nil,
80
- 89, nil, nil, 90, nil, nil, nil, nil, nil, nil,
81
- nil, nil, 95 ]
82
-
83
- racc_goto_check = [
84
- 7, 7, 15, 8, 2, 9, 1, 8, 7, 5,
85
- 7, 7, 14, 10, 14, 1, 9, 15, 11, 6,
86
- 3, 16, 19, nil, nil, nil, nil, nil, nil, nil,
87
- 2, nil, nil, nil, 7, 8, nil, nil, nil, nil,
88
- nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
89
- nil, nil, nil, nil, nil, nil, nil, 15, nil, nil,
90
- 15, nil, nil, 15, nil, nil, nil, nil, nil, nil,
91
- nil, nil, 7 ]
92
-
93
- racc_goto_pointer = [
94
- nil, 6, -27, 14, nil, -32, 12, -7, -4, 0,
95
- -1, 4, nil, nil, -16, -2, 17, nil, nil, -19 ]
96
-
97
- racc_goto_default = [
98
- nil, nil, 3, nil, 6, 7, nil, 11, nil, 14,
99
- 15, 17, 18, 2, nil, nil, nil, 8, 73, nil ]
100
-
101
- racc_reduce_table = [
102
- 0, 0, :racc_error,
103
- 3, 32, :_reduce_1,
104
- 1, 32, :_reduce_2,
105
- 1, 34, :_reduce_3,
106
- 1, 34, :_reduce_4,
107
- 1, 34, :_reduce_5,
108
- 1, 34, :_reduce_6,
109
- 1, 34, :_reduce_7,
110
- 1, 34, :_reduce_8,
111
- 2, 35, :_reduce_9,
112
- 3, 35, :_reduce_10,
113
- 2, 35, :_reduce_11,
114
- 1, 35, :_reduce_none,
115
- 2, 35, :_reduce_13,
116
- 2, 35, :_reduce_14,
117
- 2, 35, :_reduce_15,
118
- 1, 35, :_reduce_16,
119
- 3, 33, :_reduce_17,
120
- 1, 33, :_reduce_none,
121
- 2, 43, :_reduce_19,
122
- 3, 36, :_reduce_20,
123
- 1, 36, :_reduce_21,
124
- 1, 36, :_reduce_22,
125
- 1, 44, :_reduce_23,
126
- 0, 44, :_reduce_none,
127
- 4, 42, :_reduce_25,
128
- 4, 42, :_reduce_26,
129
- 3, 42, :_reduce_27,
130
- 2, 40, :_reduce_28,
131
- 3, 40, :_reduce_29,
132
- 3, 40, :_reduce_30,
133
- 3, 40, :_reduce_31,
134
- 3, 40, :_reduce_32,
135
- 3, 46, :_reduce_33,
136
- 3, 46, :_reduce_34,
137
- 3, 46, :_reduce_35,
138
- 1, 46, :_reduce_none,
139
- 1, 46, :_reduce_none,
140
- 1, 46, :_reduce_38,
141
- 4, 47, :_reduce_39,
142
- 3, 47, :_reduce_40,
143
- 2, 47, :_reduce_41,
144
- 2, 41, :_reduce_42,
145
- 2, 41, :_reduce_43,
146
- 1, 37, :_reduce_none,
147
- 0, 37, :_reduce_none,
148
- 2, 38, :_reduce_46,
149
- 2, 38, :_reduce_47,
150
- 2, 38, :_reduce_48,
151
- 2, 38, :_reduce_49,
152
- 1, 38, :_reduce_none,
153
- 1, 38, :_reduce_none,
154
- 1, 38, :_reduce_none,
155
- 1, 38, :_reduce_none,
156
- 1, 48, :_reduce_54,
157
- 2, 45, :_reduce_55,
158
- 2, 45, :_reduce_56,
159
- 0, 45, :_reduce_none,
160
- 1, 49, :_reduce_58,
161
- 1, 49, :_reduce_59,
162
- 1, 49, :_reduce_60,
163
- 1, 49, :_reduce_61,
164
- 1, 49, :_reduce_62,
165
- 1, 49, :_reduce_63,
166
- 1, 49, :_reduce_64,
167
- 3, 39, :_reduce_65,
168
- 1, 50, :_reduce_none,
169
- 2, 50, :_reduce_none,
170
- 1, 50, :_reduce_none ]
171
-
172
- racc_reduce_n = 69
173
-
174
- racc_shift_n = 98
175
-
176
- racc_token_table = {
177
- false => 0,
178
- :error => 1,
179
- :FUNCTION => 2,
180
- :INCLUDES => 3,
181
- :DASHMATCH => 4,
182
- :LBRACE => 5,
183
- :HASH => 6,
184
- :PLUS => 7,
185
- :GREATER => 8,
186
- :S => 9,
187
- :STRING => 10,
188
- :IDENT => 11,
189
- :COMMA => 12,
190
- :NUMBER => 13,
191
- :PREFIXMATCH => 14,
192
- :SUFFIXMATCH => 15,
193
- :SUBSTRINGMATCH => 16,
194
- :TILDE => 17,
195
- :NOT_EQUAL => 18,
196
- :SLASH => 19,
197
- :DOUBLESLASH => 20,
198
- :NOT => 21,
199
- :EQUAL => 22,
200
- :RPAREN => 23,
201
- :LSQUARE => 24,
202
- :RSQUARE => 25,
203
- :HAS => 26,
204
- "." => 27,
205
- "|" => 28,
206
- "*" => 29,
207
- ":" => 30 }
208
-
209
- racc_nt_base = 31
210
-
211
- racc_use_result_var = true
212
-
213
- Racc_arg = [
214
- racc_action_table,
215
- racc_action_check,
216
- racc_action_default,
217
- racc_action_pointer,
218
- racc_goto_table,
219
- racc_goto_check,
220
- racc_goto_default,
221
- racc_goto_pointer,
222
- racc_nt_base,
223
- racc_reduce_table,
224
- racc_token_table,
225
- racc_shift_n,
226
- racc_reduce_n,
227
- racc_use_result_var ]
228
-
229
- Racc_token_to_s_table = [
230
- "$end",
231
- "error",
232
- "FUNCTION",
233
- "INCLUDES",
234
- "DASHMATCH",
235
- "LBRACE",
236
- "HASH",
237
- "PLUS",
238
- "GREATER",
239
- "S",
240
- "STRING",
241
- "IDENT",
242
- "COMMA",
243
- "NUMBER",
244
- "PREFIXMATCH",
245
- "SUFFIXMATCH",
246
- "SUBSTRINGMATCH",
247
- "TILDE",
248
- "NOT_EQUAL",
249
- "SLASH",
250
- "DOUBLESLASH",
251
- "NOT",
252
- "EQUAL",
253
- "RPAREN",
254
- "LSQUARE",
255
- "RSQUARE",
256
- "HAS",
257
- "\".\"",
258
- "\"|\"",
259
- "\"*\"",
260
- "\":\"",
261
- "$start",
262
- "selector",
263
- "simple_selector_1toN",
264
- "combinator",
265
- "simple_selector",
266
- "element_name",
267
- "hcap_0toN",
268
- "hcap_1toN",
269
- "negation",
270
- "function",
271
- "pseudo",
272
- "attrib",
273
- "class",
274
- "namespace",
275
- "attrib_val_0or1",
276
- "expr",
277
- "an_plus_b",
278
- "attribute_id",
279
- "eql_incl_dash",
280
- "negation_arg" ]
281
-
282
- Racc_debug_parser = false
283
-
284
- ##### State transition tables end #####
285
-
286
- # reduce 0 omitted
287
-
288
- def _reduce_1(val, _values, result)
289
- result = [val.first, val.last].flatten
290
-
291
- result
292
- end
293
-
294
- def _reduce_2(val, _values, result)
295
- result = val.flatten
296
- result
297
- end
298
-
299
- def _reduce_3(val, _values, result)
300
- result = :DIRECT_ADJACENT_SELECTOR
301
- result
302
- end
303
-
304
- def _reduce_4(val, _values, result)
305
- result = :CHILD_SELECTOR
306
- result
307
- end
308
-
309
- def _reduce_5(val, _values, result)
310
- result = :PRECEDING_SELECTOR
311
- result
312
- end
313
-
314
- def _reduce_6(val, _values, result)
315
- result = :DESCENDANT_SELECTOR
316
- result
317
- end
318
-
319
- def _reduce_7(val, _values, result)
320
- result = :DESCENDANT_SELECTOR
321
- result
322
- end
323
-
324
- def _reduce_8(val, _values, result)
325
- result = :CHILD_SELECTOR
326
- result
327
- end
328
-
329
- def _reduce_9(val, _values, result)
330
- result = if val[1].nil?
331
- val.first
332
- else
333
- Node.new(:CONDITIONAL_SELECTOR, [val.first, val[1]])
334
- end
335
-
336
- result
337
- end
338
-
339
- def _reduce_10(val, _values, result)
340
- result = Node.new(:CONDITIONAL_SELECTOR,
341
- [
342
- val.first,
343
- Node.new(:COMBINATOR, [val[1], val.last])
344
- ]
345
- )
346
-
347
- result
348
- end
349
-
350
- def _reduce_11(val, _values, result)
351
- result = Node.new(:CONDITIONAL_SELECTOR, val)
352
-
353
- result
354
- end
355
-
356
- # reduce 12 omitted
357
-
358
- def _reduce_13(val, _values, result)
359
- result = Node.new(:CONDITIONAL_SELECTOR, val)
360
-
361
- result
362
- end
363
-
364
- def _reduce_14(val, _values, result)
365
- result = Node.new(:CONDITIONAL_SELECTOR, val)
366
-
367
- result
368
- end
369
-
370
- def _reduce_15(val, _values, result)
371
- result = Node.new(:CONDITIONAL_SELECTOR,
372
- [
373
- Node.new(:ELEMENT_NAME, ['*']),
374
- Node.new(:COMBINATOR, val)
375
- ]
376
- )
377
-
378
- result
379
- end
380
-
381
- def _reduce_16(val, _values, result)
382
- result = Node.new(:CONDITIONAL_SELECTOR,
383
- [Node.new(:ELEMENT_NAME, ['*']), val.first]
384
- )
385
-
386
- result
387
- end
388
-
389
- def _reduce_17(val, _values, result)
390
- result = Node.new(val[1], [val.first, val.last])
391
-
392
- result
393
- end
394
-
395
- # reduce 18 omitted
396
-
397
- def _reduce_19(val, _values, result)
398
- result = Node.new(:CLASS_CONDITION, [val[1]])
399
- result
400
- end
401
-
402
- def _reduce_20(val, _values, result)
403
- result = Node.new(:ELEMENT_NAME,
404
- [[val.first, val.last].compact.join(':')]
405
- )
406
-
407
- result
408
- end
409
-
410
- def _reduce_21(val, _values, result)
411
- name = @namespaces.key?('xmlns') ? "xmlns:#{val.first}" : val.first
412
- result = Node.new(:ELEMENT_NAME, [name])
413
-
414
- result
415
- end
416
-
417
- def _reduce_22(val, _values, result)
418
- result = Node.new(:ELEMENT_NAME, val)
419
- result
420
- end
421
-
422
- def _reduce_23(val, _values, result)
423
- result = val[0]
424
- result
425
- end
426
-
427
- # reduce 24 omitted
428
-
429
- def _reduce_25(val, _values, result)
430
- result = Node.new(:ATTRIBUTE_CONDITION,
431
- [Node.new(:ELEMENT_NAME, [val[1]])] + (val[2] || [])
432
- )
433
-
434
- result
435
- end
436
-
437
- def _reduce_26(val, _values, result)
438
- result = Node.new(:ATTRIBUTE_CONDITION,
439
- [val[1]] + (val[2] || [])
440
- )
441
-
442
- result
443
- end
444
-
445
- def _reduce_27(val, _values, result)
446
- # Non standard, but hpricot supports it.
447
- result = Node.new(:PSEUDO_CLASS,
448
- [Node.new(:FUNCTION, ['nth-child(', val[1]])]
449
- )
450
-
451
- result
452
- end
453
-
454
- def _reduce_28(val, _values, result)
455
- result = Node.new(:FUNCTION, [val.first.strip])
456
-
457
- result
458
- end
459
-
460
- def _reduce_29(val, _values, result)
461
- result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
462
-
463
- result
464
- end
465
-
466
- def _reduce_30(val, _values, result)
467
- result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
468
-
469
- result
470
- end
471
-
472
- def _reduce_31(val, _values, result)
473
- result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
474
-
475
- result
476
- end
477
-
478
- def _reduce_32(val, _values, result)
479
- result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
480
-
481
- result
482
- end
483
-
484
- def _reduce_33(val, _values, result)
485
- result = [val.first, val.last]
486
- result
487
- end
488
-
489
- def _reduce_34(val, _values, result)
490
- result = [val.first, val.last]
491
- result
492
- end
493
-
494
- def _reduce_35(val, _values, result)
495
- result = [val.first, val.last]
496
- result
497
- end
498
-
499
- # reduce 36 omitted
500
-
501
- # reduce 37 omitted
502
-
503
- def _reduce_38(val, _values, result)
504
- if val[0] == 'even'
505
- val = ["2","n","+","0"]
506
- result = Node.new(:AN_PLUS_B, val)
507
- elsif val[0] == 'odd'
508
- val = ["2","n","+","1"]
509
- result = Node.new(:AN_PLUS_B, val)
510
- else
511
- # This is not CSS standard. It allows us to support this:
512
- # assert_xpath("//a[foo(., @href)]", @parser.parse('a:foo(@href)'))
513
- # assert_xpath("//a[foo(., @a, b)]", @parser.parse('a:foo(@a, b)'))
514
- # assert_xpath("//a[foo(., a, 10)]", @parser.parse('a:foo(a, 10)'))
515
- result = val
516
- end
517
-
518
- result
519
- end
520
-
521
- def _reduce_39(val, _values, result)
522
- if val[1] == 'n'
523
- result = Node.new(:AN_PLUS_B, val)
524
- else
525
- raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
526
- end
527
-
528
- result
529
- end
530
-
531
- def _reduce_40(val, _values, result)
532
- # n+3, -n+3
533
- if val[0] == 'n'
534
- val.unshift("1")
535
- result = Node.new(:AN_PLUS_B, val)
536
- elsif val[0] == '-n'
537
- val[0] = 'n'
538
- val.unshift("-1")
539
- result = Node.new(:AN_PLUS_B, val)
540
- else
541
- raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
542
- end
543
-
544
- result
545
- end
546
-
547
- def _reduce_41(val, _values, result)
548
- if val[1] == 'n'
549
- val << "+"
550
- val << "0"
551
- result = Node.new(:AN_PLUS_B, val)
552
- else
553
- raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
554
- end
555
-
556
- result
557
- end
558
-
559
- def _reduce_42(val, _values, result)
560
- result = Node.new(:PSEUDO_CLASS, [val[1]])
561
-
562
- result
563
- end
564
-
565
- def _reduce_43(val, _values, result)
566
- result = Node.new(:PSEUDO_CLASS, [val[1]])
567
- result
568
- end
569
-
570
- # reduce 44 omitted
571
-
572
- # reduce 45 omitted
573
-
574
- def _reduce_46(val, _values, result)
575
- result = Node.new(:COMBINATOR, val)
576
-
577
- result
578
- end
579
-
580
- def _reduce_47(val, _values, result)
581
- result = Node.new(:COMBINATOR, val)
582
-
583
- result
584
- end
585
-
586
- def _reduce_48(val, _values, result)
587
- result = Node.new(:COMBINATOR, val)
588
-
589
- result
590
- end
591
-
592
- def _reduce_49(val, _values, result)
593
- result = Node.new(:COMBINATOR, val)
594
-
595
- result
596
- end
597
-
598
- # reduce 50 omitted
599
-
600
- # reduce 51 omitted
601
-
602
- # reduce 52 omitted
603
-
604
- # reduce 53 omitted
605
-
606
- def _reduce_54(val, _values, result)
607
- result = Node.new(:ID, val)
608
- result
609
- end
610
-
611
- def _reduce_55(val, _values, result)
612
- result = [val.first, val[1]]
613
- result
614
- end
615
-
616
- def _reduce_56(val, _values, result)
617
- result = [val.first, val[1]]
618
- result
619
- end
620
-
621
- # reduce 57 omitted
622
-
623
- def _reduce_58(val, _values, result)
624
- result = :equal
625
- result
626
- end
627
-
628
- def _reduce_59(val, _values, result)
629
- result = :prefix_match
630
- result
631
- end
632
-
633
- def _reduce_60(val, _values, result)
634
- result = :suffix_match
635
- result
636
- end
637
-
638
- def _reduce_61(val, _values, result)
639
- result = :substring_match
640
- result
641
- end
642
-
643
- def _reduce_62(val, _values, result)
644
- result = :not_equal
645
- result
646
- end
647
-
648
- def _reduce_63(val, _values, result)
649
- result = :includes
650
- result
651
- end
652
-
653
- def _reduce_64(val, _values, result)
654
- result = :dash_match
655
- result
656
- end
657
-
658
- def _reduce_65(val, _values, result)
659
- result = Node.new(:NOT, [val[1]])
660
-
661
- result
662
- end
663
-
664
- # reduce 66 omitted
665
-
666
- # reduce 67 omitted
667
-
668
- # reduce 68 omitted
669
-
670
- def _reduce_none(val, _values, result)
671
- val[0]
672
- end
673
-
674
- end # class GeneratedParser
675
- end # module CSS
676
- end # module Nokogiri