nokogiri 1.6.0 → 1.13.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.
- checksums.yaml +7 -0
- data/Gemfile +3 -19
- data/LICENSE-DEPENDENCIES.md +1903 -0
- data/LICENSE.md +9 -0
- data/README.md +280 -0
- data/bin/nokogiri +84 -31
- data/dependencies.yml +23 -4
- data/ext/nokogiri/depend +38 -358
- data/ext/nokogiri/extconf.rb +952 -132
- 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 +231 -96
- 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 +269 -177
- 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 +407 -357
- data/lib/nokogiri/css/parser.y +265 -246
- 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 +8 -7
- data/lib/nokogiri/css/xpath_visitor.rb +266 -80
- 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 -105
- 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 +270 -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 +29 -20
- 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 +3040 -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 +3037 -0
- data/ports/archives/libxml2-2.9.13.tar.xz +0 -0
- data/ports/archives/libxslt-1.1.35.tar.xz +0 -0
- metadata +278 -362
- data/.autotest +0 -26
- data/.gemtest +0 -0
- data/.travis.yml +0 -27
- data/CHANGELOG.ja.rdoc +0 -819
- data/CHANGELOG.rdoc +0 -819
- data/C_CODING_STYLE.rdoc +0 -33
- data/Manifest.txt +0 -315
- data/README.ja.rdoc +0 -106
- data/README.rdoc +0 -175
- data/ROADMAP.md +0 -90
- data/Rakefile +0 -246
- 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/ports/archives/libxml2-2.8.0.tar.gz +0 -0
- data/ports/archives/libxslt-1.1.26.tar.gz +0 -0
- data/tasks/cross_compile.rb +0 -132
- 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/bogus.xml +0 -0
- 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/saml/saml20assertion_schema.xsd +0 -283
- data/test/files/saml/saml20protocol_schema.xsd +0 -302
- data/test/files/saml/xenc_schema.xsd +0 -146
- data/test/files/saml/xmldsig_schema.xsd +0 -318
- 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,242 @@
|
|
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
|
+
|
13
|
+
module Nokogiri
|
14
|
+
module CSS
|
15
|
+
# :nodoc: all
|
16
|
+
class Parser < Racc::Parser
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
11
21
|
module Nokogiri
|
12
22
|
module CSS
|
13
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
|
+
27, 11, 38, 99, 36, 12, 40, 26, 48, 25,
|
43
|
+
49, 27, 100, 12, 30, 36, 105, 99, -26, 28,
|
44
|
+
25, -26, 26, 27, 29, 14, 21, 23, 80, 30,
|
45
|
+
28, 36, 72, 26, -26, 29, 14, 21, 23, 27,
|
46
|
+
30, 91, 56, 36, 97, 96, 43, 29, 25, 26,
|
47
|
+
27, 92, 94, 21, 36, 95, 30, 98, 28, 25,
|
48
|
+
101, 26, 102, 29, 14, 21, 23, 96, 30, 28,
|
49
|
+
36, 36, 26, 103, 29, 14, 21, 23, 27, 30,
|
50
|
+
108, 107, 36, 109, 106, 43, 43, 25, 26, 26,
|
51
|
+
27, 110, 21, 21, 111, 30, 30, 28, 99, 50,
|
52
|
+
26, 53, 29, 14, 21, 23, 36, 30, 36, 56,
|
53
|
+
61, 64, 113, 66, 29, 14, 116, 36, 118, 36,
|
54
|
+
nil, 43, nil, 43, 26, nil, 26, 14, 21, 23,
|
55
|
+
21, 30, 43, 30, 43, 26, nil, 26, 36, 21,
|
56
|
+
36, 21, 30, 25, 30, nil, nil, nil, nil, nil,
|
57
|
+
nil, 61, 62, 43, 60, 43, 26, nil, 26, nil,
|
58
|
+
21, 23, 21, 30, 57, 30, 88, 89, 14, nil,
|
59
|
+
nil, 88, 89, nil, nil, nil, nil, 84, 85, 86,
|
60
|
+
nil, 87, 84, 85, 86, 83, 87, nil, 61, 93,
|
61
|
+
83, 66, 61, 93, nil, 66, 61, 93, nil, 66,
|
62
|
+
61, 93, nil, 66, nil, 14, nil, 61, 93, 14,
|
63
|
+
66, nil, nil, 14, nil, nil, nil, 14, 4, 5,
|
64
|
+
10, nil, nil, nil, 14, 4, 5, 47, 6, nil,
|
65
|
+
8, 7, 4, 5, 10, 6, nil, 8, 7, nil,
|
66
|
+
nil, nil, 6, nil, 8, 7 ]
|
34
67
|
|
35
68
|
racc_action_check = [
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
69
|
+
3, 1, 11, 64, 3, 70, 14, 17, 21, 3,
|
70
|
+
24, 9, 62, 1, 17, 9, 70, 62, 25, 3,
|
71
|
+
9, 64, 3, 30, 3, 3, 3, 3, 49, 3,
|
72
|
+
9, 16, 30, 9, 50, 9, 9, 9, 9, 12,
|
73
|
+
9, 53, 30, 12, 60, 60, 16, 30, 12, 16,
|
74
|
+
46, 54, 58, 16, 46, 59, 16, 61, 12, 46,
|
75
|
+
63, 12, 65, 12, 12, 12, 12, 66, 12, 46,
|
76
|
+
31, 32, 46, 67, 46, 46, 46, 46, 47, 46,
|
77
|
+
82, 82, 47, 82, 81, 31, 32, 47, 31, 32,
|
78
|
+
26, 90, 31, 32, 92, 31, 32, 47, 93, 26,
|
79
|
+
47, 26, 47, 47, 47, 47, 28, 47, 33, 26,
|
80
|
+
28, 28, 97, 28, 26, 26, 100, 34, 113, 35,
|
81
|
+
nil, 28, nil, 33, 28, nil, 33, 28, 28, 28,
|
82
|
+
33, 28, 34, 33, 35, 34, nil, 35, 43, 34,
|
83
|
+
68, 35, 34, 43, 35, nil, nil, nil, nil, nil,
|
84
|
+
nil, 27, 27, 43, 27, 68, 43, nil, 68, nil,
|
85
|
+
43, 43, 68, 43, 27, 68, 51, 51, 27, nil,
|
86
|
+
nil, 52, 52, nil, nil, nil, nil, 51, 51, 51,
|
87
|
+
nil, 51, 52, 52, 52, 51, 52, nil, 56, 56,
|
88
|
+
52, 56, 96, 96, nil, 96, 98, 98, nil, 98,
|
89
|
+
99, 99, nil, 99, nil, 56, nil, 101, 101, 96,
|
90
|
+
101, nil, nil, 98, nil, nil, nil, 99, 0, 0,
|
91
|
+
0, nil, nil, nil, 101, 20, 20, 20, 0, nil,
|
92
|
+
0, 0, 29, 29, 29, 20, nil, 20, 20, nil,
|
93
|
+
nil, nil, 29, nil, 29, 29 ]
|
53
94
|
|
54
95
|
racc_action_pointer = [
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
nil, nil,
|
63
|
-
nil,
|
64
|
-
|
65
|
-
nil,
|
96
|
+
211, 1, nil, -2, nil, nil, nil, nil, nil, 9,
|
97
|
+
nil, 2, 37, nil, -5, nil, 25, -17, nil, nil,
|
98
|
+
218, -3, nil, nil, -20, -12, 88, 141, 100, 225,
|
99
|
+
21, 64, 65, 102, 111, 113, nil, nil, nil, nil,
|
100
|
+
nil, nil, nil, 132, nil, nil, 48, 76, nil, 17,
|
101
|
+
4, 163, 168, 16, 21, nil, 178, nil, 29, 32,
|
102
|
+
33, 45, 5, 48, -9, 39, 55, 50, 134, nil,
|
103
|
+
-7, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
104
|
+
nil, 59, 70, nil, nil, nil, nil, nil, nil, nil,
|
105
|
+
66, nil, 83, 86, nil, nil, 182, 105, 186, 190,
|
106
|
+
103, 197, nil, nil, nil, nil, nil, nil, nil, nil,
|
107
|
+
nil, nil, nil, 105, nil, nil, nil, nil, nil ]
|
66
108
|
|
67
109
|
racc_action_default = [
|
68
|
-
-
|
69
|
-
-
|
70
|
-
-
|
71
|
-
-
|
72
|
-
|
73
|
-
-
|
74
|
-
-
|
75
|
-
-
|
76
|
-
-
|
77
|
-
-
|
78
|
-
-
|
110
|
+
-81, -82, -2, -27, -4, -5, -6, -7, -8, -27,
|
111
|
+
-80, -82, -27, -3, -82, -10, -53, -12, -15, -16,
|
112
|
+
-20, -82, -22, -23, -82, -25, -27, -82, -27, -81,
|
113
|
+
-82, -59, -60, -61, -62, -63, -64, -17, 119, -1,
|
114
|
+
-9, -11, -52, -27, -13, -14, -27, -27, -21, -82,
|
115
|
+
-32, -68, -68, -82, -82, -33, -82, -34, -82, -82,
|
116
|
+
-43, -44, -45, -46, -25, -82, -43, -82, -77, -79,
|
117
|
+
-82, -50, -51, -54, -55, -56, -57, -58, -18, -19,
|
118
|
+
-24, -82, -82, -69, -70, -71, -72, -73, -74, -75,
|
119
|
+
-82, -30, -82, -45, -35, -36, -82, -49, -82, -82,
|
120
|
+
-82, -82, -37, -76, -78, -38, -28, -65, -66, -67,
|
121
|
+
-29, -31, -39, -82, -40, -41, -48, -42, -47 ]
|
79
122
|
|
80
123
|
racc_goto_table = [
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
nil, nil, nil, nil, nil,
|
86
|
-
|
87
|
-
|
124
|
+
58, 42, 13, 1, 46, 52, 19, 68, 37, 71,
|
125
|
+
41, 39, 19, 69, 44, 19, 73, 74, 75, 76,
|
126
|
+
77, 45, 68, 81, 90, 54, 51, 59, 69, 55,
|
127
|
+
nil, nil, 70, nil, nil, nil, nil, nil, nil, nil,
|
128
|
+
nil, nil, nil, nil, nil, 78, 79, nil, nil, 19,
|
129
|
+
19, nil, nil, 104, nil, nil, nil, nil, nil, nil,
|
130
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, 112,
|
131
|
+
nil, 114, 115, nil, 117 ]
|
88
132
|
|
89
133
|
racc_goto_check = [
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
nil, nil, nil, nil, nil,
|
95
|
-
|
96
|
-
|
134
|
+
20, 14, 2, 1, 5, 11, 7, 9, 2, 11,
|
135
|
+
10, 2, 7, 14, 12, 7, 14, 14, 14, 14,
|
136
|
+
14, 13, 9, 19, 19, 17, 18, 21, 14, 7,
|
137
|
+
nil, nil, 1, nil, nil, nil, nil, nil, nil, nil,
|
138
|
+
nil, nil, nil, nil, nil, 2, 2, nil, nil, 7,
|
139
|
+
7, nil, nil, 14, nil, nil, nil, nil, nil, nil,
|
140
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, 20,
|
141
|
+
nil, 20, 20, nil, 20 ]
|
97
142
|
|
98
143
|
racc_goto_pointer = [
|
99
|
-
nil,
|
100
|
-
-
|
101
|
-
nil, nil,
|
144
|
+
nil, 3, -1, nil, nil, -16, nil, 3, nil, -21,
|
145
|
+
-6, -21, -3, 4, -15, nil, nil, -1, 0, -28,
|
146
|
+
-27, 0, nil, nil, nil, nil ]
|
102
147
|
|
103
148
|
racc_goto_default = [
|
104
|
-
nil, nil, 3,
|
105
|
-
|
106
|
-
|
149
|
+
nil, nil, nil, 2, 3, 9, 15, 63, 20, 16,
|
150
|
+
nil, 17, 34, 33, 18, 32, 22, 24, nil, nil,
|
151
|
+
65, nil, 31, 35, 82, 67 ]
|
107
152
|
|
108
153
|
racc_reduce_table = [
|
109
154
|
0, 0, :racc_error,
|
110
|
-
3,
|
111
|
-
1,
|
112
|
-
|
113
|
-
1,
|
114
|
-
1,
|
115
|
-
1,
|
116
|
-
1,
|
117
|
-
1,
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
155
|
+
3, 33, :_reduce_1,
|
156
|
+
1, 33, :_reduce_2,
|
157
|
+
2, 33, :_reduce_3,
|
158
|
+
1, 37, :_reduce_4,
|
159
|
+
1, 37, :_reduce_5,
|
160
|
+
1, 37, :_reduce_6,
|
161
|
+
1, 37, :_reduce_7,
|
162
|
+
1, 37, :_reduce_8,
|
163
|
+
2, 38, :_reduce_9,
|
164
|
+
1, 39, :_reduce_10,
|
165
|
+
2, 40, :_reduce_11,
|
166
|
+
1, 40, :_reduce_none,
|
167
|
+
2, 40, :_reduce_13,
|
168
|
+
2, 40, :_reduce_14,
|
169
|
+
1, 40, :_reduce_15,
|
170
|
+
1, 40, :_reduce_none,
|
171
|
+
2, 35, :_reduce_17,
|
172
|
+
3, 34, :_reduce_18,
|
173
|
+
3, 34, :_reduce_19,
|
174
|
+
1, 34, :_reduce_none,
|
175
|
+
2, 47, :_reduce_21,
|
176
|
+
1, 41, :_reduce_none,
|
177
|
+
1, 41, :_reduce_23,
|
178
|
+
3, 48, :_reduce_24,
|
179
|
+
1, 48, :_reduce_25,
|
180
|
+
1, 49, :_reduce_26,
|
181
|
+
0, 49, :_reduce_none,
|
182
|
+
4, 45, :_reduce_28,
|
183
|
+
4, 45, :_reduce_29,
|
184
|
+
3, 45, :_reduce_30,
|
185
|
+
3, 50, :_reduce_31,
|
186
|
+
1, 50, :_reduce_32,
|
187
|
+
1, 50, :_reduce_none,
|
188
|
+
2, 43, :_reduce_34,
|
189
|
+
3, 43, :_reduce_35,
|
190
|
+
3, 43, :_reduce_36,
|
191
|
+
3, 43, :_reduce_37,
|
192
|
+
3, 43, :_reduce_38,
|
193
|
+
3, 52, :_reduce_39,
|
194
|
+
3, 52, :_reduce_40,
|
195
|
+
3, 52, :_reduce_41,
|
196
|
+
3, 52, :_reduce_42,
|
197
|
+
1, 52, :_reduce_none,
|
198
|
+
1, 52, :_reduce_none,
|
199
|
+
1, 52, :_reduce_45,
|
200
|
+
1, 52, :_reduce_none,
|
201
|
+
4, 53, :_reduce_47,
|
202
|
+
3, 53, :_reduce_48,
|
203
|
+
2, 53, :_reduce_49,
|
204
|
+
2, 44, :_reduce_50,
|
205
|
+
2, 44, :_reduce_51,
|
206
|
+
1, 42, :_reduce_none,
|
207
|
+
0, 42, :_reduce_none,
|
208
|
+
2, 46, :_reduce_54,
|
209
|
+
2, 46, :_reduce_55,
|
210
|
+
2, 46, :_reduce_56,
|
211
|
+
2, 46, :_reduce_57,
|
212
|
+
2, 46, :_reduce_58,
|
213
|
+
1, 46, :_reduce_none,
|
214
|
+
1, 46, :_reduce_none,
|
215
|
+
1, 46, :_reduce_none,
|
216
|
+
1, 46, :_reduce_none,
|
217
|
+
1, 46, :_reduce_none,
|
218
|
+
1, 54, :_reduce_64,
|
219
|
+
2, 51, :_reduce_65,
|
220
|
+
2, 51, :_reduce_66,
|
221
|
+
2, 51, :_reduce_67,
|
222
|
+
0, 51, :_reduce_none,
|
223
|
+
1, 56, :_reduce_69,
|
224
|
+
1, 56, :_reduce_70,
|
225
|
+
1, 56, :_reduce_71,
|
226
|
+
1, 56, :_reduce_72,
|
227
|
+
1, 56, :_reduce_73,
|
228
|
+
1, 56, :_reduce_74,
|
229
|
+
1, 56, :_reduce_75,
|
230
|
+
3, 55, :_reduce_76,
|
231
|
+
1, 57, :_reduce_none,
|
232
|
+
2, 57, :_reduce_none,
|
233
|
+
1, 57, :_reduce_none,
|
122
234
|
1, 36, :_reduce_none,
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
3, 33, :_reduce_19,
|
129
|
-
1, 33, :_reduce_none,
|
130
|
-
2, 44, :_reduce_21,
|
131
|
-
1, 37, :_reduce_none,
|
132
|
-
1, 37, :_reduce_23,
|
133
|
-
3, 45, :_reduce_24,
|
134
|
-
1, 45, :_reduce_25,
|
135
|
-
1, 46, :_reduce_26,
|
136
|
-
0, 46, :_reduce_none,
|
137
|
-
4, 43, :_reduce_28,
|
138
|
-
4, 43, :_reduce_29,
|
139
|
-
3, 43, :_reduce_30,
|
140
|
-
3, 47, :_reduce_31,
|
141
|
-
1, 47, :_reduce_32,
|
142
|
-
2, 41, :_reduce_33,
|
143
|
-
3, 41, :_reduce_34,
|
144
|
-
3, 41, :_reduce_35,
|
145
|
-
3, 41, :_reduce_36,
|
146
|
-
3, 41, :_reduce_37,
|
147
|
-
3, 49, :_reduce_38,
|
148
|
-
3, 49, :_reduce_39,
|
149
|
-
3, 49, :_reduce_40,
|
150
|
-
1, 49, :_reduce_none,
|
151
|
-
1, 49, :_reduce_none,
|
152
|
-
1, 49, :_reduce_43,
|
153
|
-
4, 50, :_reduce_44,
|
154
|
-
3, 50, :_reduce_45,
|
155
|
-
2, 50, :_reduce_46,
|
156
|
-
2, 42, :_reduce_47,
|
157
|
-
2, 42, :_reduce_48,
|
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,
|
166
|
-
1, 39, :_reduce_none,
|
167
|
-
1, 39, :_reduce_none,
|
168
|
-
1, 51, :_reduce_59,
|
169
|
-
2, 48, :_reduce_60,
|
170
|
-
2, 48, :_reduce_61,
|
171
|
-
0, 48, :_reduce_none,
|
172
|
-
1, 52, :_reduce_63,
|
173
|
-
1, 52, :_reduce_64,
|
174
|
-
1, 52, :_reduce_65,
|
175
|
-
1, 52, :_reduce_66,
|
176
|
-
1, 52, :_reduce_67,
|
177
|
-
1, 52, :_reduce_68,
|
178
|
-
1, 52, :_reduce_69,
|
179
|
-
3, 40, :_reduce_70,
|
180
|
-
1, 53, :_reduce_none,
|
181
|
-
2, 53, :_reduce_none,
|
182
|
-
1, 53, :_reduce_none ]
|
183
|
-
|
184
|
-
racc_reduce_n = 74
|
185
|
-
|
186
|
-
racc_shift_n = 106
|
235
|
+
0, 36, :_reduce_none ]
|
236
|
+
|
237
|
+
racc_reduce_n = 82
|
238
|
+
|
239
|
+
racc_shift_n = 119
|
187
240
|
|
188
241
|
racc_token_table = {
|
189
242
|
false => 0,
|
@@ -213,12 +266,13 @@ racc_token_table = {
|
|
213
266
|
:LSQUARE => 24,
|
214
267
|
:RSQUARE => 25,
|
215
268
|
:HAS => 26,
|
216
|
-
"
|
217
|
-
"
|
218
|
-
"
|
219
|
-
"
|
269
|
+
"@" => 27,
|
270
|
+
"." => 28,
|
271
|
+
"*" => 29,
|
272
|
+
"|" => 30,
|
273
|
+
":" => 31 }
|
220
274
|
|
221
|
-
racc_nt_base =
|
275
|
+
racc_nt_base = 32
|
222
276
|
|
223
277
|
racc_use_result_var = true
|
224
278
|
|
@@ -266,6 +320,7 @@ Racc_token_to_s_table = [
|
|
266
320
|
"LSQUARE",
|
267
321
|
"RSQUARE",
|
268
322
|
"HAS",
|
323
|
+
"\"@\"",
|
269
324
|
"\".\"",
|
270
325
|
"\"*\"",
|
271
326
|
"\"|\"",
|
@@ -274,23 +329,26 @@ Racc_token_to_s_table = [
|
|
274
329
|
"selector",
|
275
330
|
"simple_selector_1toN",
|
276
331
|
"prefixless_combinator_selector",
|
332
|
+
"optional_S",
|
277
333
|
"combinator",
|
334
|
+
"xpath_attribute_name",
|
335
|
+
"xpath_attribute",
|
278
336
|
"simple_selector",
|
279
337
|
"element_name",
|
280
338
|
"hcap_0toN",
|
281
|
-
"hcap_1toN",
|
282
|
-
"negation",
|
283
339
|
"function",
|
284
340
|
"pseudo",
|
285
341
|
"attrib",
|
342
|
+
"hcap_1toN",
|
286
343
|
"class",
|
287
344
|
"namespaced_ident",
|
288
345
|
"namespace",
|
289
346
|
"attrib_name",
|
290
347
|
"attrib_val_0or1",
|
291
348
|
"expr",
|
292
|
-
"
|
349
|
+
"nth",
|
293
350
|
"attribute_id",
|
351
|
+
"negation",
|
294
352
|
"eql_incl_dash",
|
295
353
|
"negation_arg" ]
|
296
354
|
|
@@ -301,420 +359,412 @@ Racc_debug_parser = false
|
|
301
359
|
# reduce 0 omitted
|
302
360
|
|
303
361
|
def _reduce_1(val, _values, result)
|
304
|
-
|
305
|
-
|
362
|
+
result = [val[0], val[2]].flatten
|
363
|
+
|
306
364
|
result
|
307
365
|
end
|
308
366
|
|
309
367
|
def _reduce_2(val, _values, result)
|
310
|
-
result = val.flatten
|
368
|
+
result = val.flatten
|
311
369
|
result
|
312
370
|
end
|
313
371
|
|
314
372
|
def _reduce_3(val, _values, result)
|
315
|
-
result = val.flatten
|
373
|
+
result = [val[1]].flatten
|
316
374
|
result
|
317
375
|
end
|
318
376
|
|
319
377
|
def _reduce_4(val, _values, result)
|
320
|
-
result = :DIRECT_ADJACENT_SELECTOR
|
378
|
+
result = :DIRECT_ADJACENT_SELECTOR
|
321
379
|
result
|
322
380
|
end
|
323
381
|
|
324
382
|
def _reduce_5(val, _values, result)
|
325
|
-
result = :CHILD_SELECTOR
|
383
|
+
result = :CHILD_SELECTOR
|
326
384
|
result
|
327
385
|
end
|
328
386
|
|
329
387
|
def _reduce_6(val, _values, result)
|
330
|
-
result = :FOLLOWING_SELECTOR
|
388
|
+
result = :FOLLOWING_SELECTOR
|
331
389
|
result
|
332
390
|
end
|
333
391
|
|
334
392
|
def _reduce_7(val, _values, result)
|
335
|
-
result = :DESCENDANT_SELECTOR
|
393
|
+
result = :DESCENDANT_SELECTOR
|
336
394
|
result
|
337
395
|
end
|
338
396
|
|
339
397
|
def _reduce_8(val, _values, result)
|
340
|
-
result = :
|
398
|
+
result = :CHILD_SELECTOR
|
341
399
|
result
|
342
400
|
end
|
343
401
|
|
344
402
|
def _reduce_9(val, _values, result)
|
345
|
-
result =
|
403
|
+
result = val[1]
|
346
404
|
result
|
347
405
|
end
|
348
406
|
|
349
407
|
def _reduce_10(val, _values, result)
|
350
|
-
|
351
|
-
val.first
|
352
|
-
else
|
353
|
-
Node.new(:CONDITIONAL_SELECTOR, [val.first, val[1]])
|
354
|
-
end
|
355
|
-
|
408
|
+
result = Node.new(:ATTRIB_NAME, [val[0]])
|
356
409
|
result
|
357
410
|
end
|
358
411
|
|
359
412
|
def _reduce_11(val, _values, result)
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
413
|
+
result = if val[1].nil?
|
414
|
+
val[0]
|
415
|
+
else
|
416
|
+
Node.new(:CONDITIONAL_SELECTOR, [val[0], val[1]])
|
417
|
+
end
|
418
|
+
|
367
419
|
result
|
368
420
|
end
|
369
421
|
|
370
|
-
|
371
|
-
|
372
|
-
|
422
|
+
# reduce 12 omitted
|
423
|
+
|
424
|
+
def _reduce_13(val, _values, result)
|
425
|
+
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
373
426
|
result
|
374
427
|
end
|
375
428
|
|
376
|
-
# reduce 13 omitted
|
377
|
-
|
378
429
|
def _reduce_14(val, _values, result)
|
379
|
-
|
380
|
-
|
430
|
+
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
381
431
|
result
|
382
432
|
end
|
383
433
|
|
384
434
|
def _reduce_15(val, _values, result)
|
385
|
-
|
386
|
-
|
435
|
+
result = Node.new(:CONDITIONAL_SELECTOR, [Node.new(:ELEMENT_NAME, ['*']), val[0]])
|
387
436
|
result
|
388
437
|
end
|
389
438
|
|
390
|
-
|
391
|
-
result = Node.new(:CONDITIONAL_SELECTOR,
|
392
|
-
[
|
393
|
-
Node.new(:ELEMENT_NAME, ['*']),
|
394
|
-
Node.new(:COMBINATOR, val)
|
395
|
-
]
|
396
|
-
)
|
397
|
-
|
398
|
-
result
|
399
|
-
end
|
439
|
+
# reduce 16 omitted
|
400
440
|
|
401
441
|
def _reduce_17(val, _values, result)
|
402
|
-
|
403
|
-
[Node.new(:ELEMENT_NAME, ['*']), val.first]
|
404
|
-
)
|
405
|
-
|
442
|
+
result = Node.new(val[0], [nil, val[1]])
|
406
443
|
result
|
407
444
|
end
|
408
445
|
|
409
446
|
def _reduce_18(val, _values, result)
|
410
|
-
|
411
|
-
|
447
|
+
result = Node.new(val[1], [val[0], val[2]])
|
412
448
|
result
|
413
449
|
end
|
414
450
|
|
415
451
|
def _reduce_19(val, _values, result)
|
416
|
-
|
417
|
-
|
452
|
+
result = Node.new(:DESCENDANT_SELECTOR, [val[0], val[2]])
|
418
453
|
result
|
419
454
|
end
|
420
455
|
|
421
456
|
# reduce 20 omitted
|
422
457
|
|
423
458
|
def _reduce_21(val, _values, result)
|
424
|
-
result = Node.new(:CLASS_CONDITION, [val[1]])
|
459
|
+
result = Node.new(:CLASS_CONDITION, [unescape_css_identifier(val[1])])
|
425
460
|
result
|
426
461
|
end
|
427
462
|
|
428
463
|
# reduce 22 omitted
|
429
464
|
|
430
465
|
def _reduce_23(val, _values, result)
|
431
|
-
result = Node.new(:ELEMENT_NAME, val)
|
466
|
+
result = Node.new(:ELEMENT_NAME, val)
|
432
467
|
result
|
433
468
|
end
|
434
469
|
|
435
470
|
def _reduce_24(val, _values, result)
|
436
|
-
|
437
|
-
[[val.first, val.last].compact.join(':')]
|
438
|
-
)
|
439
|
-
|
471
|
+
result = Node.new(:ELEMENT_NAME, [[val[0], val[2]].compact.join(':')])
|
440
472
|
result
|
441
473
|
end
|
442
474
|
|
443
475
|
def _reduce_25(val, _values, result)
|
444
|
-
|
445
|
-
|
446
|
-
|
476
|
+
name = @namespaces.key?('xmlns') ? "xmlns:#{val[0]}" : val[0]
|
477
|
+
result = Node.new(:ELEMENT_NAME, [name])
|
478
|
+
|
447
479
|
result
|
448
480
|
end
|
449
481
|
|
450
482
|
def _reduce_26(val, _values, result)
|
451
|
-
result = val[0]
|
483
|
+
result = val[0]
|
452
484
|
result
|
453
485
|
end
|
454
486
|
|
455
487
|
# reduce 27 omitted
|
456
488
|
|
457
489
|
def _reduce_28(val, _values, result)
|
458
|
-
|
459
|
-
|
460
|
-
)
|
461
|
-
|
490
|
+
result = Node.new(:ATTRIBUTE_CONDITION, [val[1]] + (val[2] || []))
|
491
|
+
|
462
492
|
result
|
463
493
|
end
|
464
494
|
|
465
495
|
def _reduce_29(val, _values, result)
|
466
|
-
|
467
|
-
|
468
|
-
)
|
469
|
-
|
496
|
+
result = Node.new(:ATTRIBUTE_CONDITION, [val[1]] + (val[2] || []))
|
497
|
+
|
470
498
|
result
|
471
499
|
end
|
472
500
|
|
473
501
|
def _reduce_30(val, _values, result)
|
474
|
-
|
475
|
-
|
476
|
-
[Node.new(:FUNCTION, ['nth-child(', val[1]])]
|
477
|
-
)
|
478
|
-
|
502
|
+
result = Node.new(:PSEUDO_CLASS, [Node.new(:FUNCTION, ['nth-child(', val[1]])])
|
503
|
+
|
479
504
|
result
|
480
505
|
end
|
481
506
|
|
482
507
|
def _reduce_31(val, _values, result)
|
483
|
-
|
484
|
-
[[val.first, val.last].compact.join(':')]
|
485
|
-
)
|
486
|
-
|
508
|
+
result = Node.new(:ATTRIB_NAME, [[val[0], val[2]].compact.join(':')])
|
487
509
|
result
|
488
510
|
end
|
489
511
|
|
490
512
|
def _reduce_32(val, _values, result)
|
491
|
-
|
492
|
-
# So we don't add prefix "xmlns:" as in namespaced_ident.
|
493
|
-
result = Node.new(:ELEMENT_NAME, [val.first])
|
494
|
-
|
513
|
+
result = Node.new(:ATTRIB_NAME, [val[0]])
|
495
514
|
result
|
496
515
|
end
|
497
516
|
|
498
|
-
|
499
|
-
result = Node.new(:FUNCTION, [val.first.strip])
|
500
|
-
|
501
|
-
result
|
502
|
-
end
|
517
|
+
# reduce 33 omitted
|
503
518
|
|
504
519
|
def _reduce_34(val, _values, result)
|
505
|
-
|
506
|
-
|
520
|
+
result = Node.new(:FUNCTION, [val[0].strip])
|
521
|
+
|
507
522
|
result
|
508
523
|
end
|
509
524
|
|
510
525
|
def _reduce_35(val, _values, result)
|
511
|
-
|
512
|
-
|
526
|
+
result = Node.new(:FUNCTION, [val[0].strip, val[1]].flatten)
|
527
|
+
|
513
528
|
result
|
514
529
|
end
|
515
530
|
|
516
531
|
def _reduce_36(val, _values, result)
|
517
|
-
|
518
|
-
|
532
|
+
result = Node.new(:FUNCTION, [val[0].strip, val[1]].flatten)
|
533
|
+
|
519
534
|
result
|
520
535
|
end
|
521
536
|
|
522
537
|
def _reduce_37(val, _values, result)
|
523
|
-
|
524
|
-
|
538
|
+
result = Node.new(:FUNCTION, [val[0].strip, val[1]].flatten)
|
539
|
+
|
525
540
|
result
|
526
541
|
end
|
527
542
|
|
528
543
|
def _reduce_38(val, _values, result)
|
529
|
-
|
544
|
+
result = Node.new(:FUNCTION, [val[0].strip, val[1]].flatten)
|
545
|
+
|
530
546
|
result
|
531
547
|
end
|
532
548
|
|
533
549
|
def _reduce_39(val, _values, result)
|
534
|
-
result = [val
|
550
|
+
result = [val[0], val[2]]
|
535
551
|
result
|
536
552
|
end
|
537
553
|
|
538
554
|
def _reduce_40(val, _values, result)
|
539
|
-
result = [val
|
555
|
+
result = [val[0], val[2]]
|
540
556
|
result
|
541
557
|
end
|
542
558
|
|
543
|
-
|
544
|
-
|
545
|
-
# reduce 42 omitted
|
546
|
-
|
547
|
-
def _reduce_43(val, _values, result)
|
548
|
-
if val[0] == 'even'
|
549
|
-
val = ["2","n","+","0"]
|
550
|
-
result = Node.new(:AN_PLUS_B, val)
|
551
|
-
elsif val[0] == 'odd'
|
552
|
-
val = ["2","n","+","1"]
|
553
|
-
result = Node.new(:AN_PLUS_B, val)
|
554
|
-
else
|
555
|
-
# This is not CSS standard. It allows us to support this:
|
556
|
-
# assert_xpath("//a[foo(., @href)]", @parser.parse('a:foo(@href)'))
|
557
|
-
# assert_xpath("//a[foo(., @a, b)]", @parser.parse('a:foo(@a, b)'))
|
558
|
-
# assert_xpath("//a[foo(., a, 10)]", @parser.parse('a:foo(a, 10)'))
|
559
|
-
result = val
|
560
|
-
end
|
561
|
-
|
559
|
+
def _reduce_41(val, _values, result)
|
560
|
+
result = [val[0], val[2]]
|
562
561
|
result
|
563
562
|
end
|
564
563
|
|
565
|
-
def
|
566
|
-
|
567
|
-
result = Node.new(:AN_PLUS_B, val)
|
568
|
-
else
|
569
|
-
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
570
|
-
end
|
571
|
-
|
564
|
+
def _reduce_42(val, _values, result)
|
565
|
+
result = [val[0], val[2]]
|
572
566
|
result
|
573
567
|
end
|
574
568
|
|
569
|
+
# reduce 43 omitted
|
570
|
+
|
571
|
+
# reduce 44 omitted
|
572
|
+
|
575
573
|
def _reduce_45(val, _values, result)
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
end
|
587
|
-
|
588
|
-
result
|
589
|
-
end
|
574
|
+
case val[0]
|
575
|
+
when 'even'
|
576
|
+
result = Node.new(:NTH, ['2','n','+','0'])
|
577
|
+
when 'odd'
|
578
|
+
result = Node.new(:NTH, ['2','n','+','1'])
|
579
|
+
when 'n'
|
580
|
+
result = Node.new(:NTH, ['1','n','+','0'])
|
581
|
+
else
|
582
|
+
result = val
|
583
|
+
end
|
590
584
|
|
591
|
-
def _reduce_46(val, _values, result)
|
592
|
-
if val[1] == 'n'
|
593
|
-
val << "+"
|
594
|
-
val << "0"
|
595
|
-
result = Node.new(:AN_PLUS_B, val)
|
596
|
-
else
|
597
|
-
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
598
|
-
end
|
599
|
-
|
600
585
|
result
|
601
586
|
end
|
602
587
|
|
588
|
+
# reduce 46 omitted
|
589
|
+
|
603
590
|
def _reduce_47(val, _values, result)
|
604
|
-
|
605
|
-
|
591
|
+
if val[1] == 'n'
|
592
|
+
result = Node.new(:NTH, val)
|
593
|
+
else
|
594
|
+
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
595
|
+
end
|
596
|
+
|
606
597
|
result
|
607
598
|
end
|
608
599
|
|
609
600
|
def _reduce_48(val, _values, result)
|
610
|
-
|
601
|
+
# n+3, -n+3
|
602
|
+
if val[0] == 'n'
|
603
|
+
val.unshift("1")
|
604
|
+
result = Node.new(:NTH, val)
|
605
|
+
elsif val[0] == '-n'
|
606
|
+
val[0] = 'n'
|
607
|
+
val.unshift("-1")
|
608
|
+
result = Node.new(:NTH, val)
|
609
|
+
else
|
610
|
+
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
611
|
+
end
|
612
|
+
|
611
613
|
result
|
612
614
|
end
|
613
615
|
|
614
|
-
|
615
|
-
|
616
|
-
|
616
|
+
def _reduce_49(val, _values, result)
|
617
|
+
# 5n, -5n, 10n-1
|
618
|
+
n = val[1]
|
619
|
+
if n[0, 2] == 'n-'
|
620
|
+
val[1] = 'n'
|
621
|
+
val << "-"
|
622
|
+
# b is contained in n as n is the string "n-b"
|
623
|
+
val << n[2, n.size]
|
624
|
+
result = Node.new(:NTH, val)
|
625
|
+
elsif n == 'n'
|
626
|
+
val << "+"
|
627
|
+
val << "0"
|
628
|
+
result = Node.new(:NTH, val)
|
629
|
+
else
|
630
|
+
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
631
|
+
end
|
617
632
|
|
618
|
-
def _reduce_51(val, _values, result)
|
619
|
-
result = Node.new(:COMBINATOR, val)
|
620
|
-
|
621
633
|
result
|
622
634
|
end
|
623
635
|
|
624
|
-
def
|
625
|
-
|
626
|
-
|
636
|
+
def _reduce_50(val, _values, result)
|
637
|
+
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
638
|
+
|
627
639
|
result
|
628
640
|
end
|
629
641
|
|
630
|
-
def
|
631
|
-
|
632
|
-
|
642
|
+
def _reduce_51(val, _values, result)
|
643
|
+
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
633
644
|
result
|
634
645
|
end
|
635
646
|
|
647
|
+
# reduce 52 omitted
|
648
|
+
|
649
|
+
# reduce 53 omitted
|
650
|
+
|
636
651
|
def _reduce_54(val, _values, result)
|
637
|
-
|
638
|
-
|
652
|
+
result = Node.new(:COMBINATOR, val)
|
653
|
+
|
639
654
|
result
|
640
655
|
end
|
641
656
|
|
642
|
-
|
657
|
+
def _reduce_55(val, _values, result)
|
658
|
+
result = Node.new(:COMBINATOR, val)
|
643
659
|
|
644
|
-
|
645
|
-
|
646
|
-
# reduce 57 omitted
|
660
|
+
result
|
661
|
+
end
|
647
662
|
|
648
|
-
|
663
|
+
def _reduce_56(val, _values, result)
|
664
|
+
result = Node.new(:COMBINATOR, val)
|
649
665
|
|
650
|
-
def _reduce_59(val, _values, result)
|
651
|
-
result = Node.new(:ID, val)
|
652
666
|
result
|
653
667
|
end
|
654
668
|
|
655
|
-
def
|
656
|
-
|
669
|
+
def _reduce_57(val, _values, result)
|
670
|
+
result = Node.new(:COMBINATOR, val)
|
671
|
+
|
657
672
|
result
|
658
673
|
end
|
659
674
|
|
660
|
-
def
|
661
|
-
|
675
|
+
def _reduce_58(val, _values, result)
|
676
|
+
result = Node.new(:COMBINATOR, val)
|
677
|
+
|
662
678
|
result
|
663
679
|
end
|
664
680
|
|
681
|
+
# reduce 59 omitted
|
682
|
+
|
683
|
+
# reduce 60 omitted
|
684
|
+
|
685
|
+
# reduce 61 omitted
|
686
|
+
|
665
687
|
# reduce 62 omitted
|
666
688
|
|
667
|
-
|
668
|
-
result = :equal
|
669
|
-
result
|
670
|
-
end
|
689
|
+
# reduce 63 omitted
|
671
690
|
|
672
691
|
def _reduce_64(val, _values, result)
|
673
|
-
result = :
|
692
|
+
result = Node.new(:ID, [unescape_css_identifier(val[0])])
|
674
693
|
result
|
675
694
|
end
|
676
695
|
|
677
696
|
def _reduce_65(val, _values, result)
|
678
|
-
result =
|
697
|
+
result = [val[0], unescape_css_identifier(val[1])]
|
679
698
|
result
|
680
699
|
end
|
681
700
|
|
682
701
|
def _reduce_66(val, _values, result)
|
683
|
-
result =
|
702
|
+
result = [val[0], unescape_css_string(val[1])]
|
684
703
|
result
|
685
704
|
end
|
686
705
|
|
687
706
|
def _reduce_67(val, _values, result)
|
688
|
-
result =
|
707
|
+
result = [val[0], val[1]]
|
689
708
|
result
|
690
709
|
end
|
691
710
|
|
692
|
-
|
693
|
-
result = :includes
|
694
|
-
result
|
695
|
-
end
|
711
|
+
# reduce 68 omitted
|
696
712
|
|
697
713
|
def _reduce_69(val, _values, result)
|
698
|
-
result = :
|
714
|
+
result = :equal
|
699
715
|
result
|
700
716
|
end
|
701
717
|
|
702
718
|
def _reduce_70(val, _values, result)
|
703
|
-
|
704
|
-
|
719
|
+
result = :prefix_match
|
705
720
|
result
|
706
721
|
end
|
707
722
|
|
708
|
-
|
723
|
+
def _reduce_71(val, _values, result)
|
724
|
+
result = :suffix_match
|
725
|
+
result
|
726
|
+
end
|
727
|
+
|
728
|
+
def _reduce_72(val, _values, result)
|
729
|
+
result = :substring_match
|
730
|
+
result
|
731
|
+
end
|
732
|
+
|
733
|
+
def _reduce_73(val, _values, result)
|
734
|
+
result = :not_equal
|
735
|
+
result
|
736
|
+
end
|
737
|
+
|
738
|
+
def _reduce_74(val, _values, result)
|
739
|
+
result = :includes
|
740
|
+
result
|
741
|
+
end
|
742
|
+
|
743
|
+
def _reduce_75(val, _values, result)
|
744
|
+
result = :dash_match
|
745
|
+
result
|
746
|
+
end
|
747
|
+
|
748
|
+
def _reduce_76(val, _values, result)
|
749
|
+
result = Node.new(:NOT, [val[1]])
|
750
|
+
|
751
|
+
result
|
752
|
+
end
|
753
|
+
|
754
|
+
# reduce 77 omitted
|
755
|
+
|
756
|
+
# reduce 78 omitted
|
757
|
+
|
758
|
+
# reduce 79 omitted
|
709
759
|
|
710
|
-
# reduce
|
760
|
+
# reduce 80 omitted
|
711
761
|
|
712
|
-
# reduce
|
762
|
+
# reduce 81 omitted
|
713
763
|
|
714
764
|
def _reduce_none(val, _values, result)
|
715
765
|
val[0]
|
716
766
|
end
|
717
767
|
|
718
768
|
end # class Parser
|
719
|
-
|
720
|
-
|
769
|
+
end # module CSS
|
770
|
+
end # module Nokogiri
|