nokogiri 1.13.0-x64-mingw-ucrt
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 +131 -0
- data/dependencies.yml +73 -0
- data/ext/nokogiri/depend +38 -0
- data/ext/nokogiri/extconf.rb +1000 -0
- 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/include/libexslt/exslt.h +102 -0
- data/ext/nokogiri/include/libexslt/exsltconfig.h +70 -0
- data/ext/nokogiri/include/libexslt/exsltexports.h +140 -0
- data/ext/nokogiri/include/libxml2/libxml/DOCBparser.h +96 -0
- data/ext/nokogiri/include/libxml2/libxml/HTMLparser.h +306 -0
- data/ext/nokogiri/include/libxml2/libxml/HTMLtree.h +147 -0
- data/ext/nokogiri/include/libxml2/libxml/SAX.h +173 -0
- data/ext/nokogiri/include/libxml2/libxml/SAX2.h +178 -0
- data/ext/nokogiri/include/libxml2/libxml/c14n.h +128 -0
- data/ext/nokogiri/include/libxml2/libxml/catalog.h +182 -0
- data/ext/nokogiri/include/libxml2/libxml/chvalid.h +230 -0
- data/ext/nokogiri/include/libxml2/libxml/debugXML.h +217 -0
- data/ext/nokogiri/include/libxml2/libxml/dict.h +79 -0
- data/ext/nokogiri/include/libxml2/libxml/encoding.h +245 -0
- data/ext/nokogiri/include/libxml2/libxml/entities.h +151 -0
- data/ext/nokogiri/include/libxml2/libxml/globals.h +508 -0
- data/ext/nokogiri/include/libxml2/libxml/hash.h +236 -0
- data/ext/nokogiri/include/libxml2/libxml/list.h +137 -0
- data/ext/nokogiri/include/libxml2/libxml/nanoftp.h +163 -0
- data/ext/nokogiri/include/libxml2/libxml/nanohttp.h +81 -0
- data/ext/nokogiri/include/libxml2/libxml/parser.h +1243 -0
- data/ext/nokogiri/include/libxml2/libxml/parserInternals.h +644 -0
- data/ext/nokogiri/include/libxml2/libxml/pattern.h +100 -0
- data/ext/nokogiri/include/libxml2/libxml/relaxng.h +217 -0
- data/ext/nokogiri/include/libxml2/libxml/schemasInternals.h +958 -0
- data/ext/nokogiri/include/libxml2/libxml/schematron.h +142 -0
- data/ext/nokogiri/include/libxml2/libxml/threads.h +89 -0
- data/ext/nokogiri/include/libxml2/libxml/tree.h +1311 -0
- data/ext/nokogiri/include/libxml2/libxml/uri.h +94 -0
- data/ext/nokogiri/include/libxml2/libxml/valid.h +458 -0
- data/ext/nokogiri/include/libxml2/libxml/xinclude.h +129 -0
- data/ext/nokogiri/include/libxml2/libxml/xlink.h +189 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlIO.h +368 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlautomata.h +146 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlerror.h +946 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlexports.h +77 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlmemory.h +224 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlmodule.h +57 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlreader.h +428 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlregexp.h +222 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlsave.h +88 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlschemas.h +246 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlschemastypes.h +151 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlstring.h +140 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlunicode.h +202 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlversion.h +485 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlwriter.h +488 -0
- data/ext/nokogiri/include/libxml2/libxml/xpath.h +564 -0
- data/ext/nokogiri/include/libxml2/libxml/xpathInternals.h +632 -0
- data/ext/nokogiri/include/libxml2/libxml/xpointer.h +114 -0
- data/ext/nokogiri/include/libxslt/attributes.h +38 -0
- data/ext/nokogiri/include/libxslt/documents.h +93 -0
- data/ext/nokogiri/include/libxslt/extensions.h +262 -0
- data/ext/nokogiri/include/libxslt/extra.h +72 -0
- data/ext/nokogiri/include/libxslt/functions.h +78 -0
- data/ext/nokogiri/include/libxslt/imports.h +75 -0
- data/ext/nokogiri/include/libxslt/keys.h +53 -0
- data/ext/nokogiri/include/libxslt/namespaces.h +68 -0
- data/ext/nokogiri/include/libxslt/numbersInternals.h +73 -0
- data/ext/nokogiri/include/libxslt/pattern.h +84 -0
- data/ext/nokogiri/include/libxslt/preproc.h +43 -0
- data/ext/nokogiri/include/libxslt/security.h +104 -0
- data/ext/nokogiri/include/libxslt/templates.h +77 -0
- data/ext/nokogiri/include/libxslt/transform.h +207 -0
- data/ext/nokogiri/include/libxslt/variables.h +118 -0
- data/ext/nokogiri/include/libxslt/xslt.h +110 -0
- data/ext/nokogiri/include/libxslt/xsltInternals.h +1978 -0
- data/ext/nokogiri/include/libxslt/xsltconfig.h +180 -0
- data/ext/nokogiri/include/libxslt/xsltexports.h +142 -0
- data/ext/nokogiri/include/libxslt/xsltlocale.h +76 -0
- data/ext/nokogiri/include/libxslt/xsltutils.h +313 -0
- data/ext/nokogiri/libxml2_backwards_compat.c +121 -0
- data/ext/nokogiri/nokogiri.c +278 -0
- data/ext/nokogiri/nokogiri.h +223 -0
- data/ext/nokogiri/test_global_handlers.c +40 -0
- data/ext/nokogiri/xml_attr.c +103 -0
- data/ext/nokogiri/xml_attribute_decl.c +70 -0
- data/ext/nokogiri/xml_cdata.c +57 -0
- data/ext/nokogiri/xml_comment.c +62 -0
- data/ext/nokogiri/xml_document.c +680 -0
- data/ext/nokogiri/xml_document_fragment.c +44 -0
- data/ext/nokogiri/xml_dtd.c +208 -0
- data/ext/nokogiri/xml_element_content.c +128 -0
- data/ext/nokogiri/xml_element_decl.c +69 -0
- data/ext/nokogiri/xml_encoding_handler.c +104 -0
- data/ext/nokogiri/xml_entity_decl.c +112 -0
- data/ext/nokogiri/xml_entity_reference.c +50 -0
- data/ext/nokogiri/xml_namespace.c +120 -0
- data/ext/nokogiri/xml_node.c +2144 -0
- data/ext/nokogiri/xml_node_set.c +498 -0
- data/ext/nokogiri/xml_processing_instruction.c +54 -0
- data/ext/nokogiri/xml_reader.c +719 -0
- data/ext/nokogiri/xml_relax_ng.c +185 -0
- data/ext/nokogiri/xml_sax_parser.c +310 -0
- data/ext/nokogiri/xml_sax_parser_context.c +281 -0
- data/ext/nokogiri/xml_sax_push_parser.c +168 -0
- data/ext/nokogiri/xml_schema.c +284 -0
- data/ext/nokogiri/xml_syntax_error.c +85 -0
- data/ext/nokogiri/xml_text.c +48 -0
- data/ext/nokogiri/xml_xpath_context.c +406 -0
- data/ext/nokogiri/xslt_stylesheet.c +264 -0
- data/gumbo-parser/CHANGES.md +63 -0
- data/gumbo-parser/Makefile +101 -0
- data/gumbo-parser/THANKS +27 -0
- data/lib/nokogiri/3.1/nokogiri.so +0 -0
- data/lib/nokogiri/class_resolver.rb +67 -0
- data/lib/nokogiri/css/node.rb +54 -0
- data/lib/nokogiri/css/parser.rb +759 -0
- data/lib/nokogiri/css/parser.y +280 -0
- data/lib/nokogiri/css/parser_extras.rb +94 -0
- data/lib/nokogiri/css/syntax_error.rb +9 -0
- data/lib/nokogiri/css/tokenizer.rb +155 -0
- data/lib/nokogiri/css/tokenizer.rex +56 -0
- data/lib/nokogiri/css/xpath_visitor.rb +359 -0
- data/lib/nokogiri/css.rb +60 -0
- data/lib/nokogiri/decorators/slop.rb +44 -0
- data/lib/nokogiri/extension.rb +31 -0
- data/lib/nokogiri/gumbo.rb +15 -0
- data/lib/nokogiri/html.rb +48 -0
- data/lib/nokogiri/html4/builder.rb +37 -0
- data/lib/nokogiri/html4/document.rb +331 -0
- data/lib/nokogiri/html4/document_fragment.rb +54 -0
- data/lib/nokogiri/html4/element_description.rb +25 -0
- data/lib/nokogiri/html4/element_description_defaults.rb +578 -0
- data/lib/nokogiri/html4/entity_lookup.rb +15 -0
- data/lib/nokogiri/html4/sax/parser.rb +61 -0
- 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 +6 -0
- data/lib/nokogiri/version/constant.rb +6 -0
- data/lib/nokogiri/version/info.rb +221 -0
- data/lib/nokogiri/version.rb +4 -0
- data/lib/nokogiri/xml/attr.rb +17 -0
- data/lib/nokogiri/xml/attribute_decl.rb +20 -0
- data/lib/nokogiri/xml/builder.rb +485 -0
- data/lib/nokogiri/xml/cdata.rb +13 -0
- data/lib/nokogiri/xml/character_data.rb +9 -0
- data/lib/nokogiri/xml/document.rb +418 -0
- data/lib/nokogiri/xml/document_fragment.rb +162 -0
- data/lib/nokogiri/xml/dtd.rb +34 -0
- data/lib/nokogiri/xml/element_content.rb +38 -0
- data/lib/nokogiri/xml/element_decl.rb +15 -0
- data/lib/nokogiri/xml/entity_decl.rb +21 -0
- data/lib/nokogiri/xml/entity_reference.rb +20 -0
- data/lib/nokogiri/xml/namespace.rb +16 -0
- data/lib/nokogiri/xml/node/save_options.rb +65 -0
- data/lib/nokogiri/xml/node.rb +1402 -0
- data/lib/nokogiri/xml/node_set.rb +364 -0
- data/lib/nokogiri/xml/notation.rb +19 -0
- data/lib/nokogiri/xml/parse_options.rb +133 -0
- data/lib/nokogiri/xml/pp/character_data.rb +21 -0
- data/lib/nokogiri/xml/pp/node.rb +55 -0
- data/lib/nokogiri/xml/pp.rb +4 -0
- data/lib/nokogiri/xml/processing_instruction.rb +10 -0
- data/lib/nokogiri/xml/reader.rb +107 -0
- data/lib/nokogiri/xml/relax_ng.rb +38 -0
- data/lib/nokogiri/xml/sax/document.rb +167 -0
- data/lib/nokogiri/xml/sax/parser.rb +125 -0
- data/lib/nokogiri/xml/sax/parser_context.rb +21 -0
- data/lib/nokogiri/xml/sax/push_parser.rb +61 -0
- data/lib/nokogiri/xml/sax.rb +6 -0
- data/lib/nokogiri/xml/schema.rb +73 -0
- data/lib/nokogiri/xml/searchable.rb +259 -0
- data/lib/nokogiri/xml/syntax_error.rb +71 -0
- data/lib/nokogiri/xml/text.rb +11 -0
- data/lib/nokogiri/xml/xpath/syntax_error.rb +13 -0
- data/lib/nokogiri/xml/xpath.rb +21 -0
- data/lib/nokogiri/xml/xpath_context.rb +16 -0
- data/lib/nokogiri/xml.rb +75 -0
- data/lib/nokogiri/xslt/stylesheet.rb +27 -0
- data/lib/nokogiri/xslt.rb +58 -0
- data/lib/nokogiri.rb +128 -0
- data/lib/xsd/xmlparser/nokogiri.rb +104 -0
- metadata +536 -0
@@ -0,0 +1,759 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# DO NOT MODIFY!!!!
|
4
|
+
# This file is automatically generated by Racc 1.6.0
|
5
|
+
# from Racc grammar file "".
|
6
|
+
#
|
7
|
+
|
8
|
+
require 'racc/parser.rb'
|
9
|
+
|
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
|
+
|
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
|
39
|
+
##### State transition tables begin ###
|
40
|
+
|
41
|
+
racc_action_table = [
|
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 ]
|
64
|
+
|
65
|
+
racc_action_check = [
|
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 ]
|
88
|
+
|
89
|
+
racc_action_pointer = [
|
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 ]
|
102
|
+
|
103
|
+
racc_action_default = [
|
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 ]
|
116
|
+
|
117
|
+
racc_goto_table = [
|
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,
|
121
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
122
|
+
nil, 72, 73, nil, nil, nil, nil, nil, nil, 97,
|
123
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
124
|
+
nil, nil, nil, nil, nil, nil, 105, nil, 107, 108 ]
|
125
|
+
|
126
|
+
racc_goto_check = [
|
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,
|
130
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
131
|
+
nil, 2, 2, nil, nil, nil, nil, nil, nil, 12,
|
132
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
133
|
+
nil, nil, nil, nil, nil, nil, 18, nil, 18, 18 ]
|
134
|
+
|
135
|
+
racc_goto_pointer = [
|
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 ]
|
139
|
+
|
140
|
+
racc_goto_default = [
|
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 ]
|
144
|
+
|
145
|
+
racc_reduce_table = [
|
146
|
+
0, 0, :racc_error,
|
147
|
+
3, 32, :_reduce_1,
|
148
|
+
1, 32, :_reduce_2,
|
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,
|
156
|
+
1, 37, :_reduce_none,
|
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,
|
170
|
+
0, 46, :_reduce_none,
|
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,
|
184
|
+
1, 49, :_reduce_none,
|
185
|
+
1, 49, :_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,
|
192
|
+
1, 39, :_reduce_none,
|
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,
|
206
|
+
2, 48, :_reduce_60,
|
207
|
+
2, 48, :_reduce_61,
|
208
|
+
0, 48, :_reduce_none,
|
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
|
226
|
+
|
227
|
+
racc_token_table = {
|
228
|
+
false => 0,
|
229
|
+
:error => 1,
|
230
|
+
:FUNCTION => 2,
|
231
|
+
:INCLUDES => 3,
|
232
|
+
:DASHMATCH => 4,
|
233
|
+
:LBRACE => 5,
|
234
|
+
:HASH => 6,
|
235
|
+
:PLUS => 7,
|
236
|
+
:GREATER => 8,
|
237
|
+
:S => 9,
|
238
|
+
:STRING => 10,
|
239
|
+
:IDENT => 11,
|
240
|
+
:COMMA => 12,
|
241
|
+
:NUMBER => 13,
|
242
|
+
:PREFIXMATCH => 14,
|
243
|
+
:SUFFIXMATCH => 15,
|
244
|
+
:SUBSTRINGMATCH => 16,
|
245
|
+
:TILDE => 17,
|
246
|
+
:NOT_EQUAL => 18,
|
247
|
+
:SLASH => 19,
|
248
|
+
:DOUBLESLASH => 20,
|
249
|
+
:NOT => 21,
|
250
|
+
:EQUAL => 22,
|
251
|
+
:RPAREN => 23,
|
252
|
+
:LSQUARE => 24,
|
253
|
+
:RSQUARE => 25,
|
254
|
+
:HAS => 26,
|
255
|
+
"." => 27,
|
256
|
+
"*" => 28,
|
257
|
+
"|" => 29,
|
258
|
+
":" => 30 }
|
259
|
+
|
260
|
+
racc_nt_base = 31
|
261
|
+
|
262
|
+
racc_use_result_var = true
|
263
|
+
|
264
|
+
Racc_arg = [
|
265
|
+
racc_action_table,
|
266
|
+
racc_action_check,
|
267
|
+
racc_action_default,
|
268
|
+
racc_action_pointer,
|
269
|
+
racc_goto_table,
|
270
|
+
racc_goto_check,
|
271
|
+
racc_goto_default,
|
272
|
+
racc_goto_pointer,
|
273
|
+
racc_nt_base,
|
274
|
+
racc_reduce_table,
|
275
|
+
racc_token_table,
|
276
|
+
racc_shift_n,
|
277
|
+
racc_reduce_n,
|
278
|
+
racc_use_result_var ]
|
279
|
+
|
280
|
+
Racc_token_to_s_table = [
|
281
|
+
"$end",
|
282
|
+
"error",
|
283
|
+
"FUNCTION",
|
284
|
+
"INCLUDES",
|
285
|
+
"DASHMATCH",
|
286
|
+
"LBRACE",
|
287
|
+
"HASH",
|
288
|
+
"PLUS",
|
289
|
+
"GREATER",
|
290
|
+
"S",
|
291
|
+
"STRING",
|
292
|
+
"IDENT",
|
293
|
+
"COMMA",
|
294
|
+
"NUMBER",
|
295
|
+
"PREFIXMATCH",
|
296
|
+
"SUFFIXMATCH",
|
297
|
+
"SUBSTRINGMATCH",
|
298
|
+
"TILDE",
|
299
|
+
"NOT_EQUAL",
|
300
|
+
"SLASH",
|
301
|
+
"DOUBLESLASH",
|
302
|
+
"NOT",
|
303
|
+
"EQUAL",
|
304
|
+
"RPAREN",
|
305
|
+
"LSQUARE",
|
306
|
+
"RSQUARE",
|
307
|
+
"HAS",
|
308
|
+
"\".\"",
|
309
|
+
"\"*\"",
|
310
|
+
"\"|\"",
|
311
|
+
"\":\"",
|
312
|
+
"$start",
|
313
|
+
"selector",
|
314
|
+
"simple_selector_1toN",
|
315
|
+
"prefixless_combinator_selector",
|
316
|
+
"optional_S",
|
317
|
+
"combinator",
|
318
|
+
"simple_selector",
|
319
|
+
"element_name",
|
320
|
+
"hcap_0toN",
|
321
|
+
"function",
|
322
|
+
"pseudo",
|
323
|
+
"attrib",
|
324
|
+
"hcap_1toN",
|
325
|
+
"class",
|
326
|
+
"namespaced_ident",
|
327
|
+
"namespace",
|
328
|
+
"attrib_name",
|
329
|
+
"attrib_val_0or1",
|
330
|
+
"expr",
|
331
|
+
"nth",
|
332
|
+
"attribute_id",
|
333
|
+
"negation",
|
334
|
+
"eql_incl_dash",
|
335
|
+
"negation_arg" ]
|
336
|
+
|
337
|
+
Racc_debug_parser = false
|
338
|
+
|
339
|
+
##### State transition tables end #####
|
340
|
+
|
341
|
+
# reduce 0 omitted
|
342
|
+
|
343
|
+
def _reduce_1(val, _values, result)
|
344
|
+
result = [val.first, val.last].flatten
|
345
|
+
|
346
|
+
result
|
347
|
+
end
|
348
|
+
|
349
|
+
def _reduce_2(val, _values, result)
|
350
|
+
result = val.flatten
|
351
|
+
result
|
352
|
+
end
|
353
|
+
|
354
|
+
def _reduce_3(val, _values, result)
|
355
|
+
result = [val.last].flatten
|
356
|
+
result
|
357
|
+
end
|
358
|
+
|
359
|
+
def _reduce_4(val, _values, result)
|
360
|
+
result = :DIRECT_ADJACENT_SELECTOR
|
361
|
+
result
|
362
|
+
end
|
363
|
+
|
364
|
+
def _reduce_5(val, _values, result)
|
365
|
+
result = :CHILD_SELECTOR
|
366
|
+
result
|
367
|
+
end
|
368
|
+
|
369
|
+
def _reduce_6(val, _values, result)
|
370
|
+
result = :FOLLOWING_SELECTOR
|
371
|
+
result
|
372
|
+
end
|
373
|
+
|
374
|
+
def _reduce_7(val, _values, result)
|
375
|
+
result = :DESCENDANT_SELECTOR
|
376
|
+
result
|
377
|
+
end
|
378
|
+
|
379
|
+
def _reduce_8(val, _values, result)
|
380
|
+
result = :CHILD_SELECTOR
|
381
|
+
result
|
382
|
+
end
|
383
|
+
|
384
|
+
def _reduce_9(val, _values, result)
|
385
|
+
result = if val[1].nil?
|
386
|
+
val.first
|
387
|
+
else
|
388
|
+
Node.new(:CONDITIONAL_SELECTOR, [val.first, val[1]])
|
389
|
+
end
|
390
|
+
|
391
|
+
result
|
392
|
+
end
|
393
|
+
|
394
|
+
# reduce 10 omitted
|
395
|
+
|
396
|
+
def _reduce_11(val, _values, result)
|
397
|
+
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
398
|
+
|
399
|
+
result
|
400
|
+
end
|
401
|
+
|
402
|
+
def _reduce_12(val, _values, result)
|
403
|
+
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
404
|
+
|
405
|
+
result
|
406
|
+
end
|
407
|
+
|
408
|
+
def _reduce_13(val, _values, result)
|
409
|
+
result = Node.new(:CONDITIONAL_SELECTOR,
|
410
|
+
[Node.new(:ELEMENT_NAME, ['*']), val.first]
|
411
|
+
)
|
412
|
+
|
413
|
+
result
|
414
|
+
end
|
415
|
+
|
416
|
+
def _reduce_14(val, _values, result)
|
417
|
+
result = Node.new(val.first, [nil, val.last])
|
418
|
+
|
419
|
+
result
|
420
|
+
end
|
421
|
+
|
422
|
+
def _reduce_15(val, _values, result)
|
423
|
+
result = Node.new(val[1], [val.first, val.last])
|
424
|
+
|
425
|
+
result
|
426
|
+
end
|
427
|
+
|
428
|
+
def _reduce_16(val, _values, result)
|
429
|
+
result = Node.new(:DESCENDANT_SELECTOR, [val.first, val.last])
|
430
|
+
|
431
|
+
result
|
432
|
+
end
|
433
|
+
|
434
|
+
# reduce 17 omitted
|
435
|
+
|
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)
|
445
|
+
result
|
446
|
+
end
|
447
|
+
|
448
|
+
def _reduce_21(val, _values, result)
|
449
|
+
result = Node.new(:ELEMENT_NAME,
|
450
|
+
[[val.first, val.last].compact.join(':')]
|
451
|
+
)
|
452
|
+
|
453
|
+
result
|
454
|
+
end
|
455
|
+
|
456
|
+
def _reduce_22(val, _values, result)
|
457
|
+
name = @namespaces.key?('xmlns') ? "xmlns:#{val.first}" : val.first
|
458
|
+
result = Node.new(:ELEMENT_NAME, [name])
|
459
|
+
|
460
|
+
result
|
461
|
+
end
|
462
|
+
|
463
|
+
def _reduce_23(val, _values, result)
|
464
|
+
result = val[0]
|
465
|
+
result
|
466
|
+
end
|
467
|
+
|
468
|
+
# reduce 24 omitted
|
469
|
+
|
470
|
+
def _reduce_25(val, _values, result)
|
471
|
+
result = Node.new(:ATTRIBUTE_CONDITION,
|
472
|
+
[val[1]] + (val[2] || [])
|
473
|
+
)
|
474
|
+
|
475
|
+
result
|
476
|
+
end
|
477
|
+
|
478
|
+
def _reduce_26(val, _values, result)
|
479
|
+
result = Node.new(:ATTRIBUTE_CONDITION,
|
480
|
+
[val[1]] + (val[2] || [])
|
481
|
+
)
|
482
|
+
|
483
|
+
result
|
484
|
+
end
|
485
|
+
|
486
|
+
def _reduce_27(val, _values, result)
|
487
|
+
# non-standard, from hpricot
|
488
|
+
result = Node.new(:PSEUDO_CLASS,
|
489
|
+
[Node.new(:FUNCTION, ['nth-child(', val[1]])]
|
490
|
+
)
|
491
|
+
|
492
|
+
result
|
493
|
+
end
|
494
|
+
|
495
|
+
def _reduce_28(val, _values, result)
|
496
|
+
result = Node.new(:ATTRIB_NAME,
|
497
|
+
[[val.first, val.last].compact.join(':')]
|
498
|
+
)
|
499
|
+
|
500
|
+
result
|
501
|
+
end
|
502
|
+
|
503
|
+
def _reduce_29(val, _values, result)
|
504
|
+
# Default namespace is not applied to attributes.
|
505
|
+
# So we don't add prefix "xmlns:" as in namespaced_ident.
|
506
|
+
result = Node.new(:ATTRIB_NAME, [val.first])
|
507
|
+
|
508
|
+
result
|
509
|
+
end
|
510
|
+
|
511
|
+
def _reduce_30(val, _values, result)
|
512
|
+
result = Node.new(:FUNCTION, [val.first.strip])
|
513
|
+
|
514
|
+
result
|
515
|
+
end
|
516
|
+
|
517
|
+
def _reduce_31(val, _values, result)
|
518
|
+
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
519
|
+
|
520
|
+
result
|
521
|
+
end
|
522
|
+
|
523
|
+
def _reduce_32(val, _values, result)
|
524
|
+
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
525
|
+
|
526
|
+
result
|
527
|
+
end
|
528
|
+
|
529
|
+
def _reduce_33(val, _values, result)
|
530
|
+
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
531
|
+
|
532
|
+
result
|
533
|
+
end
|
534
|
+
|
535
|
+
def _reduce_34(val, _values, result)
|
536
|
+
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
537
|
+
|
538
|
+
result
|
539
|
+
end
|
540
|
+
|
541
|
+
def _reduce_35(val, _values, result)
|
542
|
+
result = [val.first, val.last]
|
543
|
+
result
|
544
|
+
end
|
545
|
+
|
546
|
+
def _reduce_36(val, _values, result)
|
547
|
+
result = [val.first, val.last]
|
548
|
+
result
|
549
|
+
end
|
550
|
+
|
551
|
+
def _reduce_37(val, _values, result)
|
552
|
+
result = [val.first, val.last]
|
553
|
+
result
|
554
|
+
end
|
555
|
+
|
556
|
+
# reduce 38 omitted
|
557
|
+
|
558
|
+
# reduce 39 omitted
|
559
|
+
|
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'])
|
568
|
+
else
|
569
|
+
# non-standard to support custom functions:
|
570
|
+
# assert_xpath("//a[foo(., @href)]", @parser.parse('a:foo(@href)'))
|
571
|
+
# assert_xpath("//a[foo(., @a, b)]", @parser.parse('a:foo(@a, b)'))
|
572
|
+
# assert_xpath("//a[foo(., a, 10)]", @parser.parse('a:foo(a, 10)'))
|
573
|
+
result = val
|
574
|
+
end
|
575
|
+
|
576
|
+
result
|
577
|
+
end
|
578
|
+
|
579
|
+
def _reduce_41(val, _values, result)
|
580
|
+
if val[1] == 'n'
|
581
|
+
result = Node.new(:NTH, val)
|
582
|
+
else
|
583
|
+
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
584
|
+
end
|
585
|
+
|
586
|
+
result
|
587
|
+
end
|
588
|
+
|
589
|
+
def _reduce_42(val, _values, result)
|
590
|
+
# n+3, -n+3
|
591
|
+
if val[0] == 'n'
|
592
|
+
val.unshift("1")
|
593
|
+
result = Node.new(:NTH, val)
|
594
|
+
elsif val[0] == '-n'
|
595
|
+
val[0] = 'n'
|
596
|
+
val.unshift("-1")
|
597
|
+
result = Node.new(:NTH, val)
|
598
|
+
else
|
599
|
+
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
600
|
+
end
|
601
|
+
|
602
|
+
result
|
603
|
+
end
|
604
|
+
|
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'
|
615
|
+
val << "+"
|
616
|
+
val << "0"
|
617
|
+
result = Node.new(:NTH, val)
|
618
|
+
else
|
619
|
+
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
620
|
+
end
|
621
|
+
|
622
|
+
result
|
623
|
+
end
|
624
|
+
|
625
|
+
def _reduce_44(val, _values, result)
|
626
|
+
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
627
|
+
|
628
|
+
result
|
629
|
+
end
|
630
|
+
|
631
|
+
def _reduce_45(val, _values, result)
|
632
|
+
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
633
|
+
result
|
634
|
+
end
|
635
|
+
|
636
|
+
# reduce 46 omitted
|
637
|
+
|
638
|
+
# reduce 47 omitted
|
639
|
+
|
640
|
+
def _reduce_48(val, _values, result)
|
641
|
+
result = Node.new(:COMBINATOR, val)
|
642
|
+
|
643
|
+
result
|
644
|
+
end
|
645
|
+
|
646
|
+
def _reduce_49(val, _values, result)
|
647
|
+
result = Node.new(:COMBINATOR, val)
|
648
|
+
|
649
|
+
result
|
650
|
+
end
|
651
|
+
|
652
|
+
def _reduce_50(val, _values, result)
|
653
|
+
result = Node.new(:COMBINATOR, val)
|
654
|
+
|
655
|
+
result
|
656
|
+
end
|
657
|
+
|
658
|
+
def _reduce_51(val, _values, result)
|
659
|
+
result = Node.new(:COMBINATOR, val)
|
660
|
+
|
661
|
+
result
|
662
|
+
end
|
663
|
+
|
664
|
+
def _reduce_52(val, _values, result)
|
665
|
+
result = Node.new(:COMBINATOR, val)
|
666
|
+
|
667
|
+
result
|
668
|
+
end
|
669
|
+
|
670
|
+
# reduce 53 omitted
|
671
|
+
|
672
|
+
# reduce 54 omitted
|
673
|
+
|
674
|
+
# reduce 55 omitted
|
675
|
+
|
676
|
+
# reduce 56 omitted
|
677
|
+
|
678
|
+
# reduce 57 omitted
|
679
|
+
|
680
|
+
def _reduce_58(val, _values, result)
|
681
|
+
result = Node.new(:ID, [unescape_css_identifier(val.first)])
|
682
|
+
result
|
683
|
+
end
|
684
|
+
|
685
|
+
def _reduce_59(val, _values, result)
|
686
|
+
result = [val.first, unescape_css_identifier(val[1])]
|
687
|
+
result
|
688
|
+
end
|
689
|
+
|
690
|
+
def _reduce_60(val, _values, result)
|
691
|
+
result = [val.first, unescape_css_string(val[1])]
|
692
|
+
result
|
693
|
+
end
|
694
|
+
|
695
|
+
def _reduce_61(val, _values, result)
|
696
|
+
result = [val.first, val[1]]
|
697
|
+
result
|
698
|
+
end
|
699
|
+
|
700
|
+
# reduce 62 omitted
|
701
|
+
|
702
|
+
def _reduce_63(val, _values, result)
|
703
|
+
result = :equal
|
704
|
+
result
|
705
|
+
end
|
706
|
+
|
707
|
+
def _reduce_64(val, _values, result)
|
708
|
+
result = :prefix_match
|
709
|
+
result
|
710
|
+
end
|
711
|
+
|
712
|
+
def _reduce_65(val, _values, result)
|
713
|
+
result = :suffix_match
|
714
|
+
result
|
715
|
+
end
|
716
|
+
|
717
|
+
def _reduce_66(val, _values, result)
|
718
|
+
result = :substring_match
|
719
|
+
result
|
720
|
+
end
|
721
|
+
|
722
|
+
def _reduce_67(val, _values, result)
|
723
|
+
result = :not_equal
|
724
|
+
result
|
725
|
+
end
|
726
|
+
|
727
|
+
def _reduce_68(val, _values, result)
|
728
|
+
result = :includes
|
729
|
+
result
|
730
|
+
end
|
731
|
+
|
732
|
+
def _reduce_69(val, _values, result)
|
733
|
+
result = :dash_match
|
734
|
+
result
|
735
|
+
end
|
736
|
+
|
737
|
+
def _reduce_70(val, _values, result)
|
738
|
+
result = Node.new(:NOT, [val[1]])
|
739
|
+
|
740
|
+
result
|
741
|
+
end
|
742
|
+
|
743
|
+
# reduce 71 omitted
|
744
|
+
|
745
|
+
# reduce 72 omitted
|
746
|
+
|
747
|
+
# reduce 73 omitted
|
748
|
+
|
749
|
+
# reduce 74 omitted
|
750
|
+
|
751
|
+
# reduce 75 omitted
|
752
|
+
|
753
|
+
def _reduce_none(val, _values, result)
|
754
|
+
val[0]
|
755
|
+
end
|
756
|
+
|
757
|
+
end # class Parser
|
758
|
+
end # module CSS
|
759
|
+
end # module Nokogiri
|