nokogiri 1.5.10 → 1.13.0
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.
- checksums.yaml +7 -0
- data/Gemfile +5 -0
- data/LICENSE-DEPENDENCIES.md +1903 -0
- data/LICENSE.md +9 -0
- data/README.md +280 -0
- data/bin/nokogiri +84 -31
- data/dependencies.yml +73 -0
- data/ext/nokogiri/depend +38 -358
- data/ext/nokogiri/extconf.rb +956 -100
- data/ext/nokogiri/gumbo.c +584 -0
- data/ext/nokogiri/html4_document.c +166 -0
- data/ext/nokogiri/html4_element_description.c +294 -0
- data/ext/nokogiri/html4_entity_lookup.c +37 -0
- data/ext/nokogiri/html4_sax_parser_context.c +120 -0
- data/ext/nokogiri/html4_sax_push_parser.c +95 -0
- data/ext/nokogiri/libxml2_backwards_compat.c +121 -0
- data/ext/nokogiri/nokogiri.c +232 -87
- data/ext/nokogiri/nokogiri.h +188 -129
- data/ext/nokogiri/test_global_handlers.c +40 -0
- data/ext/nokogiri/xml_attr.c +49 -40
- data/ext/nokogiri/xml_attribute_decl.c +18 -18
- data/ext/nokogiri/xml_cdata.c +24 -23
- data/ext/nokogiri/xml_comment.c +29 -21
- data/ext/nokogiri/xml_document.c +327 -223
- data/ext/nokogiri/xml_document_fragment.c +12 -16
- data/ext/nokogiri/xml_dtd.c +56 -50
- data/ext/nokogiri/xml_element_content.c +31 -26
- data/ext/nokogiri/xml_element_decl.c +22 -22
- data/ext/nokogiri/xml_encoding_handler.c +45 -20
- data/ext/nokogiri/xml_entity_decl.c +32 -30
- data/ext/nokogiri/xml_entity_reference.c +16 -18
- data/ext/nokogiri/xml_namespace.c +74 -32
- data/ext/nokogiri/xml_node.c +1290 -680
- data/ext/nokogiri/xml_node_set.c +239 -208
- data/ext/nokogiri/xml_processing_instruction.c +17 -19
- data/ext/nokogiri/xml_reader.c +227 -189
- data/ext/nokogiri/xml_relax_ng.c +52 -28
- data/ext/nokogiri/xml_sax_parser.c +123 -125
- data/ext/nokogiri/xml_sax_parser_context.c +138 -79
- data/ext/nokogiri/xml_sax_push_parser.c +88 -35
- data/ext/nokogiri/xml_schema.c +112 -33
- data/ext/nokogiri/xml_syntax_error.c +50 -23
- data/ext/nokogiri/xml_text.c +14 -18
- data/ext/nokogiri/xml_xpath_context.c +227 -140
- data/ext/nokogiri/xslt_stylesheet.c +162 -168
- data/gumbo-parser/CHANGES.md +63 -0
- data/gumbo-parser/Makefile +101 -0
- data/gumbo-parser/THANKS +27 -0
- data/gumbo-parser/src/Makefile +34 -0
- data/gumbo-parser/src/README.md +41 -0
- data/gumbo-parser/src/ascii.c +75 -0
- data/gumbo-parser/src/ascii.h +115 -0
- data/gumbo-parser/src/attribute.c +42 -0
- data/gumbo-parser/src/attribute.h +17 -0
- data/gumbo-parser/src/char_ref.c +22225 -0
- data/gumbo-parser/src/char_ref.h +29 -0
- data/gumbo-parser/src/char_ref.rl +2154 -0
- data/gumbo-parser/src/error.c +626 -0
- data/gumbo-parser/src/error.h +148 -0
- data/gumbo-parser/src/foreign_attrs.c +104 -0
- data/gumbo-parser/src/foreign_attrs.gperf +27 -0
- data/gumbo-parser/src/gumbo.h +943 -0
- data/gumbo-parser/src/insertion_mode.h +33 -0
- data/gumbo-parser/src/macros.h +91 -0
- data/gumbo-parser/src/parser.c +4875 -0
- data/gumbo-parser/src/parser.h +41 -0
- data/gumbo-parser/src/replacement.h +33 -0
- data/gumbo-parser/src/string_buffer.c +103 -0
- data/gumbo-parser/src/string_buffer.h +68 -0
- data/gumbo-parser/src/string_piece.c +48 -0
- data/gumbo-parser/src/svg_attrs.c +174 -0
- data/gumbo-parser/src/svg_attrs.gperf +77 -0
- data/gumbo-parser/src/svg_tags.c +137 -0
- data/gumbo-parser/src/svg_tags.gperf +55 -0
- data/gumbo-parser/src/tag.c +222 -0
- data/gumbo-parser/src/tag_lookup.c +382 -0
- data/gumbo-parser/src/tag_lookup.gperf +169 -0
- data/gumbo-parser/src/tag_lookup.h +13 -0
- data/gumbo-parser/src/token_buffer.c +79 -0
- data/gumbo-parser/src/token_buffer.h +71 -0
- data/gumbo-parser/src/token_type.h +17 -0
- data/gumbo-parser/src/tokenizer.c +3463 -0
- data/gumbo-parser/src/tokenizer.h +112 -0
- data/gumbo-parser/src/tokenizer_states.h +339 -0
- data/gumbo-parser/src/utf8.c +245 -0
- data/gumbo-parser/src/utf8.h +164 -0
- data/gumbo-parser/src/util.c +68 -0
- data/gumbo-parser/src/util.h +30 -0
- data/gumbo-parser/src/vector.c +111 -0
- data/gumbo-parser/src/vector.h +45 -0
- data/lib/nokogiri/class_resolver.rb +67 -0
- data/lib/nokogiri/css/node.rb +10 -58
- data/lib/nokogiri/css/parser.rb +327 -288
- data/lib/nokogiri/css/parser.y +67 -45
- data/lib/nokogiri/css/parser_extras.rb +52 -49
- data/lib/nokogiri/css/syntax_error.rb +3 -1
- data/lib/nokogiri/css/tokenizer.rb +107 -104
- data/lib/nokogiri/css/tokenizer.rex +7 -6
- data/lib/nokogiri/css/xpath_visitor.rb +263 -75
- data/lib/nokogiri/css.rb +50 -17
- data/lib/nokogiri/decorators/slop.rb +17 -8
- data/lib/nokogiri/extension.rb +31 -0
- data/lib/nokogiri/gumbo.rb +15 -0
- data/lib/nokogiri/html.rb +38 -27
- data/lib/nokogiri/{html → html4}/builder.rb +4 -2
- data/lib/nokogiri/html4/document.rb +331 -0
- data/lib/nokogiri/html4/document_fragment.rb +54 -0
- data/lib/nokogiri/{html → html4}/element_description.rb +3 -1
- data/lib/nokogiri/html4/element_description_defaults.rb +578 -0
- data/lib/nokogiri/{html → html4}/entity_lookup.rb +4 -2
- data/lib/nokogiri/{html → html4}/sax/parser.rb +24 -15
- data/lib/nokogiri/html4/sax/parser_context.rb +20 -0
- data/lib/nokogiri/html4/sax/push_parser.rb +37 -0
- data/lib/nokogiri/html4.rb +46 -0
- data/lib/nokogiri/html5/document.rb +88 -0
- data/lib/nokogiri/html5/document_fragment.rb +83 -0
- data/lib/nokogiri/html5/node.rb +96 -0
- data/lib/nokogiri/html5.rb +477 -0
- data/lib/nokogiri/jruby/dependencies.rb +21 -0
- data/lib/nokogiri/syntax_error.rb +2 -0
- data/lib/nokogiri/version/constant.rb +6 -0
- data/lib/nokogiri/version/info.rb +221 -0
- data/lib/nokogiri/version.rb +3 -90
- data/lib/nokogiri/xml/attr.rb +6 -3
- data/lib/nokogiri/xml/attribute_decl.rb +3 -1
- data/lib/nokogiri/xml/builder.rb +96 -54
- data/lib/nokogiri/xml/cdata.rb +3 -1
- data/lib/nokogiri/xml/character_data.rb +2 -0
- data/lib/nokogiri/xml/document.rb +234 -95
- data/lib/nokogiri/xml/document_fragment.rb +86 -36
- data/lib/nokogiri/xml/dtd.rb +16 -4
- data/lib/nokogiri/xml/element_content.rb +2 -0
- data/lib/nokogiri/xml/element_decl.rb +3 -1
- data/lib/nokogiri/xml/entity_decl.rb +4 -2
- data/lib/nokogiri/xml/entity_reference.rb +20 -0
- data/lib/nokogiri/xml/namespace.rb +3 -0
- data/lib/nokogiri/xml/node/save_options.rb +8 -4
- data/lib/nokogiri/xml/node.rb +947 -502
- data/lib/nokogiri/xml/node_set.rb +168 -159
- data/lib/nokogiri/xml/notation.rb +13 -0
- data/lib/nokogiri/xml/parse_options.rb +40 -5
- data/lib/nokogiri/xml/pp/character_data.rb +9 -6
- data/lib/nokogiri/xml/pp/node.rb +25 -26
- data/lib/nokogiri/xml/pp.rb +4 -2
- data/lib/nokogiri/xml/processing_instruction.rb +3 -1
- data/lib/nokogiri/xml/reader.rb +23 -28
- data/lib/nokogiri/xml/relax_ng.rb +8 -2
- data/lib/nokogiri/xml/sax/document.rb +45 -49
- data/lib/nokogiri/xml/sax/parser.rb +43 -41
- data/lib/nokogiri/xml/sax/parser_context.rb +8 -3
- data/lib/nokogiri/xml/sax/push_parser.rb +6 -5
- data/lib/nokogiri/xml/sax.rb +6 -4
- data/lib/nokogiri/xml/schema.rb +19 -9
- data/lib/nokogiri/xml/searchable.rb +259 -0
- data/lib/nokogiri/xml/syntax_error.rb +25 -1
- data/lib/nokogiri/xml/text.rb +2 -0
- data/lib/nokogiri/xml/xpath/syntax_error.rb +4 -2
- data/lib/nokogiri/xml/xpath.rb +15 -4
- data/lib/nokogiri/xml/xpath_context.rb +3 -3
- data/lib/nokogiri/xml.rb +38 -36
- data/lib/nokogiri/xslt/stylesheet.rb +3 -1
- data/lib/nokogiri/xslt.rb +18 -16
- data/lib/nokogiri.rb +69 -69
- data/lib/xsd/xmlparser/nokogiri.rb +26 -24
- data/patches/libxml2/0001-Remove-script-macro-support.patch +40 -0
- data/patches/libxml2/0002-Update-entities-to-remove-handling-of-ssi.patch +44 -0
- data/patches/libxml2/0003-libxml2.la-is-in-top_builddir.patch +25 -0
- data/patches/libxml2/0004-use-glibc-strlen.patch +53 -0
- data/patches/libxml2/0005-avoid-isnan-isinf.patch +81 -0
- data/patches/libxml2/0006-update-automake-files-for-arm64.patch +2511 -0
- data/patches/libxml2/0007-Fix-XPath-recursion-limit.patch +31 -0
- data/patches/libxml2/0008-htmlParseComment-handle-abruptly-closed-comments.patch +61 -0
- data/patches/libxml2/0009-allow-wildcard-namespaces.patch +77 -0
- data/patches/libxslt/0001-update-automake-files-for-arm64.patch +2511 -0
- data/patches/libxslt/0002-Fix-xml2-config-check-in-configure-script.patch +19 -0
- data/ports/archives/libxml2-2.9.12.tar.gz +0 -0
- data/ports/archives/libxslt-1.1.34.tar.gz +0 -0
- metadata +382 -460
- data/.autotest +0 -26
- data/.gemtest +0 -0
- data/CHANGELOG.ja.rdoc +0 -785
- data/CHANGELOG.rdoc +0 -783
- data/C_CODING_STYLE.rdoc +0 -33
- data/Manifest.txt +0 -303
- data/README.ja.rdoc +0 -106
- data/README.rdoc +0 -175
- data/ROADMAP.md +0 -90
- data/Rakefile +0 -228
- data/STANDARD_RESPONSES.md +0 -47
- data/Y_U_NO_GEMSPEC.md +0 -155
- data/build_all +0 -105
- data/ext/nokogiri/html_document.c +0 -170
- data/ext/nokogiri/html_document.h +0 -10
- data/ext/nokogiri/html_element_description.c +0 -279
- data/ext/nokogiri/html_element_description.h +0 -10
- data/ext/nokogiri/html_entity_lookup.c +0 -32
- data/ext/nokogiri/html_entity_lookup.h +0 -8
- data/ext/nokogiri/html_sax_parser_context.c +0 -116
- data/ext/nokogiri/html_sax_parser_context.h +0 -11
- data/ext/nokogiri/html_sax_push_parser.c +0 -87
- data/ext/nokogiri/html_sax_push_parser.h +0 -9
- data/ext/nokogiri/xml_attr.h +0 -9
- data/ext/nokogiri/xml_attribute_decl.h +0 -9
- data/ext/nokogiri/xml_cdata.h +0 -9
- data/ext/nokogiri/xml_comment.h +0 -9
- data/ext/nokogiri/xml_document.h +0 -23
- data/ext/nokogiri/xml_document_fragment.h +0 -10
- data/ext/nokogiri/xml_dtd.h +0 -10
- data/ext/nokogiri/xml_element_content.h +0 -10
- data/ext/nokogiri/xml_element_decl.h +0 -9
- data/ext/nokogiri/xml_encoding_handler.h +0 -8
- data/ext/nokogiri/xml_entity_decl.h +0 -10
- data/ext/nokogiri/xml_entity_reference.h +0 -9
- data/ext/nokogiri/xml_io.c +0 -56
- data/ext/nokogiri/xml_io.h +0 -11
- data/ext/nokogiri/xml_libxml2_hacks.c +0 -112
- data/ext/nokogiri/xml_libxml2_hacks.h +0 -12
- data/ext/nokogiri/xml_namespace.h +0 -13
- data/ext/nokogiri/xml_node.h +0 -13
- data/ext/nokogiri/xml_node_set.h +0 -14
- data/ext/nokogiri/xml_processing_instruction.h +0 -9
- data/ext/nokogiri/xml_reader.h +0 -10
- data/ext/nokogiri/xml_relax_ng.h +0 -9
- data/ext/nokogiri/xml_sax_parser.h +0 -39
- data/ext/nokogiri/xml_sax_parser_context.h +0 -10
- data/ext/nokogiri/xml_sax_push_parser.h +0 -9
- data/ext/nokogiri/xml_schema.h +0 -9
- data/ext/nokogiri/xml_syntax_error.h +0 -13
- data/ext/nokogiri/xml_text.h +0 -9
- data/ext/nokogiri/xml_xpath_context.h +0 -10
- data/ext/nokogiri/xslt_stylesheet.h +0 -14
- data/lib/nokogiri/html/document.rb +0 -254
- data/lib/nokogiri/html/document_fragment.rb +0 -41
- data/lib/nokogiri/html/element_description_defaults.rb +0 -671
- data/lib/nokogiri/html/sax/parser_context.rb +0 -16
- data/lib/nokogiri/html/sax/push_parser.rb +0 -16
- data/tasks/cross_compile.rb +0 -150
- data/tasks/nokogiri.org.rb +0 -24
- data/tasks/test.rb +0 -95
- data/test/css/test_nthiness.rb +0 -159
- data/test/css/test_parser.rb +0 -341
- data/test/css/test_tokenizer.rb +0 -198
- data/test/css/test_xpath_visitor.rb +0 -91
- data/test/decorators/test_slop.rb +0 -16
- data/test/files/2ch.html +0 -108
- data/test/files/address_book.rlx +0 -12
- data/test/files/address_book.xml +0 -10
- data/test/files/bar/bar.xsd +0 -4
- data/test/files/dont_hurt_em_why.xml +0 -422
- data/test/files/encoding.html +0 -82
- data/test/files/encoding.xhtml +0 -84
- data/test/files/exslt.xml +0 -8
- data/test/files/exslt.xslt +0 -35
- data/test/files/foo/foo.xsd +0 -4
- data/test/files/metacharset.html +0 -10
- data/test/files/noencoding.html +0 -47
- data/test/files/po.xml +0 -32
- data/test/files/po.xsd +0 -66
- data/test/files/shift_jis.html +0 -10
- data/test/files/shift_jis.xml +0 -5
- data/test/files/snuggles.xml +0 -3
- data/test/files/staff.dtd +0 -10
- data/test/files/staff.xml +0 -59
- data/test/files/staff.xslt +0 -32
- data/test/files/test_document_url/bar.xml +0 -2
- data/test/files/test_document_url/document.dtd +0 -4
- data/test/files/test_document_url/document.xml +0 -6
- data/test/files/tlm.html +0 -850
- data/test/files/to_be_xincluded.xml +0 -2
- data/test/files/valid_bar.xml +0 -2
- data/test/files/xinclude.xml +0 -4
- data/test/helper.rb +0 -154
- data/test/html/sax/test_parser.rb +0 -141
- data/test/html/sax/test_parser_context.rb +0 -46
- data/test/html/test_builder.rb +0 -164
- data/test/html/test_document.rb +0 -552
- data/test/html/test_document_encoding.rb +0 -138
- data/test/html/test_document_fragment.rb +0 -261
- data/test/html/test_element_description.rb +0 -105
- data/test/html/test_named_characters.rb +0 -14
- data/test/html/test_node.rb +0 -196
- data/test/html/test_node_encoding.rb +0 -27
- data/test/namespaces/test_additional_namespaces_in_builder_doc.rb +0 -14
- data/test/namespaces/test_namespaces_in_builder_doc.rb +0 -75
- data/test/namespaces/test_namespaces_in_created_doc.rb +0 -75
- data/test/namespaces/test_namespaces_in_parsed_doc.rb +0 -66
- data/test/test_convert_xpath.rb +0 -135
- data/test/test_css_cache.rb +0 -45
- data/test/test_encoding_handler.rb +0 -46
- data/test/test_memory_leak.rb +0 -156
- data/test/test_nokogiri.rb +0 -132
- data/test/test_reader.rb +0 -555
- data/test/test_soap4r_sax.rb +0 -52
- data/test/test_xslt_transforms.rb +0 -254
- data/test/xml/node/test_save_options.rb +0 -28
- data/test/xml/node/test_subclass.rb +0 -44
- data/test/xml/sax/test_parser.rb +0 -366
- data/test/xml/sax/test_parser_context.rb +0 -106
- data/test/xml/sax/test_push_parser.rb +0 -157
- data/test/xml/test_attr.rb +0 -64
- data/test/xml/test_attribute_decl.rb +0 -86
- data/test/xml/test_builder.rb +0 -306
- data/test/xml/test_c14n.rb +0 -151
- data/test/xml/test_cdata.rb +0 -48
- data/test/xml/test_comment.rb +0 -29
- data/test/xml/test_document.rb +0 -828
- data/test/xml/test_document_encoding.rb +0 -28
- data/test/xml/test_document_fragment.rb +0 -223
- data/test/xml/test_dtd.rb +0 -103
- data/test/xml/test_dtd_encoding.rb +0 -33
- data/test/xml/test_element_content.rb +0 -56
- data/test/xml/test_element_decl.rb +0 -73
- data/test/xml/test_entity_decl.rb +0 -122
- data/test/xml/test_entity_reference.rb +0 -245
- data/test/xml/test_namespace.rb +0 -95
- data/test/xml/test_node.rb +0 -1137
- data/test/xml/test_node_attributes.rb +0 -96
- data/test/xml/test_node_encoding.rb +0 -107
- data/test/xml/test_node_inheritance.rb +0 -32
- data/test/xml/test_node_reparenting.rb +0 -374
- data/test/xml/test_node_set.rb +0 -755
- data/test/xml/test_parse_options.rb +0 -64
- data/test/xml/test_processing_instruction.rb +0 -30
- data/test/xml/test_reader_encoding.rb +0 -142
- data/test/xml/test_relax_ng.rb +0 -60
- data/test/xml/test_schema.rb +0 -103
- data/test/xml/test_syntax_error.rb +0 -12
- data/test/xml/test_text.rb +0 -45
- data/test/xml/test_unparented_node.rb +0 -422
- data/test/xml/test_xinclude.rb +0 -83
- data/test/xml/test_xpath.rb +0 -295
- data/test/xslt/test_custom_functions.rb +0 -133
- data/test/xslt/test_exception_handling.rb +0 -37
- data/test_all +0 -81
data/lib/nokogiri/css/parser.rb
CHANGED
@@ -1,189 +1,228 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# DO NOT MODIFY!!!!
|
3
|
-
# This file is automatically generated by Racc 1.
|
4
|
-
# from Racc
|
4
|
+
# This file is automatically generated by Racc 1.6.0
|
5
|
+
# from Racc grammar file "".
|
5
6
|
#
|
6
7
|
|
7
8
|
require 'racc/parser.rb'
|
8
9
|
|
9
10
|
|
10
|
-
|
11
|
+
require_relative "parser_extras"
|
12
|
+
|
11
13
|
module Nokogiri
|
12
14
|
module CSS
|
15
|
+
# :nodoc: all
|
13
16
|
class Parser < Racc::Parser
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
module Nokogiri
|
22
|
+
module CSS
|
23
|
+
class Parser < Racc::Parser
|
24
|
+
|
25
|
+
|
26
|
+
def unescape_css_identifier(identifier)
|
27
|
+
identifier.gsub(/\\(?:([^0-9a-fA-F])|([0-9a-fA-F]{1,6})\s?)/){ |m| $1 || [$2.hex].pack('U') }
|
28
|
+
end
|
29
|
+
|
30
|
+
def unescape_css_string(str)
|
31
|
+
str.gsub(/\\(?:([^0-9a-fA-F])|([0-9a-fA-F]{1,6})\s?)/) do |m|
|
32
|
+
if $1=="\n"
|
33
|
+
''
|
34
|
+
else
|
35
|
+
$1 || [$2.hex].pack('U')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
14
39
|
##### State transition tables begin ###
|
15
40
|
|
16
41
|
racc_action_table = [
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
42
|
+
24, 93, 56, 57, 33, 55, 94, 23, 24, 22,
|
43
|
+
12, 93, 33, 27, 35, 52, 44, 22, -23, 25,
|
44
|
+
45, 98, 23, 33, 26, 18, 20, 25, 27, -23,
|
45
|
+
23, 24, 26, 18, 20, 33, 27, 11, 39, 24,
|
46
|
+
22, 23, 74, 33, 18, 91, 90, 27, 22, 12,
|
47
|
+
25, 24, -23, 23, 85, 26, 18, 20, 25, 27,
|
48
|
+
66, 23, 24, 26, 18, 20, 33, 27, 86, 88,
|
49
|
+
51, 22, 89, 92, 24, 26, 56, 87, 95, 60,
|
50
|
+
90, 25, 96, 46, 23, 49, 26, 18, 20, 99,
|
51
|
+
27, 33, 33, 51, 103, 104, 56, 58, 26, 60,
|
52
|
+
93, 106, 33, 33, 33, 109, 39, 39, 110, 23,
|
53
|
+
23, nil, 18, 18, 20, 27, 27, 39, 39, 39,
|
54
|
+
23, 23, 23, 18, 18, 18, 27, 27, 27, 33,
|
55
|
+
33, 101, 100, nil, 102, 22, 56, 87, nil, 60,
|
56
|
+
33, nil, nil, nil, 39, 39, nil, 23, 23, nil,
|
57
|
+
18, 18, 20, 27, 27, 39, 82, 83, 23, 56,
|
58
|
+
87, 18, 60, nil, 27, 82, 83, 78, 79, 80,
|
59
|
+
nil, 81, nil, nil, nil, 77, 78, 79, 80, nil,
|
60
|
+
81, 4, 5, 10, 77, 4, 5, 43, nil, 56,
|
61
|
+
87, 6, 60, 8, 7, 6, nil, 8, 7, 4,
|
62
|
+
5, 10, nil, nil, nil, nil, nil, nil, nil, 6,
|
63
|
+
nil, 8, 7 ]
|
34
64
|
|
35
65
|
racc_action_check = [
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
66
|
+
3, 58, 24, 24, 3, 24, 57, 15, 9, 3,
|
67
|
+
64, 57, 9, 15, 11, 24, 18, 9, 58, 3,
|
68
|
+
21, 64, 3, 14, 3, 3, 3, 9, 3, 22,
|
69
|
+
9, 12, 9, 9, 9, 12, 9, 1, 14, 42,
|
70
|
+
12, 14, 45, 42, 14, 55, 55, 14, 42, 1,
|
71
|
+
12, 27, 46, 12, 49, 12, 12, 12, 42, 12,
|
72
|
+
27, 42, 43, 42, 42, 42, 43, 42, 50, 53,
|
73
|
+
27, 43, 54, 56, 23, 27, 51, 51, 59, 51,
|
74
|
+
60, 43, 61, 23, 43, 23, 43, 43, 43, 75,
|
75
|
+
43, 28, 25, 23, 84, 86, 25, 25, 23, 25,
|
76
|
+
87, 91, 29, 30, 31, 94, 28, 25, 106, 28,
|
77
|
+
25, nil, 28, 25, 25, 28, 25, 29, 30, 31,
|
78
|
+
29, 30, 31, 29, 30, 31, 29, 30, 31, 32,
|
79
|
+
39, 76, 76, nil, 76, 39, 90, 90, nil, 90,
|
80
|
+
62, nil, nil, nil, 32, 39, nil, 32, 39, nil,
|
81
|
+
32, 39, 39, 32, 39, 62, 47, 47, 62, 92,
|
82
|
+
92, 62, 92, nil, 62, 48, 48, 47, 47, 47,
|
83
|
+
nil, 47, nil, nil, nil, 47, 48, 48, 48, nil,
|
84
|
+
48, 0, 0, 0, 48, 17, 17, 17, nil, 93,
|
85
|
+
93, 0, 93, 0, 0, 17, nil, 17, 17, 26,
|
86
|
+
26, 26, nil, nil, nil, nil, nil, nil, nil, 26,
|
87
|
+
nil, 26, 26 ]
|
53
88
|
|
54
89
|
racc_action_pointer = [
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
nil, nil,
|
63
|
-
nil,
|
64
|
-
|
65
|
-
nil,
|
90
|
+
174, 37, nil, -2, nil, nil, nil, nil, nil, 6,
|
91
|
+
nil, 14, 29, nil, 17, -17, nil, 178, 5, nil,
|
92
|
+
nil, -9, 0, 72, -8, 86, 192, 49, 85, 96,
|
93
|
+
97, 98, 123, nil, nil, nil, nil, nil, nil, 124,
|
94
|
+
nil, nil, 37, 60, nil, 31, 23, 153, 162, 29,
|
95
|
+
39, 66, nil, 46, 49, 34, 61, -1, -11, 55,
|
96
|
+
68, 59, 134, nil, -2, nil, nil, nil, nil, nil,
|
97
|
+
nil, nil, nil, nil, nil, 64, 121, nil, nil, nil,
|
98
|
+
nil, nil, nil, nil, 69, nil, 84, 88, nil, nil,
|
99
|
+
126, 94, 149, 179, 92, nil, nil, nil, nil, nil,
|
100
|
+
nil, nil, nil, nil, nil, nil, 95, nil, nil, nil,
|
101
|
+
nil ]
|
66
102
|
|
67
103
|
racc_action_default = [
|
68
|
-
-
|
69
|
-
-
|
70
|
-
-
|
71
|
-
-
|
72
|
-
-
|
73
|
-
-
|
74
|
-
-
|
75
|
-
-
|
76
|
-
-
|
77
|
-
-
|
78
|
-
-
|
104
|
+
-75, -76, -2, -24, -4, -5, -6, -7, -8, -24,
|
105
|
+
-74, -76, -24, -3, -47, -10, -13, -17, -76, -19,
|
106
|
+
-20, -76, -22, -24, -76, -24, -75, -76, -53, -54,
|
107
|
+
-55, -56, -57, -58, -14, 111, -1, -9, -46, -24,
|
108
|
+
-11, -12, -24, -24, -18, -76, -29, -62, -62, -76,
|
109
|
+
-76, -76, -30, -76, -76, -38, -39, -40, -22, -76,
|
110
|
+
-38, -76, -71, -73, -76, -44, -45, -48, -49, -50,
|
111
|
+
-51, -52, -15, -16, -21, -76, -76, -63, -64, -65,
|
112
|
+
-66, -67, -68, -69, -76, -27, -76, -40, -31, -32,
|
113
|
+
-76, -43, -76, -76, -76, -33, -70, -72, -34, -25,
|
114
|
+
-59, -60, -61, -26, -28, -35, -76, -36, -37, -42,
|
115
|
+
-41 ]
|
79
116
|
|
80
117
|
racc_goto_table = [
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
70, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
118
|
+
53, 38, 13, 1, 42, 48, 62, 37, 34, 65,
|
119
|
+
40, 36, 63, 75, 84, 67, 68, 69, 70, 71,
|
120
|
+
62, 41, 50, 47, 54, nil, 63, nil, nil, 64,
|
85
121
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
122
|
+
nil, 72, 73, nil, nil, nil, nil, nil, nil, 97,
|
86
123
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
87
|
-
|
124
|
+
nil, nil, nil, nil, nil, nil, 105, nil, 107, 108 ]
|
88
125
|
|
89
126
|
racc_goto_check = [
|
90
|
-
18,
|
91
|
-
|
92
|
-
|
93
|
-
2, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
127
|
+
18, 12, 2, 1, 5, 9, 7, 8, 2, 9,
|
128
|
+
10, 2, 12, 17, 17, 12, 12, 12, 12, 12,
|
129
|
+
7, 11, 15, 16, 19, nil, 12, nil, nil, 1,
|
94
130
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
131
|
+
nil, 2, 2, nil, nil, nil, nil, nil, nil, 12,
|
95
132
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
96
|
-
|
133
|
+
nil, nil, nil, nil, nil, nil, 18, nil, 18, 18 ]
|
97
134
|
|
98
135
|
racc_goto_pointer = [
|
99
|
-
nil,
|
100
|
-
|
101
|
-
nil, nil,
|
136
|
+
nil, 3, -1, nil, nil, -13, nil, -19, -7, -18,
|
137
|
+
-5, 6, -13, nil, nil, -1, 0, -34, -24, 0,
|
138
|
+
nil, nil, nil, nil ]
|
102
139
|
|
103
140
|
racc_goto_default = [
|
104
|
-
nil, nil, 3,
|
105
|
-
|
106
|
-
|
141
|
+
nil, nil, nil, 2, 3, 9, 17, 14, nil, 15,
|
142
|
+
31, 30, 16, 29, 19, 21, nil, nil, 59, nil,
|
143
|
+
28, 32, 76, 61 ]
|
107
144
|
|
108
145
|
racc_reduce_table = [
|
109
146
|
0, 0, :racc_error,
|
110
147
|
3, 32, :_reduce_1,
|
111
148
|
1, 32, :_reduce_2,
|
112
|
-
|
113
|
-
1,
|
114
|
-
1,
|
115
|
-
1,
|
116
|
-
1,
|
117
|
-
1,
|
118
|
-
|
119
|
-
2, 36, :_reduce_10,
|
120
|
-
3, 36, :_reduce_11,
|
121
|
-
2, 36, :_reduce_12,
|
122
|
-
1, 36, :_reduce_none,
|
123
|
-
2, 36, :_reduce_14,
|
124
|
-
2, 36, :_reduce_15,
|
125
|
-
2, 36, :_reduce_16,
|
126
|
-
1, 36, :_reduce_17,
|
127
|
-
2, 34, :_reduce_18,
|
128
|
-
3, 33, :_reduce_19,
|
129
|
-
1, 33, :_reduce_none,
|
130
|
-
2, 44, :_reduce_21,
|
149
|
+
2, 32, :_reduce_3,
|
150
|
+
1, 36, :_reduce_4,
|
151
|
+
1, 36, :_reduce_5,
|
152
|
+
1, 36, :_reduce_6,
|
153
|
+
1, 36, :_reduce_7,
|
154
|
+
1, 36, :_reduce_8,
|
155
|
+
2, 37, :_reduce_9,
|
131
156
|
1, 37, :_reduce_none,
|
132
|
-
|
133
|
-
|
134
|
-
1,
|
135
|
-
|
157
|
+
2, 37, :_reduce_11,
|
158
|
+
2, 37, :_reduce_12,
|
159
|
+
1, 37, :_reduce_13,
|
160
|
+
2, 34, :_reduce_14,
|
161
|
+
3, 33, :_reduce_15,
|
162
|
+
3, 33, :_reduce_16,
|
163
|
+
1, 33, :_reduce_none,
|
164
|
+
2, 44, :_reduce_18,
|
165
|
+
1, 38, :_reduce_none,
|
166
|
+
1, 38, :_reduce_20,
|
167
|
+
3, 45, :_reduce_21,
|
168
|
+
1, 45, :_reduce_22,
|
169
|
+
1, 46, :_reduce_23,
|
136
170
|
0, 46, :_reduce_none,
|
137
|
-
4,
|
138
|
-
4,
|
139
|
-
3,
|
140
|
-
3, 47, :
|
141
|
-
1, 47, :
|
142
|
-
2,
|
143
|
-
3,
|
144
|
-
3,
|
145
|
-
3,
|
146
|
-
3,
|
147
|
-
3, 49, :
|
148
|
-
3, 49, :
|
149
|
-
3, 49, :
|
171
|
+
4, 42, :_reduce_25,
|
172
|
+
4, 42, :_reduce_26,
|
173
|
+
3, 42, :_reduce_27,
|
174
|
+
3, 47, :_reduce_28,
|
175
|
+
1, 47, :_reduce_29,
|
176
|
+
2, 40, :_reduce_30,
|
177
|
+
3, 40, :_reduce_31,
|
178
|
+
3, 40, :_reduce_32,
|
179
|
+
3, 40, :_reduce_33,
|
180
|
+
3, 40, :_reduce_34,
|
181
|
+
3, 49, :_reduce_35,
|
182
|
+
3, 49, :_reduce_36,
|
183
|
+
3, 49, :_reduce_37,
|
150
184
|
1, 49, :_reduce_none,
|
151
185
|
1, 49, :_reduce_none,
|
152
|
-
1, 49, :
|
153
|
-
4, 50, :
|
154
|
-
3, 50, :
|
155
|
-
2, 50, :
|
156
|
-
2,
|
157
|
-
2,
|
158
|
-
1, 38, :_reduce_none,
|
159
|
-
0, 38, :_reduce_none,
|
160
|
-
2, 39, :_reduce_51,
|
161
|
-
2, 39, :_reduce_52,
|
162
|
-
2, 39, :_reduce_53,
|
163
|
-
2, 39, :_reduce_54,
|
164
|
-
1, 39, :_reduce_none,
|
165
|
-
1, 39, :_reduce_none,
|
186
|
+
1, 49, :_reduce_40,
|
187
|
+
4, 50, :_reduce_41,
|
188
|
+
3, 50, :_reduce_42,
|
189
|
+
2, 50, :_reduce_43,
|
190
|
+
2, 41, :_reduce_44,
|
191
|
+
2, 41, :_reduce_45,
|
166
192
|
1, 39, :_reduce_none,
|
167
|
-
|
168
|
-
|
193
|
+
0, 39, :_reduce_none,
|
194
|
+
2, 43, :_reduce_48,
|
195
|
+
2, 43, :_reduce_49,
|
196
|
+
2, 43, :_reduce_50,
|
197
|
+
2, 43, :_reduce_51,
|
198
|
+
2, 43, :_reduce_52,
|
199
|
+
1, 43, :_reduce_none,
|
200
|
+
1, 43, :_reduce_none,
|
201
|
+
1, 43, :_reduce_none,
|
202
|
+
1, 43, :_reduce_none,
|
203
|
+
1, 43, :_reduce_none,
|
204
|
+
1, 51, :_reduce_58,
|
205
|
+
2, 48, :_reduce_59,
|
169
206
|
2, 48, :_reduce_60,
|
170
207
|
2, 48, :_reduce_61,
|
171
208
|
0, 48, :_reduce_none,
|
172
|
-
1,
|
173
|
-
1,
|
174
|
-
1,
|
175
|
-
1,
|
176
|
-
1,
|
177
|
-
1,
|
178
|
-
1,
|
179
|
-
3,
|
180
|
-
1,
|
181
|
-
2,
|
182
|
-
1,
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
209
|
+
1, 53, :_reduce_63,
|
210
|
+
1, 53, :_reduce_64,
|
211
|
+
1, 53, :_reduce_65,
|
212
|
+
1, 53, :_reduce_66,
|
213
|
+
1, 53, :_reduce_67,
|
214
|
+
1, 53, :_reduce_68,
|
215
|
+
1, 53, :_reduce_69,
|
216
|
+
3, 52, :_reduce_70,
|
217
|
+
1, 54, :_reduce_none,
|
218
|
+
2, 54, :_reduce_none,
|
219
|
+
1, 54, :_reduce_none,
|
220
|
+
1, 35, :_reduce_none,
|
221
|
+
0, 35, :_reduce_none ]
|
222
|
+
|
223
|
+
racc_reduce_n = 76
|
224
|
+
|
225
|
+
racc_shift_n = 111
|
187
226
|
|
188
227
|
racc_token_table = {
|
189
228
|
false => 0,
|
@@ -274,23 +313,24 @@ Racc_token_to_s_table = [
|
|
274
313
|
"selector",
|
275
314
|
"simple_selector_1toN",
|
276
315
|
"prefixless_combinator_selector",
|
316
|
+
"optional_S",
|
277
317
|
"combinator",
|
278
318
|
"simple_selector",
|
279
319
|
"element_name",
|
280
320
|
"hcap_0toN",
|
281
|
-
"hcap_1toN",
|
282
|
-
"negation",
|
283
321
|
"function",
|
284
322
|
"pseudo",
|
285
323
|
"attrib",
|
324
|
+
"hcap_1toN",
|
286
325
|
"class",
|
287
326
|
"namespaced_ident",
|
288
327
|
"namespace",
|
289
328
|
"attrib_name",
|
290
329
|
"attrib_val_0or1",
|
291
330
|
"expr",
|
292
|
-
"
|
331
|
+
"nth",
|
293
332
|
"attribute_id",
|
333
|
+
"negation",
|
294
334
|
"eql_incl_dash",
|
295
335
|
"negation_arg" ]
|
296
336
|
|
@@ -302,406 +342,401 @@ Racc_debug_parser = false
|
|
302
342
|
|
303
343
|
def _reduce_1(val, _values, result)
|
304
344
|
result = [val.first, val.last].flatten
|
305
|
-
|
345
|
+
|
306
346
|
result
|
307
347
|
end
|
308
348
|
|
309
349
|
def _reduce_2(val, _values, result)
|
310
|
-
result = val.flatten
|
350
|
+
result = val.flatten
|
311
351
|
result
|
312
352
|
end
|
313
353
|
|
314
354
|
def _reduce_3(val, _values, result)
|
315
|
-
result = val.flatten
|
355
|
+
result = [val.last].flatten
|
316
356
|
result
|
317
357
|
end
|
318
358
|
|
319
359
|
def _reduce_4(val, _values, result)
|
320
|
-
result = :DIRECT_ADJACENT_SELECTOR
|
360
|
+
result = :DIRECT_ADJACENT_SELECTOR
|
321
361
|
result
|
322
362
|
end
|
323
363
|
|
324
364
|
def _reduce_5(val, _values, result)
|
325
|
-
result = :CHILD_SELECTOR
|
365
|
+
result = :CHILD_SELECTOR
|
326
366
|
result
|
327
367
|
end
|
328
368
|
|
329
369
|
def _reduce_6(val, _values, result)
|
330
|
-
result = :FOLLOWING_SELECTOR
|
370
|
+
result = :FOLLOWING_SELECTOR
|
331
371
|
result
|
332
372
|
end
|
333
373
|
|
334
374
|
def _reduce_7(val, _values, result)
|
335
|
-
result = :DESCENDANT_SELECTOR
|
375
|
+
result = :DESCENDANT_SELECTOR
|
336
376
|
result
|
337
377
|
end
|
338
378
|
|
339
379
|
def _reduce_8(val, _values, result)
|
340
|
-
result = :
|
380
|
+
result = :CHILD_SELECTOR
|
341
381
|
result
|
342
382
|
end
|
343
383
|
|
344
384
|
def _reduce_9(val, _values, result)
|
345
|
-
result = :CHILD_SELECTOR
|
346
|
-
result
|
347
|
-
end
|
348
|
-
|
349
|
-
def _reduce_10(val, _values, result)
|
350
385
|
result = if val[1].nil?
|
351
386
|
val.first
|
352
387
|
else
|
353
388
|
Node.new(:CONDITIONAL_SELECTOR, [val.first, val[1]])
|
354
389
|
end
|
355
|
-
|
356
|
-
result
|
357
|
-
end
|
358
|
-
|
359
|
-
def _reduce_11(val, _values, result)
|
360
|
-
result = Node.new(:CONDITIONAL_SELECTOR,
|
361
|
-
[
|
362
|
-
val.first,
|
363
|
-
Node.new(:COMBINATOR, [val[1], val.last])
|
364
|
-
]
|
365
|
-
)
|
366
|
-
|
367
|
-
result
|
368
|
-
end
|
369
390
|
|
370
|
-
def _reduce_12(val, _values, result)
|
371
|
-
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
372
|
-
|
373
391
|
result
|
374
392
|
end
|
375
393
|
|
376
|
-
# reduce
|
394
|
+
# reduce 10 omitted
|
377
395
|
|
378
|
-
def
|
396
|
+
def _reduce_11(val, _values, result)
|
379
397
|
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
380
|
-
|
398
|
+
|
381
399
|
result
|
382
400
|
end
|
383
401
|
|
384
|
-
def
|
402
|
+
def _reduce_12(val, _values, result)
|
385
403
|
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
386
|
-
|
387
|
-
result
|
388
|
-
end
|
389
404
|
|
390
|
-
def _reduce_16(val, _values, result)
|
391
|
-
result = Node.new(:CONDITIONAL_SELECTOR,
|
392
|
-
[
|
393
|
-
Node.new(:ELEMENT_NAME, ['*']),
|
394
|
-
Node.new(:COMBINATOR, val)
|
395
|
-
]
|
396
|
-
)
|
397
|
-
|
398
405
|
result
|
399
406
|
end
|
400
407
|
|
401
|
-
def
|
408
|
+
def _reduce_13(val, _values, result)
|
402
409
|
result = Node.new(:CONDITIONAL_SELECTOR,
|
403
410
|
[Node.new(:ELEMENT_NAME, ['*']), val.first]
|
404
411
|
)
|
405
|
-
|
412
|
+
|
406
413
|
result
|
407
414
|
end
|
408
415
|
|
409
|
-
def
|
416
|
+
def _reduce_14(val, _values, result)
|
410
417
|
result = Node.new(val.first, [nil, val.last])
|
411
|
-
|
418
|
+
|
412
419
|
result
|
413
420
|
end
|
414
421
|
|
415
|
-
def
|
422
|
+
def _reduce_15(val, _values, result)
|
416
423
|
result = Node.new(val[1], [val.first, val.last])
|
417
|
-
|
424
|
+
|
418
425
|
result
|
419
426
|
end
|
420
427
|
|
421
|
-
|
428
|
+
def _reduce_16(val, _values, result)
|
429
|
+
result = Node.new(:DESCENDANT_SELECTOR, [val.first, val.last])
|
422
430
|
|
423
|
-
def _reduce_21(val, _values, result)
|
424
|
-
result = Node.new(:CLASS_CONDITION, [val[1]])
|
425
431
|
result
|
426
432
|
end
|
427
433
|
|
428
|
-
# reduce
|
434
|
+
# reduce 17 omitted
|
429
435
|
|
430
|
-
def
|
431
|
-
result = Node.new(:
|
436
|
+
def _reduce_18(val, _values, result)
|
437
|
+
result = Node.new(:CLASS_CONDITION, [unescape_css_identifier(val[1])])
|
438
|
+
result
|
439
|
+
end
|
440
|
+
|
441
|
+
# reduce 19 omitted
|
442
|
+
|
443
|
+
def _reduce_20(val, _values, result)
|
444
|
+
result = Node.new(:ELEMENT_NAME, val)
|
432
445
|
result
|
433
446
|
end
|
434
447
|
|
435
|
-
def
|
448
|
+
def _reduce_21(val, _values, result)
|
436
449
|
result = Node.new(:ELEMENT_NAME,
|
437
450
|
[[val.first, val.last].compact.join(':')]
|
438
451
|
)
|
439
|
-
|
452
|
+
|
440
453
|
result
|
441
454
|
end
|
442
455
|
|
443
|
-
def
|
456
|
+
def _reduce_22(val, _values, result)
|
444
457
|
name = @namespaces.key?('xmlns') ? "xmlns:#{val.first}" : val.first
|
445
458
|
result = Node.new(:ELEMENT_NAME, [name])
|
446
|
-
|
459
|
+
|
447
460
|
result
|
448
461
|
end
|
449
462
|
|
450
|
-
def
|
451
|
-
result = val[0]
|
463
|
+
def _reduce_23(val, _values, result)
|
464
|
+
result = val[0]
|
452
465
|
result
|
453
466
|
end
|
454
467
|
|
455
|
-
# reduce
|
468
|
+
# reduce 24 omitted
|
456
469
|
|
457
|
-
def
|
470
|
+
def _reduce_25(val, _values, result)
|
458
471
|
result = Node.new(:ATTRIBUTE_CONDITION,
|
459
472
|
[val[1]] + (val[2] || [])
|
460
473
|
)
|
461
|
-
|
474
|
+
|
462
475
|
result
|
463
476
|
end
|
464
477
|
|
465
|
-
def
|
478
|
+
def _reduce_26(val, _values, result)
|
466
479
|
result = Node.new(:ATTRIBUTE_CONDITION,
|
467
480
|
[val[1]] + (val[2] || [])
|
468
481
|
)
|
469
|
-
|
482
|
+
|
470
483
|
result
|
471
484
|
end
|
472
485
|
|
473
|
-
def
|
474
|
-
#
|
486
|
+
def _reduce_27(val, _values, result)
|
487
|
+
# non-standard, from hpricot
|
475
488
|
result = Node.new(:PSEUDO_CLASS,
|
476
489
|
[Node.new(:FUNCTION, ['nth-child(', val[1]])]
|
477
490
|
)
|
478
|
-
|
491
|
+
|
479
492
|
result
|
480
493
|
end
|
481
494
|
|
482
|
-
def
|
483
|
-
result = Node.new(:
|
495
|
+
def _reduce_28(val, _values, result)
|
496
|
+
result = Node.new(:ATTRIB_NAME,
|
484
497
|
[[val.first, val.last].compact.join(':')]
|
485
498
|
)
|
486
|
-
|
499
|
+
|
487
500
|
result
|
488
501
|
end
|
489
502
|
|
490
|
-
def
|
503
|
+
def _reduce_29(val, _values, result)
|
491
504
|
# Default namespace is not applied to attributes.
|
492
505
|
# So we don't add prefix "xmlns:" as in namespaced_ident.
|
493
|
-
result = Node.new(:
|
494
|
-
|
506
|
+
result = Node.new(:ATTRIB_NAME, [val.first])
|
507
|
+
|
495
508
|
result
|
496
509
|
end
|
497
510
|
|
498
|
-
def
|
511
|
+
def _reduce_30(val, _values, result)
|
499
512
|
result = Node.new(:FUNCTION, [val.first.strip])
|
500
|
-
|
513
|
+
|
501
514
|
result
|
502
515
|
end
|
503
516
|
|
504
|
-
def
|
517
|
+
def _reduce_31(val, _values, result)
|
505
518
|
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
506
|
-
|
519
|
+
|
507
520
|
result
|
508
521
|
end
|
509
522
|
|
510
|
-
def
|
523
|
+
def _reduce_32(val, _values, result)
|
511
524
|
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
512
|
-
|
525
|
+
|
513
526
|
result
|
514
527
|
end
|
515
528
|
|
516
|
-
def
|
529
|
+
def _reduce_33(val, _values, result)
|
517
530
|
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
518
|
-
|
531
|
+
|
519
532
|
result
|
520
533
|
end
|
521
534
|
|
522
|
-
def
|
535
|
+
def _reduce_34(val, _values, result)
|
523
536
|
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
524
|
-
|
537
|
+
|
525
538
|
result
|
526
539
|
end
|
527
540
|
|
528
|
-
def
|
529
|
-
result = [val.first, val.last]
|
541
|
+
def _reduce_35(val, _values, result)
|
542
|
+
result = [val.first, val.last]
|
530
543
|
result
|
531
544
|
end
|
532
545
|
|
533
|
-
def
|
534
|
-
result = [val.first, val.last]
|
546
|
+
def _reduce_36(val, _values, result)
|
547
|
+
result = [val.first, val.last]
|
535
548
|
result
|
536
549
|
end
|
537
550
|
|
538
|
-
def
|
539
|
-
result = [val.first, val.last]
|
551
|
+
def _reduce_37(val, _values, result)
|
552
|
+
result = [val.first, val.last]
|
540
553
|
result
|
541
554
|
end
|
542
555
|
|
543
|
-
# reduce
|
556
|
+
# reduce 38 omitted
|
544
557
|
|
545
|
-
# reduce
|
558
|
+
# reduce 39 omitted
|
546
559
|
|
547
|
-
def
|
548
|
-
|
549
|
-
|
550
|
-
result = Node.new(:
|
551
|
-
|
552
|
-
|
553
|
-
|
560
|
+
def _reduce_40(val, _values, result)
|
561
|
+
case val[0]
|
562
|
+
when 'even'
|
563
|
+
result = Node.new(:NTH, ['2','n','+','0'])
|
564
|
+
when 'odd'
|
565
|
+
result = Node.new(:NTH, ['2','n','+','1'])
|
566
|
+
when 'n'
|
567
|
+
result = Node.new(:NTH, ['1','n','+','0'])
|
554
568
|
else
|
555
|
-
#
|
569
|
+
# non-standard to support custom functions:
|
556
570
|
# assert_xpath("//a[foo(., @href)]", @parser.parse('a:foo(@href)'))
|
557
571
|
# assert_xpath("//a[foo(., @a, b)]", @parser.parse('a:foo(@a, b)'))
|
558
572
|
# assert_xpath("//a[foo(., a, 10)]", @parser.parse('a:foo(a, 10)'))
|
559
573
|
result = val
|
560
574
|
end
|
561
|
-
|
575
|
+
|
562
576
|
result
|
563
577
|
end
|
564
578
|
|
565
|
-
def
|
579
|
+
def _reduce_41(val, _values, result)
|
566
580
|
if val[1] == 'n'
|
567
|
-
result = Node.new(:
|
581
|
+
result = Node.new(:NTH, val)
|
568
582
|
else
|
569
583
|
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
570
584
|
end
|
571
|
-
|
585
|
+
|
572
586
|
result
|
573
587
|
end
|
574
588
|
|
575
|
-
def
|
589
|
+
def _reduce_42(val, _values, result)
|
576
590
|
# n+3, -n+3
|
577
591
|
if val[0] == 'n'
|
578
592
|
val.unshift("1")
|
579
|
-
result = Node.new(:
|
593
|
+
result = Node.new(:NTH, val)
|
580
594
|
elsif val[0] == '-n'
|
581
595
|
val[0] = 'n'
|
582
596
|
val.unshift("-1")
|
583
|
-
result = Node.new(:
|
597
|
+
result = Node.new(:NTH, val)
|
584
598
|
else
|
585
599
|
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
586
600
|
end
|
587
|
-
|
601
|
+
|
588
602
|
result
|
589
603
|
end
|
590
604
|
|
591
|
-
def
|
592
|
-
|
605
|
+
def _reduce_43(val, _values, result)
|
606
|
+
# 5n, -5n, 10n-1
|
607
|
+
n = val[1]
|
608
|
+
if n[0, 2] == 'n-'
|
609
|
+
val[1] = 'n'
|
610
|
+
val << "-"
|
611
|
+
# b is contained in n as n is the string "n-b"
|
612
|
+
val << n[2, n.size]
|
613
|
+
result = Node.new(:NTH, val)
|
614
|
+
elsif n == 'n'
|
593
615
|
val << "+"
|
594
616
|
val << "0"
|
595
|
-
result = Node.new(:
|
617
|
+
result = Node.new(:NTH, val)
|
596
618
|
else
|
597
619
|
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
598
620
|
end
|
599
|
-
|
621
|
+
|
600
622
|
result
|
601
623
|
end
|
602
624
|
|
603
|
-
def
|
625
|
+
def _reduce_44(val, _values, result)
|
604
626
|
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
605
|
-
|
627
|
+
|
606
628
|
result
|
607
629
|
end
|
608
630
|
|
609
|
-
def
|
610
|
-
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
631
|
+
def _reduce_45(val, _values, result)
|
632
|
+
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
611
633
|
result
|
612
634
|
end
|
613
635
|
|
614
|
-
# reduce
|
636
|
+
# reduce 46 omitted
|
615
637
|
|
616
|
-
# reduce
|
638
|
+
# reduce 47 omitted
|
617
639
|
|
618
|
-
def
|
640
|
+
def _reduce_48(val, _values, result)
|
619
641
|
result = Node.new(:COMBINATOR, val)
|
620
|
-
|
642
|
+
|
621
643
|
result
|
622
644
|
end
|
623
645
|
|
624
|
-
def
|
646
|
+
def _reduce_49(val, _values, result)
|
625
647
|
result = Node.new(:COMBINATOR, val)
|
626
|
-
|
648
|
+
|
627
649
|
result
|
628
650
|
end
|
629
651
|
|
630
|
-
def
|
652
|
+
def _reduce_50(val, _values, result)
|
631
653
|
result = Node.new(:COMBINATOR, val)
|
632
|
-
|
654
|
+
|
655
|
+
result
|
656
|
+
end
|
657
|
+
|
658
|
+
def _reduce_51(val, _values, result)
|
659
|
+
result = Node.new(:COMBINATOR, val)
|
660
|
+
|
633
661
|
result
|
634
662
|
end
|
635
663
|
|
636
|
-
def
|
664
|
+
def _reduce_52(val, _values, result)
|
637
665
|
result = Node.new(:COMBINATOR, val)
|
638
|
-
|
666
|
+
|
639
667
|
result
|
640
668
|
end
|
641
669
|
|
670
|
+
# reduce 53 omitted
|
671
|
+
|
672
|
+
# reduce 54 omitted
|
673
|
+
|
642
674
|
# reduce 55 omitted
|
643
675
|
|
644
676
|
# reduce 56 omitted
|
645
677
|
|
646
678
|
# reduce 57 omitted
|
647
679
|
|
648
|
-
|
680
|
+
def _reduce_58(val, _values, result)
|
681
|
+
result = Node.new(:ID, [unescape_css_identifier(val.first)])
|
682
|
+
result
|
683
|
+
end
|
649
684
|
|
650
685
|
def _reduce_59(val, _values, result)
|
651
|
-
result =
|
686
|
+
result = [val.first, unescape_css_identifier(val[1])]
|
652
687
|
result
|
653
688
|
end
|
654
689
|
|
655
690
|
def _reduce_60(val, _values, result)
|
656
|
-
result = [val.first, val[1]]
|
691
|
+
result = [val.first, unescape_css_string(val[1])]
|
657
692
|
result
|
658
693
|
end
|
659
694
|
|
660
695
|
def _reduce_61(val, _values, result)
|
661
|
-
result = [val.first, val[1]]
|
696
|
+
result = [val.first, val[1]]
|
662
697
|
result
|
663
698
|
end
|
664
699
|
|
665
700
|
# reduce 62 omitted
|
666
701
|
|
667
702
|
def _reduce_63(val, _values, result)
|
668
|
-
result = :equal
|
703
|
+
result = :equal
|
669
704
|
result
|
670
705
|
end
|
671
706
|
|
672
707
|
def _reduce_64(val, _values, result)
|
673
|
-
result = :prefix_match
|
708
|
+
result = :prefix_match
|
674
709
|
result
|
675
710
|
end
|
676
711
|
|
677
712
|
def _reduce_65(val, _values, result)
|
678
|
-
result = :suffix_match
|
713
|
+
result = :suffix_match
|
679
714
|
result
|
680
715
|
end
|
681
716
|
|
682
717
|
def _reduce_66(val, _values, result)
|
683
|
-
result = :substring_match
|
718
|
+
result = :substring_match
|
684
719
|
result
|
685
720
|
end
|
686
721
|
|
687
722
|
def _reduce_67(val, _values, result)
|
688
|
-
result = :not_equal
|
723
|
+
result = :not_equal
|
689
724
|
result
|
690
725
|
end
|
691
726
|
|
692
727
|
def _reduce_68(val, _values, result)
|
693
|
-
result = :includes
|
728
|
+
result = :includes
|
694
729
|
result
|
695
730
|
end
|
696
731
|
|
697
732
|
def _reduce_69(val, _values, result)
|
698
|
-
result = :dash_match
|
733
|
+
result = :dash_match
|
699
734
|
result
|
700
735
|
end
|
701
736
|
|
702
737
|
def _reduce_70(val, _values, result)
|
703
738
|
result = Node.new(:NOT, [val[1]])
|
704
|
-
|
739
|
+
|
705
740
|
result
|
706
741
|
end
|
707
742
|
|
@@ -711,10 +746,14 @@ end
|
|
711
746
|
|
712
747
|
# reduce 73 omitted
|
713
748
|
|
749
|
+
# reduce 74 omitted
|
750
|
+
|
751
|
+
# reduce 75 omitted
|
752
|
+
|
714
753
|
def _reduce_none(val, _values, result)
|
715
754
|
val[0]
|
716
755
|
end
|
717
756
|
|
718
757
|
end # class Parser
|
719
|
-
|
720
|
-
|
758
|
+
end # module CSS
|
759
|
+
end # module Nokogiri
|