nokogiri 1.2.3-x86-mswin32-60 → 1.4.5-x86-mswin32-60
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.
- data/.autotest +18 -7
- data/.gemtest +0 -0
- data/CHANGELOG.ja.rdoc +297 -3
- data/CHANGELOG.rdoc +289 -0
- data/Manifest.txt +148 -37
- data/README.ja.rdoc +20 -20
- data/README.rdoc +53 -22
- data/Rakefile +127 -211
- data/bin/nokogiri +54 -0
- data/ext/nokogiri/depend +358 -0
- data/ext/nokogiri/extconf.rb +89 -54
- data/ext/nokogiri/html_document.c +34 -27
- data/ext/nokogiri/html_document.h +1 -1
- data/ext/nokogiri/html_element_description.c +276 -0
- data/ext/nokogiri/html_element_description.h +10 -0
- data/ext/nokogiri/html_entity_lookup.c +7 -5
- data/ext/nokogiri/html_entity_lookup.h +1 -1
- data/ext/nokogiri/html_sax_parser_context.c +94 -0
- data/ext/nokogiri/html_sax_parser_context.h +11 -0
- data/ext/nokogiri/{native.c → nokogiri.c} +31 -7
- data/ext/nokogiri/{native.h → nokogiri.h} +68 -41
- data/ext/nokogiri/xml_attr.c +20 -9
- data/ext/nokogiri/xml_attr.h +1 -1
- data/ext/nokogiri/xml_attribute_decl.c +70 -0
- data/ext/nokogiri/xml_attribute_decl.h +9 -0
- data/ext/nokogiri/xml_cdata.c +21 -9
- data/ext/nokogiri/xml_cdata.h +1 -1
- data/ext/nokogiri/xml_comment.c +18 -6
- data/ext/nokogiri/xml_comment.h +1 -1
- data/ext/nokogiri/xml_document.c +247 -68
- data/ext/nokogiri/xml_document.h +5 -3
- data/ext/nokogiri/xml_document_fragment.c +15 -7
- data/ext/nokogiri/xml_document_fragment.h +1 -1
- data/ext/nokogiri/xml_dtd.c +110 -10
- data/ext/nokogiri/xml_dtd.h +3 -1
- data/ext/nokogiri/xml_element_content.c +123 -0
- data/ext/nokogiri/xml_element_content.h +10 -0
- data/ext/nokogiri/xml_element_decl.c +69 -0
- data/ext/nokogiri/xml_element_decl.h +9 -0
- data/ext/nokogiri/xml_encoding_handler.c +79 -0
- data/ext/nokogiri/xml_encoding_handler.h +8 -0
- data/ext/nokogiri/xml_entity_decl.c +110 -0
- data/ext/nokogiri/xml_entity_decl.h +10 -0
- data/ext/nokogiri/xml_entity_reference.c +16 -5
- data/ext/nokogiri/xml_entity_reference.h +1 -1
- data/ext/nokogiri/xml_io.c +40 -8
- data/ext/nokogiri/xml_io.h +2 -1
- data/ext/nokogiri/xml_libxml2_hacks.c +112 -0
- data/ext/nokogiri/xml_libxml2_hacks.h +12 -0
- data/ext/nokogiri/xml_namespace.c +84 -0
- data/ext/nokogiri/xml_namespace.h +13 -0
- data/ext/nokogiri/xml_node.c +782 -225
- data/ext/nokogiri/xml_node.h +2 -4
- data/ext/nokogiri/xml_node_set.c +253 -34
- data/ext/nokogiri/xml_node_set.h +2 -2
- data/ext/nokogiri/xml_processing_instruction.c +17 -5
- data/ext/nokogiri/xml_processing_instruction.h +1 -1
- data/ext/nokogiri/xml_reader.c +277 -85
- data/ext/nokogiri/xml_reader.h +1 -1
- data/ext/nokogiri/xml_relax_ng.c +168 -0
- data/ext/nokogiri/xml_relax_ng.h +9 -0
- data/ext/nokogiri/xml_sax_parser.c +183 -111
- data/ext/nokogiri/xml_sax_parser.h +30 -1
- data/ext/nokogiri/xml_sax_parser_context.c +199 -0
- data/ext/nokogiri/xml_sax_parser_context.h +10 -0
- data/ext/nokogiri/xml_sax_push_parser.c +42 -12
- data/ext/nokogiri/xml_sax_push_parser.h +1 -1
- data/ext/nokogiri/xml_schema.c +205 -0
- data/ext/nokogiri/xml_schema.h +9 -0
- data/ext/nokogiri/xml_syntax_error.c +28 -173
- data/ext/nokogiri/xml_syntax_error.h +2 -1
- data/ext/nokogiri/xml_text.c +16 -6
- data/ext/nokogiri/xml_text.h +1 -1
- data/ext/nokogiri/xml_xpath_context.c +104 -47
- data/ext/nokogiri/xml_xpath_context.h +1 -1
- data/ext/nokogiri/xslt_stylesheet.c +161 -19
- data/ext/nokogiri/xslt_stylesheet.h +1 -1
- data/lib/nokogiri.rb +47 -8
- data/lib/nokogiri/1.8/nokogiri.so +0 -0
- data/lib/nokogiri/1.9/nokogiri.so +0 -0
- data/lib/nokogiri/css.rb +6 -3
- data/lib/nokogiri/css/node.rb +14 -12
- data/lib/nokogiri/css/parser.rb +665 -62
- data/lib/nokogiri/css/parser.y +20 -10
- data/lib/nokogiri/css/parser_extras.rb +91 -0
- data/lib/nokogiri/css/tokenizer.rb +148 -5
- data/lib/nokogiri/css/tokenizer.rex +10 -9
- data/lib/nokogiri/css/xpath_visitor.rb +47 -44
- data/lib/nokogiri/decorators/slop.rb +8 -4
- data/lib/nokogiri/ffi/encoding_handler.rb +42 -0
- data/lib/nokogiri/ffi/html/document.rb +28 -0
- data/lib/nokogiri/ffi/html/element_description.rb +81 -0
- data/lib/nokogiri/ffi/html/entity_lookup.rb +16 -0
- data/lib/nokogiri/ffi/html/sax/parser_context.rb +38 -0
- data/lib/nokogiri/ffi/io_callbacks.rb +42 -0
- data/lib/nokogiri/ffi/libxml.rb +420 -0
- data/lib/nokogiri/ffi/structs/common_node.rb +38 -0
- data/lib/nokogiri/ffi/structs/html_elem_desc.rb +24 -0
- data/lib/nokogiri/ffi/structs/html_entity_desc.rb +13 -0
- data/lib/nokogiri/ffi/structs/xml_alloc.rb +16 -0
- data/lib/nokogiri/ffi/structs/xml_attr.rb +20 -0
- data/lib/nokogiri/ffi/structs/xml_attribute.rb +27 -0
- data/lib/nokogiri/ffi/structs/xml_buffer.rb +16 -0
- data/lib/nokogiri/ffi/structs/xml_char_encoding_handler.rb +11 -0
- data/lib/nokogiri/ffi/structs/xml_document.rb +117 -0
- data/lib/nokogiri/ffi/structs/xml_dtd.rb +28 -0
- data/lib/nokogiri/ffi/structs/xml_element.rb +26 -0
- data/lib/nokogiri/ffi/structs/xml_element_content.rb +17 -0
- data/lib/nokogiri/ffi/structs/xml_entity.rb +32 -0
- data/lib/nokogiri/ffi/structs/xml_enumeration.rb +12 -0
- data/lib/nokogiri/ffi/structs/xml_node.rb +28 -0
- data/lib/nokogiri/ffi/structs/xml_node_set.rb +53 -0
- data/lib/nokogiri/ffi/structs/xml_notation.rb +11 -0
- data/lib/nokogiri/ffi/structs/xml_ns.rb +15 -0
- data/lib/nokogiri/ffi/structs/xml_parser_context.rb +20 -0
- data/lib/nokogiri/ffi/structs/xml_parser_input.rb +19 -0
- data/lib/nokogiri/ffi/structs/xml_relax_ng.rb +14 -0
- data/lib/nokogiri/ffi/structs/xml_sax_handler.rb +51 -0
- data/lib/nokogiri/ffi/structs/xml_sax_push_parser_context.rb +124 -0
- data/lib/nokogiri/ffi/structs/xml_schema.rb +13 -0
- data/lib/nokogiri/ffi/structs/xml_syntax_error.rb +31 -0
- data/lib/nokogiri/ffi/structs/xml_text_reader.rb +12 -0
- data/lib/nokogiri/ffi/structs/xml_xpath_context.rb +38 -0
- data/lib/nokogiri/ffi/structs/xml_xpath_object.rb +35 -0
- data/lib/nokogiri/ffi/structs/xml_xpath_parser_context.rb +20 -0
- data/lib/nokogiri/ffi/structs/xslt_stylesheet.rb +13 -0
- data/lib/nokogiri/ffi/weak_bucket.rb +40 -0
- data/lib/nokogiri/ffi/xml/attr.rb +41 -0
- data/lib/nokogiri/ffi/xml/attribute_decl.rb +27 -0
- data/lib/nokogiri/ffi/xml/cdata.rb +19 -0
- data/lib/nokogiri/ffi/xml/comment.rb +18 -0
- data/lib/nokogiri/ffi/xml/document.rb +174 -0
- data/lib/nokogiri/ffi/xml/document_fragment.rb +21 -0
- data/lib/nokogiri/ffi/xml/dtd.rb +67 -0
- data/lib/nokogiri/ffi/xml/element_content.rb +43 -0
- data/lib/nokogiri/ffi/xml/element_decl.rb +19 -0
- data/lib/nokogiri/ffi/xml/entity_decl.rb +36 -0
- data/lib/nokogiri/ffi/xml/entity_reference.rb +19 -0
- data/lib/nokogiri/ffi/xml/namespace.rb +44 -0
- data/lib/nokogiri/ffi/xml/node.rb +559 -0
- data/lib/nokogiri/ffi/xml/node_set.rb +150 -0
- data/lib/nokogiri/ffi/xml/processing_instruction.rb +20 -0
- data/lib/nokogiri/ffi/xml/reader.rb +236 -0
- data/lib/nokogiri/ffi/xml/relax_ng.rb +85 -0
- data/lib/nokogiri/ffi/xml/sax/parser.rb +143 -0
- data/lib/nokogiri/ffi/xml/sax/parser_context.rb +79 -0
- data/lib/nokogiri/ffi/xml/sax/push_parser.rb +51 -0
- data/lib/nokogiri/ffi/xml/schema.rb +109 -0
- data/lib/nokogiri/ffi/xml/syntax_error.rb +98 -0
- data/lib/nokogiri/ffi/xml/text.rb +18 -0
- data/lib/nokogiri/ffi/xml/xpath.rb +9 -0
- data/lib/nokogiri/ffi/xml/xpath_context.rb +153 -0
- data/lib/nokogiri/ffi/xslt/stylesheet.rb +77 -0
- data/lib/nokogiri/html.rb +13 -47
- data/lib/nokogiri/html/builder.rb +27 -1
- data/lib/nokogiri/html/document.rb +201 -7
- data/lib/nokogiri/html/document_fragment.rb +41 -0
- data/lib/nokogiri/html/element_description.rb +23 -0
- data/lib/nokogiri/html/entity_lookup.rb +2 -0
- data/lib/nokogiri/html/sax/parser.rb +34 -3
- data/lib/nokogiri/html/sax/parser_context.rb +16 -0
- data/lib/nokogiri/nokogiri.rb +1 -0
- data/lib/nokogiri/version.rb +40 -1
- data/lib/nokogiri/version_warning.rb +14 -0
- data/lib/nokogiri/xml.rb +32 -53
- data/lib/nokogiri/xml/attr.rb +5 -0
- data/lib/nokogiri/xml/attribute_decl.rb +18 -0
- data/lib/nokogiri/xml/builder.rb +349 -29
- data/lib/nokogiri/xml/cdata.rb +3 -1
- data/lib/nokogiri/xml/character_data.rb +7 -0
- data/lib/nokogiri/xml/document.rb +166 -14
- data/lib/nokogiri/xml/document_fragment.rb +76 -1
- data/lib/nokogiri/xml/dtd.rb +16 -3
- data/lib/nokogiri/xml/element_content.rb +36 -0
- data/lib/nokogiri/xml/element_decl.rb +13 -0
- data/lib/nokogiri/xml/entity_decl.rb +19 -0
- data/lib/nokogiri/xml/namespace.rb +13 -0
- data/lib/nokogiri/xml/node.rb +561 -166
- data/lib/nokogiri/xml/node/save_options.rb +22 -2
- data/lib/nokogiri/xml/node_set.rb +202 -40
- data/lib/nokogiri/xml/parse_options.rb +93 -0
- data/lib/nokogiri/xml/pp.rb +2 -0
- data/lib/nokogiri/xml/pp/character_data.rb +18 -0
- data/lib/nokogiri/xml/pp/node.rb +56 -0
- data/lib/nokogiri/xml/processing_instruction.rb +2 -0
- data/lib/nokogiri/xml/reader.rb +93 -8
- data/lib/nokogiri/xml/relax_ng.rb +32 -0
- data/lib/nokogiri/xml/sax.rb +1 -7
- data/lib/nokogiri/xml/sax/document.rb +107 -2
- data/lib/nokogiri/xml/sax/parser.rb +57 -7
- data/lib/nokogiri/xml/sax/parser_context.rb +16 -0
- data/lib/nokogiri/xml/sax/push_parser.rb +13 -1
- data/lib/nokogiri/xml/schema.rb +63 -0
- data/lib/nokogiri/xml/syntax_error.rb +25 -1
- data/lib/nokogiri/xml/text.rb +4 -1
- data/lib/nokogiri/xml/xpath.rb +1 -1
- data/lib/nokogiri/xml/xpath/syntax_error.rb +3 -0
- data/lib/nokogiri/xml/xpath_context.rb +2 -0
- data/lib/nokogiri/xslt.rb +26 -2
- data/lib/nokogiri/xslt/stylesheet.rb +19 -0
- data/lib/xsd/xmlparser/nokogiri.rb +45 -9
- data/tasks/cross_compile.rb +173 -0
- data/tasks/test.rb +25 -69
- data/test/css/test_nthiness.rb +3 -4
- data/test/css/test_parser.rb +75 -20
- data/test/css/test_tokenizer.rb +23 -1
- data/test/css/test_xpath_visitor.rb +10 -1
- data/test/decorators/test_slop.rb +16 -0
- data/test/ffi/test_document.rb +35 -0
- data/test/files/2ch.html +108 -0
- data/test/files/address_book.rlx +12 -0
- data/test/files/address_book.xml +10 -0
- data/test/files/bar/bar.xsd +4 -0
- data/test/files/encoding.html +82 -0
- data/test/files/encoding.xhtml +84 -0
- data/test/files/foo/foo.xsd +4 -0
- data/test/files/po.xml +32 -0
- data/test/files/po.xsd +66 -0
- data/test/files/shift_jis.html +10 -0
- data/test/files/shift_jis.xml +5 -0
- data/test/files/snuggles.xml +3 -0
- data/test/files/staff.dtd +10 -0
- data/test/files/valid_bar.xml +2 -0
- data/test/helper.rb +101 -23
- data/test/html/sax/test_parser.rb +81 -2
- data/test/html/sax/test_parser_context.rb +48 -0
- data/test/html/test_builder.rb +39 -8
- data/test/html/test_document.rb +186 -23
- data/test/html/test_document_encoding.rb +78 -1
- data/test/html/test_document_fragment.rb +253 -0
- data/test/html/test_element_description.rb +98 -0
- data/test/html/test_named_characters.rb +1 -1
- data/test/html/test_node.rb +124 -36
- data/test/html/test_node_encoding.rb +27 -0
- data/test/test_convert_xpath.rb +1 -52
- data/test/test_css_cache.rb +2 -13
- data/test/test_encoding_handler.rb +46 -0
- data/test/test_memory_leak.rb +88 -19
- data/test/test_nokogiri.rb +38 -5
- data/test/test_reader.rb +188 -6
- data/test/test_soap4r_sax.rb +52 -0
- data/test/test_xslt_transforms.rb +183 -83
- data/test/xml/node/test_save_options.rb +1 -1
- data/test/xml/node/test_subclass.rb +44 -0
- data/test/xml/sax/test_parser.rb +175 -4
- data/test/xml/sax/test_parser_context.rb +113 -0
- data/test/xml/sax/test_push_parser.rb +90 -2
- data/test/xml/test_attr.rb +35 -1
- data/test/xml/test_attribute_decl.rb +82 -0
- data/test/xml/test_builder.rb +186 -1
- data/test/xml/test_cdata.rb +32 -1
- data/test/xml/test_comment.rb +13 -1
- data/test/xml/test_document.rb +415 -43
- data/test/xml/test_document_encoding.rb +1 -1
- data/test/xml/test_document_fragment.rb +173 -5
- data/test/xml/test_dtd.rb +61 -6
- data/test/xml/test_dtd_encoding.rb +3 -1
- data/test/xml/test_element_content.rb +56 -0
- data/test/xml/test_element_decl.rb +73 -0
- data/test/xml/test_entity_decl.rb +120 -0
- data/test/xml/test_entity_reference.rb +5 -1
- data/test/xml/test_namespace.rb +68 -0
- data/test/xml/test_node.rb +546 -201
- data/test/xml/test_node_attributes.rb +34 -0
- data/test/xml/test_node_encoding.rb +33 -3
- data/test/xml/test_node_reparenting.rb +321 -0
- data/test/xml/test_node_set.rb +538 -2
- data/test/xml/test_parse_options.rb +52 -0
- data/test/xml/test_processing_instruction.rb +6 -1
- data/test/xml/test_reader_encoding.rb +1 -1
- data/test/xml/test_relax_ng.rb +60 -0
- data/test/xml/test_schema.rb +94 -0
- data/test/xml/test_syntax_error.rb +12 -0
- data/test/xml/test_text.rb +35 -1
- data/test/xml/test_unparented_node.rb +5 -5
- data/test/xml/test_xpath.rb +142 -11
- data/test/xslt/test_custom_functions.rb +94 -0
- metadata +328 -92
- data/ext/nokogiri/html_sax_parser.c +0 -57
- data/ext/nokogiri/html_sax_parser.h +0 -11
- data/ext/nokogiri/iconv.dll +0 -0
- data/ext/nokogiri/libexslt.dll +0 -0
- data/ext/nokogiri/libxml2.dll +0 -0
- data/ext/nokogiri/libxslt.dll +0 -0
- data/ext/nokogiri/native.so +0 -0
- data/ext/nokogiri/xml_xpath.c +0 -53
- data/ext/nokogiri/xml_xpath.h +0 -11
- data/ext/nokogiri/zlib1.dll +0 -0
- data/lib/action-nokogiri.rb +0 -30
- data/lib/nokogiri/css/generated_parser.rb +0 -713
- data/lib/nokogiri/css/generated_tokenizer.rb +0 -144
- data/lib/nokogiri/decorators.rb +0 -2
- data/lib/nokogiri/decorators/hpricot.rb +0 -3
- data/lib/nokogiri/decorators/hpricot/node.rb +0 -56
- data/lib/nokogiri/decorators/hpricot/node_set.rb +0 -54
- data/lib/nokogiri/decorators/hpricot/xpath_visitor.rb +0 -28
- data/lib/nokogiri/hpricot.rb +0 -51
- data/lib/nokogiri/xml/comment.rb +0 -6
- data/lib/nokogiri/xml/element.rb +0 -6
- data/lib/nokogiri/xml/entity_declaration.rb +0 -9
- data/lib/nokogiri/xml/fragment_handler.rb +0 -34
- data/test/hpricot/files/basic.xhtml +0 -17
- data/test/hpricot/files/boingboing.html +0 -2266
- data/test/hpricot/files/cy0.html +0 -3653
- data/test/hpricot/files/immob.html +0 -400
- data/test/hpricot/files/pace_application.html +0 -1320
- data/test/hpricot/files/tenderlove.html +0 -16
- data/test/hpricot/files/uswebgen.html +0 -220
- data/test/hpricot/files/utf8.html +0 -1054
- data/test/hpricot/files/week9.html +0 -1723
- data/test/hpricot/files/why.xml +0 -19
- data/test/hpricot/load_files.rb +0 -11
- data/test/hpricot/test_alter.rb +0 -68
- data/test/hpricot/test_builder.rb +0 -20
- data/test/hpricot/test_parser.rb +0 -426
- data/test/hpricot/test_paths.rb +0 -15
- data/test/hpricot/test_preserved.rb +0 -77
- data/test/hpricot/test_xml.rb +0 -30
- data/test/test_gc.rb +0 -15
@@ -1,57 +0,0 @@
|
|
1
|
-
#include <html_sax_parser.h>
|
2
|
-
|
3
|
-
/*
|
4
|
-
* call-seq:
|
5
|
-
* native_parse_file(data, encoding)
|
6
|
-
*
|
7
|
-
* Parse +data+ with +encoding+
|
8
|
-
*/
|
9
|
-
static VALUE native_parse_file(VALUE self, VALUE data, VALUE encoding)
|
10
|
-
{
|
11
|
-
xmlSAXHandlerPtr handler;
|
12
|
-
htmlDocPtr hdoc ;
|
13
|
-
Data_Get_Struct(self, xmlSAXHandler, handler);
|
14
|
-
hdoc = htmlSAXParseFile( StringValuePtr(data),
|
15
|
-
(const char *)StringValuePtr(encoding),
|
16
|
-
(htmlSAXHandlerPtr)handler,
|
17
|
-
(void *)self );
|
18
|
-
xmlFreeDoc(hdoc);
|
19
|
-
return data;
|
20
|
-
}
|
21
|
-
|
22
|
-
/*
|
23
|
-
* call-seq:
|
24
|
-
* native_parse_memory(data, encoding)
|
25
|
-
*
|
26
|
-
* Parse +data+ with +encoding+
|
27
|
-
*/
|
28
|
-
static VALUE native_parse_memory(VALUE self, VALUE data, VALUE encoding)
|
29
|
-
{
|
30
|
-
xmlSAXHandlerPtr handler;
|
31
|
-
htmlDocPtr hdoc ;
|
32
|
-
Data_Get_Struct(self, xmlSAXHandler, handler);
|
33
|
-
hdoc = htmlSAXParseDoc( (xmlChar *)StringValuePtr(data),
|
34
|
-
(const char *)StringValuePtr(encoding),
|
35
|
-
(htmlSAXHandlerPtr)handler,
|
36
|
-
(void *)self );
|
37
|
-
xmlFreeDoc(hdoc);
|
38
|
-
return data;
|
39
|
-
}
|
40
|
-
|
41
|
-
VALUE cNokogiriHtmlSaxParser ;
|
42
|
-
void init_html_sax_parser()
|
43
|
-
{
|
44
|
-
VALUE nokogiri = rb_define_module("Nokogiri");
|
45
|
-
VALUE html = rb_define_module_under(nokogiri, "HTML");
|
46
|
-
VALUE sax = rb_define_module_under(html, "SAX");
|
47
|
-
/*
|
48
|
-
* Nokogiri::HTML::SAX::Parser is used for parsing HTML with SAX
|
49
|
-
* callbacks.
|
50
|
-
*/
|
51
|
-
VALUE klass = rb_define_class_under(sax, "Parser", cNokogiriXmlSaxParser);
|
52
|
-
|
53
|
-
cNokogiriHtmlSaxParser = klass;
|
54
|
-
|
55
|
-
rb_define_private_method(klass, "native_parse_memory", native_parse_memory, 2);
|
56
|
-
rb_define_private_method(klass, "native_parse_file", native_parse_file, 2);
|
57
|
-
}
|
data/ext/nokogiri/iconv.dll
DELETED
Binary file
|
data/ext/nokogiri/libexslt.dll
DELETED
Binary file
|
data/ext/nokogiri/libxml2.dll
DELETED
Binary file
|
data/ext/nokogiri/libxslt.dll
DELETED
Binary file
|
data/ext/nokogiri/native.so
DELETED
Binary file
|
data/ext/nokogiri/xml_xpath.c
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
#include <xml_xpath.h>
|
2
|
-
|
3
|
-
static void deallocate(xmlXPathObjectPtr xpath)
|
4
|
-
{
|
5
|
-
NOKOGIRI_DEBUG_START(xpath);
|
6
|
-
xmlXPathFreeNodeSetList(xpath); // despite the name, this frees the xpath but not the contained node set
|
7
|
-
NOKOGIRI_DEBUG_END(xpath);
|
8
|
-
}
|
9
|
-
|
10
|
-
VALUE Nokogiri_wrap_xml_xpath(xmlXPathObjectPtr xpath)
|
11
|
-
{
|
12
|
-
return Data_Wrap_Struct(cNokogiriXmlXpath, 0, deallocate, xpath);
|
13
|
-
}
|
14
|
-
|
15
|
-
/*
|
16
|
-
* call-seq:
|
17
|
-
* node_set
|
18
|
-
*
|
19
|
-
* Fetch the node set associated with this xpath context.
|
20
|
-
*/
|
21
|
-
static VALUE node_set(VALUE self)
|
22
|
-
{
|
23
|
-
xmlXPathObjectPtr xpath;
|
24
|
-
Data_Get_Struct(self, xmlXPathObject, xpath);
|
25
|
-
|
26
|
-
VALUE node_set = Qnil;
|
27
|
-
|
28
|
-
if (xpath->nodesetval)
|
29
|
-
node_set = Nokogiri_wrap_xml_node_set(xpath->nodesetval);
|
30
|
-
|
31
|
-
if(Qnil == node_set)
|
32
|
-
node_set = Nokogiri_wrap_xml_node_set(xmlXPathNodeSetCreate(NULL));
|
33
|
-
|
34
|
-
rb_funcall(node_set, rb_intern("document="), 1, rb_iv_get(self, "@document"));
|
35
|
-
|
36
|
-
return node_set;
|
37
|
-
}
|
38
|
-
|
39
|
-
VALUE cNokogiriXmlXpath;
|
40
|
-
void init_xml_xpath(void)
|
41
|
-
{
|
42
|
-
VALUE module = rb_define_module("Nokogiri");
|
43
|
-
VALUE xml = rb_define_module_under(module, "XML");
|
44
|
-
|
45
|
-
/*
|
46
|
-
* This class wraps an XPath object and should only be instantiated from
|
47
|
-
* XPathContext.
|
48
|
-
*/
|
49
|
-
VALUE klass = rb_define_class_under(xml, "XPath", rb_cObject);
|
50
|
-
|
51
|
-
cNokogiriXmlXpath = klass;
|
52
|
-
rb_define_method(klass, "node_set", node_set, 0);
|
53
|
-
}
|
data/ext/nokogiri/xml_xpath.h
DELETED
data/ext/nokogiri/zlib1.dll
DELETED
Binary file
|
data/lib/action-nokogiri.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'nokogiri'
|
2
|
-
|
3
|
-
#
|
4
|
-
# to use this in your Rails view or controller tests, simply:
|
5
|
-
#
|
6
|
-
# require 'action-nokogiri'
|
7
|
-
#
|
8
|
-
# class KittehControllerTest < ActionController::TestCase
|
9
|
-
# def test_i_can_does_test_with_nokogiri
|
10
|
-
# get(:index, {:wants => "cheezburgers"})
|
11
|
-
# assert @response.html.at("h2.lolcats")
|
12
|
-
# end
|
13
|
-
#
|
14
|
-
module ActionController
|
15
|
-
module TestResponseBehavior
|
16
|
-
|
17
|
-
def html(flavor=nil)
|
18
|
-
if flavor == :hpricot
|
19
|
-
@_nokogiri_html_hpricot ||= Nokogiri::Hpricot(body)
|
20
|
-
else
|
21
|
-
@_nokogiri_html_vanilla ||= Nokogiri::HTML(body)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def xml
|
26
|
-
@_nokogiri_xml ||= Nokogiri::XML(body)
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
end
|
@@ -1,713 +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, 22, 24, 26, 10, 62, 4, 72, 50, 1,
|
17
|
-
10, 21, 4, 23, 25, 1, 10, 10, 59, 18,
|
18
|
-
51, 1, 5, 10, 8, 18, 11, 14, 5, 10,
|
19
|
-
8, 18, 11, 14, 5, 5, 8, 8, 11, 14,
|
20
|
-
14, 5, 10, 8, 4, 57, 14, 5, 10, 8,
|
21
|
-
56, 40, 14, 46, 10, 33, 52, 40, 54, 58,
|
22
|
-
5, 77, 8, 18, 4, 14, 5, 78, 8, 64,
|
23
|
-
66, 14, 5, 34, 8, 35, 49, 14, 64, 66,
|
24
|
-
65, 67, 69, 18, 70, 60, 61, 56, 63, 65,
|
25
|
-
67, 69, 80, 70, 61, 33, 28, 63, 32, 33,
|
26
|
-
52, 5, 54, 33, 52, 82, 54, 83, 31, 33,
|
27
|
-
52, 40, 54, 87, 86, 42, -22, 88, 89, 90,
|
28
|
-
91 ]
|
29
|
-
|
30
|
-
racc_action_check = [
|
31
|
-
0, 2, 2, 2, 0, 33, 20, 35, 17, 0,
|
32
|
-
20, 2, 51, 2, 2, 20, 51, 3, 30, 0,
|
33
|
-
17, 51, 0, 40, 0, 20, 0, 0, 20, 15,
|
34
|
-
20, 51, 20, 20, 51, 3, 51, 3, 51, 51,
|
35
|
-
3, 40, 6, 40, 14, 28, 40, 15, 7, 15,
|
36
|
-
28, 38, 15, 14, 13, 18, 18, 6, 18, 29,
|
37
|
-
6, 49, 6, 14, 5, 6, 7, 50, 7, 34,
|
38
|
-
34, 7, 13, 5, 13, 5, 16, 13, 36, 36,
|
39
|
-
34, 34, 34, 5, 34, 32, 32, 52, 34, 36,
|
40
|
-
36, 36, 53, 36, 54, 4, 4, 36, 4, 62,
|
41
|
-
62, 12, 62, 61, 61, 57, 61, 60, 4, 56,
|
42
|
-
56, 9, 56, 68, 68, 8, 1, 71, 73, 76,
|
43
|
-
83 ]
|
44
|
-
|
45
|
-
racc_action_pointer = [
|
46
|
-
-2, 89, -6, 11, 85, 62, 36, 42, 104, 90,
|
47
|
-
nil, nil, 77, 48, 42, 23, 49, 8, 45, nil,
|
48
|
-
4, nil, nil, nil, nil, nil, nil, nil, 38, 36,
|
49
|
-
-5, nil, 74, -7, 66, -18, 75, nil, 30, nil,
|
50
|
-
17, nil, nil, nil, nil, nil, nil, nil, nil, 50,
|
51
|
-
67, 10, 75, 69, 82, nil, 99, 92, nil, nil,
|
52
|
-
100, 93, 89, nil, nil, nil, nil, nil, 103, nil,
|
53
|
-
nil, 92, nil, 93, nil, nil, 96, nil, nil, nil,
|
54
|
-
nil, nil, nil, 107, nil, nil, nil, nil, nil, nil,
|
55
|
-
nil, nil ]
|
56
|
-
|
57
|
-
racc_action_default = [
|
58
|
-
-23, -20, -17, -51, -65, -65, -43, -48, -65, -15,
|
59
|
-
-52, -21, -12, -50, -65, -49, -65, -65, -65, -2,
|
60
|
-
-23, -5, -3, -8, -4, -7, -6, -47, -36, -65,
|
61
|
-
-65, -27, -34, -35, -55, -65, -55, -9, -42, -11,
|
62
|
-
-65, -44, -18, -14, -13, -46, -41, -40, -45, -65,
|
63
|
-
-65, -23, -36, -65, -34, -16, -65, -65, -28, -29,
|
64
|
-
-39, -65, -65, -56, -61, -57, -62, -58, -65, -59,
|
65
|
-
-60, -65, -26, -65, -10, -64, -65, -19, 92, -1,
|
66
|
-
-30, -33, -38, -65, -31, -32, -53, -54, -24, -25,
|
67
|
-
-63, -37 ]
|
68
|
-
|
69
|
-
racc_goto_table = [
|
70
|
-
29, 27, 19, 39, 38, 41, 43, 36, 71, 17,
|
71
|
-
73, 45, 44, 48, 53, 37, 47, 20, 30, 76,
|
72
|
-
nil, nil, 55, nil, nil, nil, nil, nil, nil, nil,
|
73
|
-
nil, nil, nil, nil, nil, 74, nil, nil, 75, nil,
|
74
|
-
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
75
|
-
nil, nil, 81, 79, nil, nil, nil, 84, 85 ]
|
76
|
-
|
77
|
-
racc_goto_check = [
|
78
|
-
14, 7, 2, 8, 7, 7, 8, 9, 13, 1,
|
79
|
-
13, 7, 10, 7, 14, 6, 9, 3, 15, 19,
|
80
|
-
nil, nil, 2, nil, nil, nil, nil, nil, nil, nil,
|
81
|
-
nil, nil, nil, nil, nil, 8, nil, nil, 7, nil,
|
82
|
-
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
83
|
-
nil, nil, 14, 2, nil, nil, nil, 14, 14 ]
|
84
|
-
|
85
|
-
racc_goto_pointer = [
|
86
|
-
nil, 9, 2, 15, nil, nil, 9, -2, -3, 2,
|
87
|
-
0, nil, nil, -26, -4, 14, nil, nil, nil, -21 ]
|
88
|
-
|
89
|
-
racc_goto_default = [
|
90
|
-
nil, nil, nil, nil, 2, 6, nil, 9, nil, 12,
|
91
|
-
13, 15, 16, nil, nil, nil, 3, 7, 68, nil ]
|
92
|
-
|
93
|
-
racc_reduce_table = [
|
94
|
-
0, 0, :racc_error,
|
95
|
-
3, 31, :_reduce_1,
|
96
|
-
1, 31, :_reduce_2,
|
97
|
-
1, 33, :_reduce_3,
|
98
|
-
1, 33, :_reduce_4,
|
99
|
-
1, 33, :_reduce_5,
|
100
|
-
1, 33, :_reduce_6,
|
101
|
-
1, 33, :_reduce_7,
|
102
|
-
1, 33, :_reduce_8,
|
103
|
-
2, 34, :_reduce_9,
|
104
|
-
3, 34, :_reduce_10,
|
105
|
-
2, 34, :_reduce_11,
|
106
|
-
1, 34, :_reduce_none,
|
107
|
-
2, 34, :_reduce_13,
|
108
|
-
2, 34, :_reduce_14,
|
109
|
-
1, 34, :_reduce_15,
|
110
|
-
3, 32, :_reduce_16,
|
111
|
-
1, 32, :_reduce_none,
|
112
|
-
2, 41, :_reduce_18,
|
113
|
-
3, 35, :_reduce_19,
|
114
|
-
1, 35, :_reduce_20,
|
115
|
-
1, 35, :_reduce_21,
|
116
|
-
1, 42, :_reduce_22,
|
117
|
-
0, 42, :_reduce_none,
|
118
|
-
4, 40, :_reduce_24,
|
119
|
-
4, 40, :_reduce_25,
|
120
|
-
3, 40, :_reduce_26,
|
121
|
-
2, 39, :_reduce_27,
|
122
|
-
3, 39, :_reduce_28,
|
123
|
-
3, 39, :_reduce_29,
|
124
|
-
3, 39, :_reduce_30,
|
125
|
-
3, 44, :_reduce_31,
|
126
|
-
3, 44, :_reduce_32,
|
127
|
-
3, 44, :_reduce_33,
|
128
|
-
1, 44, :_reduce_none,
|
129
|
-
1, 44, :_reduce_none,
|
130
|
-
1, 44, :_reduce_36,
|
131
|
-
4, 45, :_reduce_37,
|
132
|
-
3, 45, :_reduce_38,
|
133
|
-
2, 45, :_reduce_39,
|
134
|
-
2, 46, :_reduce_40,
|
135
|
-
2, 46, :_reduce_41,
|
136
|
-
1, 36, :_reduce_none,
|
137
|
-
0, 36, :_reduce_none,
|
138
|
-
2, 37, :_reduce_44,
|
139
|
-
2, 37, :_reduce_45,
|
140
|
-
2, 37, :_reduce_46,
|
141
|
-
2, 37, :_reduce_47,
|
142
|
-
1, 37, :_reduce_none,
|
143
|
-
1, 37, :_reduce_none,
|
144
|
-
1, 37, :_reduce_none,
|
145
|
-
1, 37, :_reduce_none,
|
146
|
-
1, 47, :_reduce_52,
|
147
|
-
2, 43, :_reduce_53,
|
148
|
-
2, 43, :_reduce_54,
|
149
|
-
0, 43, :_reduce_none,
|
150
|
-
1, 48, :_reduce_none,
|
151
|
-
1, 48, :_reduce_none,
|
152
|
-
1, 48, :_reduce_none,
|
153
|
-
1, 48, :_reduce_none,
|
154
|
-
1, 48, :_reduce_none,
|
155
|
-
1, 48, :_reduce_none,
|
156
|
-
1, 48, :_reduce_none,
|
157
|
-
3, 38, :_reduce_63,
|
158
|
-
1, 49, :_reduce_none ]
|
159
|
-
|
160
|
-
racc_reduce_n = 65
|
161
|
-
|
162
|
-
racc_shift_n = 92
|
163
|
-
|
164
|
-
racc_token_table = {
|
165
|
-
false => 0,
|
166
|
-
:error => 1,
|
167
|
-
:FUNCTION => 2,
|
168
|
-
:INCLUDES => 3,
|
169
|
-
:DASHMATCH => 4,
|
170
|
-
:LBRACE => 5,
|
171
|
-
:HASH => 6,
|
172
|
-
:PLUS => 7,
|
173
|
-
:GREATER => 8,
|
174
|
-
:S => 9,
|
175
|
-
:STRING => 10,
|
176
|
-
:IDENT => 11,
|
177
|
-
:COMMA => 12,
|
178
|
-
:NUMBER => 13,
|
179
|
-
:PREFIXMATCH => 14,
|
180
|
-
:SUFFIXMATCH => 15,
|
181
|
-
:SUBSTRINGMATCH => 16,
|
182
|
-
:TILDE => 17,
|
183
|
-
:NOT_EQUAL => 18,
|
184
|
-
:SLASH => 19,
|
185
|
-
:DOUBLESLASH => 20,
|
186
|
-
:NOT => 21,
|
187
|
-
:EQUAL => 22,
|
188
|
-
:RPAREN => 23,
|
189
|
-
:LSQUARE => 24,
|
190
|
-
:RSQUARE => 25,
|
191
|
-
"." => 26,
|
192
|
-
"|" => 27,
|
193
|
-
"*" => 28,
|
194
|
-
":" => 29 }
|
195
|
-
|
196
|
-
racc_nt_base = 30
|
197
|
-
|
198
|
-
racc_use_result_var = true
|
199
|
-
|
200
|
-
Racc_arg = [
|
201
|
-
racc_action_table,
|
202
|
-
racc_action_check,
|
203
|
-
racc_action_default,
|
204
|
-
racc_action_pointer,
|
205
|
-
racc_goto_table,
|
206
|
-
racc_goto_check,
|
207
|
-
racc_goto_default,
|
208
|
-
racc_goto_pointer,
|
209
|
-
racc_nt_base,
|
210
|
-
racc_reduce_table,
|
211
|
-
racc_token_table,
|
212
|
-
racc_shift_n,
|
213
|
-
racc_reduce_n,
|
214
|
-
racc_use_result_var ]
|
215
|
-
|
216
|
-
Racc_token_to_s_table = [
|
217
|
-
"$end",
|
218
|
-
"error",
|
219
|
-
"FUNCTION",
|
220
|
-
"INCLUDES",
|
221
|
-
"DASHMATCH",
|
222
|
-
"LBRACE",
|
223
|
-
"HASH",
|
224
|
-
"PLUS",
|
225
|
-
"GREATER",
|
226
|
-
"S",
|
227
|
-
"STRING",
|
228
|
-
"IDENT",
|
229
|
-
"COMMA",
|
230
|
-
"NUMBER",
|
231
|
-
"PREFIXMATCH",
|
232
|
-
"SUFFIXMATCH",
|
233
|
-
"SUBSTRINGMATCH",
|
234
|
-
"TILDE",
|
235
|
-
"NOT_EQUAL",
|
236
|
-
"SLASH",
|
237
|
-
"DOUBLESLASH",
|
238
|
-
"NOT",
|
239
|
-
"EQUAL",
|
240
|
-
"RPAREN",
|
241
|
-
"LSQUARE",
|
242
|
-
"RSQUARE",
|
243
|
-
"\".\"",
|
244
|
-
"\"|\"",
|
245
|
-
"\"*\"",
|
246
|
-
"\":\"",
|
247
|
-
"$start",
|
248
|
-
"selector",
|
249
|
-
"simple_selector_1toN",
|
250
|
-
"combinator",
|
251
|
-
"simple_selector",
|
252
|
-
"element_name",
|
253
|
-
"hcap_0toN",
|
254
|
-
"hcap_1toN",
|
255
|
-
"negation",
|
256
|
-
"function",
|
257
|
-
"attrib",
|
258
|
-
"class",
|
259
|
-
"namespace",
|
260
|
-
"attrib_val_0or1",
|
261
|
-
"expr",
|
262
|
-
"an_plus_b",
|
263
|
-
"pseudo",
|
264
|
-
"attribute_id",
|
265
|
-
"eql_incl_dash",
|
266
|
-
"negation_arg" ]
|
267
|
-
|
268
|
-
Racc_debug_parser = false
|
269
|
-
|
270
|
-
##### State transition tables end #####
|
271
|
-
|
272
|
-
# reduce 0 omitted
|
273
|
-
|
274
|
-
module_eval(<<'.,.,', 'parser.y', 9)
|
275
|
-
def _reduce_1(val, _values, result)
|
276
|
-
result = [val.first, val.last].flatten
|
277
|
-
|
278
|
-
result
|
279
|
-
end
|
280
|
-
.,.,
|
281
|
-
|
282
|
-
module_eval(<<'.,.,', 'parser.y', 11)
|
283
|
-
def _reduce_2(val, _values, result)
|
284
|
-
result = val.flatten
|
285
|
-
result
|
286
|
-
end
|
287
|
-
.,.,
|
288
|
-
|
289
|
-
module_eval(<<'.,.,', 'parser.y', 14)
|
290
|
-
def _reduce_3(val, _values, result)
|
291
|
-
result = :DIRECT_ADJACENT_SELECTOR
|
292
|
-
result
|
293
|
-
end
|
294
|
-
.,.,
|
295
|
-
|
296
|
-
module_eval(<<'.,.,', 'parser.y', 15)
|
297
|
-
def _reduce_4(val, _values, result)
|
298
|
-
result = :CHILD_SELECTOR
|
299
|
-
result
|
300
|
-
end
|
301
|
-
.,.,
|
302
|
-
|
303
|
-
module_eval(<<'.,.,', 'parser.y', 16)
|
304
|
-
def _reduce_5(val, _values, result)
|
305
|
-
result = :PRECEDING_SELECTOR
|
306
|
-
result
|
307
|
-
end
|
308
|
-
.,.,
|
309
|
-
|
310
|
-
module_eval(<<'.,.,', 'parser.y', 17)
|
311
|
-
def _reduce_6(val, _values, result)
|
312
|
-
result = :DESCENDANT_SELECTOR
|
313
|
-
result
|
314
|
-
end
|
315
|
-
.,.,
|
316
|
-
|
317
|
-
module_eval(<<'.,.,', 'parser.y', 18)
|
318
|
-
def _reduce_7(val, _values, result)
|
319
|
-
result = :DESCENDANT_SELECTOR
|
320
|
-
result
|
321
|
-
end
|
322
|
-
.,.,
|
323
|
-
|
324
|
-
module_eval(<<'.,.,', 'parser.y', 19)
|
325
|
-
def _reduce_8(val, _values, result)
|
326
|
-
result = :CHILD_SELECTOR
|
327
|
-
result
|
328
|
-
end
|
329
|
-
.,.,
|
330
|
-
|
331
|
-
module_eval(<<'.,.,', 'parser.y', 23)
|
332
|
-
def _reduce_9(val, _values, result)
|
333
|
-
result = if val[1].nil?
|
334
|
-
val.first
|
335
|
-
else
|
336
|
-
Node.new(:CONDITIONAL_SELECTOR, [val.first, val[1]])
|
337
|
-
end
|
338
|
-
|
339
|
-
result
|
340
|
-
end
|
341
|
-
.,.,
|
342
|
-
|
343
|
-
module_eval(<<'.,.,', 'parser.y', 30)
|
344
|
-
def _reduce_10(val, _values, result)
|
345
|
-
result = Node.new(:CONDITIONAL_SELECTOR,
|
346
|
-
[
|
347
|
-
val.first,
|
348
|
-
Node.new(:COMBINATOR, [val[1], val.last])
|
349
|
-
]
|
350
|
-
)
|
351
|
-
|
352
|
-
result
|
353
|
-
end
|
354
|
-
.,.,
|
355
|
-
|
356
|
-
module_eval(<<'.,.,', 'parser.y', 38)
|
357
|
-
def _reduce_11(val, _values, result)
|
358
|
-
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
359
|
-
|
360
|
-
result
|
361
|
-
end
|
362
|
-
.,.,
|
363
|
-
|
364
|
-
# reduce 12 omitted
|
365
|
-
|
366
|
-
module_eval(<<'.,.,', 'parser.y', 42)
|
367
|
-
def _reduce_13(val, _values, result)
|
368
|
-
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
369
|
-
|
370
|
-
result
|
371
|
-
end
|
372
|
-
.,.,
|
373
|
-
|
374
|
-
module_eval(<<'.,.,', 'parser.y', 45)
|
375
|
-
def _reduce_14(val, _values, result)
|
376
|
-
result = Node.new(:CONDITIONAL_SELECTOR,
|
377
|
-
[
|
378
|
-
Node.new(:ELEMENT_NAME, ['*']),
|
379
|
-
Node.new(:COMBINATOR, val)
|
380
|
-
]
|
381
|
-
)
|
382
|
-
|
383
|
-
result
|
384
|
-
end
|
385
|
-
.,.,
|
386
|
-
|
387
|
-
module_eval(<<'.,.,', 'parser.y', 53)
|
388
|
-
def _reduce_15(val, _values, result)
|
389
|
-
result = Node.new(:CONDITIONAL_SELECTOR,
|
390
|
-
[Node.new(:ELEMENT_NAME, ['*']), val.first]
|
391
|
-
)
|
392
|
-
|
393
|
-
result
|
394
|
-
end
|
395
|
-
.,.,
|
396
|
-
|
397
|
-
module_eval(<<'.,.,', 'parser.y', 60)
|
398
|
-
def _reduce_16(val, _values, result)
|
399
|
-
result = Node.new(val[1], [val.first, val.last])
|
400
|
-
|
401
|
-
result
|
402
|
-
end
|
403
|
-
.,.,
|
404
|
-
|
405
|
-
# reduce 17 omitted
|
406
|
-
|
407
|
-
module_eval(<<'.,.,', 'parser.y', 65)
|
408
|
-
def _reduce_18(val, _values, result)
|
409
|
-
result = Node.new(:CLASS_CONDITION, [val[1]])
|
410
|
-
result
|
411
|
-
end
|
412
|
-
.,.,
|
413
|
-
|
414
|
-
module_eval(<<'.,.,', 'parser.y', 69)
|
415
|
-
def _reduce_19(val, _values, result)
|
416
|
-
result = Node.new(:ELEMENT_NAME,
|
417
|
-
[[val.first, val.last].compact.join(':')]
|
418
|
-
)
|
419
|
-
|
420
|
-
result
|
421
|
-
end
|
422
|
-
.,.,
|
423
|
-
|
424
|
-
module_eval(<<'.,.,', 'parser.y', 74)
|
425
|
-
def _reduce_20(val, _values, result)
|
426
|
-
name = @namespaces.key?('xmlns') ? "xmlns:#{val.first}" : val.first
|
427
|
-
result = Node.new(:ELEMENT_NAME, [name])
|
428
|
-
|
429
|
-
result
|
430
|
-
end
|
431
|
-
.,.,
|
432
|
-
|
433
|
-
module_eval(<<'.,.,', 'parser.y', 77)
|
434
|
-
def _reduce_21(val, _values, result)
|
435
|
-
result = Node.new(:ELEMENT_NAME, val)
|
436
|
-
result
|
437
|
-
end
|
438
|
-
.,.,
|
439
|
-
|
440
|
-
module_eval(<<'.,.,', 'parser.y', 80)
|
441
|
-
def _reduce_22(val, _values, result)
|
442
|
-
result = val[0]
|
443
|
-
result
|
444
|
-
end
|
445
|
-
.,.,
|
446
|
-
|
447
|
-
# reduce 23 omitted
|
448
|
-
|
449
|
-
module_eval(<<'.,.,', 'parser.y', 85)
|
450
|
-
def _reduce_24(val, _values, result)
|
451
|
-
result = Node.new(:ATTRIBUTE_CONDITION,
|
452
|
-
[Node.new(:ELEMENT_NAME, [val[1]])] + (val[2] || [])
|
453
|
-
)
|
454
|
-
|
455
|
-
result
|
456
|
-
end
|
457
|
-
.,.,
|
458
|
-
|
459
|
-
module_eval(<<'.,.,', 'parser.y', 90)
|
460
|
-
def _reduce_25(val, _values, result)
|
461
|
-
result = Node.new(:ATTRIBUTE_CONDITION,
|
462
|
-
[val[1]] + (val[2] || [])
|
463
|
-
)
|
464
|
-
|
465
|
-
result
|
466
|
-
end
|
467
|
-
.,.,
|
468
|
-
|
469
|
-
module_eval(<<'.,.,', 'parser.y', 95)
|
470
|
-
def _reduce_26(val, _values, result)
|
471
|
-
# Non standard, but hpricot supports it.
|
472
|
-
result = Node.new(:PSEUDO_CLASS,
|
473
|
-
[Node.new(:FUNCTION, ['nth-child(', val[1]])]
|
474
|
-
)
|
475
|
-
|
476
|
-
result
|
477
|
-
end
|
478
|
-
.,.,
|
479
|
-
|
480
|
-
module_eval(<<'.,.,', 'parser.y', 103)
|
481
|
-
def _reduce_27(val, _values, result)
|
482
|
-
result = Node.new(:FUNCTION, [val.first.strip])
|
483
|
-
|
484
|
-
result
|
485
|
-
end
|
486
|
-
.,.,
|
487
|
-
|
488
|
-
module_eval(<<'.,.,', 'parser.y', 106)
|
489
|
-
def _reduce_28(val, _values, result)
|
490
|
-
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
491
|
-
|
492
|
-
result
|
493
|
-
end
|
494
|
-
.,.,
|
495
|
-
|
496
|
-
module_eval(<<'.,.,', 'parser.y', 109)
|
497
|
-
def _reduce_29(val, _values, result)
|
498
|
-
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
499
|
-
|
500
|
-
result
|
501
|
-
end
|
502
|
-
.,.,
|
503
|
-
|
504
|
-
module_eval(<<'.,.,', 'parser.y', 112)
|
505
|
-
def _reduce_30(val, _values, result)
|
506
|
-
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
507
|
-
|
508
|
-
result
|
509
|
-
end
|
510
|
-
.,.,
|
511
|
-
|
512
|
-
module_eval(<<'.,.,', 'parser.y', 116)
|
513
|
-
def _reduce_31(val, _values, result)
|
514
|
-
result = [val.first, val.last]
|
515
|
-
result
|
516
|
-
end
|
517
|
-
.,.,
|
518
|
-
|
519
|
-
module_eval(<<'.,.,', 'parser.y', 117)
|
520
|
-
def _reduce_32(val, _values, result)
|
521
|
-
result = [val.first, val.last]
|
522
|
-
result
|
523
|
-
end
|
524
|
-
.,.,
|
525
|
-
|
526
|
-
module_eval(<<'.,.,', 'parser.y', 118)
|
527
|
-
def _reduce_33(val, _values, result)
|
528
|
-
result = [val.first, val.last]
|
529
|
-
result
|
530
|
-
end
|
531
|
-
.,.,
|
532
|
-
|
533
|
-
# reduce 34 omitted
|
534
|
-
|
535
|
-
# reduce 35 omitted
|
536
|
-
|
537
|
-
module_eval(<<'.,.,', 'parser.y', 123)
|
538
|
-
def _reduce_36(val, _values, result)
|
539
|
-
if val[0] == 'even'
|
540
|
-
val = ["2","n","+","0"]
|
541
|
-
result = Node.new(:AN_PLUS_B, val)
|
542
|
-
elsif val[0] == 'odd'
|
543
|
-
val = ["2","n","+","1"]
|
544
|
-
result = Node.new(:AN_PLUS_B, val)
|
545
|
-
else
|
546
|
-
# This is not CSS standard. It allows us to support this:
|
547
|
-
# assert_xpath("//a[foo(., @href)]", @parser.parse('a:foo(@href)'))
|
548
|
-
# assert_xpath("//a[foo(., @a, b)]", @parser.parse('a:foo(@a, b)'))
|
549
|
-
# assert_xpath("//a[foo(., a, 10)]", @parser.parse('a:foo(a, 10)'))
|
550
|
-
result = val
|
551
|
-
end
|
552
|
-
|
553
|
-
result
|
554
|
-
end
|
555
|
-
.,.,
|
556
|
-
|
557
|
-
module_eval(<<'.,.,', 'parser.y', 141)
|
558
|
-
def _reduce_37(val, _values, result)
|
559
|
-
if val[1] == 'n'
|
560
|
-
result = Node.new(:AN_PLUS_B, val)
|
561
|
-
else
|
562
|
-
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
563
|
-
end
|
564
|
-
|
565
|
-
result
|
566
|
-
end
|
567
|
-
.,.,
|
568
|
-
|
569
|
-
module_eval(<<'.,.,', 'parser.y', 147)
|
570
|
-
def _reduce_38(val, _values, result)
|
571
|
-
# n+3, -n+3
|
572
|
-
if val[0] == 'n'
|
573
|
-
val.unshift("1")
|
574
|
-
result = Node.new(:AN_PLUS_B, val)
|
575
|
-
elsif val[0] == '-n'
|
576
|
-
val[0] = 'n'
|
577
|
-
val.unshift("-1")
|
578
|
-
result = Node.new(:AN_PLUS_B, val)
|
579
|
-
else
|
580
|
-
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
581
|
-
end
|
582
|
-
|
583
|
-
result
|
584
|
-
end
|
585
|
-
.,.,
|
586
|
-
|
587
|
-
module_eval(<<'.,.,', 'parser.y', 161)
|
588
|
-
def _reduce_39(val, _values, result)
|
589
|
-
if val[1] == 'n'
|
590
|
-
val << "+"
|
591
|
-
val << "0"
|
592
|
-
result = Node.new(:AN_PLUS_B, val)
|
593
|
-
else
|
594
|
-
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
595
|
-
end
|
596
|
-
|
597
|
-
result
|
598
|
-
end
|
599
|
-
.,.,
|
600
|
-
|
601
|
-
module_eval(<<'.,.,', 'parser.y', 172)
|
602
|
-
def _reduce_40(val, _values, result)
|
603
|
-
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
604
|
-
|
605
|
-
result
|
606
|
-
end
|
607
|
-
.,.,
|
608
|
-
|
609
|
-
module_eval(<<'.,.,', 'parser.y', 174)
|
610
|
-
def _reduce_41(val, _values, result)
|
611
|
-
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
612
|
-
result
|
613
|
-
end
|
614
|
-
.,.,
|
615
|
-
|
616
|
-
# reduce 42 omitted
|
617
|
-
|
618
|
-
# reduce 43 omitted
|
619
|
-
|
620
|
-
module_eval(<<'.,.,', 'parser.y', 182)
|
621
|
-
def _reduce_44(val, _values, result)
|
622
|
-
result = Node.new(:COMBINATOR, val)
|
623
|
-
|
624
|
-
result
|
625
|
-
end
|
626
|
-
.,.,
|
627
|
-
|
628
|
-
module_eval(<<'.,.,', 'parser.y', 185)
|
629
|
-
def _reduce_45(val, _values, result)
|
630
|
-
result = Node.new(:COMBINATOR, val)
|
631
|
-
|
632
|
-
result
|
633
|
-
end
|
634
|
-
.,.,
|
635
|
-
|
636
|
-
module_eval(<<'.,.,', 'parser.y', 188)
|
637
|
-
def _reduce_46(val, _values, result)
|
638
|
-
result = Node.new(:COMBINATOR, val)
|
639
|
-
|
640
|
-
result
|
641
|
-
end
|
642
|
-
.,.,
|
643
|
-
|
644
|
-
module_eval(<<'.,.,', 'parser.y', 191)
|
645
|
-
def _reduce_47(val, _values, result)
|
646
|
-
result = Node.new(:COMBINATOR, val)
|
647
|
-
|
648
|
-
result
|
649
|
-
end
|
650
|
-
.,.,
|
651
|
-
|
652
|
-
# reduce 48 omitted
|
653
|
-
|
654
|
-
# reduce 49 omitted
|
655
|
-
|
656
|
-
# reduce 50 omitted
|
657
|
-
|
658
|
-
# reduce 51 omitted
|
659
|
-
|
660
|
-
module_eval(<<'.,.,', 'parser.y', 199)
|
661
|
-
def _reduce_52(val, _values, result)
|
662
|
-
result = Node.new(:ID, val)
|
663
|
-
result
|
664
|
-
end
|
665
|
-
.,.,
|
666
|
-
|
667
|
-
module_eval(<<'.,.,', 'parser.y', 202)
|
668
|
-
def _reduce_53(val, _values, result)
|
669
|
-
result = [val.first, val[1]]
|
670
|
-
result
|
671
|
-
end
|
672
|
-
.,.,
|
673
|
-
|
674
|
-
module_eval(<<'.,.,', 'parser.y', 203)
|
675
|
-
def _reduce_54(val, _values, result)
|
676
|
-
result = [val.first, val[1]]
|
677
|
-
result
|
678
|
-
end
|
679
|
-
.,.,
|
680
|
-
|
681
|
-
# reduce 55 omitted
|
682
|
-
|
683
|
-
# reduce 56 omitted
|
684
|
-
|
685
|
-
# reduce 57 omitted
|
686
|
-
|
687
|
-
# reduce 58 omitted
|
688
|
-
|
689
|
-
# reduce 59 omitted
|
690
|
-
|
691
|
-
# reduce 60 omitted
|
692
|
-
|
693
|
-
# reduce 61 omitted
|
694
|
-
|
695
|
-
# reduce 62 omitted
|
696
|
-
|
697
|
-
module_eval(<<'.,.,', 'parser.y', 217)
|
698
|
-
def _reduce_63(val, _values, result)
|
699
|
-
result = Node.new(:NOT, [val[1]])
|
700
|
-
|
701
|
-
result
|
702
|
-
end
|
703
|
-
.,.,
|
704
|
-
|
705
|
-
# reduce 64 omitted
|
706
|
-
|
707
|
-
def _reduce_none(val, _values, result)
|
708
|
-
val[0]
|
709
|
-
end
|
710
|
-
|
711
|
-
end # class GeneratedParser
|
712
|
-
end # module CSS
|
713
|
-
end # module Nokogiri
|