nokogiri 1.10.7 → 1.16.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 +4 -4
- data/Gemfile +42 -0
- data/LICENSE-DEPENDENCIES.md +1632 -1022
- data/LICENSE.md +1 -1
- data/README.md +188 -96
- data/bin/nokogiri +63 -50
- data/dependencies.yml +34 -66
- data/ext/nokogiri/depend +38 -358
- data/ext/nokogiri/extconf.rb +862 -421
- data/ext/nokogiri/gumbo.c +594 -0
- data/ext/nokogiri/html4_document.c +165 -0
- data/ext/nokogiri/html4_element_description.c +299 -0
- data/ext/nokogiri/html4_entity_lookup.c +37 -0
- data/ext/nokogiri/html4_sax_parser_context.c +108 -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 +251 -105
- data/ext/nokogiri/nokogiri.h +222 -90
- data/ext/nokogiri/test_global_handlers.c +40 -0
- data/ext/nokogiri/xml_attr.c +17 -17
- data/ext/nokogiri/xml_attribute_decl.c +22 -22
- data/ext/nokogiri/xml_cdata.c +39 -31
- data/ext/nokogiri/xml_comment.c +20 -27
- data/ext/nokogiri/xml_document.c +408 -243
- data/ext/nokogiri/xml_document_fragment.c +13 -17
- data/ext/nokogiri/xml_dtd.c +64 -58
- data/ext/nokogiri/xml_element_content.c +63 -55
- data/ext/nokogiri/xml_element_decl.c +31 -31
- data/ext/nokogiri/xml_encoding_handler.c +54 -21
- data/ext/nokogiri/xml_entity_decl.c +37 -35
- data/ext/nokogiri/xml_entity_reference.c +17 -19
- data/ext/nokogiri/xml_namespace.c +131 -61
- data/ext/nokogiri/xml_node.c +1343 -674
- data/ext/nokogiri/xml_node_set.c +246 -216
- data/ext/nokogiri/xml_processing_instruction.c +18 -20
- data/ext/nokogiri/xml_reader.c +305 -213
- data/ext/nokogiri/xml_relax_ng.c +87 -78
- data/ext/nokogiri/xml_sax_parser.c +149 -124
- data/ext/nokogiri/xml_sax_parser_context.c +149 -103
- data/ext/nokogiri/xml_sax_push_parser.c +65 -37
- data/ext/nokogiri/xml_schema.c +138 -82
- data/ext/nokogiri/xml_syntax_error.c +42 -21
- data/ext/nokogiri/xml_text.c +35 -26
- data/ext/nokogiri/xml_xpath_context.c +363 -178
- data/ext/nokogiri/xslt_stylesheet.c +335 -189
- data/gumbo-parser/CHANGES.md +63 -0
- data/gumbo-parser/Makefile +126 -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 +630 -0
- data/gumbo-parser/src/error.h +148 -0
- data/gumbo-parser/src/foreign_attrs.c +103 -0
- data/gumbo-parser/src/foreign_attrs.gperf +27 -0
- data/gumbo-parser/src/insertion_mode.h +33 -0
- data/gumbo-parser/src/macros.h +91 -0
- data/gumbo-parser/src/nokogiri_gumbo.h +944 -0
- data/gumbo-parser/src/parser.c +4891 -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 +223 -0
- data/gumbo-parser/src/tag_lookup.c +382 -0
- data/gumbo-parser/src/tag_lookup.gperf +170 -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 +3464 -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 +66 -0
- data/gumbo-parser/src/util.h +34 -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 -8
- data/lib/nokogiri/css/parser.rb +397 -377
- data/lib/nokogiri/css/parser.y +250 -245
- data/lib/nokogiri/css/parser_extras.rb +54 -49
- data/lib/nokogiri/css/syntax_error.rb +3 -1
- data/lib/nokogiri/css/tokenizer.rb +5 -3
- data/lib/nokogiri/css/tokenizer.rex +3 -2
- data/lib/nokogiri/css/xpath_visitor.rb +205 -96
- data/lib/nokogiri/css.rb +56 -17
- data/lib/nokogiri/decorators/slop.rb +9 -7
- data/lib/nokogiri/encoding_handler.rb +57 -0
- data/lib/nokogiri/extension.rb +32 -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 +214 -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 +2040 -0
- data/lib/nokogiri/html4/encoding_reader.rb +121 -0
- data/lib/nokogiri/{html → html4}/entity_lookup.rb +4 -2
- data/lib/nokogiri/{html → html4}/sax/parser.rb +17 -16
- data/lib/nokogiri/html4/sax/parser_context.rb +20 -0
- data/lib/nokogiri/{html → html4}/sax/push_parser.rb +12 -11
- data/lib/nokogiri/html4.rb +47 -0
- data/lib/nokogiri/html5/document.rb +168 -0
- data/lib/nokogiri/html5/document_fragment.rb +90 -0
- data/lib/nokogiri/html5/node.rb +103 -0
- data/lib/nokogiri/html5.rb +326 -0
- data/lib/nokogiri/jruby/dependencies.rb +3 -0
- data/lib/nokogiri/jruby/nokogiri_jars.rb +43 -0
- data/lib/nokogiri/syntax_error.rb +2 -0
- data/lib/nokogiri/version/constant.rb +6 -0
- data/lib/nokogiri/version/info.rb +224 -0
- data/lib/nokogiri/version.rb +3 -108
- data/lib/nokogiri/xml/attr.rb +55 -3
- data/lib/nokogiri/xml/attribute_decl.rb +6 -2
- data/lib/nokogiri/xml/builder.rb +75 -34
- data/lib/nokogiri/xml/cdata.rb +3 -1
- data/lib/nokogiri/xml/character_data.rb +2 -0
- data/lib/nokogiri/xml/document.rb +312 -127
- data/lib/nokogiri/xml/document_fragment.rb +93 -48
- data/lib/nokogiri/xml/dtd.rb +4 -2
- data/lib/nokogiri/xml/element_content.rb +12 -2
- data/lib/nokogiri/xml/element_decl.rb +6 -2
- data/lib/nokogiri/xml/entity_decl.rb +7 -3
- data/lib/nokogiri/xml/entity_reference.rb +2 -0
- data/lib/nokogiri/xml/namespace.rb +44 -0
- data/lib/nokogiri/xml/node/save_options.rb +23 -8
- data/lib/nokogiri/xml/node.rb +1096 -419
- data/lib/nokogiri/xml/node_set.rb +137 -61
- data/lib/nokogiri/xml/notation.rb +13 -0
- data/lib/nokogiri/xml/parse_options.rb +145 -52
- data/lib/nokogiri/xml/pp/character_data.rb +9 -6
- data/lib/nokogiri/xml/pp/node.rb +42 -30
- data/lib/nokogiri/xml/pp.rb +4 -2
- data/lib/nokogiri/xml/processing_instruction.rb +4 -1
- data/lib/nokogiri/xml/reader.rb +21 -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 +39 -36
- 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 +120 -72
- data/lib/nokogiri/xml/syntax_error.rb +7 -5
- 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 +39 -38
- data/lib/nokogiri/xslt/stylesheet.rb +3 -1
- data/lib/nokogiri/xslt.rb +101 -22
- data/lib/nokogiri.rb +59 -75
- data/lib/xsd/xmlparser/nokogiri.rb +29 -25
- data/patches/libxml2/{0004-libxml2.la-is-in-top_builddir.patch → 0003-libxml2.la-is-in-top_builddir.patch} +1 -1
- data/patches/libxml2/0009-allow-wildcard-namespaces.patch +77 -0
- data/patches/libxml2/0010-update-config.guess-and-config.sub-for-libxml2.patch +224 -0
- data/patches/libxml2/0011-rip-out-libxml2-s-libc_single_threaded-support.patch +30 -0
- data/patches/libxslt/0001-update-config.guess-and-config.sub-for-libxslt.patch +224 -0
- data/ports/archives/libxml2-2.12.3.tar.xz +0 -0
- data/ports/archives/libxslt-1.1.39.tar.xz +0 -0
- metadata +121 -291
- 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 -61
- 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 -14
- data/ext/nokogiri/xml_node.h +0 -13
- data/ext/nokogiri/xml_node_set.h +0 -12
- 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 -335
- data/lib/nokogiri/html/document_fragment.rb +0 -49
- data/lib/nokogiri/html/element_description_defaults.rb +0 -671
- data/lib/nokogiri/html/sax/parser_context.rb +0 -16
- data/patches/libxml2/0001-Revert-Do-not-URI-escape-in-server-side-includes.patch +0 -78
- data/ports/archives/libxml2-2.9.10.tar.gz +0 -0
- data/ports/archives/libxslt-1.1.34.tar.gz +0 -0
- /data/patches/libxml2/{0002-Remove-script-macro-support.patch → 0001-Remove-script-macro-support.patch} +0 -0
- /data/patches/libxml2/{0003-Update-entities-to-remove-handling-of-ssi.patch → 0002-Update-entities-to-remove-handling-of-ssi.patch} +0 -0
data/lib/nokogiri/css/parser.rb
CHANGED
@@ -1,13 +1,22 @@
|
|
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
|
11
20
|
|
12
21
|
module Nokogiri
|
13
22
|
module CSS
|
@@ -30,190 +39,204 @@ end
|
|
30
39
|
##### State transition tables begin ###
|
31
40
|
|
32
41
|
racc_action_table = [
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
27,
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
nil,
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
nil,
|
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 ]
|
55
67
|
|
56
68
|
racc_action_check = [
|
57
|
-
3,
|
58
|
-
|
59
|
-
|
60
|
-
9,
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
nil,
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
nil,
|
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 ]
|
79
94
|
|
80
95
|
racc_action_pointer = [
|
81
|
-
|
82
|
-
nil,
|
83
|
-
|
84
|
-
|
85
|
-
nil, nil,
|
86
|
-
|
87
|
-
|
88
|
-
nil, nil, nil, nil, nil,
|
89
|
-
nil, nil, nil, nil,
|
90
|
-
|
91
|
-
|
92
|
-
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 ]
|
93
108
|
|
94
109
|
racc_action_default = [
|
95
|
-
-
|
96
|
-
-
|
97
|
-
-20, -
|
98
|
-
-
|
99
|
-
|
100
|
-
-
|
101
|
-
-
|
102
|
-
-
|
103
|
-
-
|
104
|
-
-
|
105
|
-
-
|
106
|
-
-41 ]
|
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 ]
|
107
122
|
|
108
123
|
racc_goto_table = [
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
nil, nil,
|
113
|
-
nil,
|
114
|
-
|
115
|
-
nil, nil, nil, nil, nil, nil,
|
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 ]
|
116
132
|
|
117
133
|
racc_goto_check = [
|
118
|
-
|
119
|
-
10, 2,
|
120
|
-
|
121
|
-
nil, nil,
|
122
|
-
nil,
|
123
|
-
|
124
|
-
nil, nil, nil, nil, nil, nil,
|
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 ]
|
125
142
|
|
126
143
|
racc_goto_pointer = [
|
127
|
-
nil, 3, -1, nil, nil, -
|
128
|
-
-
|
129
|
-
nil, nil, 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 ]
|
130
147
|
|
131
148
|
racc_goto_default = [
|
132
|
-
nil, nil, nil, 2, 3, 9,
|
133
|
-
|
134
|
-
|
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 ]
|
135
152
|
|
136
153
|
racc_reduce_table = [
|
137
154
|
0, 0, :racc_error,
|
138
|
-
3,
|
139
|
-
1,
|
140
|
-
2,
|
141
|
-
1,
|
142
|
-
1,
|
143
|
-
1,
|
144
|
-
1,
|
145
|
-
1,
|
146
|
-
2,
|
147
|
-
1,
|
148
|
-
2,
|
149
|
-
|
150
|
-
|
151
|
-
2,
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
1,
|
158
|
-
|
159
|
-
1,
|
160
|
-
1,
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
3,
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
3,
|
173
|
-
3,
|
174
|
-
3,
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
3,
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
1,
|
184
|
-
|
185
|
-
|
186
|
-
2,
|
187
|
-
2,
|
188
|
-
2,
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
1,
|
201
|
-
1,
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
1,
|
207
|
-
|
208
|
-
1,
|
209
|
-
|
210
|
-
1,
|
211
|
-
1,
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
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,
|
234
|
+
1, 36, :_reduce_none,
|
235
|
+
0, 36, :_reduce_none ]
|
236
|
+
|
237
|
+
racc_reduce_n = 82
|
238
|
+
|
239
|
+
racc_shift_n = 119
|
217
240
|
|
218
241
|
racc_token_table = {
|
219
242
|
false => 0,
|
@@ -243,12 +266,13 @@ racc_token_table = {
|
|
243
266
|
:LSQUARE => 24,
|
244
267
|
:RSQUARE => 25,
|
245
268
|
:HAS => 26,
|
246
|
-
"
|
247
|
-
"
|
248
|
-
"
|
249
|
-
"
|
269
|
+
"@" => 27,
|
270
|
+
"." => 28,
|
271
|
+
"*" => 29,
|
272
|
+
"|" => 30,
|
273
|
+
":" => 31 }
|
250
274
|
|
251
|
-
racc_nt_base =
|
275
|
+
racc_nt_base = 32
|
252
276
|
|
253
277
|
racc_use_result_var = true
|
254
278
|
|
@@ -296,6 +320,7 @@ Racc_token_to_s_table = [
|
|
296
320
|
"LSQUARE",
|
297
321
|
"RSQUARE",
|
298
322
|
"HAS",
|
323
|
+
"\"@\"",
|
299
324
|
"\".\"",
|
300
325
|
"\"*\"",
|
301
326
|
"\"|\"",
|
@@ -306,6 +331,8 @@ Racc_token_to_s_table = [
|
|
306
331
|
"prefixless_combinator_selector",
|
307
332
|
"optional_S",
|
308
333
|
"combinator",
|
334
|
+
"xpath_attribute_name",
|
335
|
+
"xpath_attribute",
|
309
336
|
"simple_selector",
|
310
337
|
"element_name",
|
311
338
|
"hcap_0toN",
|
@@ -332,419 +359,412 @@ Racc_debug_parser = false
|
|
332
359
|
# reduce 0 omitted
|
333
360
|
|
334
361
|
def _reduce_1(val, _values, result)
|
335
|
-
|
336
|
-
|
362
|
+
result = [val[0], val[2]].flatten
|
363
|
+
|
337
364
|
result
|
338
365
|
end
|
339
366
|
|
340
367
|
def _reduce_2(val, _values, result)
|
341
|
-
result = val.flatten
|
368
|
+
result = val.flatten
|
342
369
|
result
|
343
370
|
end
|
344
371
|
|
345
372
|
def _reduce_3(val, _values, result)
|
346
|
-
result = [val
|
373
|
+
result = [val[1]].flatten
|
347
374
|
result
|
348
375
|
end
|
349
376
|
|
350
377
|
def _reduce_4(val, _values, result)
|
351
|
-
result = :DIRECT_ADJACENT_SELECTOR
|
378
|
+
result = :DIRECT_ADJACENT_SELECTOR
|
352
379
|
result
|
353
380
|
end
|
354
381
|
|
355
382
|
def _reduce_5(val, _values, result)
|
356
|
-
result = :CHILD_SELECTOR
|
383
|
+
result = :CHILD_SELECTOR
|
357
384
|
result
|
358
385
|
end
|
359
386
|
|
360
387
|
def _reduce_6(val, _values, result)
|
361
|
-
result = :FOLLOWING_SELECTOR
|
388
|
+
result = :FOLLOWING_SELECTOR
|
362
389
|
result
|
363
390
|
end
|
364
391
|
|
365
392
|
def _reduce_7(val, _values, result)
|
366
|
-
result = :DESCENDANT_SELECTOR
|
393
|
+
result = :DESCENDANT_SELECTOR
|
367
394
|
result
|
368
395
|
end
|
369
396
|
|
370
397
|
def _reduce_8(val, _values, result)
|
371
|
-
result = :CHILD_SELECTOR
|
398
|
+
result = :CHILD_SELECTOR
|
372
399
|
result
|
373
400
|
end
|
374
401
|
|
375
402
|
def _reduce_9(val, _values, result)
|
376
|
-
|
377
|
-
val.first
|
378
|
-
else
|
379
|
-
Node.new(:CONDITIONAL_SELECTOR, [val.first, val[1]])
|
380
|
-
end
|
381
|
-
|
403
|
+
result = val[1]
|
382
404
|
result
|
383
405
|
end
|
384
406
|
|
385
|
-
|
386
|
-
|
387
|
-
def _reduce_11(val, _values, result)
|
388
|
-
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
389
|
-
|
407
|
+
def _reduce_10(val, _values, result)
|
408
|
+
result = Node.new(:ATTRIB_NAME, [val[0]])
|
390
409
|
result
|
391
410
|
end
|
392
411
|
|
393
|
-
def
|
394
|
-
|
395
|
-
|
412
|
+
def _reduce_11(val, _values, result)
|
413
|
+
result = if val[1].nil?
|
414
|
+
val[0]
|
415
|
+
else
|
416
|
+
Node.new(:CONDITIONAL_SELECTOR, [val[0], val[1]])
|
417
|
+
end
|
418
|
+
|
396
419
|
result
|
397
420
|
end
|
398
421
|
|
422
|
+
# reduce 12 omitted
|
423
|
+
|
399
424
|
def _reduce_13(val, _values, result)
|
400
|
-
|
401
|
-
[Node.new(:ELEMENT_NAME, ['*']), val.first]
|
402
|
-
)
|
403
|
-
|
425
|
+
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
404
426
|
result
|
405
427
|
end
|
406
428
|
|
407
429
|
def _reduce_14(val, _values, result)
|
408
|
-
|
409
|
-
|
430
|
+
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
410
431
|
result
|
411
432
|
end
|
412
433
|
|
413
434
|
def _reduce_15(val, _values, result)
|
414
|
-
|
415
|
-
|
435
|
+
result = Node.new(:CONDITIONAL_SELECTOR, [Node.new(:ELEMENT_NAME, ['*']), val[0]])
|
416
436
|
result
|
417
437
|
end
|
418
438
|
|
419
|
-
|
420
|
-
|
421
|
-
|
439
|
+
# reduce 16 omitted
|
440
|
+
|
441
|
+
def _reduce_17(val, _values, result)
|
442
|
+
result = Node.new(val[0], [nil, val[1]])
|
422
443
|
result
|
423
444
|
end
|
424
445
|
|
425
|
-
# reduce 17 omitted
|
426
|
-
|
427
446
|
def _reduce_18(val, _values, result)
|
428
|
-
result = Node.new(
|
447
|
+
result = Node.new(val[1], [val[0], val[2]])
|
429
448
|
result
|
430
449
|
end
|
431
450
|
|
432
|
-
|
433
|
-
|
434
|
-
def _reduce_20(val, _values, result)
|
435
|
-
result = Node.new(:ELEMENT_NAME, val)
|
451
|
+
def _reduce_19(val, _values, result)
|
452
|
+
result = Node.new(:DESCENDANT_SELECTOR, [val[0], val[2]])
|
436
453
|
result
|
437
454
|
end
|
438
455
|
|
456
|
+
# reduce 20 omitted
|
457
|
+
|
439
458
|
def _reduce_21(val, _values, result)
|
440
|
-
|
441
|
-
[[val.first, val.last].compact.join(':')]
|
442
|
-
)
|
443
|
-
|
459
|
+
result = Node.new(:CLASS_CONDITION, [unescape_css_identifier(val[1])])
|
444
460
|
result
|
445
461
|
end
|
446
462
|
|
447
|
-
|
448
|
-
name = @namespaces.key?('xmlns') ? "xmlns:#{val.first}" : val.first
|
449
|
-
result = Node.new(:ELEMENT_NAME, [name])
|
450
|
-
|
451
|
-
result
|
452
|
-
end
|
463
|
+
# reduce 22 omitted
|
453
464
|
|
454
465
|
def _reduce_23(val, _values, result)
|
455
|
-
result = val
|
466
|
+
result = Node.new(:ELEMENT_NAME, val)
|
456
467
|
result
|
457
468
|
end
|
458
469
|
|
459
|
-
|
470
|
+
def _reduce_24(val, _values, result)
|
471
|
+
result = Node.new(:ELEMENT_NAME, [[val[0], val[2]].compact.join(':')])
|
472
|
+
result
|
473
|
+
end
|
460
474
|
|
461
475
|
def _reduce_25(val, _values, result)
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
476
|
+
name = @namespaces.key?('xmlns') ? "xmlns:#{val[0]}" : val[0]
|
477
|
+
result = Node.new(:ELEMENT_NAME, [name])
|
478
|
+
|
466
479
|
result
|
467
480
|
end
|
468
481
|
|
469
482
|
def _reduce_26(val, _values, result)
|
470
|
-
|
471
|
-
[val[1]] + (val[2] || [])
|
472
|
-
)
|
473
|
-
|
483
|
+
result = val[0]
|
474
484
|
result
|
475
485
|
end
|
476
486
|
|
477
|
-
|
478
|
-
# Non standard, but hpricot supports it.
|
479
|
-
result = Node.new(:PSEUDO_CLASS,
|
480
|
-
[Node.new(:FUNCTION, ['nth-child(', val[1]])]
|
481
|
-
)
|
482
|
-
|
483
|
-
result
|
484
|
-
end
|
487
|
+
# reduce 27 omitted
|
485
488
|
|
486
489
|
def _reduce_28(val, _values, result)
|
487
|
-
|
488
|
-
|
489
|
-
)
|
490
|
-
|
490
|
+
result = Node.new(:ATTRIBUTE_CONDITION, [val[1]] + (val[2] || []))
|
491
|
+
|
491
492
|
result
|
492
493
|
end
|
493
494
|
|
494
495
|
def _reduce_29(val, _values, result)
|
495
|
-
|
496
|
-
|
497
|
-
result = Node.new(:ELEMENT_NAME, [val.first])
|
498
|
-
|
496
|
+
result = Node.new(:ATTRIBUTE_CONDITION, [val[1]] + (val[2] || []))
|
497
|
+
|
499
498
|
result
|
500
499
|
end
|
501
500
|
|
502
501
|
def _reduce_30(val, _values, result)
|
503
|
-
|
504
|
-
|
502
|
+
result = Node.new(:PSEUDO_CLASS, [Node.new(:FUNCTION, ['nth-child(', val[1]])])
|
503
|
+
|
505
504
|
result
|
506
505
|
end
|
507
506
|
|
508
507
|
def _reduce_31(val, _values, result)
|
509
|
-
|
510
|
-
|
508
|
+
result = Node.new(:ATTRIB_NAME, [[val[0], val[2]].compact.join(':')])
|
511
509
|
result
|
512
510
|
end
|
513
511
|
|
514
512
|
def _reduce_32(val, _values, result)
|
515
|
-
|
516
|
-
|
513
|
+
result = Node.new(:ATTRIB_NAME, [val[0]])
|
517
514
|
result
|
518
515
|
end
|
519
516
|
|
520
|
-
|
521
|
-
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
522
|
-
|
523
|
-
result
|
524
|
-
end
|
517
|
+
# reduce 33 omitted
|
525
518
|
|
526
519
|
def _reduce_34(val, _values, result)
|
527
|
-
|
528
|
-
|
520
|
+
result = Node.new(:FUNCTION, [val[0].strip])
|
521
|
+
|
529
522
|
result
|
530
523
|
end
|
531
524
|
|
532
525
|
def _reduce_35(val, _values, result)
|
533
|
-
|
526
|
+
result = Node.new(:FUNCTION, [val[0].strip, val[1]].flatten)
|
527
|
+
|
534
528
|
result
|
535
529
|
end
|
536
530
|
|
537
531
|
def _reduce_36(val, _values, result)
|
538
|
-
|
532
|
+
result = Node.new(:FUNCTION, [val[0].strip, val[1]].flatten)
|
533
|
+
|
539
534
|
result
|
540
535
|
end
|
541
536
|
|
542
537
|
def _reduce_37(val, _values, result)
|
543
|
-
|
538
|
+
result = Node.new(:FUNCTION, [val[0].strip, val[1]].flatten)
|
539
|
+
|
544
540
|
result
|
545
541
|
end
|
546
542
|
|
547
|
-
|
548
|
-
|
549
|
-
# reduce 39 omitted
|
543
|
+
def _reduce_38(val, _values, result)
|
544
|
+
result = Node.new(:FUNCTION, [val[0].strip, val[1]].flatten)
|
550
545
|
|
551
|
-
def _reduce_40(val, _values, result)
|
552
|
-
case val[0]
|
553
|
-
when 'even'
|
554
|
-
result = Node.new(:NTH, ['2','n','+','0'])
|
555
|
-
when 'odd'
|
556
|
-
result = Node.new(:NTH, ['2','n','+','1'])
|
557
|
-
when 'n'
|
558
|
-
result = Node.new(:NTH, ['1','n','+','0'])
|
559
|
-
else
|
560
|
-
# This is not CSS standard. It allows us to support this:
|
561
|
-
# assert_xpath("//a[foo(., @href)]", @parser.parse('a:foo(@href)'))
|
562
|
-
# assert_xpath("//a[foo(., @a, b)]", @parser.parse('a:foo(@a, b)'))
|
563
|
-
# assert_xpath("//a[foo(., a, 10)]", @parser.parse('a:foo(a, 10)'))
|
564
|
-
result = val
|
565
|
-
end
|
566
|
-
|
567
546
|
result
|
568
547
|
end
|
569
548
|
|
570
|
-
def
|
571
|
-
|
572
|
-
result = Node.new(:NTH, val)
|
573
|
-
else
|
574
|
-
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
575
|
-
end
|
576
|
-
|
549
|
+
def _reduce_39(val, _values, result)
|
550
|
+
result = [val[0], val[2]]
|
577
551
|
result
|
578
552
|
end
|
579
553
|
|
580
|
-
def
|
581
|
-
|
582
|
-
if val[0] == 'n'
|
583
|
-
val.unshift("1")
|
584
|
-
result = Node.new(:NTH, val)
|
585
|
-
elsif val[0] == '-n'
|
586
|
-
val[0] = 'n'
|
587
|
-
val.unshift("-1")
|
588
|
-
result = Node.new(:NTH, val)
|
589
|
-
else
|
590
|
-
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
591
|
-
end
|
592
|
-
|
554
|
+
def _reduce_40(val, _values, result)
|
555
|
+
result = [val[0], val[2]]
|
593
556
|
result
|
594
557
|
end
|
595
558
|
|
596
|
-
def
|
597
|
-
|
598
|
-
n = val[1]
|
599
|
-
if n[0, 2] == 'n-'
|
600
|
-
val[1] = 'n'
|
601
|
-
val << "-"
|
602
|
-
# b is contained in n as n is the string "n-b"
|
603
|
-
val << n[2, n.size]
|
604
|
-
result = Node.new(:NTH, val)
|
605
|
-
elsif n == 'n'
|
606
|
-
val << "+"
|
607
|
-
val << "0"
|
608
|
-
result = Node.new(:NTH, val)
|
609
|
-
else
|
610
|
-
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
611
|
-
end
|
612
|
-
|
559
|
+
def _reduce_41(val, _values, result)
|
560
|
+
result = [val[0], val[2]]
|
613
561
|
result
|
614
562
|
end
|
615
563
|
|
616
|
-
def
|
617
|
-
|
618
|
-
|
564
|
+
def _reduce_42(val, _values, result)
|
565
|
+
result = [val[0], val[2]]
|
619
566
|
result
|
620
567
|
end
|
621
568
|
|
569
|
+
# reduce 43 omitted
|
570
|
+
|
571
|
+
# reduce 44 omitted
|
572
|
+
|
622
573
|
def _reduce_45(val, _values, result)
|
623
|
-
|
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
|
584
|
+
|
624
585
|
result
|
625
586
|
end
|
626
587
|
|
627
588
|
# reduce 46 omitted
|
628
589
|
|
629
|
-
|
590
|
+
def _reduce_47(val, _values, result)
|
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
|
+
|
597
|
+
result
|
598
|
+
end
|
630
599
|
|
631
600
|
def _reduce_48(val, _values, result)
|
632
|
-
|
633
|
-
|
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
|
+
|
634
613
|
result
|
635
614
|
end
|
636
615
|
|
637
616
|
def _reduce_49(val, _values, result)
|
638
|
-
|
639
|
-
|
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
|
632
|
+
|
640
633
|
result
|
641
634
|
end
|
642
635
|
|
643
636
|
def _reduce_50(val, _values, result)
|
644
|
-
|
645
|
-
|
637
|
+
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
638
|
+
|
646
639
|
result
|
647
640
|
end
|
648
641
|
|
649
642
|
def _reduce_51(val, _values, result)
|
650
|
-
|
651
|
-
|
643
|
+
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
652
644
|
result
|
653
645
|
end
|
654
646
|
|
655
|
-
|
656
|
-
result = Node.new(:COMBINATOR, val)
|
657
|
-
|
658
|
-
result
|
659
|
-
end
|
647
|
+
# reduce 52 omitted
|
660
648
|
|
661
649
|
# reduce 53 omitted
|
662
650
|
|
663
|
-
|
664
|
-
|
665
|
-
# reduce 55 omitted
|
651
|
+
def _reduce_54(val, _values, result)
|
652
|
+
result = Node.new(:COMBINATOR, val)
|
666
653
|
|
667
|
-
|
654
|
+
result
|
655
|
+
end
|
668
656
|
|
669
|
-
|
657
|
+
def _reduce_55(val, _values, result)
|
658
|
+
result = Node.new(:COMBINATOR, val)
|
670
659
|
|
671
|
-
def _reduce_58(val, _values, result)
|
672
|
-
result = Node.new(:ID, [unescape_css_identifier(val.first)])
|
673
660
|
result
|
674
661
|
end
|
675
662
|
|
676
|
-
def
|
677
|
-
|
663
|
+
def _reduce_56(val, _values, result)
|
664
|
+
result = Node.new(:COMBINATOR, val)
|
665
|
+
|
678
666
|
result
|
679
667
|
end
|
680
668
|
|
681
|
-
def
|
682
|
-
|
669
|
+
def _reduce_57(val, _values, result)
|
670
|
+
result = Node.new(:COMBINATOR, val)
|
671
|
+
|
683
672
|
result
|
684
673
|
end
|
685
674
|
|
686
|
-
def
|
687
|
-
|
675
|
+
def _reduce_58(val, _values, result)
|
676
|
+
result = Node.new(:COMBINATOR, val)
|
677
|
+
|
688
678
|
result
|
689
679
|
end
|
690
680
|
|
681
|
+
# reduce 59 omitted
|
682
|
+
|
683
|
+
# reduce 60 omitted
|
684
|
+
|
685
|
+
# reduce 61 omitted
|
686
|
+
|
691
687
|
# reduce 62 omitted
|
692
688
|
|
693
|
-
|
694
|
-
result = :equal
|
695
|
-
result
|
696
|
-
end
|
689
|
+
# reduce 63 omitted
|
697
690
|
|
698
691
|
def _reduce_64(val, _values, result)
|
699
|
-
result = :
|
692
|
+
result = Node.new(:ID, [unescape_css_identifier(val[0])])
|
700
693
|
result
|
701
694
|
end
|
702
695
|
|
703
696
|
def _reduce_65(val, _values, result)
|
704
|
-
result =
|
697
|
+
result = [val[0], unescape_css_identifier(val[1])]
|
705
698
|
result
|
706
699
|
end
|
707
700
|
|
708
701
|
def _reduce_66(val, _values, result)
|
709
|
-
result =
|
702
|
+
result = [val[0], unescape_css_string(val[1])]
|
710
703
|
result
|
711
704
|
end
|
712
705
|
|
713
706
|
def _reduce_67(val, _values, result)
|
714
|
-
result =
|
707
|
+
result = [val[0], val[1]]
|
715
708
|
result
|
716
709
|
end
|
717
710
|
|
718
|
-
|
719
|
-
result = :includes
|
720
|
-
result
|
721
|
-
end
|
711
|
+
# reduce 68 omitted
|
722
712
|
|
723
713
|
def _reduce_69(val, _values, result)
|
724
|
-
result = :
|
714
|
+
result = :equal
|
725
715
|
result
|
726
716
|
end
|
727
717
|
|
728
718
|
def _reduce_70(val, _values, result)
|
729
|
-
|
730
|
-
|
719
|
+
result = :prefix_match
|
720
|
+
result
|
721
|
+
end
|
722
|
+
|
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
|
+
|
731
751
|
result
|
732
752
|
end
|
733
753
|
|
734
|
-
# reduce
|
754
|
+
# reduce 77 omitted
|
735
755
|
|
736
|
-
# reduce
|
756
|
+
# reduce 78 omitted
|
737
757
|
|
738
|
-
# reduce
|
758
|
+
# reduce 79 omitted
|
739
759
|
|
740
|
-
# reduce
|
760
|
+
# reduce 80 omitted
|
741
761
|
|
742
|
-
# reduce
|
762
|
+
# reduce 81 omitted
|
743
763
|
|
744
764
|
def _reduce_none(val, _values, result)
|
745
765
|
val[0]
|
746
766
|
end
|
747
767
|
|
748
768
|
end # class Parser
|
749
|
-
|
750
|
-
|
769
|
+
end # module CSS
|
770
|
+
end # module Nokogiri
|