nokogiri 1.10.8-java → 1.11.0.rc3-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 (107) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -22
  3. data/ext/java/nokogiri/HtmlDocument.java +34 -46
  4. data/ext/java/nokogiri/HtmlSaxParserContext.java +87 -57
  5. data/ext/java/nokogiri/NokogiriService.java +1 -1
  6. data/ext/java/nokogiri/XmlAttr.java +13 -20
  7. data/ext/java/nokogiri/XmlAttributeDecl.java +11 -12
  8. data/ext/java/nokogiri/XmlCdata.java +3 -4
  9. data/ext/java/nokogiri/XmlComment.java +1 -1
  10. data/ext/java/nokogiri/XmlDocument.java +148 -175
  11. data/ext/java/nokogiri/XmlDocumentFragment.java +13 -31
  12. data/ext/java/nokogiri/XmlDtd.java +5 -8
  13. data/ext/java/nokogiri/XmlElement.java +1 -20
  14. data/ext/java/nokogiri/XmlElementDecl.java +23 -28
  15. data/ext/java/nokogiri/XmlEntityDecl.java +23 -27
  16. data/ext/java/nokogiri/XmlEntityReference.java +2 -2
  17. data/ext/java/nokogiri/XmlNamespace.java +72 -89
  18. data/ext/java/nokogiri/XmlNode.java +300 -401
  19. data/ext/java/nokogiri/XmlNodeSet.java +72 -77
  20. data/ext/java/nokogiri/XmlReader.java +10 -11
  21. data/ext/java/nokogiri/XmlSaxParserContext.java +7 -7
  22. data/ext/java/nokogiri/XmlSchema.java +3 -3
  23. data/ext/java/nokogiri/XmlText.java +12 -9
  24. data/ext/java/nokogiri/XmlXpathContext.java +7 -7
  25. data/ext/java/nokogiri/XsltStylesheet.java +7 -15
  26. data/ext/java/nokogiri/internals/HtmlDomParserContext.java +4 -10
  27. data/ext/java/nokogiri/internals/NokogiriHelpers.java +71 -135
  28. data/ext/java/nokogiri/internals/NokogiriNamespaceCache.java +90 -58
  29. data/ext/java/nokogiri/internals/NokogiriXPathFunction.java +5 -4
  30. data/ext/java/nokogiri/internals/ParserContext.java +27 -73
  31. data/ext/java/nokogiri/internals/ReaderNode.java +2 -4
  32. data/ext/java/nokogiri/internals/XmlDomParserContext.java +17 -32
  33. data/ext/nokogiri/extconf.rb +50 -37
  34. data/ext/nokogiri/nokogiri.c +12 -6
  35. data/ext/nokogiri/nokogiri.h +13 -0
  36. data/ext/nokogiri/xml_document.c +16 -2
  37. data/ext/nokogiri/xml_io.c +8 -6
  38. data/ext/nokogiri/xml_node.c +20 -0
  39. data/ext/nokogiri/xml_reader.c +6 -17
  40. data/ext/nokogiri/xml_schema.c +29 -0
  41. data/ext/nokogiri/xslt_stylesheet.c +0 -4
  42. data/lib/nokogiri.rb +3 -20
  43. data/lib/nokogiri/css.rb +1 -0
  44. data/lib/nokogiri/css/node.rb +1 -0
  45. data/lib/nokogiri/css/parser.rb +61 -60
  46. data/lib/nokogiri/css/parser_extras.rb +39 -36
  47. data/lib/nokogiri/css/syntax_error.rb +1 -0
  48. data/lib/nokogiri/css/tokenizer.rb +1 -0
  49. data/lib/nokogiri/css/xpath_visitor.rb +3 -1
  50. data/lib/nokogiri/decorators/slop.rb +1 -0
  51. data/lib/nokogiri/html.rb +1 -0
  52. data/lib/nokogiri/html/builder.rb +1 -0
  53. data/lib/nokogiri/html/document.rb +1 -0
  54. data/lib/nokogiri/html/document_fragment.rb +1 -0
  55. data/lib/nokogiri/html/element_description.rb +1 -0
  56. data/lib/nokogiri/html/element_description_defaults.rb +1 -0
  57. data/lib/nokogiri/html/entity_lookup.rb +1 -0
  58. data/lib/nokogiri/html/sax/parser.rb +1 -0
  59. data/lib/nokogiri/html/sax/parser_context.rb +1 -0
  60. data/lib/nokogiri/html/sax/push_parser.rb +1 -0
  61. data/lib/nokogiri/jruby/dependencies.rb +20 -0
  62. data/lib/nokogiri/nokogiri.jar +0 -0
  63. data/lib/nokogiri/syntax_error.rb +1 -0
  64. data/lib/nokogiri/version.rb +86 -45
  65. data/lib/nokogiri/xml.rb +1 -0
  66. data/lib/nokogiri/xml/attr.rb +1 -0
  67. data/lib/nokogiri/xml/attribute_decl.rb +1 -0
  68. data/lib/nokogiri/xml/builder.rb +3 -2
  69. data/lib/nokogiri/xml/cdata.rb +1 -0
  70. data/lib/nokogiri/xml/character_data.rb +1 -0
  71. data/lib/nokogiri/xml/document.rb +3 -8
  72. data/lib/nokogiri/xml/document_fragment.rb +1 -0
  73. data/lib/nokogiri/xml/dtd.rb +1 -0
  74. data/lib/nokogiri/xml/element_content.rb +1 -0
  75. data/lib/nokogiri/xml/element_decl.rb +1 -0
  76. data/lib/nokogiri/xml/entity_decl.rb +1 -0
  77. data/lib/nokogiri/xml/entity_reference.rb +1 -0
  78. data/lib/nokogiri/xml/namespace.rb +1 -0
  79. data/lib/nokogiri/xml/node.rb +539 -224
  80. data/lib/nokogiri/xml/node/save_options.rb +1 -0
  81. data/lib/nokogiri/xml/node_set.rb +1 -0
  82. data/lib/nokogiri/xml/notation.rb +1 -0
  83. data/lib/nokogiri/xml/parse_options.rb +4 -3
  84. data/lib/nokogiri/xml/pp.rb +1 -0
  85. data/lib/nokogiri/xml/pp/character_data.rb +1 -0
  86. data/lib/nokogiri/xml/pp/node.rb +1 -0
  87. data/lib/nokogiri/xml/processing_instruction.rb +1 -0
  88. data/lib/nokogiri/xml/reader.rb +7 -3
  89. data/lib/nokogiri/xml/relax_ng.rb +1 -0
  90. data/lib/nokogiri/xml/sax.rb +1 -0
  91. data/lib/nokogiri/xml/sax/document.rb +1 -0
  92. data/lib/nokogiri/xml/sax/parser.rb +1 -0
  93. data/lib/nokogiri/xml/sax/parser_context.rb +1 -0
  94. data/lib/nokogiri/xml/sax/push_parser.rb +1 -0
  95. data/lib/nokogiri/xml/schema.rb +1 -0
  96. data/lib/nokogiri/xml/searchable.rb +22 -15
  97. data/lib/nokogiri/xml/syntax_error.rb +1 -0
  98. data/lib/nokogiri/xml/text.rb +1 -0
  99. data/lib/nokogiri/xml/xpath.rb +1 -0
  100. data/lib/nokogiri/xml/xpath/syntax_error.rb +1 -0
  101. data/lib/nokogiri/xml/xpath_context.rb +1 -0
  102. data/lib/nokogiri/xslt.rb +1 -0
  103. data/lib/nokogiri/xslt/stylesheet.rb +1 -0
  104. data/lib/xsd/xmlparser/nokogiri.rb +1 -0
  105. metadata +53 -34
  106. data/ext/java/nokogiri/internals/NokogiriEncodingReaderWrapper.java +0 -107
  107. data/ext/java/nokogiri/internals/UncloseableInputStream.java +0 -102
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Nokogiri
2
3
  module CSS
3
4
  class Node
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # DO NOT MODIFY!!!!
3
- # This file is automatically generated by Racc 1.4.14
4
- # from Racc grammer file "".
4
+ # This file is automatically generated by Racc 1.4.16
5
+ # from Racc grammar file "".
5
6
  #
6
7
 
7
8
  require 'racc/parser.rb'
@@ -333,42 +334,42 @@ Racc_debug_parser = false
333
334
 
334
335
  def _reduce_1(val, _values, result)
335
336
  result = [val.first, val.last].flatten
336
-
337
+
337
338
  result
338
339
  end
339
340
 
340
341
  def _reduce_2(val, _values, result)
341
- result = val.flatten
342
+ result = val.flatten
342
343
  result
343
344
  end
344
345
 
345
346
  def _reduce_3(val, _values, result)
346
- result = [val.last].flatten
347
+ result = [val.last].flatten
347
348
  result
348
349
  end
349
350
 
350
351
  def _reduce_4(val, _values, result)
351
- result = :DIRECT_ADJACENT_SELECTOR
352
+ result = :DIRECT_ADJACENT_SELECTOR
352
353
  result
353
354
  end
354
355
 
355
356
  def _reduce_5(val, _values, result)
356
- result = :CHILD_SELECTOR
357
+ result = :CHILD_SELECTOR
357
358
  result
358
359
  end
359
360
 
360
361
  def _reduce_6(val, _values, result)
361
- result = :FOLLOWING_SELECTOR
362
+ result = :FOLLOWING_SELECTOR
362
363
  result
363
364
  end
364
365
 
365
366
  def _reduce_7(val, _values, result)
366
- result = :DESCENDANT_SELECTOR
367
+ result = :DESCENDANT_SELECTOR
367
368
  result
368
369
  end
369
370
 
370
371
  def _reduce_8(val, _values, result)
371
- result = :CHILD_SELECTOR
372
+ result = :CHILD_SELECTOR
372
373
  result
373
374
  end
374
375
 
@@ -378,7 +379,7 @@ def _reduce_9(val, _values, result)
378
379
  else
379
380
  Node.new(:CONDITIONAL_SELECTOR, [val.first, val[1]])
380
381
  end
381
-
382
+
382
383
  result
383
384
  end
384
385
 
@@ -386,13 +387,13 @@ end
386
387
 
387
388
  def _reduce_11(val, _values, result)
388
389
  result = Node.new(:CONDITIONAL_SELECTOR, val)
389
-
390
+
390
391
  result
391
392
  end
392
393
 
393
394
  def _reduce_12(val, _values, result)
394
395
  result = Node.new(:CONDITIONAL_SELECTOR, val)
395
-
396
+
396
397
  result
397
398
  end
398
399
 
@@ -400,39 +401,39 @@ def _reduce_13(val, _values, result)
400
401
  result = Node.new(:CONDITIONAL_SELECTOR,
401
402
  [Node.new(:ELEMENT_NAME, ['*']), val.first]
402
403
  )
403
-
404
+
404
405
  result
405
406
  end
406
407
 
407
408
  def _reduce_14(val, _values, result)
408
409
  result = Node.new(val.first, [nil, val.last])
409
-
410
+
410
411
  result
411
412
  end
412
413
 
413
414
  def _reduce_15(val, _values, result)
414
415
  result = Node.new(val[1], [val.first, val.last])
415
-
416
+
416
417
  result
417
418
  end
418
419
 
419
420
  def _reduce_16(val, _values, result)
420
421
  result = Node.new(:DESCENDANT_SELECTOR, [val.first, val.last])
421
-
422
+
422
423
  result
423
424
  end
424
425
 
425
426
  # reduce 17 omitted
426
427
 
427
428
  def _reduce_18(val, _values, result)
428
- result = Node.new(:CLASS_CONDITION, [unescape_css_identifier(val[1])])
429
+ result = Node.new(:CLASS_CONDITION, [unescape_css_identifier(val[1])])
429
430
  result
430
431
  end
431
432
 
432
433
  # reduce 19 omitted
433
434
 
434
435
  def _reduce_20(val, _values, result)
435
- result = Node.new(:ELEMENT_NAME, val)
436
+ result = Node.new(:ELEMENT_NAME, val)
436
437
  result
437
438
  end
438
439
 
@@ -440,19 +441,19 @@ def _reduce_21(val, _values, result)
440
441
  result = Node.new(:ELEMENT_NAME,
441
442
  [[val.first, val.last].compact.join(':')]
442
443
  )
443
-
444
+
444
445
  result
445
446
  end
446
447
 
447
448
  def _reduce_22(val, _values, result)
448
449
  name = @namespaces.key?('xmlns') ? "xmlns:#{val.first}" : val.first
449
450
  result = Node.new(:ELEMENT_NAME, [name])
450
-
451
+
451
452
  result
452
453
  end
453
454
 
454
455
  def _reduce_23(val, _values, result)
455
- result = val[0]
456
+ result = val[0]
456
457
  result
457
458
  end
458
459
 
@@ -462,7 +463,7 @@ def _reduce_25(val, _values, result)
462
463
  result = Node.new(:ATTRIBUTE_CONDITION,
463
464
  [val[1]] + (val[2] || [])
464
465
  )
465
-
466
+
466
467
  result
467
468
  end
468
469
 
@@ -470,7 +471,7 @@ def _reduce_26(val, _values, result)
470
471
  result = Node.new(:ATTRIBUTE_CONDITION,
471
472
  [val[1]] + (val[2] || [])
472
473
  )
473
-
474
+
474
475
  result
475
476
  end
476
477
 
@@ -479,7 +480,7 @@ def _reduce_27(val, _values, result)
479
480
  result = Node.new(:PSEUDO_CLASS,
480
481
  [Node.new(:FUNCTION, ['nth-child(', val[1]])]
481
482
  )
482
-
483
+
483
484
  result
484
485
  end
485
486
 
@@ -487,7 +488,7 @@ def _reduce_28(val, _values, result)
487
488
  result = Node.new(:ELEMENT_NAME,
488
489
  [[val.first, val.last].compact.join(':')]
489
490
  )
490
-
491
+
491
492
  result
492
493
  end
493
494
 
@@ -495,52 +496,52 @@ def _reduce_29(val, _values, result)
495
496
  # Default namespace is not applied to attributes.
496
497
  # So we don't add prefix "xmlns:" as in namespaced_ident.
497
498
  result = Node.new(:ELEMENT_NAME, [val.first])
498
-
499
+
499
500
  result
500
501
  end
501
502
 
502
503
  def _reduce_30(val, _values, result)
503
504
  result = Node.new(:FUNCTION, [val.first.strip])
504
-
505
+
505
506
  result
506
507
  end
507
508
 
508
509
  def _reduce_31(val, _values, result)
509
510
  result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
510
-
511
+
511
512
  result
512
513
  end
513
514
 
514
515
  def _reduce_32(val, _values, result)
515
516
  result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
516
-
517
+
517
518
  result
518
519
  end
519
520
 
520
521
  def _reduce_33(val, _values, result)
521
522
  result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
522
-
523
+
523
524
  result
524
525
  end
525
526
 
526
527
  def _reduce_34(val, _values, result)
527
528
  result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
528
-
529
+
529
530
  result
530
531
  end
531
532
 
532
533
  def _reduce_35(val, _values, result)
533
- result = [val.first, val.last]
534
+ result = [val.first, val.last]
534
535
  result
535
536
  end
536
537
 
537
538
  def _reduce_36(val, _values, result)
538
- result = [val.first, val.last]
539
+ result = [val.first, val.last]
539
540
  result
540
541
  end
541
542
 
542
543
  def _reduce_37(val, _values, result)
543
- result = [val.first, val.last]
544
+ result = [val.first, val.last]
544
545
  result
545
546
  end
546
547
 
@@ -563,7 +564,7 @@ def _reduce_40(val, _values, result)
563
564
  # assert_xpath("//a[foo(., a, 10)]", @parser.parse('a:foo(a, 10)'))
564
565
  result = val
565
566
  end
566
-
567
+
567
568
  result
568
569
  end
569
570
 
@@ -573,7 +574,7 @@ def _reduce_41(val, _values, result)
573
574
  else
574
575
  raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
575
576
  end
576
-
577
+
577
578
  result
578
579
  end
579
580
 
@@ -589,7 +590,7 @@ def _reduce_42(val, _values, result)
589
590
  else
590
591
  raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
591
592
  end
592
-
593
+
593
594
  result
594
595
  end
595
596
 
@@ -609,18 +610,18 @@ def _reduce_43(val, _values, result)
609
610
  else
610
611
  raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
611
612
  end
612
-
613
+
613
614
  result
614
615
  end
615
616
 
616
617
  def _reduce_44(val, _values, result)
617
618
  result = Node.new(:PSEUDO_CLASS, [val[1]])
618
-
619
+
619
620
  result
620
621
  end
621
622
 
622
623
  def _reduce_45(val, _values, result)
623
- result = Node.new(:PSEUDO_CLASS, [val[1]])
624
+ result = Node.new(:PSEUDO_CLASS, [val[1]])
624
625
  result
625
626
  end
626
627
 
@@ -630,31 +631,31 @@ end
630
631
 
631
632
  def _reduce_48(val, _values, result)
632
633
  result = Node.new(:COMBINATOR, val)
633
-
634
+
634
635
  result
635
636
  end
636
637
 
637
638
  def _reduce_49(val, _values, result)
638
639
  result = Node.new(:COMBINATOR, val)
639
-
640
+
640
641
  result
641
642
  end
642
643
 
643
644
  def _reduce_50(val, _values, result)
644
645
  result = Node.new(:COMBINATOR, val)
645
-
646
+
646
647
  result
647
648
  end
648
649
 
649
650
  def _reduce_51(val, _values, result)
650
651
  result = Node.new(:COMBINATOR, val)
651
-
652
+
652
653
  result
653
654
  end
654
655
 
655
656
  def _reduce_52(val, _values, result)
656
657
  result = Node.new(:COMBINATOR, val)
657
-
658
+
658
659
  result
659
660
  end
660
661
 
@@ -669,65 +670,65 @@ end
669
670
  # reduce 57 omitted
670
671
 
671
672
  def _reduce_58(val, _values, result)
672
- result = Node.new(:ID, [unescape_css_identifier(val.first)])
673
+ result = Node.new(:ID, [unescape_css_identifier(val.first)])
673
674
  result
674
675
  end
675
676
 
676
677
  def _reduce_59(val, _values, result)
677
- result = [val.first, unescape_css_identifier(val[1])]
678
+ result = [val.first, unescape_css_identifier(val[1])]
678
679
  result
679
680
  end
680
681
 
681
682
  def _reduce_60(val, _values, result)
682
- result = [val.first, unescape_css_string(val[1])]
683
+ result = [val.first, unescape_css_string(val[1])]
683
684
  result
684
685
  end
685
686
 
686
687
  def _reduce_61(val, _values, result)
687
- result = [val.first, val[1]]
688
+ result = [val.first, val[1]]
688
689
  result
689
690
  end
690
691
 
691
692
  # reduce 62 omitted
692
693
 
693
694
  def _reduce_63(val, _values, result)
694
- result = :equal
695
+ result = :equal
695
696
  result
696
697
  end
697
698
 
698
699
  def _reduce_64(val, _values, result)
699
- result = :prefix_match
700
+ result = :prefix_match
700
701
  result
701
702
  end
702
703
 
703
704
  def _reduce_65(val, _values, result)
704
- result = :suffix_match
705
+ result = :suffix_match
705
706
  result
706
707
  end
707
708
 
708
709
  def _reduce_66(val, _values, result)
709
- result = :substring_match
710
+ result = :substring_match
710
711
  result
711
712
  end
712
713
 
713
714
  def _reduce_67(val, _values, result)
714
- result = :not_equal
715
+ result = :not_equal
715
716
  result
716
717
  end
717
718
 
718
719
  def _reduce_68(val, _values, result)
719
- result = :includes
720
+ result = :includes
720
721
  result
721
722
  end
722
723
 
723
724
  def _reduce_69(val, _values, result)
724
- result = :dash_match
725
+ result = :dash_match
725
726
  result
726
727
  end
727
728
 
728
729
  def _reduce_70(val, _values, result)
729
730
  result = Node.new(:NOT, [val[1]])
730
-
731
+
731
732
  result
732
733
  end
733
734
 
@@ -746,5 +747,5 @@ def _reduce_none(val, _values, result)
746
747
  end
747
748
 
748
749
  end # class Parser
749
- end # module CSS
750
- end # module Nokogiri
750
+ end # module CSS
751
+ end # module Nokogiri
@@ -1,63 +1,66 @@
1
- require 'thread'
1
+ # frozen_string_literal: true
2
+ require "thread"
2
3
 
3
4
  module Nokogiri
4
5
  module CSS
5
6
  class Parser < Racc::Parser
6
- @cache_on = true
7
- @cache = {}
8
- @mutex = Mutex.new
7
+ CACHE_SWITCH_NAME = :nokogiri_css_parser_cache_is_off
8
+
9
+ @cache = {}
10
+ @mutex = Mutex.new
9
11
 
10
12
  class << self
11
- # Turn on CSS parse caching
12
- attr_accessor :cache_on
13
- alias :cache_on? :cache_on
14
- alias :set_cache :cache_on=
13
+ # Return a thread-local boolean indicating whether the CSS-to-XPath cache is active. (Default is `true`.)
14
+ def cache_on?
15
+ !Thread.current[CACHE_SWITCH_NAME]
16
+ end
17
+
18
+ # Set a thread-local boolean to turn cacheing on and off. Truthy values turn the cache on, falsey values turn the cache off.
19
+ def set_cache(value)
20
+ Thread.current[CACHE_SWITCH_NAME] = !value
21
+ end
15
22
 
16
23
  # Get the css selector in +string+ from the cache
17
- def [] string
18
- return unless @cache_on
24
+ def [](string)
25
+ return unless cache_on?
19
26
  @mutex.synchronize { @cache[string] }
20
27
  end
21
28
 
22
29
  # Set the css selector in +string+ in the cache to +value+
23
- def []= string, value
24
- return value unless @cache_on
30
+ def []=(string, value)
31
+ return value unless cache_on?
25
32
  @mutex.synchronize { @cache[string] = value }
26
33
  end
27
34
 
28
35
  # Clear the cache
29
- def clear_cache
30
- @mutex.synchronize { @cache = {} }
36
+ def clear_cache(create_new_object = false)
37
+ @mutex.synchronize do
38
+ if create_new_object
39
+ @cache = {}
40
+ else
41
+ @cache.clear
42
+ end
43
+ end
31
44
  end
32
45
 
33
46
  # Execute +block+ without cache
34
- def without_cache &block
35
- tmp = @cache_on
36
- @cache_on = false
47
+ def without_cache(&block)
48
+ original_cache_setting = cache_on?
49
+ set_cache false
37
50
  block.call
38
- @cache_on = tmp
39
- end
40
-
41
- ###
42
- # Parse this CSS selector in +selector+. Returns an AST.
43
- def parse selector
44
- @warned ||= false
45
- unless @warned
46
- $stderr.puts('Nokogiri::CSS::Parser.parse is deprecated, call Nokogiri::CSS.parse(), this will be removed August 1st or version 1.4.0 (whichever is first)')
47
- @warned = true
48
- end
49
- new.parse selector
51
+ ensure
52
+ set_cache original_cache_setting
50
53
  end
51
54
  end
52
55
 
53
56
  # Create a new CSS parser with respect to +namespaces+
54
- def initialize namespaces = {}
55
- @tokenizer = Tokenizer.new
57
+ def initialize(namespaces = {})
58
+ @tokenizer = Tokenizer.new
56
59
  @namespaces = namespaces
57
60
  super()
58
61
  end
59
62
 
60
- def parse string
63
+ def parse(string)
61
64
  @tokenizer.scan_setup string
62
65
  do_parse
63
66
  end
@@ -67,14 +70,14 @@ module Nokogiri
67
70
  end
68
71
 
69
72
  # Get the xpath for +string+ using +options+
70
- def xpath_for string, options={}
73
+ def xpath_for(string, options = {})
71
74
  key = "#{string}#{options[:ns]}#{options[:prefix]}"
72
75
  v = self.class[key]
73
76
  return v if v
74
77
 
75
78
  args = [
76
- options[:prefix] || '//',
77
- options[:visitor] || XPathVisitor.new
79
+ options[:prefix] || "//",
80
+ options[:visitor] || XPathVisitor.new,
78
81
  ]
79
82
  self.class[key] = parse(string).map { |ast|
80
83
  ast.to_xpath(*args)
@@ -82,7 +85,7 @@ module Nokogiri
82
85
  end
83
86
 
84
87
  # On CSS parser error, raise an exception
85
- def on_error error_token_id, error_value, value_stack
88
+ def on_error(error_token_id, error_value, value_stack)
86
89
  after = value_stack.compact.last
87
90
  raise SyntaxError.new("unexpected '#{error_value}' after '#{after}'")
88
91
  end