nokogiri 1.5.0.beta.1 → 1.5.0.beta.2

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 (114) hide show
  1. data/CHANGELOG.ja.rdoc +28 -8
  2. data/CHANGELOG.rdoc +23 -0
  3. data/Manifest.txt +63 -1
  4. data/README.ja.rdoc +1 -1
  5. data/README.rdoc +22 -4
  6. data/Rakefile +6 -2
  7. data/ext/java/nokogiri/EncodingHandler.java +92 -0
  8. data/ext/java/nokogiri/HtmlDocument.java +116 -0
  9. data/ext/java/nokogiri/HtmlElementDescription.java +111 -0
  10. data/ext/java/nokogiri/HtmlEntityLookup.java +45 -0
  11. data/ext/java/nokogiri/HtmlSaxParserContext.java +218 -0
  12. data/ext/java/nokogiri/NokogiriService.java +370 -0
  13. data/ext/java/nokogiri/XmlAttr.java +147 -0
  14. data/ext/java/nokogiri/XmlAttributeDecl.java +98 -0
  15. data/ext/java/nokogiri/XmlCdata.java +50 -0
  16. data/ext/java/nokogiri/XmlComment.java +47 -0
  17. data/ext/java/nokogiri/XmlDocument.java +463 -0
  18. data/ext/java/nokogiri/XmlDocumentFragment.java +207 -0
  19. data/ext/java/nokogiri/XmlDtd.java +427 -0
  20. data/ext/java/nokogiri/XmlElement.java +172 -0
  21. data/ext/java/nokogiri/XmlElementContent.java +350 -0
  22. data/ext/java/nokogiri/XmlElementDecl.java +115 -0
  23. data/ext/java/nokogiri/XmlEntityDecl.java +129 -0
  24. data/ext/java/nokogiri/XmlEntityReference.java +42 -0
  25. data/ext/java/nokogiri/XmlNamespace.java +77 -0
  26. data/ext/java/nokogiri/XmlNode.java +1399 -0
  27. data/ext/java/nokogiri/XmlNodeSet.java +248 -0
  28. data/ext/java/nokogiri/XmlProcessingInstruction.java +70 -0
  29. data/ext/java/nokogiri/XmlReader.java +373 -0
  30. data/ext/java/nokogiri/XmlRelaxng.java +166 -0
  31. data/ext/java/nokogiri/XmlSaxParserContext.java +308 -0
  32. data/ext/java/nokogiri/XmlSaxPushParser.java +146 -0
  33. data/ext/java/nokogiri/XmlSchema.java +142 -0
  34. data/ext/java/nokogiri/XmlSyntaxError.java +84 -0
  35. data/ext/java/nokogiri/XmlText.java +96 -0
  36. data/ext/java/nokogiri/XmlXpathContext.java +130 -0
  37. data/ext/java/nokogiri/XsltStylesheet.java +126 -0
  38. data/ext/java/nokogiri/internals/HtmlDomParserContext.java +181 -0
  39. data/ext/java/nokogiri/internals/NokogiriDocumentCache.java +39 -0
  40. data/ext/java/nokogiri/internals/NokogiriErrorHandler.java +42 -0
  41. data/ext/java/nokogiri/internals/NokogiriHandler.java +251 -0
  42. data/ext/java/nokogiri/internals/NokogiriHelpers.java +526 -0
  43. data/ext/java/nokogiri/internals/NokogiriNamespaceCache.java +136 -0
  44. data/ext/java/nokogiri/internals/NokogiriNamespaceContext.java +80 -0
  45. data/ext/java/nokogiri/internals/NokogiriNonStrictErrorHandler.java +37 -0
  46. data/ext/java/nokogiri/internals/NokogiriNonStrictErrorHandler4NekoHtml.java +54 -0
  47. data/ext/java/nokogiri/internals/NokogiriStrictErrorHandler.java +49 -0
  48. data/ext/java/nokogiri/internals/NokogiriXPathFunction.java +88 -0
  49. data/ext/java/nokogiri/internals/NokogiriXPathFunctionResolver.java +23 -0
  50. data/ext/java/nokogiri/internals/ParserContext.java +235 -0
  51. data/ext/java/nokogiri/internals/PushInputStream.java +381 -0
  52. data/ext/java/nokogiri/internals/ReaderNode.java +431 -0
  53. data/ext/java/nokogiri/internals/SaveContext.java +249 -0
  54. data/ext/java/nokogiri/internals/SchemaErrorHandler.java +35 -0
  55. data/ext/java/nokogiri/internals/XmlDeclHandler.java +10 -0
  56. data/ext/java/nokogiri/internals/XmlDomParser.java +45 -0
  57. data/ext/java/nokogiri/internals/XmlDomParserContext.java +201 -0
  58. data/ext/java/nokogiri/internals/XmlSaxParser.java +33 -0
  59. data/ext/nokogiri/depend +32 -0
  60. data/ext/nokogiri/extconf.rb +61 -32
  61. data/ext/nokogiri/nokogiri.c +0 -5
  62. data/ext/nokogiri/nokogiri.h +2 -2
  63. data/ext/nokogiri/xml_document.c +5 -0
  64. data/ext/nokogiri/xml_libxml2_hacks.c +112 -0
  65. data/ext/nokogiri/xml_libxml2_hacks.h +12 -0
  66. data/ext/nokogiri/xml_node.c +56 -16
  67. data/ext/nokogiri/xml_node_set.c +7 -7
  68. data/ext/nokogiri/xml_reader.c +20 -1
  69. data/ext/nokogiri/xml_relax_ng.c +0 -7
  70. data/ext/nokogiri/xml_xpath_context.c +2 -0
  71. data/lib/isorelax.jar +0 -0
  72. data/lib/jing.jar +0 -0
  73. data/lib/nekodtd.jar +0 -0
  74. data/lib/nekohtml.jar +0 -0
  75. data/lib/nokogiri.rb +1 -2
  76. data/lib/nokogiri/css/generated_parser.rb +155 -148
  77. data/lib/nokogiri/css/generated_tokenizer.rb +2 -1
  78. data/lib/nokogiri/css/parser.y +3 -0
  79. data/lib/nokogiri/css/xpath_visitor.rb +1 -7
  80. data/lib/nokogiri/html.rb +2 -2
  81. data/lib/nokogiri/html/document_fragment.rb +7 -4
  82. data/lib/nokogiri/nokogiri.jar +0 -0
  83. data/lib/nokogiri/version.rb +3 -6
  84. data/lib/nokogiri/xml/builder.rb +1 -1
  85. data/lib/nokogiri/xml/document.rb +1 -2
  86. data/lib/nokogiri/xml/document_fragment.rb +7 -0
  87. data/lib/nokogiri/xml/node.rb +5 -3
  88. data/lib/nokogiri/xml/node_set.rb +25 -0
  89. data/lib/nokogiri/xml/reader.rb +2 -0
  90. data/lib/nokogiri/xml/sax/document.rb +3 -1
  91. data/lib/xercesImpl.jar +0 -0
  92. data/spec/helper.rb +3 -0
  93. data/spec/xml/reader_spec.rb +307 -0
  94. data/tasks/test.rb +1 -1
  95. data/test/css/test_parser.rb +11 -1
  96. data/test/html/sax/test_parser_context.rb +2 -2
  97. data/test/html/test_document.rb +2 -2
  98. data/test/html/test_document_fragment.rb +34 -6
  99. data/test/test_memory_leak.rb +2 -2
  100. data/test/test_reader.rb +28 -6
  101. data/test/test_xslt_transforms.rb +2 -3
  102. data/test/xml/test_attr.rb +31 -4
  103. data/test/xml/test_builder.rb +5 -5
  104. data/test/xml/test_cdata.rb +3 -3
  105. data/test/xml/test_document.rb +8 -8
  106. data/test/xml/test_document_fragment.rb +4 -12
  107. data/test/xml/test_node.rb +1 -1
  108. data/test/xml/test_node_reparenting.rb +26 -11
  109. data/test/xml/test_node_set.rb +38 -2
  110. data/test/xml/test_text.rb +11 -2
  111. data/test/xml/test_unparented_node.rb +1 -1
  112. data/test/xml/test_xpath.rb +11 -7
  113. metadata +68 -5
  114. data/lib/nokogiri/version_warning.rb +0 -14
@@ -23,11 +23,6 @@ int vasprintf (char **strp, const char *fmt, va_list ap)
23
23
  }
24
24
  #endif
25
25
 
26
- int is_2_6_16(void)
27
- {
28
- return (strcmp(xmlParserVersion, "20616") <= 0) ? 1 : 0 ;
29
- }
30
-
31
26
  void Init_nokogiri()
32
27
  {
33
28
  xmlMemSetup(
@@ -35,8 +35,6 @@ int vasprintf (char **strp, const char *fmt, va_list ap);
35
35
  #include <st.h>
36
36
  #endif
37
37
 
38
- int is_2_6_16(void) ;
39
-
40
38
  #ifndef UNUSED
41
39
  # if defined(__GNUC__)
42
40
  # define MAYBE_UNUSED(name) name __attribute__((unused))
@@ -77,6 +75,8 @@ int is_2_6_16(void) ;
77
75
  #define RBSTR_OR_QNIL(_str) \
78
76
  (_str ? NOKOGIRI_STR_NEW2(_str) : Qnil)
79
77
 
78
+ #include <xml_libxml2_hacks.h>
79
+
80
80
  #include <xml_io.h>
81
81
  #include <xml_document.h>
82
82
  #include <html_entity_lookup.h>
@@ -46,6 +46,11 @@ static void recursively_remove_namespaces_from_node(xmlNodePtr node)
46
46
 
47
47
  for (child = node->children ; child ; child = child->next)
48
48
  recursively_remove_namespaces_from_node(child);
49
+
50
+ if (node->nsDef) {
51
+ xmlFreeNsList(node->nsDef);
52
+ node->nsDef = NULL;
53
+ }
49
54
  }
50
55
 
51
56
  /*
@@ -0,0 +1,112 @@
1
+ #ifndef HAVE_XMLFIRSTELEMENTCHILD
2
+ #include <libxml/tree.h>
3
+ /**
4
+ * xmlFirstElementChild:
5
+ * @parent: the parent node
6
+ *
7
+ * Finds the first child node of that element which is a Element node
8
+ * Note the handling of entities references is different than in
9
+ * the W3C DOM element traversal spec since we don't have back reference
10
+ * from entities content to entities references.
11
+ *
12
+ * Returns the first element child or NULL if not available
13
+ */
14
+ xmlNodePtr
15
+ xmlFirstElementChild(xmlNodePtr parent) {
16
+ xmlNodePtr cur = NULL;
17
+
18
+ if (parent == NULL)
19
+ return(NULL);
20
+ switch (parent->type) {
21
+ case XML_ELEMENT_NODE:
22
+ case XML_ENTITY_NODE:
23
+ case XML_DOCUMENT_NODE:
24
+ case XML_HTML_DOCUMENT_NODE:
25
+ cur = parent->children;
26
+ break;
27
+ default:
28
+ return(NULL);
29
+ }
30
+ while (cur != NULL) {
31
+ if (cur->type == XML_ELEMENT_NODE)
32
+ return(cur);
33
+ cur = cur->next;
34
+ }
35
+ return(NULL);
36
+ }
37
+
38
+ /**
39
+ * xmlNextElementSibling:
40
+ * @node: the current node
41
+ *
42
+ * Finds the first closest next sibling of the node which is an
43
+ * element node.
44
+ * Note the handling of entities references is different than in
45
+ * the W3C DOM element traversal spec since we don't have back reference
46
+ * from entities content to entities references.
47
+ *
48
+ * Returns the next element sibling or NULL if not available
49
+ */
50
+ xmlNodePtr
51
+ xmlNextElementSibling(xmlNodePtr node) {
52
+ if (node == NULL)
53
+ return(NULL);
54
+ switch (node->type) {
55
+ case XML_ELEMENT_NODE:
56
+ case XML_TEXT_NODE:
57
+ case XML_CDATA_SECTION_NODE:
58
+ case XML_ENTITY_REF_NODE:
59
+ case XML_ENTITY_NODE:
60
+ case XML_PI_NODE:
61
+ case XML_COMMENT_NODE:
62
+ case XML_DTD_NODE:
63
+ case XML_XINCLUDE_START:
64
+ case XML_XINCLUDE_END:
65
+ node = node->next;
66
+ break;
67
+ default:
68
+ return(NULL);
69
+ }
70
+ while (node != NULL) {
71
+ if (node->type == XML_ELEMENT_NODE)
72
+ return(node);
73
+ node = node->next;
74
+ }
75
+ return(NULL);
76
+ }
77
+
78
+ /**
79
+ * xmlLastElementChild:
80
+ * @parent: the parent node
81
+ *
82
+ * Finds the last child node of that element which is a Element node
83
+ * Note the handling of entities references is different than in
84
+ * the W3C DOM element traversal spec since we don't have back reference
85
+ * from entities content to entities references.
86
+ *
87
+ * Returns the last element child or NULL if not available
88
+ */
89
+ xmlNodePtr
90
+ xmlLastElementChild(xmlNodePtr parent) {
91
+ xmlNodePtr cur = NULL;
92
+
93
+ if (parent == NULL)
94
+ return(NULL);
95
+ switch (parent->type) {
96
+ case XML_ELEMENT_NODE:
97
+ case XML_ENTITY_NODE:
98
+ case XML_DOCUMENT_NODE:
99
+ case XML_HTML_DOCUMENT_NODE:
100
+ cur = parent->last;
101
+ break;
102
+ default:
103
+ return(NULL);
104
+ }
105
+ while (cur != NULL) {
106
+ if (cur->type == XML_ELEMENT_NODE)
107
+ return(cur);
108
+ cur = cur->prev;
109
+ }
110
+ return(NULL);
111
+ }
112
+ #endif
@@ -0,0 +1,12 @@
1
+ #ifndef HAVE_XMLFIRSTELEMENTCHILD
2
+
3
+ #ifndef XML_LIBXML2_HACKS
4
+ #define XML_LIBXML2_HACKS
5
+
6
+ xmlNodePtr xmlFirstElementChild(xmlNodePtr parent);
7
+ xmlNodePtr xmlNextElementSibling(xmlNodePtr node);
8
+ xmlNodePtr xmlLastElementChild(xmlNodePtr parent);
9
+
10
+ #endif
11
+
12
+ #endif
@@ -103,7 +103,7 @@ static xmlNodePtr xmlReplaceNodeWrapper(xmlNodePtr pivot, xmlNodePtr new_node)
103
103
  static VALUE reparent_node_with(VALUE pivot_obj, VALUE reparentee_obj, pivot_reparentee_func prf)
104
104
  {
105
105
  VALUE reparented_obj ;
106
- xmlNodePtr reparentee, pivot, reparented ;
106
+ xmlNodePtr reparentee, pivot, reparented, next_text, new_next_text ;
107
107
 
108
108
  if(!rb_obj_is_kind_of(reparentee_obj, cNokogiriXmlNode))
109
109
  rb_raise(rb_eArgError, "node must be a Nokogiri::XML::Node");
@@ -141,10 +141,32 @@ static VALUE reparent_node_with(VALUE pivot_obj, VALUE reparentee_obj, pivot_rep
141
141
  }
142
142
  }
143
143
 
144
- /* TODO: I really want to remove this. We shouldn't support 2.6.16 anymore */
145
- if ( reparentee->type == XML_TEXT_NODE && pivot->type == XML_TEXT_NODE && is_2_6_16() ) {
146
- /* work around a string-handling bug in libxml 2.6.16. we'd rather leak than segfault. */
147
- pivot->content = xmlStrdup(pivot->content);
144
+ if (reparentee->type == XML_TEXT_NODE && pivot->next && pivot->next->type == XML_TEXT_NODE) {
145
+ /*
146
+ * libxml merges text nodes in a right-to-left fashion, meaning that if
147
+ * there are two text nodes who would be adjacent, the right (or following,
148
+ * or next) node will be merged into the left (or preceding, or previous)
149
+ * node.
150
+ *
151
+ * and by "merged" I mean the string contents will be concatenated onto the
152
+ * left node's contents, and then the node will be freed.
153
+ *
154
+ * which means that if we have a ruby object wrapped around the right node,
155
+ * its memory would be freed out from under it.
156
+ *
157
+ * so, we detect this edge case and unlink-and-root the text node before it gets
158
+ * merged. then we dup the node and insert that duplicate back into the
159
+ * document where the real node was.
160
+ *
161
+ * yes, this is totally lame.
162
+ */
163
+ next_text = pivot->next ;
164
+ new_next_text = xmlDocCopyNode(next_text, pivot->doc, 1) ;
165
+
166
+ xmlUnlinkNode(next_text);
167
+ NOKOGIRI_ROOT_NODE(next_text);
168
+
169
+ xmlAddNextSibling(pivot, new_next_text);
148
170
  }
149
171
 
150
172
  if(!(reparented = (*prf)(pivot, reparentee))) {
@@ -1021,26 +1043,32 @@ static VALUE line(VALUE self)
1021
1043
  */
1022
1044
  static VALUE add_namespace_definition(VALUE self, VALUE prefix, VALUE href)
1023
1045
  {
1024
- xmlNodePtr node;
1046
+ xmlNodePtr node, namespacee;
1025
1047
  xmlNsPtr ns;
1026
1048
 
1027
1049
  Data_Get_Struct(self, xmlNode, node);
1050
+ namespacee = node ;
1028
1051
 
1029
- ns = xmlNewNs(
1052
+ ns = xmlSearchNs(
1053
+ node->doc,
1030
1054
  node,
1031
- (const xmlChar *)StringValuePtr(href),
1032
1055
  (const xmlChar *)(NIL_P(prefix) ? NULL : StringValuePtr(prefix))
1033
1056
  );
1034
1057
 
1035
1058
  if(!ns) {
1036
- ns = xmlSearchNs(
1037
- node->doc,
1038
- node,
1059
+ if (node->type != XML_ELEMENT_NODE) {
1060
+ namespacee = node->parent;
1061
+ }
1062
+ ns = xmlNewNs(
1063
+ namespacee,
1064
+ (const xmlChar *)StringValuePtr(href),
1039
1065
  (const xmlChar *)(NIL_P(prefix) ? NULL : StringValuePtr(prefix))
1040
1066
  );
1041
1067
  }
1042
1068
 
1043
- if(NIL_P(prefix)) xmlSetNs(node, ns);
1069
+ if (!ns) return Qnil ;
1070
+
1071
+ if(NIL_P(prefix) || node != namespacee) xmlSetNs(node, ns);
1044
1072
 
1045
1073
  return Nokogiri_wrap_xml_namespace(node->doc, ns);
1046
1074
  }
@@ -1122,13 +1150,11 @@ static VALUE in_context(VALUE self, VALUE _str, VALUE _options)
1122
1150
  xmlNodePtr node;
1123
1151
  xmlNodePtr list;
1124
1152
  xmlNodeSetPtr set;
1153
+ xmlParserErrors error;
1125
1154
  VALUE doc, err;
1126
1155
 
1127
1156
  Data_Get_Struct(self, xmlNode, node);
1128
1157
 
1129
- if(!node->parent)
1130
- rb_raise(rb_eRuntimeError, "no contextual parsing on unlinked nodes");
1131
-
1132
1158
  doc = DOC_RUBY_OBJECT(node->doc);
1133
1159
  err = rb_iv_get(doc, "@errors");
1134
1160
 
@@ -1141,7 +1167,7 @@ static VALUE in_context(VALUE self, VALUE _str, VALUE _options)
1141
1167
  htmlHandleOmittedElem(0);
1142
1168
  #endif
1143
1169
 
1144
- xmlParseInNodeContext(
1170
+ error = xmlParseInNodeContext(
1145
1171
  node,
1146
1172
  StringValuePtr(_str),
1147
1173
  (int)RSTRING_LEN(_str),
@@ -1154,6 +1180,20 @@ static VALUE in_context(VALUE self, VALUE _str, VALUE _options)
1154
1180
 
1155
1181
  xmlSetStructuredErrorFunc(NULL, NULL);
1156
1182
 
1183
+ /* FIXME: This probably needs to handle more constants... */
1184
+ switch(error) {
1185
+ case XML_ERR_OK:
1186
+ break;
1187
+
1188
+ case XML_ERR_INTERNAL_ERROR:
1189
+ case XML_ERR_NO_MEMORY:
1190
+ rb_raise(rb_eRuntimeError, "error parsing fragment (%d)", error);
1191
+ break;
1192
+
1193
+ default:
1194
+ break;
1195
+ }
1196
+
1157
1197
  set = xmlXPathNodeSetCreate(NULL);
1158
1198
 
1159
1199
  while(list) {
@@ -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);
@@ -129,9 +129,6 @@ static VALUE from_document(VALUE klass, VALUE document)
129
129
  schema = xmlRelaxNGParse(ctx);
130
130
 
131
131
  xmlSetStructuredErrorFunc(NULL, NULL);
132
- if (! is_2_6_16()) {
133
- xmlRelaxNGFreeParserCtxt(ctx);
134
- }
135
132
 
136
133
  if(NULL == schema) {
137
134
  xmlErrorPtr error = xmlGetLastError();
@@ -143,10 +140,6 @@ static VALUE from_document(VALUE klass, VALUE document)
143
140
  return Qnil;
144
141
  }
145
142
 
146
- if (is_2_6_16()) {
147
- xmlRelaxNGFreeParserCtxt(ctx);
148
- }
149
-
150
143
  rb_schema = Data_Wrap_Struct(klass, 0, dealloc, schema);
151
144
  rb_iv_set(rb_schema, "@errors", errors);
152
145
 
@@ -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
Binary file
Binary file
@@ -6,7 +6,7 @@ ENV['PATH'] = [File.expand_path(
6
6
  File.join(File.dirname(__FILE__), "..", "ext", "nokogiri")
7
7
  ), ENV['PATH']].compact.join(';') if RbConfig::CONFIG['host_os'] =~ /(mswin|mingw)/i
8
8
 
9
- if defined? RUBY_ENGINE && RUBY_ENGINE == "jruby"
9
+ if defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
10
10
  require 'isorelax.jar'
11
11
  require 'jing.jar'
12
12
  require 'nekohtml.jar'
@@ -35,7 +35,6 @@ Thanks,
35
35
  eowarn
36
36
 
37
37
  require 'nokogiri/version'
38
- require 'nokogiri/version_warning'
39
38
  require 'nokogiri/syntax_error'
40
39
  require 'nokogiri/xml'
41
40
  require 'nokogiri/xslt'
@@ -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