nokogiri 1.5.2-java → 1.5.3-java
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of nokogiri might be problematic. Click here for more details.
- data/CHANGELOG.ja.rdoc +35 -0
- data/CHANGELOG.rdoc +37 -2
- data/Manifest.txt +11 -3
- data/README.rdoc +1 -1
- data/ROADMAP.md +86 -0
- data/{nokogiri_help_responses.md → STANDARD_RESPONSES.md} +11 -4
- data/Y_U_NO_GEMSPEC.md +155 -0
- data/build_all +58 -0
- data/ext/java/nokogiri/HtmlDocument.java +10 -1
- data/ext/java/nokogiri/XmlAttr.java +11 -1
- data/ext/java/nokogiri/XmlDocument.java +4 -0
- data/ext/java/nokogiri/XmlNamespace.java +25 -0
- data/ext/java/nokogiri/XmlNode.java +6 -6
- data/ext/java/nokogiri/XmlReader.java +19 -4
- data/ext/java/nokogiri/XmlSaxPushParser.java +88 -57
- data/ext/java/nokogiri/XmlSyntaxError.java +15 -3
- data/ext/java/nokogiri/XmlXpathContext.java +3 -3
- data/ext/java/nokogiri/internals/HtmlDomParserContext.java +2 -1
- data/ext/java/nokogiri/internals/NokogiriHelpers.java +89 -1
- data/ext/java/nokogiri/internals/ParserContext.java +23 -2
- data/ext/java/nokogiri/internals/SaveContextVisitor.java +18 -1
- data/ext/java/nokogiri/internals/XmlDomParserContext.java +2 -3
- data/ext/nokogiri/extconf.rb +1 -1
- data/ext/nokogiri/xml_io.c +1 -1
- data/ext/nokogiri/xml_namespace.c +0 -6
- data/ext/nokogiri/xml_node.c +11 -11
- data/ext/nokogiri/xml_node_set.c +1 -1
- data/ext/nokogiri/xml_xpath_context.c +20 -16
- data/ext/nokogiri/xml_xpath_context.h +1 -0
- data/ext/nokogiri/xslt_stylesheet.c +7 -64
- data/lib/nokogiri/css/node.rb +3 -0
- data/lib/nokogiri/css/parser.rb +244 -203
- data/lib/nokogiri/css/parser.y +20 -2
- data/lib/nokogiri/css/xpath_visitor.rb +2 -2
- data/lib/nokogiri/html/document.rb +2 -1
- data/lib/nokogiri/html/element_description_defaults.rb +1 -1
- data/lib/nokogiri/nokogiri.jar +0 -0
- data/lib/nokogiri/version.rb +1 -1
- data/lib/nokogiri/xml/document.rb +1 -1
- data/lib/nokogiri/xml/parse_options.rb +2 -2
- data/lib/nokogiri/xml/sax/document.rb +1 -1
- data/lib/nokogiri/xml/sax/parser.rb +1 -1
- data/lib/nokogiri/xslt.rb +1 -1
- data/test/css/test_parser.rb +38 -0
- data/test/files/to_be_xincluded.xml +2 -0
- data/test/files/xinclude.xml +4 -0
- data/test/helper.rb +18 -45
- data/test/html/sax/test_parser.rb +5 -3
- data/test/html/sax/test_parser_context.rb +8 -10
- data/test/html/test_document.rb +19 -5
- data/test/html/test_node.rb +2 -4
- data/test/test_reader.rb +63 -0
- data/test/test_xslt_transforms.rb +3 -1
- data/test/xml/sax/test_parser_context.rb +10 -17
- data/test/xml/sax/test_push_parser.rb +1 -0
- data/test/xml/test_attr.rb +5 -6
- data/test/xml/test_builder.rb +5 -6
- data/test/xml/test_cdata.rb +1 -3
- data/test/xml/test_document.rb +11 -14
- data/test/xml/test_document_encoding.rb +3 -1
- data/test/xml/test_document_fragment.rb +27 -8
- data/test/xml/test_node.rb +21 -0
- data/test/xml/test_node_set.rb +2 -2
- data/test/xml/test_text.rb +1 -3
- data/test/xml/test_unparented_node.rb +2 -2
- data/test/xml/test_xpath.rb +15 -6
- data/test/xslt/test_custom_functions.rb +35 -0
- data/test_all +84 -0
- metadata +13 -8
- data/ext/java/nokogiri/internals/PushInputStream.java +0 -411
data/lib/nokogiri/css/node.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
module Nokogiri
|
2
2
|
module CSS
|
3
3
|
class Node
|
4
|
+
ALLOW_COMBINATOR_ON_SELF = [:DIRECT_ADJACENT_SELECTOR, :FOLLOWING_SELECTOR, :CHILD_SELECTOR]
|
5
|
+
|
4
6
|
# Get the type of this node
|
5
7
|
attr_accessor :type
|
6
8
|
# Get the value of this node
|
@@ -21,6 +23,7 @@ module Nokogiri
|
|
21
23
|
# Convert this CSS node to xpath with +prefix+ using +visitor+
|
22
24
|
def to_xpath prefix = '//', visitor = XPathVisitor.new
|
23
25
|
self.preprocess!
|
26
|
+
prefix = '.' if ALLOW_COMBINATOR_ON_SELF.include?(type) && value.first.nil?
|
24
27
|
prefix + visitor.accept(self)
|
25
28
|
end
|
26
29
|
|
data/lib/nokogiri/css/parser.rb
CHANGED
@@ -14,168 +14,180 @@ module Nokogiri
|
|
14
14
|
##### State transition tables begin ###
|
15
15
|
|
16
16
|
racc_action_table = [
|
17
|
-
|
18
|
-
6,
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
17
|
+
6, 62, 7, 63, 14, 19, 23, 26, 20, 2,
|
18
|
+
71, 14, 6, 63, 85, 17, 14, 22, 25, 28,
|
19
|
+
83, 2, 7, 72, 11, 13, 15, -26, 20, 7,
|
20
|
+
49, 28, 13, 70, 7, 20, 11, 13, 15, 6,
|
21
|
+
20, 64, 65, 14, 19, 23, 26, 64, 2, 36,
|
22
|
+
59, 6, 60, 67, 17, 14, 22, 25, 28, 90,
|
23
|
+
2, 7, 6, 11, 13, 15, 14, 20, 66, 67,
|
24
|
+
28, 2, 91, 7, 14, 11, 13, 15, 14, 20,
|
25
|
+
69, 28, 6, 2, 7, 68, 11, 13, 15, 14,
|
26
|
+
20, 37, 7, 39, 94, 13, 7, 14, 20, 13,
|
27
|
+
15, 28, 20, 6, 49, 14, 11, 7, 36, 59,
|
28
|
+
13, 60, 53, 20, 14, 7, 36, 59, 13, 60,
|
29
|
+
95, 20, 28, 7, 101, 100, 13, 11, 49, 20,
|
30
|
+
74, 76, 7, 36, 31, 13, 33, 50, 20, 74,
|
31
|
+
76, 75, 77, 79, 98, 80, 32, 99, 42, 73,
|
32
|
+
75, 77, 79, 102, 80, 19, 23, 26, 73, 36,
|
33
|
+
59, -26, 60, 104, 105, 17, nil, 22, 25 ]
|
32
34
|
|
33
35
|
racc_action_check = [
|
34
|
-
0, 21,
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
36
|
+
0, 29, 21, 45, 0, 0, 0, 0, 21, 0,
|
37
|
+
38, 24, 63, 29, 45, 0, 63, 0, 0, 0,
|
38
|
+
42, 63, 0, 39, 0, 0, 0, 37, 0, 24,
|
39
|
+
47, 63, 24, 36, 63, 24, 63, 63, 63, 11,
|
40
|
+
63, 59, 31, 11, 11, 11, 11, 31, 11, 70,
|
41
|
+
70, 9, 70, 60, 11, 9, 11, 11, 11, 61,
|
42
|
+
9, 11, 44, 11, 11, 11, 44, 11, 33, 33,
|
43
|
+
9, 44, 62, 9, 87, 9, 9, 9, 49, 9,
|
44
|
+
35, 44, 7, 49, 44, 34, 44, 44, 44, 12,
|
45
|
+
44, 7, 87, 7, 65, 87, 49, 27, 87, 49,
|
46
|
+
49, 7, 49, 20, 12, 18, 7, 12, 64, 64,
|
47
|
+
12, 64, 20, 12, 1, 27, 28, 28, 27, 28,
|
48
|
+
66, 27, 20, 18, 81, 81, 18, 20, 16, 18,
|
49
|
+
41, 41, 1, 6, 6, 1, 6, 13, 1, 40,
|
50
|
+
40, 41, 41, 41, 71, 41, 6, 78, 8, 41,
|
51
|
+
40, 40, 40, 82, 40, 10, 10, 10, 40, 67,
|
52
|
+
67, 2, 67, 89, 95, 10, nil, 10, 10 ]
|
49
53
|
|
50
54
|
racc_action_pointer = [
|
51
|
-
-2,
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
nil, nil, nil, nil,
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
nil, nil, nil, nil, nil, nil, nil, nil, nil
|
55
|
+
-2, 108, 132, nil, nil, nil, 123, 80, 119, 49,
|
56
|
+
148, 37, 83, 126, nil, nil, 107, nil, 99, nil,
|
57
|
+
101, -22, nil, nil, 5, nil, nil, 91, 106, 1,
|
58
|
+
nil, 35, nil, 57, 62, 57, 21, -2, -19, -2,
|
59
|
+
136, 127, 9, nil, 60, -9, nil, 9, nil, 72,
|
60
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, 29,
|
61
|
+
41, 36, 72, 10, 98, 81, 113, 149, nil, nil,
|
62
|
+
39, 133, nil, nil, nil, nil, nil, nil, 122, nil,
|
63
|
+
nil, 114, 128, nil, nil, nil, nil, 68, nil, 140,
|
64
|
+
nil, nil, nil, nil, nil, 151, nil, nil, nil, nil,
|
65
|
+
nil, nil, nil, nil, nil, nil ]
|
61
66
|
|
62
67
|
racc_action_default = [
|
63
|
-
-
|
64
|
-
-
|
65
|
-
-
|
66
|
-
-
|
67
|
-
-
|
68
|
-
-
|
69
|
-
-
|
70
|
-
-
|
71
|
-
-67, -
|
72
|
-
-
|
68
|
+
-27, -56, -25, -3, -22, -2, -74, -27, -74, -27,
|
69
|
+
-20, -27, -50, -74, -59, -23, -17, -6, -55, -4,
|
70
|
+
-74, -13, -9, -5, -58, -8, -7, -57, -74, -74,
|
71
|
+
-52, -43, -33, -41, -74, -74, -42, -32, -74, -74,
|
72
|
+
-62, -62, -74, -18, -27, -74, -10, -49, -12, -27,
|
73
|
+
-21, -16, -51, -48, -47, -14, -15, -54, -53, -43,
|
74
|
+
-41, -74, -74, -27, -74, -74, -46, -74, -34, -35,
|
75
|
+
-74, -74, -30, -63, -68, -64, -69, -65, -74, -66,
|
76
|
+
-67, -74, -74, -24, -19, -37, -11, -71, -73, -74,
|
77
|
+
-36, 106, -1, -40, -45, -74, -38, -39, -31, -28,
|
78
|
+
-60, -61, -29, -72, -70, -44 ]
|
73
79
|
|
74
80
|
racc_goto_table = [
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
81
|
+
30, 43, 34, 48, 29, 41, 55, 51, 78, 82,
|
82
|
+
46, 47, 56, 38, 40, 45, 87, 52, 54, 44,
|
83
|
+
35, 89, nil, 57, 61, nil, 58, nil, nil, nil,
|
84
|
+
nil, nil, nil, nil, nil, nil, 84, nil, 86, nil,
|
85
|
+
nil, nil, nil, nil, nil, nil, nil, nil, 88, nil,
|
86
|
+
nil, nil, nil, nil, nil, 92, nil, nil, nil, nil,
|
87
|
+
93, nil, nil, 96, nil, nil, 97, nil, nil, nil,
|
79
88
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
80
|
-
nil, nil, nil, nil, nil, nil,
|
81
|
-
nil, nil, 91, nil, nil, nil, nil, nil, nil, nil,
|
82
|
-
nil, nil, 96 ]
|
89
|
+
nil, nil, nil, nil, nil, nil, 103 ]
|
83
90
|
|
84
91
|
racc_goto_check = [
|
85
|
-
|
86
|
-
7,
|
87
|
-
|
88
|
-
|
92
|
+
8, 2, 18, 9, 1, 10, 11, 9, 17, 17,
|
93
|
+
7, 8, 12, 15, 16, 1, 6, 8, 10, 4,
|
94
|
+
19, 22, nil, 8, 18, nil, 8, nil, nil, nil,
|
95
|
+
nil, nil, nil, nil, nil, nil, 2, nil, 9, nil,
|
96
|
+
nil, nil, nil, nil, nil, nil, nil, nil, 8, nil,
|
97
|
+
nil, nil, nil, nil, nil, 2, nil, nil, nil, nil,
|
98
|
+
18, nil, nil, 18, nil, nil, 18, nil, nil, nil,
|
89
99
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
90
|
-
nil, nil, nil, nil, nil, nil,
|
91
|
-
nil, nil, 16, nil, nil, nil, nil, nil, nil, nil,
|
92
|
-
nil, nil, 7 ]
|
100
|
+
nil, nil, nil, nil, nil, nil, 8 ]
|
93
101
|
|
94
102
|
racc_goto_pointer = [
|
95
|
-
nil,
|
96
|
-
-
|
97
|
-
-
|
103
|
+
nil, 4, -8, nil, 9, nil, -33, -2, -1, -9,
|
104
|
+
-2, -15, -9, nil, nil, 6, 7, -32, -4, 14,
|
105
|
+
nil, nil, -28 ]
|
98
106
|
|
99
107
|
racc_goto_default = [
|
100
|
-
nil, nil, 3,
|
101
|
-
|
102
|
-
nil ]
|
108
|
+
nil, nil, 3, 5, 9, 10, 12, nil, 16, nil,
|
109
|
+
21, 24, 27, 1, 4, 8, nil, nil, nil, nil,
|
110
|
+
18, 81, nil ]
|
103
111
|
|
104
112
|
racc_reduce_table = [
|
105
113
|
0, 0, :racc_error,
|
106
114
|
3, 32, :_reduce_1,
|
107
115
|
1, 32, :_reduce_2,
|
108
|
-
1,
|
109
|
-
1,
|
110
|
-
1,
|
111
|
-
1,
|
112
|
-
1,
|
113
|
-
1,
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
2, 35, :_reduce_13,
|
119
|
-
2, 35, :_reduce_14,
|
120
|
-
2, 35, :_reduce_15,
|
121
|
-
1, 35, :_reduce_16,
|
122
|
-
3, 33, :_reduce_17,
|
123
|
-
1, 33, :_reduce_none,
|
124
|
-
2, 43, :_reduce_19,
|
116
|
+
1, 32, :_reduce_3,
|
117
|
+
1, 35, :_reduce_4,
|
118
|
+
1, 35, :_reduce_5,
|
119
|
+
1, 35, :_reduce_6,
|
120
|
+
1, 35, :_reduce_7,
|
121
|
+
1, 35, :_reduce_8,
|
122
|
+
1, 35, :_reduce_9,
|
123
|
+
2, 36, :_reduce_10,
|
124
|
+
3, 36, :_reduce_11,
|
125
|
+
2, 36, :_reduce_12,
|
125
126
|
1, 36, :_reduce_none,
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
1,
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
2, 40, :_reduce_29,
|
135
|
-
3, 40, :_reduce_30,
|
136
|
-
3, 40, :_reduce_31,
|
137
|
-
3, 40, :_reduce_32,
|
138
|
-
3, 40, :_reduce_33,
|
139
|
-
3, 47, :_reduce_34,
|
140
|
-
3, 47, :_reduce_35,
|
141
|
-
3, 47, :_reduce_36,
|
142
|
-
1, 47, :_reduce_none,
|
143
|
-
1, 47, :_reduce_none,
|
144
|
-
1, 47, :_reduce_39,
|
145
|
-
4, 48, :_reduce_40,
|
146
|
-
3, 48, :_reduce_41,
|
147
|
-
2, 48, :_reduce_42,
|
148
|
-
2, 41, :_reduce_43,
|
149
|
-
2, 41, :_reduce_44,
|
127
|
+
2, 36, :_reduce_14,
|
128
|
+
2, 36, :_reduce_15,
|
129
|
+
2, 36, :_reduce_16,
|
130
|
+
1, 36, :_reduce_17,
|
131
|
+
2, 34, :_reduce_18,
|
132
|
+
3, 33, :_reduce_19,
|
133
|
+
1, 33, :_reduce_none,
|
134
|
+
2, 44, :_reduce_21,
|
150
135
|
1, 37, :_reduce_none,
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
2, 38, :_reduce_50,
|
156
|
-
1, 38, :_reduce_none,
|
157
|
-
1, 38, :_reduce_none,
|
158
|
-
1, 38, :_reduce_none,
|
159
|
-
1, 38, :_reduce_none,
|
160
|
-
1, 49, :_reduce_55,
|
161
|
-
2, 46, :_reduce_56,
|
162
|
-
2, 46, :_reduce_57,
|
136
|
+
1, 37, :_reduce_23,
|
137
|
+
3, 45, :_reduce_24,
|
138
|
+
1, 45, :_reduce_25,
|
139
|
+
1, 46, :_reduce_26,
|
163
140
|
0, 46, :_reduce_none,
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
1,
|
169
|
-
|
170
|
-
|
171
|
-
3,
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
141
|
+
4, 43, :_reduce_28,
|
142
|
+
4, 43, :_reduce_29,
|
143
|
+
3, 43, :_reduce_30,
|
144
|
+
3, 47, :_reduce_31,
|
145
|
+
1, 47, :_reduce_32,
|
146
|
+
2, 41, :_reduce_33,
|
147
|
+
3, 41, :_reduce_34,
|
148
|
+
3, 41, :_reduce_35,
|
149
|
+
3, 41, :_reduce_36,
|
150
|
+
3, 41, :_reduce_37,
|
151
|
+
3, 49, :_reduce_38,
|
152
|
+
3, 49, :_reduce_39,
|
153
|
+
3, 49, :_reduce_40,
|
154
|
+
1, 49, :_reduce_none,
|
155
|
+
1, 49, :_reduce_none,
|
156
|
+
1, 49, :_reduce_43,
|
157
|
+
4, 50, :_reduce_44,
|
158
|
+
3, 50, :_reduce_45,
|
159
|
+
2, 50, :_reduce_46,
|
160
|
+
2, 42, :_reduce_47,
|
161
|
+
2, 42, :_reduce_48,
|
162
|
+
1, 38, :_reduce_none,
|
163
|
+
0, 38, :_reduce_none,
|
164
|
+
2, 39, :_reduce_51,
|
165
|
+
2, 39, :_reduce_52,
|
166
|
+
2, 39, :_reduce_53,
|
167
|
+
2, 39, :_reduce_54,
|
168
|
+
1, 39, :_reduce_none,
|
169
|
+
1, 39, :_reduce_none,
|
170
|
+
1, 39, :_reduce_none,
|
171
|
+
1, 39, :_reduce_none,
|
172
|
+
1, 51, :_reduce_59,
|
173
|
+
2, 48, :_reduce_60,
|
174
|
+
2, 48, :_reduce_61,
|
175
|
+
0, 48, :_reduce_none,
|
176
|
+
1, 52, :_reduce_63,
|
177
|
+
1, 52, :_reduce_64,
|
178
|
+
1, 52, :_reduce_65,
|
179
|
+
1, 52, :_reduce_66,
|
180
|
+
1, 52, :_reduce_67,
|
181
|
+
1, 52, :_reduce_68,
|
182
|
+
1, 52, :_reduce_69,
|
183
|
+
3, 40, :_reduce_70,
|
184
|
+
1, 53, :_reduce_none,
|
185
|
+
2, 53, :_reduce_none,
|
186
|
+
1, 53, :_reduce_none ]
|
187
|
+
|
188
|
+
racc_reduce_n = 74
|
189
|
+
|
190
|
+
racc_shift_n = 106
|
179
191
|
|
180
192
|
racc_token_table = {
|
181
193
|
false => 0,
|
@@ -265,6 +277,7 @@ Racc_token_to_s_table = [
|
|
265
277
|
"$start",
|
266
278
|
"selector",
|
267
279
|
"simple_selector_1toN",
|
280
|
+
"prefixless_combinator_selector",
|
268
281
|
"combinator",
|
269
282
|
"simple_selector",
|
270
283
|
"element_name",
|
@@ -277,6 +290,7 @@ Racc_token_to_s_table = [
|
|
277
290
|
"class",
|
278
291
|
"namespaced_ident",
|
279
292
|
"namespace",
|
293
|
+
"attrib_name",
|
280
294
|
"attrib_val_0or1",
|
281
295
|
"expr",
|
282
296
|
"an_plus_b",
|
@@ -302,22 +316,22 @@ def _reduce_2(val, _values, result)
|
|
302
316
|
end
|
303
317
|
|
304
318
|
def _reduce_3(val, _values, result)
|
305
|
-
result =
|
319
|
+
result = val.flatten
|
306
320
|
result
|
307
321
|
end
|
308
322
|
|
309
323
|
def _reduce_4(val, _values, result)
|
310
|
-
result = :
|
324
|
+
result = :DIRECT_ADJACENT_SELECTOR
|
311
325
|
result
|
312
326
|
end
|
313
327
|
|
314
328
|
def _reduce_5(val, _values, result)
|
315
|
-
result = :
|
329
|
+
result = :CHILD_SELECTOR
|
316
330
|
result
|
317
331
|
end
|
318
332
|
|
319
333
|
def _reduce_6(val, _values, result)
|
320
|
-
result = :
|
334
|
+
result = :FOLLOWING_SELECTOR
|
321
335
|
result
|
322
336
|
end
|
323
337
|
|
@@ -327,11 +341,16 @@ def _reduce_7(val, _values, result)
|
|
327
341
|
end
|
328
342
|
|
329
343
|
def _reduce_8(val, _values, result)
|
330
|
-
result = :
|
344
|
+
result = :DESCENDANT_SELECTOR
|
331
345
|
result
|
332
346
|
end
|
333
347
|
|
334
348
|
def _reduce_9(val, _values, result)
|
349
|
+
result = :CHILD_SELECTOR
|
350
|
+
result
|
351
|
+
end
|
352
|
+
|
353
|
+
def _reduce_10(val, _values, result)
|
335
354
|
result = if val[1].nil?
|
336
355
|
val.first
|
337
356
|
else
|
@@ -341,7 +360,7 @@ def _reduce_9(val, _values, result)
|
|
341
360
|
result
|
342
361
|
end
|
343
362
|
|
344
|
-
def
|
363
|
+
def _reduce_11(val, _values, result)
|
345
364
|
result = Node.new(:CONDITIONAL_SELECTOR,
|
346
365
|
[
|
347
366
|
val.first,
|
@@ -352,27 +371,27 @@ def _reduce_10(val, _values, result)
|
|
352
371
|
result
|
353
372
|
end
|
354
373
|
|
355
|
-
def
|
374
|
+
def _reduce_12(val, _values, result)
|
356
375
|
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
357
376
|
|
358
377
|
result
|
359
378
|
end
|
360
379
|
|
361
|
-
# reduce
|
380
|
+
# reduce 13 omitted
|
362
381
|
|
363
|
-
def
|
382
|
+
def _reduce_14(val, _values, result)
|
364
383
|
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
365
384
|
|
366
385
|
result
|
367
386
|
end
|
368
387
|
|
369
|
-
def
|
388
|
+
def _reduce_15(val, _values, result)
|
370
389
|
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
371
390
|
|
372
391
|
result
|
373
392
|
end
|
374
393
|
|
375
|
-
def
|
394
|
+
def _reduce_16(val, _values, result)
|
376
395
|
result = Node.new(:CONDITIONAL_SELECTOR,
|
377
396
|
[
|
378
397
|
Node.new(:ELEMENT_NAME, ['*']),
|
@@ -383,7 +402,7 @@ def _reduce_15(val, _values, result)
|
|
383
402
|
result
|
384
403
|
end
|
385
404
|
|
386
|
-
def
|
405
|
+
def _reduce_17(val, _values, result)
|
387
406
|
result = Node.new(:CONDITIONAL_SELECTOR,
|
388
407
|
[Node.new(:ELEMENT_NAME, ['*']), val.first]
|
389
408
|
)
|
@@ -391,27 +410,33 @@ def _reduce_16(val, _values, result)
|
|
391
410
|
result
|
392
411
|
end
|
393
412
|
|
394
|
-
def
|
395
|
-
result = Node.new(val
|
413
|
+
def _reduce_18(val, _values, result)
|
414
|
+
result = Node.new(val.first, [nil, val.last])
|
396
415
|
|
397
416
|
result
|
398
417
|
end
|
399
418
|
|
400
|
-
# reduce 18 omitted
|
401
|
-
|
402
419
|
def _reduce_19(val, _values, result)
|
403
|
-
|
420
|
+
result = Node.new(val[1], [val.first, val.last])
|
421
|
+
|
404
422
|
result
|
405
423
|
end
|
406
424
|
|
407
425
|
# reduce 20 omitted
|
408
426
|
|
409
427
|
def _reduce_21(val, _values, result)
|
428
|
+
result = Node.new(:CLASS_CONDITION, [val[1]])
|
429
|
+
result
|
430
|
+
end
|
431
|
+
|
432
|
+
# reduce 22 omitted
|
433
|
+
|
434
|
+
def _reduce_23(val, _values, result)
|
410
435
|
result = Node.new(:ELEMENT_NAME, val)
|
411
436
|
result
|
412
437
|
end
|
413
438
|
|
414
|
-
def
|
439
|
+
def _reduce_24(val, _values, result)
|
415
440
|
result = Node.new(:ELEMENT_NAME,
|
416
441
|
[[val.first, val.last].compact.join(':')]
|
417
442
|
)
|
@@ -419,21 +444,21 @@ def _reduce_22(val, _values, result)
|
|
419
444
|
result
|
420
445
|
end
|
421
446
|
|
422
|
-
def
|
447
|
+
def _reduce_25(val, _values, result)
|
423
448
|
name = @namespaces.key?('xmlns') ? "xmlns:#{val.first}" : val.first
|
424
449
|
result = Node.new(:ELEMENT_NAME, [name])
|
425
450
|
|
426
451
|
result
|
427
452
|
end
|
428
453
|
|
429
|
-
def
|
454
|
+
def _reduce_26(val, _values, result)
|
430
455
|
result = val[0]
|
431
456
|
result
|
432
457
|
end
|
433
458
|
|
434
|
-
# reduce
|
459
|
+
# reduce 27 omitted
|
435
460
|
|
436
|
-
def
|
461
|
+
def _reduce_28(val, _values, result)
|
437
462
|
result = Node.new(:ATTRIBUTE_CONDITION,
|
438
463
|
[val[1]] + (val[2] || [])
|
439
464
|
)
|
@@ -441,7 +466,7 @@ def _reduce_26(val, _values, result)
|
|
441
466
|
result
|
442
467
|
end
|
443
468
|
|
444
|
-
def
|
469
|
+
def _reduce_29(val, _values, result)
|
445
470
|
result = Node.new(:ATTRIBUTE_CONDITION,
|
446
471
|
[val[1]] + (val[2] || [])
|
447
472
|
)
|
@@ -449,7 +474,7 @@ def _reduce_27(val, _values, result)
|
|
449
474
|
result
|
450
475
|
end
|
451
476
|
|
452
|
-
def
|
477
|
+
def _reduce_30(val, _values, result)
|
453
478
|
# Non standard, but hpricot supports it.
|
454
479
|
result = Node.new(:PSEUDO_CLASS,
|
455
480
|
[Node.new(:FUNCTION, ['nth-child(', val[1]])]
|
@@ -458,56 +483,72 @@ def _reduce_28(val, _values, result)
|
|
458
483
|
result
|
459
484
|
end
|
460
485
|
|
461
|
-
def
|
486
|
+
def _reduce_31(val, _values, result)
|
487
|
+
result = Node.new(:ELEMENT_NAME,
|
488
|
+
[[val.first, val.last].compact.join(':')]
|
489
|
+
)
|
490
|
+
|
491
|
+
result
|
492
|
+
end
|
493
|
+
|
494
|
+
def _reduce_32(val, _values, result)
|
495
|
+
# Default namespace is not applied to attributes.
|
496
|
+
# So we don't add prefix "xmlns:" as in namespaced_ident.
|
497
|
+
result = Node.new(:ELEMENT_NAME, [val.first])
|
498
|
+
|
499
|
+
result
|
500
|
+
end
|
501
|
+
|
502
|
+
def _reduce_33(val, _values, result)
|
462
503
|
result = Node.new(:FUNCTION, [val.first.strip])
|
463
504
|
|
464
505
|
result
|
465
506
|
end
|
466
507
|
|
467
|
-
def
|
508
|
+
def _reduce_34(val, _values, result)
|
468
509
|
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
469
510
|
|
470
511
|
result
|
471
512
|
end
|
472
513
|
|
473
|
-
def
|
514
|
+
def _reduce_35(val, _values, result)
|
474
515
|
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
475
516
|
|
476
517
|
result
|
477
518
|
end
|
478
519
|
|
479
|
-
def
|
520
|
+
def _reduce_36(val, _values, result)
|
480
521
|
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
481
522
|
|
482
523
|
result
|
483
524
|
end
|
484
525
|
|
485
|
-
def
|
526
|
+
def _reduce_37(val, _values, result)
|
486
527
|
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
487
528
|
|
488
529
|
result
|
489
530
|
end
|
490
531
|
|
491
|
-
def
|
532
|
+
def _reduce_38(val, _values, result)
|
492
533
|
result = [val.first, val.last]
|
493
534
|
result
|
494
535
|
end
|
495
536
|
|
496
|
-
def
|
537
|
+
def _reduce_39(val, _values, result)
|
497
538
|
result = [val.first, val.last]
|
498
539
|
result
|
499
540
|
end
|
500
541
|
|
501
|
-
def
|
542
|
+
def _reduce_40(val, _values, result)
|
502
543
|
result = [val.first, val.last]
|
503
544
|
result
|
504
545
|
end
|
505
546
|
|
506
|
-
# reduce
|
547
|
+
# reduce 41 omitted
|
507
548
|
|
508
|
-
# reduce
|
549
|
+
# reduce 42 omitted
|
509
550
|
|
510
|
-
def
|
551
|
+
def _reduce_43(val, _values, result)
|
511
552
|
if val[0] == 'even'
|
512
553
|
val = ["2","n","+","0"]
|
513
554
|
result = Node.new(:AN_PLUS_B, val)
|
@@ -525,7 +566,7 @@ def _reduce_39(val, _values, result)
|
|
525
566
|
result
|
526
567
|
end
|
527
568
|
|
528
|
-
def
|
569
|
+
def _reduce_44(val, _values, result)
|
529
570
|
if val[1] == 'n'
|
530
571
|
result = Node.new(:AN_PLUS_B, val)
|
531
572
|
else
|
@@ -535,7 +576,7 @@ def _reduce_40(val, _values, result)
|
|
535
576
|
result
|
536
577
|
end
|
537
578
|
|
538
|
-
def
|
579
|
+
def _reduce_45(val, _values, result)
|
539
580
|
# n+3, -n+3
|
540
581
|
if val[0] == 'n'
|
541
582
|
val.unshift("1")
|
@@ -551,7 +592,7 @@ def _reduce_41(val, _values, result)
|
|
551
592
|
result
|
552
593
|
end
|
553
594
|
|
554
|
-
def
|
595
|
+
def _reduce_46(val, _values, result)
|
555
596
|
if val[1] == 'n'
|
556
597
|
val << "+"
|
557
598
|
val << "0"
|
@@ -563,116 +604,116 @@ def _reduce_42(val, _values, result)
|
|
563
604
|
result
|
564
605
|
end
|
565
606
|
|
566
|
-
def
|
607
|
+
def _reduce_47(val, _values, result)
|
567
608
|
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
568
609
|
|
569
610
|
result
|
570
611
|
end
|
571
612
|
|
572
|
-
def
|
613
|
+
def _reduce_48(val, _values, result)
|
573
614
|
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
574
615
|
result
|
575
616
|
end
|
576
617
|
|
577
|
-
# reduce
|
618
|
+
# reduce 49 omitted
|
578
619
|
|
579
|
-
# reduce
|
620
|
+
# reduce 50 omitted
|
580
621
|
|
581
|
-
def
|
622
|
+
def _reduce_51(val, _values, result)
|
582
623
|
result = Node.new(:COMBINATOR, val)
|
583
624
|
|
584
625
|
result
|
585
626
|
end
|
586
627
|
|
587
|
-
def
|
628
|
+
def _reduce_52(val, _values, result)
|
588
629
|
result = Node.new(:COMBINATOR, val)
|
589
630
|
|
590
631
|
result
|
591
632
|
end
|
592
633
|
|
593
|
-
def
|
634
|
+
def _reduce_53(val, _values, result)
|
594
635
|
result = Node.new(:COMBINATOR, val)
|
595
636
|
|
596
637
|
result
|
597
638
|
end
|
598
639
|
|
599
|
-
def
|
640
|
+
def _reduce_54(val, _values, result)
|
600
641
|
result = Node.new(:COMBINATOR, val)
|
601
642
|
|
602
643
|
result
|
603
644
|
end
|
604
645
|
|
605
|
-
# reduce
|
646
|
+
# reduce 55 omitted
|
606
647
|
|
607
|
-
# reduce
|
648
|
+
# reduce 56 omitted
|
608
649
|
|
609
|
-
# reduce
|
650
|
+
# reduce 57 omitted
|
610
651
|
|
611
|
-
# reduce
|
652
|
+
# reduce 58 omitted
|
612
653
|
|
613
|
-
def
|
654
|
+
def _reduce_59(val, _values, result)
|
614
655
|
result = Node.new(:ID, val)
|
615
656
|
result
|
616
657
|
end
|
617
658
|
|
618
|
-
def
|
659
|
+
def _reduce_60(val, _values, result)
|
619
660
|
result = [val.first, val[1]]
|
620
661
|
result
|
621
662
|
end
|
622
663
|
|
623
|
-
def
|
664
|
+
def _reduce_61(val, _values, result)
|
624
665
|
result = [val.first, val[1]]
|
625
666
|
result
|
626
667
|
end
|
627
668
|
|
628
|
-
# reduce
|
669
|
+
# reduce 62 omitted
|
629
670
|
|
630
|
-
def
|
671
|
+
def _reduce_63(val, _values, result)
|
631
672
|
result = :equal
|
632
673
|
result
|
633
674
|
end
|
634
675
|
|
635
|
-
def
|
676
|
+
def _reduce_64(val, _values, result)
|
636
677
|
result = :prefix_match
|
637
678
|
result
|
638
679
|
end
|
639
680
|
|
640
|
-
def
|
681
|
+
def _reduce_65(val, _values, result)
|
641
682
|
result = :suffix_match
|
642
683
|
result
|
643
684
|
end
|
644
685
|
|
645
|
-
def
|
686
|
+
def _reduce_66(val, _values, result)
|
646
687
|
result = :substring_match
|
647
688
|
result
|
648
689
|
end
|
649
690
|
|
650
|
-
def
|
691
|
+
def _reduce_67(val, _values, result)
|
651
692
|
result = :not_equal
|
652
693
|
result
|
653
694
|
end
|
654
695
|
|
655
|
-
def
|
696
|
+
def _reduce_68(val, _values, result)
|
656
697
|
result = :includes
|
657
698
|
result
|
658
699
|
end
|
659
700
|
|
660
|
-
def
|
701
|
+
def _reduce_69(val, _values, result)
|
661
702
|
result = :dash_match
|
662
703
|
result
|
663
704
|
end
|
664
705
|
|
665
|
-
def
|
706
|
+
def _reduce_70(val, _values, result)
|
666
707
|
result = Node.new(:NOT, [val[1]])
|
667
708
|
|
668
709
|
result
|
669
710
|
end
|
670
711
|
|
671
|
-
# reduce
|
712
|
+
# reduce 71 omitted
|
672
713
|
|
673
|
-
# reduce
|
714
|
+
# reduce 72 omitted
|
674
715
|
|
675
|
-
# reduce
|
716
|
+
# reduce 73 omitted
|
676
717
|
|
677
718
|
def _reduce_none(val, _values, result)
|
678
719
|
val[0]
|