nokogiri 1.13.0 → 1.13.1
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 +3 -0
- data/ext/nokogiri/xslt_stylesheet.c +107 -9
- data/lib/nokogiri/css/parser.rb +351 -340
- data/lib/nokogiri/css/parser.y +241 -244
- data/lib/nokogiri/css/tokenizer.rb +2 -2
- data/lib/nokogiri/css/tokenizer.rex +1 -1
- data/lib/nokogiri/css/xpath_visitor.rb +16 -18
- data/lib/nokogiri/version/constant.rb +1 -1
- data/lib/nokogiri/xml/searchable.rb +51 -40
- data/lib/nokogiri/xslt.rb +19 -12
- metadata +2 -2
data/lib/nokogiri/css/parser.rb
CHANGED
@@ -39,190 +39,204 @@ end
|
|
39
39
|
##### State transition tables begin ###
|
40
40
|
|
41
41
|
racc_action_table = [
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
27,
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
nil,
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
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 ]
|
64
67
|
|
65
68
|
racc_action_check = [
|
66
|
-
3,
|
67
|
-
|
68
|
-
|
69
|
-
9,
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
nil,
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
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 ]
|
88
94
|
|
89
95
|
racc_action_pointer = [
|
90
|
-
|
91
|
-
nil,
|
92
|
-
|
93
|
-
|
94
|
-
nil, nil,
|
95
|
-
|
96
|
-
|
97
|
-
nil, nil, nil, nil, nil,
|
98
|
-
nil, nil, nil, nil,
|
99
|
-
|
100
|
-
|
101
|
-
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 ]
|
102
108
|
|
103
109
|
racc_action_default = [
|
104
|
-
-
|
105
|
-
-
|
106
|
-
-20, -
|
107
|
-
-
|
108
|
-
|
109
|
-
-
|
110
|
-
-
|
111
|
-
-
|
112
|
-
-
|
113
|
-
-
|
114
|
-
-
|
115
|
-
-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 ]
|
116
122
|
|
117
123
|
racc_goto_table = [
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
nil, nil,
|
122
|
-
nil,
|
123
|
-
|
124
|
-
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 ]
|
125
132
|
|
126
133
|
racc_goto_check = [
|
127
|
-
|
128
|
-
10, 2,
|
129
|
-
|
130
|
-
nil, nil,
|
131
|
-
nil,
|
132
|
-
|
133
|
-
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 ]
|
134
142
|
|
135
143
|
racc_goto_pointer = [
|
136
|
-
nil, 3, -1, nil, nil, -
|
137
|
-
-
|
138
|
-
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 ]
|
139
147
|
|
140
148
|
racc_goto_default = [
|
141
|
-
nil, nil, nil, 2, 3, 9,
|
142
|
-
|
143
|
-
|
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 ]
|
144
152
|
|
145
153
|
racc_reduce_table = [
|
146
154
|
0, 0, :racc_error,
|
147
|
-
3,
|
148
|
-
1,
|
149
|
-
2,
|
150
|
-
1,
|
151
|
-
1,
|
152
|
-
1,
|
153
|
-
1,
|
154
|
-
1,
|
155
|
-
2,
|
156
|
-
1,
|
157
|
-
2,
|
158
|
-
|
159
|
-
|
160
|
-
2,
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
1,
|
167
|
-
|
168
|
-
1,
|
169
|
-
1,
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
3,
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
3,
|
182
|
-
3,
|
183
|
-
3,
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
3,
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
1,
|
193
|
-
|
194
|
-
|
195
|
-
2,
|
196
|
-
2,
|
197
|
-
2,
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
1,
|
210
|
-
1,
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
1,
|
216
|
-
|
217
|
-
1,
|
218
|
-
|
219
|
-
1,
|
220
|
-
1,
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
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
|
226
240
|
|
227
241
|
racc_token_table = {
|
228
242
|
false => 0,
|
@@ -252,12 +266,13 @@ racc_token_table = {
|
|
252
266
|
:LSQUARE => 24,
|
253
267
|
:RSQUARE => 25,
|
254
268
|
:HAS => 26,
|
255
|
-
"
|
256
|
-
"
|
257
|
-
"
|
258
|
-
"
|
269
|
+
"@" => 27,
|
270
|
+
"." => 28,
|
271
|
+
"*" => 29,
|
272
|
+
"|" => 30,
|
273
|
+
":" => 31 }
|
259
274
|
|
260
|
-
racc_nt_base =
|
275
|
+
racc_nt_base = 32
|
261
276
|
|
262
277
|
racc_use_result_var = true
|
263
278
|
|
@@ -305,6 +320,7 @@ Racc_token_to_s_table = [
|
|
305
320
|
"LSQUARE",
|
306
321
|
"RSQUARE",
|
307
322
|
"HAS",
|
323
|
+
"\"@\"",
|
308
324
|
"\".\"",
|
309
325
|
"\"*\"",
|
310
326
|
"\"|\"",
|
@@ -315,6 +331,8 @@ Racc_token_to_s_table = [
|
|
315
331
|
"prefixless_combinator_selector",
|
316
332
|
"optional_S",
|
317
333
|
"combinator",
|
334
|
+
"xpath_attribute_name",
|
335
|
+
"xpath_attribute",
|
318
336
|
"simple_selector",
|
319
337
|
"element_name",
|
320
338
|
"hcap_0toN",
|
@@ -341,7 +359,7 @@ Racc_debug_parser = false
|
|
341
359
|
# reduce 0 omitted
|
342
360
|
|
343
361
|
def _reduce_1(val, _values, result)
|
344
|
-
|
362
|
+
result = [val[0], val[2]].flatten
|
345
363
|
|
346
364
|
result
|
347
365
|
end
|
@@ -352,7 +370,7 @@ def _reduce_2(val, _values, result)
|
|
352
370
|
end
|
353
371
|
|
354
372
|
def _reduce_3(val, _values, result)
|
355
|
-
result = [val
|
373
|
+
result = [val[1]].flatten
|
356
374
|
result
|
357
375
|
end
|
358
376
|
|
@@ -382,373 +400,366 @@ def _reduce_8(val, _values, result)
|
|
382
400
|
end
|
383
401
|
|
384
402
|
def _reduce_9(val, _values, result)
|
385
|
-
|
386
|
-
val.first
|
387
|
-
else
|
388
|
-
Node.new(:CONDITIONAL_SELECTOR, [val.first, val[1]])
|
389
|
-
end
|
390
|
-
|
403
|
+
result = val[1]
|
391
404
|
result
|
392
405
|
end
|
393
406
|
|
394
|
-
|
395
|
-
|
396
|
-
def _reduce_11(val, _values, result)
|
397
|
-
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
398
|
-
|
407
|
+
def _reduce_10(val, _values, result)
|
408
|
+
result = Node.new(:ATTRIB_NAME, [val[0]])
|
399
409
|
result
|
400
410
|
end
|
401
411
|
|
402
|
-
def
|
403
|
-
|
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
|
404
418
|
|
405
419
|
result
|
406
420
|
end
|
407
421
|
|
408
|
-
|
409
|
-
result = Node.new(:CONDITIONAL_SELECTOR,
|
410
|
-
[Node.new(:ELEMENT_NAME, ['*']), val.first]
|
411
|
-
)
|
422
|
+
# reduce 12 omitted
|
412
423
|
|
424
|
+
def _reduce_13(val, _values, result)
|
425
|
+
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
413
426
|
result
|
414
427
|
end
|
415
428
|
|
416
429
|
def _reduce_14(val, _values, result)
|
417
|
-
|
418
|
-
|
430
|
+
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
419
431
|
result
|
420
432
|
end
|
421
433
|
|
422
434
|
def _reduce_15(val, _values, result)
|
423
|
-
|
435
|
+
result = Node.new(:CONDITIONAL_SELECTOR, [Node.new(:ELEMENT_NAME, ['*']), val[0]])
|
436
|
+
result
|
437
|
+
end
|
438
|
+
|
439
|
+
# reduce 16 omitted
|
424
440
|
|
441
|
+
def _reduce_17(val, _values, result)
|
442
|
+
result = Node.new(val[0], [nil, val[1]])
|
425
443
|
result
|
426
444
|
end
|
427
445
|
|
428
|
-
def
|
429
|
-
|
446
|
+
def _reduce_18(val, _values, result)
|
447
|
+
result = Node.new(val[1], [val[0], val[2]])
|
448
|
+
result
|
449
|
+
end
|
430
450
|
|
451
|
+
def _reduce_19(val, _values, result)
|
452
|
+
result = Node.new(:DESCENDANT_SELECTOR, [val[0], val[2]])
|
431
453
|
result
|
432
454
|
end
|
433
455
|
|
434
|
-
# reduce
|
456
|
+
# reduce 20 omitted
|
435
457
|
|
436
|
-
def
|
458
|
+
def _reduce_21(val, _values, result)
|
437
459
|
result = Node.new(:CLASS_CONDITION, [unescape_css_identifier(val[1])])
|
438
460
|
result
|
439
461
|
end
|
440
462
|
|
441
|
-
# reduce
|
463
|
+
# reduce 22 omitted
|
442
464
|
|
443
|
-
def
|
465
|
+
def _reduce_23(val, _values, result)
|
444
466
|
result = Node.new(:ELEMENT_NAME, val)
|
445
467
|
result
|
446
468
|
end
|
447
469
|
|
448
|
-
def
|
449
|
-
|
450
|
-
[[val.first, val.last].compact.join(':')]
|
451
|
-
)
|
452
|
-
|
470
|
+
def _reduce_24(val, _values, result)
|
471
|
+
result = Node.new(:ELEMENT_NAME, [[val[0], val[2]].compact.join(':')])
|
453
472
|
result
|
454
473
|
end
|
455
474
|
|
456
|
-
def
|
457
|
-
|
458
|
-
|
475
|
+
def _reduce_25(val, _values, result)
|
476
|
+
name = @namespaces.key?('xmlns') ? "xmlns:#{val[0]}" : val[0]
|
477
|
+
result = Node.new(:ELEMENT_NAME, [name])
|
459
478
|
|
460
479
|
result
|
461
480
|
end
|
462
481
|
|
463
|
-
def
|
482
|
+
def _reduce_26(val, _values, result)
|
464
483
|
result = val[0]
|
465
484
|
result
|
466
485
|
end
|
467
486
|
|
468
|
-
# reduce
|
487
|
+
# reduce 27 omitted
|
469
488
|
|
470
|
-
def
|
471
|
-
|
472
|
-
[val[1]] + (val[2] || [])
|
473
|
-
)
|
489
|
+
def _reduce_28(val, _values, result)
|
490
|
+
result = Node.new(:ATTRIBUTE_CONDITION, [val[1]] + (val[2] || []))
|
474
491
|
|
475
492
|
result
|
476
493
|
end
|
477
494
|
|
478
|
-
def
|
479
|
-
|
480
|
-
[val[1]] + (val[2] || [])
|
481
|
-
)
|
495
|
+
def _reduce_29(val, _values, result)
|
496
|
+
result = Node.new(:ATTRIBUTE_CONDITION, [val[1]] + (val[2] || []))
|
482
497
|
|
483
498
|
result
|
484
499
|
end
|
485
500
|
|
486
|
-
def
|
487
|
-
|
488
|
-
result = Node.new(:PSEUDO_CLASS,
|
489
|
-
[Node.new(:FUNCTION, ['nth-child(', val[1]])]
|
490
|
-
)
|
501
|
+
def _reduce_30(val, _values, result)
|
502
|
+
result = Node.new(:PSEUDO_CLASS, [Node.new(:FUNCTION, ['nth-child(', val[1]])])
|
491
503
|
|
492
504
|
result
|
493
505
|
end
|
494
506
|
|
495
|
-
def
|
496
|
-
|
497
|
-
|
498
|
-
|
507
|
+
def _reduce_31(val, _values, result)
|
508
|
+
result = Node.new(:ATTRIB_NAME, [[val[0], val[2]].compact.join(':')])
|
509
|
+
result
|
510
|
+
end
|
499
511
|
|
512
|
+
def _reduce_32(val, _values, result)
|
513
|
+
result = Node.new(:ATTRIB_NAME, [val[0]])
|
500
514
|
result
|
501
515
|
end
|
502
516
|
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
517
|
+
# reduce 33 omitted
|
518
|
+
|
519
|
+
def _reduce_34(val, _values, result)
|
520
|
+
result = Node.new(:FUNCTION, [val[0].strip])
|
507
521
|
|
508
522
|
result
|
509
523
|
end
|
510
524
|
|
511
|
-
def
|
512
|
-
|
525
|
+
def _reduce_35(val, _values, result)
|
526
|
+
result = Node.new(:FUNCTION, [val[0].strip, val[1]].flatten)
|
513
527
|
|
514
528
|
result
|
515
529
|
end
|
516
530
|
|
517
|
-
def
|
518
|
-
|
531
|
+
def _reduce_36(val, _values, result)
|
532
|
+
result = Node.new(:FUNCTION, [val[0].strip, val[1]].flatten)
|
519
533
|
|
520
534
|
result
|
521
535
|
end
|
522
536
|
|
523
|
-
def
|
524
|
-
|
537
|
+
def _reduce_37(val, _values, result)
|
538
|
+
result = Node.new(:FUNCTION, [val[0].strip, val[1]].flatten)
|
525
539
|
|
526
540
|
result
|
527
541
|
end
|
528
542
|
|
529
|
-
def
|
530
|
-
|
543
|
+
def _reduce_38(val, _values, result)
|
544
|
+
result = Node.new(:FUNCTION, [val[0].strip, val[1]].flatten)
|
531
545
|
|
532
546
|
result
|
533
547
|
end
|
534
548
|
|
535
|
-
def
|
536
|
-
|
537
|
-
|
549
|
+
def _reduce_39(val, _values, result)
|
550
|
+
result = [val[0], val[2]]
|
538
551
|
result
|
539
552
|
end
|
540
553
|
|
541
|
-
def
|
542
|
-
result = [val
|
554
|
+
def _reduce_40(val, _values, result)
|
555
|
+
result = [val[0], val[2]]
|
543
556
|
result
|
544
557
|
end
|
545
558
|
|
546
|
-
def
|
547
|
-
result = [val
|
559
|
+
def _reduce_41(val, _values, result)
|
560
|
+
result = [val[0], val[2]]
|
548
561
|
result
|
549
562
|
end
|
550
563
|
|
551
|
-
def
|
552
|
-
result = [val
|
564
|
+
def _reduce_42(val, _values, result)
|
565
|
+
result = [val[0], val[2]]
|
553
566
|
result
|
554
567
|
end
|
555
568
|
|
556
|
-
# reduce
|
569
|
+
# reduce 43 omitted
|
557
570
|
|
558
|
-
# reduce
|
571
|
+
# reduce 44 omitted
|
559
572
|
|
560
|
-
def
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
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
|
573
|
+
def _reduce_45(val, _values, result)
|
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
|
575
584
|
|
576
585
|
result
|
577
586
|
end
|
578
587
|
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
588
|
+
# reduce 46 omitted
|
589
|
+
|
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
|
585
596
|
|
586
597
|
result
|
587
598
|
end
|
588
599
|
|
589
|
-
def
|
600
|
+
def _reduce_48(val, _values, result)
|
590
601
|
# n+3, -n+3
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
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
|
601
612
|
|
602
613
|
result
|
603
614
|
end
|
604
615
|
|
605
|
-
def
|
616
|
+
def _reduce_49(val, _values, result)
|
606
617
|
# 5n, -5n, 10n-1
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
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
|
621
632
|
|
622
633
|
result
|
623
634
|
end
|
624
635
|
|
625
|
-
def
|
626
|
-
|
636
|
+
def _reduce_50(val, _values, result)
|
637
|
+
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
627
638
|
|
628
639
|
result
|
629
640
|
end
|
630
641
|
|
631
|
-
def
|
642
|
+
def _reduce_51(val, _values, result)
|
632
643
|
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
633
644
|
result
|
634
645
|
end
|
635
646
|
|
636
|
-
# reduce
|
647
|
+
# reduce 52 omitted
|
637
648
|
|
638
|
-
# reduce
|
649
|
+
# reduce 53 omitted
|
639
650
|
|
640
|
-
def
|
641
|
-
|
651
|
+
def _reduce_54(val, _values, result)
|
652
|
+
result = Node.new(:COMBINATOR, val)
|
642
653
|
|
643
654
|
result
|
644
655
|
end
|
645
656
|
|
646
|
-
def
|
647
|
-
|
657
|
+
def _reduce_55(val, _values, result)
|
658
|
+
result = Node.new(:COMBINATOR, val)
|
648
659
|
|
649
660
|
result
|
650
661
|
end
|
651
662
|
|
652
|
-
def
|
653
|
-
|
663
|
+
def _reduce_56(val, _values, result)
|
664
|
+
result = Node.new(:COMBINATOR, val)
|
654
665
|
|
655
666
|
result
|
656
667
|
end
|
657
668
|
|
658
|
-
def
|
659
|
-
|
669
|
+
def _reduce_57(val, _values, result)
|
670
|
+
result = Node.new(:COMBINATOR, val)
|
660
671
|
|
661
672
|
result
|
662
673
|
end
|
663
674
|
|
664
|
-
def
|
665
|
-
|
675
|
+
def _reduce_58(val, _values, result)
|
676
|
+
result = Node.new(:COMBINATOR, val)
|
666
677
|
|
667
678
|
result
|
668
679
|
end
|
669
680
|
|
670
|
-
# reduce
|
681
|
+
# reduce 59 omitted
|
671
682
|
|
672
|
-
# reduce
|
683
|
+
# reduce 60 omitted
|
673
684
|
|
674
|
-
# reduce
|
685
|
+
# reduce 61 omitted
|
675
686
|
|
676
|
-
# reduce
|
687
|
+
# reduce 62 omitted
|
677
688
|
|
678
|
-
# reduce
|
689
|
+
# reduce 63 omitted
|
679
690
|
|
680
|
-
def
|
681
|
-
result = Node.new(:ID, [unescape_css_identifier(val
|
691
|
+
def _reduce_64(val, _values, result)
|
692
|
+
result = Node.new(:ID, [unescape_css_identifier(val[0])])
|
682
693
|
result
|
683
694
|
end
|
684
695
|
|
685
|
-
def
|
686
|
-
result = [val
|
696
|
+
def _reduce_65(val, _values, result)
|
697
|
+
result = [val[0], unescape_css_identifier(val[1])]
|
687
698
|
result
|
688
699
|
end
|
689
700
|
|
690
|
-
def
|
691
|
-
result = [val
|
701
|
+
def _reduce_66(val, _values, result)
|
702
|
+
result = [val[0], unescape_css_string(val[1])]
|
692
703
|
result
|
693
704
|
end
|
694
705
|
|
695
|
-
def
|
696
|
-
result = [val
|
706
|
+
def _reduce_67(val, _values, result)
|
707
|
+
result = [val[0], val[1]]
|
697
708
|
result
|
698
709
|
end
|
699
710
|
|
700
|
-
# reduce
|
711
|
+
# reduce 68 omitted
|
701
712
|
|
702
|
-
def
|
713
|
+
def _reduce_69(val, _values, result)
|
703
714
|
result = :equal
|
704
715
|
result
|
705
716
|
end
|
706
717
|
|
707
|
-
def
|
718
|
+
def _reduce_70(val, _values, result)
|
708
719
|
result = :prefix_match
|
709
720
|
result
|
710
721
|
end
|
711
722
|
|
712
|
-
def
|
723
|
+
def _reduce_71(val, _values, result)
|
713
724
|
result = :suffix_match
|
714
725
|
result
|
715
726
|
end
|
716
727
|
|
717
|
-
def
|
728
|
+
def _reduce_72(val, _values, result)
|
718
729
|
result = :substring_match
|
719
730
|
result
|
720
731
|
end
|
721
732
|
|
722
|
-
def
|
733
|
+
def _reduce_73(val, _values, result)
|
723
734
|
result = :not_equal
|
724
735
|
result
|
725
736
|
end
|
726
737
|
|
727
|
-
def
|
738
|
+
def _reduce_74(val, _values, result)
|
728
739
|
result = :includes
|
729
740
|
result
|
730
741
|
end
|
731
742
|
|
732
|
-
def
|
743
|
+
def _reduce_75(val, _values, result)
|
733
744
|
result = :dash_match
|
734
745
|
result
|
735
746
|
end
|
736
747
|
|
737
|
-
def
|
738
|
-
|
748
|
+
def _reduce_76(val, _values, result)
|
749
|
+
result = Node.new(:NOT, [val[1]])
|
739
750
|
|
740
751
|
result
|
741
752
|
end
|
742
753
|
|
743
|
-
# reduce
|
754
|
+
# reduce 77 omitted
|
744
755
|
|
745
|
-
# reduce
|
756
|
+
# reduce 78 omitted
|
746
757
|
|
747
|
-
# reduce
|
758
|
+
# reduce 79 omitted
|
748
759
|
|
749
|
-
# reduce
|
760
|
+
# reduce 80 omitted
|
750
761
|
|
751
|
-
# reduce
|
762
|
+
# reduce 81 omitted
|
752
763
|
|
753
764
|
def _reduce_none(val, _values, result)
|
754
765
|
val[0]
|