nokogiri 1.4.2.1-x86-mswin32 → 1.4.3-x86-mswin32

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 (56) hide show
  1. data/CHANGELOG.ja.rdoc +28 -8
  2. data/CHANGELOG.rdoc +23 -0
  3. data/Manifest.txt +2 -1
  4. data/README.ja.rdoc +1 -1
  5. data/README.rdoc +22 -4
  6. data/Rakefile +6 -2
  7. data/ext/nokogiri/extconf.rb +50 -30
  8. data/ext/nokogiri/nokogiri.h +2 -0
  9. data/ext/nokogiri/xml_document.c +5 -0
  10. data/ext/nokogiri/xml_libxml2_hacks.c +112 -0
  11. data/ext/nokogiri/xml_libxml2_hacks.h +12 -0
  12. data/ext/nokogiri/xml_node.c +58 -12
  13. data/ext/nokogiri/xml_node_set.c +7 -7
  14. data/ext/nokogiri/xml_reader.c +20 -1
  15. data/ext/nokogiri/xml_xpath_context.c +2 -0
  16. data/lib/nokogiri/1.8/nokogiri.so +0 -0
  17. data/lib/nokogiri/1.9/nokogiri.so +0 -0
  18. data/lib/nokogiri/css/generated_parser.rb +155 -148
  19. data/lib/nokogiri/css/generated_tokenizer.rb +2 -1
  20. data/lib/nokogiri/css/parser.y +3 -0
  21. data/lib/nokogiri/css/xpath_visitor.rb +1 -7
  22. data/lib/nokogiri/ffi/libxml.rb +29 -4
  23. data/lib/nokogiri/ffi/xml/document.rb +4 -0
  24. data/lib/nokogiri/ffi/xml/node.rb +27 -19
  25. data/lib/nokogiri/ffi/xml/node_set.rb +3 -3
  26. data/lib/nokogiri/ffi/xml/reader.rb +4 -0
  27. data/lib/nokogiri/html.rb +2 -2
  28. data/lib/nokogiri/html/document_fragment.rb +7 -4
  29. data/lib/nokogiri/version.rb +2 -1
  30. data/lib/nokogiri/xml/builder.rb +1 -1
  31. data/lib/nokogiri/xml/document.rb +1 -2
  32. data/lib/nokogiri/xml/document_fragment.rb +7 -0
  33. data/lib/nokogiri/xml/node.rb +4 -2
  34. data/lib/nokogiri/xml/node_set.rb +25 -0
  35. data/lib/nokogiri/xml/reader.rb +2 -0
  36. data/lib/nokogiri/xml/sax/document.rb +3 -1
  37. data/test/css/test_parser.rb +11 -1
  38. data/test/html/sax/test_parser_context.rb +2 -2
  39. data/test/html/test_document.rb +2 -2
  40. data/test/html/test_document_fragment.rb +34 -6
  41. data/test/test_memory_leak.rb +2 -2
  42. data/test/test_reader.rb +28 -6
  43. data/test/test_xslt_transforms.rb +29 -28
  44. data/test/xml/test_attr.rb +31 -4
  45. data/test/xml/test_builder.rb +5 -5
  46. data/test/xml/test_cdata.rb +3 -3
  47. data/test/xml/test_document.rb +8 -8
  48. data/test/xml/test_document_fragment.rb +2 -2
  49. data/test/xml/test_node.rb +1 -1
  50. data/test/xml/test_node_reparenting.rb +26 -11
  51. data/test/xml/test_node_set.rb +38 -2
  52. data/test/xml/test_text.rb +11 -2
  53. data/test/xml/test_unparented_node.rb +1 -1
  54. data/test/xml/test_xpath.rb +78 -11
  55. metadata +24 -6
  56. data/lib/nokogiri/version_warning.rb +0 -14
@@ -49,8 +49,8 @@ static VALUE push(VALUE self, VALUE rb_node)
49
49
  xmlNodeSetPtr node_set;
50
50
  xmlNodePtr node;
51
51
 
52
- if(!rb_obj_is_kind_of(rb_node, cNokogiriXmlNode))
53
- rb_raise(rb_eArgError, "node must be a Nokogiri::XML::Node");
52
+ if(!(rb_obj_is_kind_of(rb_node, cNokogiriXmlNode) || rb_obj_is_kind_of(rb_node, cNokogiriXmlNamespace)))
53
+ rb_raise(rb_eArgError, "node must be a Nokogiri::XML::Node or Nokogiri::XML::Namespace");
54
54
 
55
55
  Data_Get_Struct(self, xmlNodeSet, node_set);
56
56
  Data_Get_Struct(rb_node, xmlNode, node);
@@ -70,9 +70,9 @@ static VALUE delete(VALUE self, VALUE rb_node)
70
70
  xmlNodeSetPtr node_set ;
71
71
  xmlNodePtr node ;
72
72
 
73
- if(!rb_obj_is_kind_of(rb_node, cNokogiriXmlNode))
74
- rb_raise(rb_eArgError, "node must be a Nokogiri::XML::Node");
75
-
73
+ if(!(rb_obj_is_kind_of(rb_node, cNokogiriXmlNode) || rb_obj_is_kind_of(rb_node, cNokogiriXmlNamespace)))
74
+ rb_raise(rb_eArgError, "node must be a Nokogiri::XML::Node or Nokogiri::XML::Namespace");
75
+
76
76
  Data_Get_Struct(self, xmlNodeSet, node_set);
77
77
  Data_Get_Struct(rb_node, xmlNode, node);
78
78
 
@@ -117,8 +117,8 @@ static VALUE include_eh(VALUE self, VALUE rb_node)
117
117
  xmlNodeSetPtr node_set;
118
118
  xmlNodePtr node;
119
119
 
120
- if(!rb_obj_is_kind_of(rb_node, cNokogiriXmlNode))
121
- rb_raise(rb_eArgError, "node must be a Nokogiri::XML::Node");
120
+ if(!(rb_obj_is_kind_of(rb_node, cNokogiriXmlNode) || rb_obj_is_kind_of(rb_node, cNokogiriXmlNamespace)))
121
+ rb_raise(rb_eArgError, "node must be a Nokogiri::XML::Node or Nokogiri::XML::Namespace");
122
122
 
123
123
  Data_Get_Struct(self, xmlNodeSet, node_set);
124
124
  Data_Get_Struct(rb_node, xmlNode, node);
@@ -523,7 +523,7 @@ static VALUE outer_xml(VALUE self)
523
523
  Data_Get_Struct(self, xmlTextReader, reader);
524
524
 
525
525
  value = xmlTextReaderReadOuterXml(reader);
526
-
526
+
527
527
  if(value) {
528
528
  str = NOKOGIRI_STR_NEW2((char*)value);
529
529
  xmlFree(value);
@@ -620,6 +620,24 @@ static VALUE from_io(int argc, VALUE *argv, VALUE klass)
620
620
  return rb_reader;
621
621
  }
622
622
 
623
+ /*
624
+ * call-seq:
625
+ * reader.empty_element? # => true or false
626
+ *
627
+ * Returns true if the current node is empty, otherwise false.
628
+ */
629
+ static VALUE empty_element_p(VALUE self)
630
+ {
631
+ xmlTextReaderPtr reader;
632
+
633
+ Data_Get_Struct(self, xmlTextReader, reader);
634
+
635
+ if(xmlTextReaderIsEmptyElement(reader))
636
+ return Qtrue;
637
+
638
+ return Qfalse;
639
+ }
640
+
623
641
  VALUE cNokogiriXmlReader;
624
642
 
625
643
  void init_xml_reader()
@@ -656,6 +674,7 @@ void init_xml_reader()
656
674
  rb_define_method(klass, "attribute", reader_attribute, 1);
657
675
  rb_define_method(klass, "namespaces", namespaces, 0);
658
676
  rb_define_method(klass, "attribute_at", attribute_at, 1);
677
+ rb_define_method(klass, "empty_element?", empty_element_p, 0);
659
678
  rb_define_method(klass, "attributes?", attributes_eh, 0);
660
679
  rb_define_method(klass, "value?", value_eh, 0);
661
680
  rb_define_method(klass, "default?", default_eh, 0);
@@ -227,6 +227,8 @@ static VALUE evaluate(int argc, VALUE *argv, VALUE self)
227
227
  DOC_RUBY_OBJECT(ctx->doc));
228
228
  }
229
229
 
230
+ xmlXPathFreeNodeSetList(xpath);
231
+
230
232
  return thing;
231
233
  }
232
234
 
Binary file
Binary file
@@ -13,90 +13,90 @@ module Nokogiri
13
13
  ##### State transition tables begin ###
14
14
 
15
15
  racc_action_table = [
16
- 3, 55, 26, 21, 12, 24, 56, 3, 81, 1,
17
- 41, 12, 41, 56, 3, 23, 1, 80, 12, 18,
18
- 92, 91, 4, 1, 9, 10, 18, 13, 16, 4,
19
- 12, 9, 10, 18, 13, 16, 4, 12, 9, 10,
20
- 3, 13, 16, 73, 12, 12, 60, 61, 4, 1,
21
- 57, 10, 12, 44, 16, 4, 61, 1, 10, 18,
22
- 41, 16, 4, 4, 9, 10, 10, 13, 16, 16,
23
- 4, 3, 58, 10, 3, 13, 16, 57, 12, 12,
24
- 27, 82, 28, 48, 26, 51, 12, 53, 26, 51,
25
- 18, 53, 83, 18, 4, 9, 4, 4, 9, 10,
26
- 10, 63, 16, 16, 4, 66, 68, 10, 26, 51,
27
- 16, 53, 86, 87, 66, 68, 67, 69, 70, 62,
28
- 72, 59, 90, 54, 64, 67, 69, 70, 93, 72,
29
- 32, 34, 36, 64, 26, 51, -22, 53, 95, 96,
30
- 31, nil, 33, 35 ]
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
31
 
32
32
  racc_action_check = [
33
- 0, 20, 3, 3, 0, 3, 43, 30, 52, 0,
34
- 39, 30, 11, 20, 56, 3, 30, 43, 56, 0,
35
- 71, 71, 0, 56, 0, 0, 30, 0, 0, 30,
36
- 8, 30, 30, 56, 30, 30, 56, 6, 56, 56,
37
- 9, 56, 56, 28, 9, 7, 24, 24, 8, 9,
38
- 51, 8, 41, 10, 8, 6, 53, 41, 6, 9,
39
- 7, 6, 9, 7, 9, 9, 7, 9, 9, 7,
40
- 41, 4, 21, 41, 16, 41, 41, 21, 15, 17,
41
- 4, 54, 4, 16, 63, 63, 77, 63, 61, 61,
42
- 4, 61, 55, 16, 14, 4, 15, 17, 16, 15,
43
- 17, 26, 15, 17, 77, 29, 29, 77, 57, 57,
44
- 77, 57, 58, 60, 27, 27, 29, 29, 29, 25,
45
- 29, 22, 65, 19, 29, 27, 27, 27, 74, 27,
46
- 5, 5, 5, 27, 18, 18, 1, 18, 79, 87,
47
- 5, nil, 5, 5 ]
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
48
 
49
49
  racc_action_pointer = [
50
- -2, 108, nil, -8, 69, 123, 31, 39, 24, 38,
51
- 42, -9, nil, nil, 70, 72, 72, 73, 124, 95,
52
- 1, 65, 98, nil, 35, 96, 89, 111, 18, 102,
53
- 5, nil, nil, nil, nil, nil, nil, nil, nil, -11,
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
54
  nil, 46, nil, -6, nil, nil, nil, nil, nil, nil,
55
- nil, 38, -15, 44, 70, 92, 12, 98, 99, nil,
56
- 106, 78, nil, 74, nil, 97, nil, nil, nil, nil,
57
- nil, 10, nil, nil, 103, nil, nil, 80, nil, 115,
58
- nil, nil, nil, nil, nil, nil, nil, 126, nil, nil,
59
- nil, 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
60
 
61
61
  racc_action_default = [
62
- -23, -20, -2, -68, -68, -17, -52, -44, -49, -23,
63
- -68, -15, -53, -21, -12, -51, -68, -50, -68, -68,
64
- -68, -37, -68, -27, -35, -68, -36, -56, -68, -56,
65
- -23, -5, -3, -8, -4, -7, -6, -48, -9, -43,
66
- -11, -23, -45, -68, -18, -14, -13, -47, -42, -41,
67
- -46, -37, -68, -35, -68, -68, -23, -68, -68, -28,
68
- -40, -68, -29, -68, -57, -68, -62, -58, -63, -59,
69
- -60, -68, -61, -26, -68, -16, -10, -65, -67, -68,
70
- -31, -30, -19, 97, -1, -34, -39, -68, -32, -33,
71
- -24, -54, -55, -25, -66, -64, -38 ]
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
72
 
73
73
  racc_goto_table = [
74
- 37, 39, 42, 22, 40, 75, 20, 29, 45, 47,
75
- 65, 50, 74, 38, 46, 43, 77, 30, 52, 49,
76
- 25, 79, nil, nil, nil, nil, nil, nil, nil, nil,
77
- nil, 84, nil, nil, nil, 78, 76, nil, nil, nil,
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
78
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
79
- nil, nil, nil, nil, nil, nil, nil, 85, nil, nil,
80
- nil, 88, nil, 89, nil, nil, nil, nil, nil, nil,
81
- nil, 94 ]
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
82
 
83
83
  racc_goto_check = [
84
- 7, 7, 7, 14, 8, 2, 1, 9, 8, 7,
85
- 13, 7, 13, 6, 10, 1, 5, 3, 14, 9,
86
- 15, 19, nil, nil, nil, nil, nil, nil, nil, nil,
87
- nil, 2, nil, nil, nil, 7, 8, nil, nil, nil,
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
88
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
89
- nil, nil, nil, nil, nil, nil, nil, 14, nil, nil,
90
- nil, 14, nil, 14, nil, nil, nil, nil, nil, nil,
91
- nil, 7 ]
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
92
 
93
93
  racc_goto_pointer = [
94
- nil, 6, -25, 12, nil, -25, 6, -6, -3, 3,
95
- 0, nil, nil, -17, 0, 17, nil, nil, nil, -20 ]
94
+ nil, 6, -27, 14, nil, -32, 12, -7, -4, 0,
95
+ -1, 4, nil, nil, -16, -2, 17, nil, nil, -19 ]
96
96
 
97
97
  racc_goto_default = [
98
- nil, nil, 2, nil, 5, 7, nil, 11, nil, 14,
99
- 15, 17, 19, nil, nil, nil, 6, 8, 71, nil ]
98
+ nil, nil, 3, nil, 6, 7, nil, 11, nil, 14,
99
+ 15, 17, 18, 2, nil, nil, nil, 8, 73, nil ]
100
100
 
101
101
  racc_reduce_table = [
102
102
  0, 0, :racc_error,
@@ -114,63 +114,64 @@ racc_reduce_table = [
114
114
  1, 35, :_reduce_none,
115
115
  2, 35, :_reduce_13,
116
116
  2, 35, :_reduce_14,
117
- 1, 35, :_reduce_15,
118
- 3, 33, :_reduce_16,
117
+ 2, 35, :_reduce_15,
118
+ 1, 35, :_reduce_16,
119
+ 3, 33, :_reduce_17,
119
120
  1, 33, :_reduce_none,
120
- 2, 42, :_reduce_18,
121
- 3, 36, :_reduce_19,
122
- 1, 36, :_reduce_20,
121
+ 2, 43, :_reduce_19,
122
+ 3, 36, :_reduce_20,
123
123
  1, 36, :_reduce_21,
124
- 1, 43, :_reduce_22,
125
- 0, 43, :_reduce_none,
126
- 4, 41, :_reduce_24,
127
- 4, 41, :_reduce_25,
128
- 3, 41, :_reduce_26,
129
- 2, 40, :_reduce_27,
130
- 3, 40, :_reduce_28,
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
131
  3, 40, :_reduce_29,
132
132
  3, 40, :_reduce_30,
133
133
  3, 40, :_reduce_31,
134
- 3, 45, :_reduce_32,
135
- 3, 45, :_reduce_33,
136
- 3, 45, :_reduce_34,
137
- 1, 45, :_reduce_none,
138
- 1, 45, :_reduce_none,
139
- 1, 45, :_reduce_37,
140
- 4, 46, :_reduce_38,
141
- 3, 46, :_reduce_39,
142
- 2, 46, :_reduce_40,
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
143
  2, 47, :_reduce_41,
144
- 2, 47, :_reduce_42,
144
+ 2, 41, :_reduce_42,
145
+ 2, 41, :_reduce_43,
145
146
  1, 37, :_reduce_none,
146
147
  0, 37, :_reduce_none,
147
- 2, 38, :_reduce_45,
148
148
  2, 38, :_reduce_46,
149
149
  2, 38, :_reduce_47,
150
150
  2, 38, :_reduce_48,
151
+ 2, 38, :_reduce_49,
151
152
  1, 38, :_reduce_none,
152
153
  1, 38, :_reduce_none,
153
154
  1, 38, :_reduce_none,
154
155
  1, 38, :_reduce_none,
155
- 1, 48, :_reduce_53,
156
- 2, 44, :_reduce_54,
157
- 2, 44, :_reduce_55,
158
- 0, 44, :_reduce_none,
159
- 1, 49, :_reduce_57,
156
+ 1, 48, :_reduce_54,
157
+ 2, 45, :_reduce_55,
158
+ 2, 45, :_reduce_56,
159
+ 0, 45, :_reduce_none,
160
160
  1, 49, :_reduce_58,
161
161
  1, 49, :_reduce_59,
162
162
  1, 49, :_reduce_60,
163
163
  1, 49, :_reduce_61,
164
164
  1, 49, :_reduce_62,
165
165
  1, 49, :_reduce_63,
166
- 3, 39, :_reduce_64,
166
+ 1, 49, :_reduce_64,
167
+ 3, 39, :_reduce_65,
167
168
  1, 50, :_reduce_none,
168
169
  2, 50, :_reduce_none,
169
170
  1, 50, :_reduce_none ]
170
171
 
171
- racc_reduce_n = 68
172
+ racc_reduce_n = 69
172
173
 
173
- racc_shift_n = 97
174
+ racc_shift_n = 98
174
175
 
175
176
  racc_token_table = {
176
177
  false => 0,
@@ -267,13 +268,13 @@ Racc_token_to_s_table = [
267
268
  "hcap_1toN",
268
269
  "negation",
269
270
  "function",
271
+ "pseudo",
270
272
  "attrib",
271
273
  "class",
272
274
  "namespace",
273
275
  "attrib_val_0or1",
274
276
  "expr",
275
277
  "an_plus_b",
276
- "pseudo",
277
278
  "attribute_id",
278
279
  "eql_incl_dash",
279
280
  "negation_arg" ]
@@ -361,6 +362,12 @@ def _reduce_13(val, _values, result)
361
362
  end
362
363
 
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)
364
371
  result = Node.new(:CONDITIONAL_SELECTOR,
365
372
  [
366
373
  Node.new(:ELEMENT_NAME, ['*']),
@@ -371,7 +378,7 @@ def _reduce_14(val, _values, result)
371
378
  result
372
379
  end
373
380
 
374
- def _reduce_15(val, _values, result)
381
+ def _reduce_16(val, _values, result)
375
382
  result = Node.new(:CONDITIONAL_SELECTOR,
376
383
  [Node.new(:ELEMENT_NAME, ['*']), val.first]
377
384
  )
@@ -379,20 +386,20 @@ def _reduce_15(val, _values, result)
379
386
  result
380
387
  end
381
388
 
382
- def _reduce_16(val, _values, result)
389
+ def _reduce_17(val, _values, result)
383
390
  result = Node.new(val[1], [val.first, val.last])
384
391
 
385
392
  result
386
393
  end
387
394
 
388
- # reduce 17 omitted
395
+ # reduce 18 omitted
389
396
 
390
- def _reduce_18(val, _values, result)
397
+ def _reduce_19(val, _values, result)
391
398
  result = Node.new(:CLASS_CONDITION, [val[1]])
392
399
  result
393
400
  end
394
401
 
395
- def _reduce_19(val, _values, result)
402
+ def _reduce_20(val, _values, result)
396
403
  result = Node.new(:ELEMENT_NAME,
397
404
  [[val.first, val.last].compact.join(':')]
398
405
  )
@@ -400,26 +407,26 @@ def _reduce_19(val, _values, result)
400
407
  result
401
408
  end
402
409
 
403
- def _reduce_20(val, _values, result)
410
+ def _reduce_21(val, _values, result)
404
411
  name = @namespaces.key?('xmlns') ? "xmlns:#{val.first}" : val.first
405
412
  result = Node.new(:ELEMENT_NAME, [name])
406
413
 
407
414
  result
408
415
  end
409
416
 
410
- def _reduce_21(val, _values, result)
417
+ def _reduce_22(val, _values, result)
411
418
  result = Node.new(:ELEMENT_NAME, val)
412
419
  result
413
420
  end
414
421
 
415
- def _reduce_22(val, _values, result)
422
+ def _reduce_23(val, _values, result)
416
423
  result = val[0]
417
424
  result
418
425
  end
419
426
 
420
- # reduce 23 omitted
427
+ # reduce 24 omitted
421
428
 
422
- def _reduce_24(val, _values, result)
429
+ def _reduce_25(val, _values, result)
423
430
  result = Node.new(:ATTRIBUTE_CONDITION,
424
431
  [Node.new(:ELEMENT_NAME, [val[1]])] + (val[2] || [])
425
432
  )
@@ -427,7 +434,7 @@ def _reduce_24(val, _values, result)
427
434
  result
428
435
  end
429
436
 
430
- def _reduce_25(val, _values, result)
437
+ def _reduce_26(val, _values, result)
431
438
  result = Node.new(:ATTRIBUTE_CONDITION,
432
439
  [val[1]] + (val[2] || [])
433
440
  )
@@ -435,7 +442,7 @@ def _reduce_25(val, _values, result)
435
442
  result
436
443
  end
437
444
 
438
- def _reduce_26(val, _values, result)
445
+ def _reduce_27(val, _values, result)
439
446
  # Non standard, but hpricot supports it.
440
447
  result = Node.new(:PSEUDO_CLASS,
441
448
  [Node.new(:FUNCTION, ['nth-child(', val[1]])]
@@ -444,14 +451,8 @@ def _reduce_26(val, _values, result)
444
451
  result
445
452
  end
446
453
 
447
- def _reduce_27(val, _values, result)
448
- result = Node.new(:FUNCTION, [val.first.strip])
449
-
450
- result
451
- end
452
-
453
454
  def _reduce_28(val, _values, result)
454
- result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
455
+ result = Node.new(:FUNCTION, [val.first.strip])
455
456
 
456
457
  result
457
458
  end
@@ -475,7 +476,8 @@ def _reduce_31(val, _values, result)
475
476
  end
476
477
 
477
478
  def _reduce_32(val, _values, result)
478
- result = [val.first, val.last]
479
+ result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
480
+
479
481
  result
480
482
  end
481
483
 
@@ -489,11 +491,16 @@ def _reduce_34(val, _values, result)
489
491
  result
490
492
  end
491
493
 
492
- # reduce 35 omitted
494
+ def _reduce_35(val, _values, result)
495
+ result = [val.first, val.last]
496
+ result
497
+ end
493
498
 
494
499
  # reduce 36 omitted
495
500
 
496
- def _reduce_37(val, _values, result)
501
+ # reduce 37 omitted
502
+
503
+ def _reduce_38(val, _values, result)
497
504
  if val[0] == 'even'
498
505
  val = ["2","n","+","0"]
499
506
  result = Node.new(:AN_PLUS_B, val)
@@ -511,7 +518,7 @@ def _reduce_37(val, _values, result)
511
518
  result
512
519
  end
513
520
 
514
- def _reduce_38(val, _values, result)
521
+ def _reduce_39(val, _values, result)
515
522
  if val[1] == 'n'
516
523
  result = Node.new(:AN_PLUS_B, val)
517
524
  else
@@ -521,7 +528,7 @@ def _reduce_38(val, _values, result)
521
528
  result
522
529
  end
523
530
 
524
- def _reduce_39(val, _values, result)
531
+ def _reduce_40(val, _values, result)
525
532
  # n+3, -n+3
526
533
  if val[0] == 'n'
527
534
  val.unshift("1")
@@ -537,7 +544,7 @@ def _reduce_39(val, _values, result)
537
544
  result
538
545
  end
539
546
 
540
- def _reduce_40(val, _values, result)
547
+ def _reduce_41(val, _values, result)
541
548
  if val[1] == 'n'
542
549
  val << "+"
543
550
  val << "0"
@@ -549,26 +556,20 @@ def _reduce_40(val, _values, result)
549
556
  result
550
557
  end
551
558
 
552
- def _reduce_41(val, _values, result)
559
+ def _reduce_42(val, _values, result)
553
560
  result = Node.new(:PSEUDO_CLASS, [val[1]])
554
561
 
555
562
  result
556
563
  end
557
564
 
558
- def _reduce_42(val, _values, result)
565
+ def _reduce_43(val, _values, result)
559
566
  result = Node.new(:PSEUDO_CLASS, [val[1]])
560
567
  result
561
568
  end
562
569
 
563
- # reduce 43 omitted
564
-
565
570
  # reduce 44 omitted
566
571
 
567
- def _reduce_45(val, _values, result)
568
- result = Node.new(:COMBINATOR, val)
569
-
570
- result
571
- end
572
+ # reduce 45 omitted
572
573
 
573
574
  def _reduce_46(val, _values, result)
574
575
  result = Node.new(:COMBINATOR, val)
@@ -588,7 +589,11 @@ def _reduce_48(val, _values, result)
588
589
  result
589
590
  end
590
591
 
591
- # reduce 49 omitted
592
+ def _reduce_49(val, _values, result)
593
+ result = Node.new(:COMBINATOR, val)
594
+
595
+ result
596
+ end
592
597
 
593
598
  # reduce 50 omitted
594
599
 
@@ -596,70 +601,72 @@ end
596
601
 
597
602
  # reduce 52 omitted
598
603
 
599
- def _reduce_53(val, _values, result)
604
+ # reduce 53 omitted
605
+
606
+ def _reduce_54(val, _values, result)
600
607
  result = Node.new(:ID, val)
601
608
  result
602
609
  end
603
610
 
604
- def _reduce_54(val, _values, result)
611
+ def _reduce_55(val, _values, result)
605
612
  result = [val.first, val[1]]
606
613
  result
607
614
  end
608
615
 
609
- def _reduce_55(val, _values, result)
616
+ def _reduce_56(val, _values, result)
610
617
  result = [val.first, val[1]]
611
618
  result
612
619
  end
613
620
 
614
- # reduce 56 omitted
621
+ # reduce 57 omitted
615
622
 
616
- def _reduce_57(val, _values, result)
623
+ def _reduce_58(val, _values, result)
617
624
  result = :equal
618
625
  result
619
626
  end
620
627
 
621
- def _reduce_58(val, _values, result)
628
+ def _reduce_59(val, _values, result)
622
629
  result = :prefix_match
623
630
  result
624
631
  end
625
632
 
626
- def _reduce_59(val, _values, result)
633
+ def _reduce_60(val, _values, result)
627
634
  result = :suffix_match
628
635
  result
629
636
  end
630
637
 
631
- def _reduce_60(val, _values, result)
638
+ def _reduce_61(val, _values, result)
632
639
  result = :substring_match
633
640
  result
634
641
  end
635
642
 
636
- def _reduce_61(val, _values, result)
643
+ def _reduce_62(val, _values, result)
637
644
  result = :not_equal
638
645
  result
639
646
  end
640
647
 
641
- def _reduce_62(val, _values, result)
648
+ def _reduce_63(val, _values, result)
642
649
  result = :includes
643
650
  result
644
651
  end
645
652
 
646
- def _reduce_63(val, _values, result)
653
+ def _reduce_64(val, _values, result)
647
654
  result = :dash_match
648
655
  result
649
656
  end
650
657
 
651
- def _reduce_64(val, _values, result)
658
+ def _reduce_65(val, _values, result)
652
659
  result = Node.new(:NOT, [val[1]])
653
660
 
654
661
  result
655
662
  end
656
663
 
657
- # reduce 65 omitted
658
-
659
664
  # reduce 66 omitted
660
665
 
661
666
  # reduce 67 omitted
662
667
 
668
+ # reduce 68 omitted
669
+
663
670
  def _reduce_none(val, _values, result)
664
671
  val[0]
665
672
  end