racc 1.4.14 → 1.4.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Manifest.txt +50 -0
- data/ext/racc/com/headius/racc/Cparse.java +66 -23
- data/ext/racc/cparse.c +1 -1
- data/ext/racc/depend +1 -1
- data/lib/racc/info.rb +2 -2
- data/test/assets/bibtex.y +141 -0
- data/test/assets/cadenza.y +170 -0
- data/test/assets/cast.y +926 -0
- data/test/assets/csspool.y +729 -0
- data/test/assets/edtf.y +583 -0
- data/test/assets/huia.y +318 -0
- data/test/assets/journey.y +47 -0
- data/test/assets/liquor.y +313 -0
- data/test/assets/machete.y +423 -0
- data/test/assets/macruby.y +2197 -0
- data/test/assets/mediacloth.y +599 -0
- data/test/assets/mof.y +649 -0
- data/test/assets/namae.y +302 -0
- data/test/assets/nasl.y +626 -0
- data/test/assets/nokogiri-css.y +255 -0
- data/test/assets/opal.y +1807 -0
- data/test/assets/php_serialization.y +98 -0
- data/test/assets/rdblockparser.y +576 -0
- data/test/assets/rdinlineparser.y +561 -0
- data/test/assets/riml.y +665 -0
- data/test/assets/ruby18.y +1943 -0
- data/test/assets/ruby19.y +2174 -0
- data/test/assets/ruby20.y +2350 -0
- data/test/assets/ruby21.y +2359 -0
- data/test/assets/ruby22.y +2381 -0
- data/test/assets/tp_plus.y +622 -0
- data/test/assets/twowaysql.y +278 -0
- data/test/helper.rb +31 -15
- data/test/regress/bibtex +474 -0
- data/test/regress/cadenza +796 -0
- data/test/regress/cast +3425 -0
- data/test/regress/csspool +2318 -0
- data/test/regress/edtf +1794 -0
- data/test/regress/huia +1392 -0
- data/test/regress/journey +222 -0
- data/test/regress/liquor +885 -0
- data/test/regress/machete +833 -0
- data/test/regress/mediacloth +1463 -0
- data/test/regress/mof +1368 -0
- data/test/regress/namae +634 -0
- data/test/regress/nasl +2058 -0
- data/test/regress/nokogiri-css +836 -0
- data/test/regress/opal +6429 -0
- data/test/regress/php_serialization +336 -0
- data/test/regress/rdblockparser +1061 -0
- data/test/regress/rdinlineparser +1243 -0
- data/test/regress/riml +3297 -0
- data/test/regress/ruby18 +6351 -0
- data/test/regress/ruby22 +7456 -0
- data/test/regress/tp_plus +1933 -0
- data/test/regress/twowaysql +556 -0
- data/test/test_racc_command.rb +177 -0
- metadata +75 -20
@@ -0,0 +1,836 @@
|
|
1
|
+
#
|
2
|
+
# DO NOT MODIFY!!!!
|
3
|
+
# This file is automatically generated by Racc 1.4.14
|
4
|
+
# from Racc grammer file "".
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'racc/parser.rb'
|
8
|
+
|
9
|
+
|
10
|
+
require 'nokogiri/css/parser_extras'
|
11
|
+
module Nokogiri
|
12
|
+
module CSS
|
13
|
+
class Parser < Racc::Parser
|
14
|
+
##### State transition tables begin ###
|
15
|
+
|
16
|
+
racc_action_table = [
|
17
|
+
24, 93, 56, 57, 33, 55, 94, 23, 24, 22,
|
18
|
+
12, 93, 33, 27, 89, 52, 92, 22, -23, 25,
|
19
|
+
108, 98, 23, 33, 26, 18, 20, 25, 27, -23,
|
20
|
+
23, 24, 26, 18, 20, 33, 27, 11, 39, 24,
|
21
|
+
22, 23, 95, 33, 18, 101, 100, 27, 22, 12,
|
22
|
+
25, 91, 90, 23, 33, 26, 18, 20, 25, 27,
|
23
|
+
90, 23, 24, 26, 18, 20, 33, 27, 96, 39,
|
24
|
+
-23, 22, 23, 74, 24, 18, 33, 99, 27, 56,
|
25
|
+
87, 25, 60, 46, 23, 49, 26, 18, 20, 102,
|
26
|
+
27, 39, 24, 51, 23, 103, 93, 18, 26, 33,
|
27
|
+
27, 66, 44, 56, 58, 105, 60, 33, 35, 33,
|
28
|
+
109, 51, 56, 87, 39, 60, 26, 23, 85, 33,
|
29
|
+
18, 20, 39, 27, 39, 23, 45, 23, 18, 33,
|
30
|
+
18, 27, 86, 27, 39, 88, 33, 23, nil, nil,
|
31
|
+
18, 22, nil, 27, 39, 56, 87, 23, 60, nil,
|
32
|
+
18, 39, nil, 27, 23, 82, 83, 18, 20, nil,
|
33
|
+
27, nil, nil, nil, 82, 83, 78, 79, 80, nil,
|
34
|
+
81, nil, nil, nil, 77, 78, 79, 80, nil, 81,
|
35
|
+
4, 5, 43, 77, 4, 5, 10, nil, 56, 87,
|
36
|
+
6, 60, 8, 7, 6, nil, 8, 7, 4, 5,
|
37
|
+
10, nil, nil, nil, nil, nil, nil, nil, 6, nil,
|
38
|
+
8, 7 ]
|
39
|
+
|
40
|
+
racc_action_check = [
|
41
|
+
3, 58, 24, 24, 3, 24, 57, 15, 42, 3,
|
42
|
+
64, 57, 42, 15, 54, 24, 56, 42, 58, 3,
|
43
|
+
94, 64, 3, 31, 3, 3, 3, 42, 3, 22,
|
44
|
+
42, 9, 42, 42, 42, 9, 42, 1, 31, 43,
|
45
|
+
9, 31, 59, 43, 31, 76, 76, 31, 43, 1,
|
46
|
+
9, 55, 55, 9, 30, 9, 9, 9, 43, 9,
|
47
|
+
60, 43, 12, 43, 43, 43, 12, 43, 61, 30,
|
48
|
+
46, 12, 30, 45, 23, 30, 29, 75, 30, 93,
|
49
|
+
93, 12, 93, 23, 12, 23, 12, 12, 12, 84,
|
50
|
+
12, 29, 27, 23, 29, 86, 87, 29, 23, 25,
|
51
|
+
29, 27, 18, 25, 25, 91, 25, 28, 11, 62,
|
52
|
+
105, 27, 51, 51, 25, 51, 27, 25, 49, 14,
|
53
|
+
25, 25, 28, 25, 62, 28, 21, 62, 28, 32,
|
54
|
+
62, 28, 50, 62, 14, 53, 39, 14, nil, nil,
|
55
|
+
14, 39, nil, 14, 32, 90, 90, 32, 90, nil,
|
56
|
+
32, 39, nil, 32, 39, 47, 47, 39, 39, nil,
|
57
|
+
39, nil, nil, nil, 48, 48, 47, 47, 47, nil,
|
58
|
+
47, nil, nil, nil, 47, 48, 48, 48, nil, 48,
|
59
|
+
17, 17, 17, 48, 0, 0, 0, nil, 92, 92,
|
60
|
+
17, 92, 17, 17, 0, nil, 0, 0, 26, 26,
|
61
|
+
26, nil, nil, nil, nil, nil, nil, nil, 26, nil,
|
62
|
+
26, 26 ]
|
63
|
+
|
64
|
+
racc_action_pointer = [
|
65
|
+
177, 37, nil, -2, nil, nil, nil, nil, nil, 29,
|
66
|
+
nil, 108, 60, nil, 113, -17, nil, 173, 91, nil,
|
67
|
+
nil, 97, 0, 72, -8, 93, 191, 90, 101, 70,
|
68
|
+
48, 17, 123, nil, nil, nil, nil, nil, nil, 130,
|
69
|
+
nil, nil, 6, 37, nil, 62, 41, 152, 161, 93,
|
70
|
+
103, 102, nil, 112, -9, 40, 4, -1, -11, 19,
|
71
|
+
48, 45, 103, nil, -2, nil, nil, nil, nil, nil,
|
72
|
+
nil, nil, nil, nil, nil, 52, 35, nil, nil, nil,
|
73
|
+
nil, nil, nil, nil, 64, nil, 84, 84, nil, nil,
|
74
|
+
135, 98, 178, 69, 7, nil, nil, nil, nil, nil,
|
75
|
+
nil, nil, nil, nil, nil, 97, nil, nil, nil, nil ]
|
76
|
+
|
77
|
+
racc_action_default = [
|
78
|
+
-74, -75, -2, -24, -4, -5, -6, -7, -8, -24,
|
79
|
+
-73, -75, -24, -3, -47, -10, -13, -17, -75, -19,
|
80
|
+
-20, -75, -22, -24, -75, -24, -74, -75, -53, -54,
|
81
|
+
-55, -56, -57, -58, -14, 110, -1, -9, -46, -24,
|
82
|
+
-11, -12, -24, -24, -18, -75, -29, -61, -61, -75,
|
83
|
+
-75, -75, -30, -75, -75, -38, -39, -40, -22, -75,
|
84
|
+
-38, -75, -70, -72, -75, -44, -45, -48, -49, -50,
|
85
|
+
-51, -52, -15, -16, -21, -75, -75, -62, -63, -64,
|
86
|
+
-65, -66, -67, -68, -75, -27, -75, -40, -31, -32,
|
87
|
+
-75, -43, -75, -75, -75, -33, -69, -71, -34, -25,
|
88
|
+
-59, -60, -26, -28, -35, -75, -36, -37, -42, -41 ]
|
89
|
+
|
90
|
+
racc_goto_table = [
|
91
|
+
53, 38, 13, 1, 54, 48, 62, 42, 34, 65,
|
92
|
+
37, 36, 63, 75, 84, 67, 68, 69, 70, 71,
|
93
|
+
62, 40, 41, 50, 47, nil, 63, nil, nil, 64,
|
94
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
95
|
+
nil, 72, 73, nil, nil, nil, nil, nil, nil, 97,
|
96
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
97
|
+
nil, nil, nil, nil, nil, nil, 104, nil, 106, 107 ]
|
98
|
+
|
99
|
+
racc_goto_check = [
|
100
|
+
18, 12, 2, 1, 19, 9, 7, 5, 2, 9,
|
101
|
+
8, 2, 12, 17, 17, 12, 12, 12, 12, 12,
|
102
|
+
7, 10, 11, 15, 16, nil, 12, nil, nil, 1,
|
103
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
104
|
+
nil, 2, 2, nil, nil, nil, nil, nil, nil, 12,
|
105
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
106
|
+
nil, nil, nil, nil, nil, nil, 18, nil, 18, 18 ]
|
107
|
+
|
108
|
+
racc_goto_pointer = [
|
109
|
+
nil, 3, -1, nil, nil, -10, nil, -19, -4, -18,
|
110
|
+
6, 7, -13, nil, nil, 0, 1, -34, -24, -20,
|
111
|
+
nil, nil, nil, nil ]
|
112
|
+
|
113
|
+
racc_goto_default = [
|
114
|
+
nil, nil, nil, 2, 3, 9, 17, 14, nil, 15,
|
115
|
+
31, 30, 16, 29, 19, 21, nil, nil, 59, nil,
|
116
|
+
28, 32, 76, 61 ]
|
117
|
+
|
118
|
+
racc_reduce_table = [
|
119
|
+
0, 0, :racc_error,
|
120
|
+
3, 32, :_reduce_1,
|
121
|
+
1, 32, :_reduce_2,
|
122
|
+
2, 32, :_reduce_3,
|
123
|
+
1, 36, :_reduce_4,
|
124
|
+
1, 36, :_reduce_5,
|
125
|
+
1, 36, :_reduce_6,
|
126
|
+
1, 36, :_reduce_7,
|
127
|
+
1, 36, :_reduce_8,
|
128
|
+
2, 37, :_reduce_9,
|
129
|
+
1, 37, :_reduce_none,
|
130
|
+
2, 37, :_reduce_11,
|
131
|
+
2, 37, :_reduce_12,
|
132
|
+
1, 37, :_reduce_13,
|
133
|
+
2, 34, :_reduce_14,
|
134
|
+
3, 33, :_reduce_15,
|
135
|
+
3, 33, :_reduce_16,
|
136
|
+
1, 33, :_reduce_none,
|
137
|
+
2, 44, :_reduce_18,
|
138
|
+
1, 38, :_reduce_none,
|
139
|
+
1, 38, :_reduce_20,
|
140
|
+
3, 45, :_reduce_21,
|
141
|
+
1, 45, :_reduce_22,
|
142
|
+
1, 46, :_reduce_23,
|
143
|
+
0, 46, :_reduce_none,
|
144
|
+
4, 42, :_reduce_25,
|
145
|
+
4, 42, :_reduce_26,
|
146
|
+
3, 42, :_reduce_27,
|
147
|
+
3, 47, :_reduce_28,
|
148
|
+
1, 47, :_reduce_29,
|
149
|
+
2, 40, :_reduce_30,
|
150
|
+
3, 40, :_reduce_31,
|
151
|
+
3, 40, :_reduce_32,
|
152
|
+
3, 40, :_reduce_33,
|
153
|
+
3, 40, :_reduce_34,
|
154
|
+
3, 49, :_reduce_35,
|
155
|
+
3, 49, :_reduce_36,
|
156
|
+
3, 49, :_reduce_37,
|
157
|
+
1, 49, :_reduce_none,
|
158
|
+
1, 49, :_reduce_none,
|
159
|
+
1, 49, :_reduce_40,
|
160
|
+
4, 50, :_reduce_41,
|
161
|
+
3, 50, :_reduce_42,
|
162
|
+
2, 50, :_reduce_43,
|
163
|
+
2, 41, :_reduce_44,
|
164
|
+
2, 41, :_reduce_45,
|
165
|
+
1, 39, :_reduce_none,
|
166
|
+
0, 39, :_reduce_none,
|
167
|
+
2, 43, :_reduce_48,
|
168
|
+
2, 43, :_reduce_49,
|
169
|
+
2, 43, :_reduce_50,
|
170
|
+
2, 43, :_reduce_51,
|
171
|
+
2, 43, :_reduce_52,
|
172
|
+
1, 43, :_reduce_none,
|
173
|
+
1, 43, :_reduce_none,
|
174
|
+
1, 43, :_reduce_none,
|
175
|
+
1, 43, :_reduce_none,
|
176
|
+
1, 43, :_reduce_none,
|
177
|
+
1, 51, :_reduce_58,
|
178
|
+
2, 48, :_reduce_59,
|
179
|
+
2, 48, :_reduce_60,
|
180
|
+
0, 48, :_reduce_none,
|
181
|
+
1, 53, :_reduce_62,
|
182
|
+
1, 53, :_reduce_63,
|
183
|
+
1, 53, :_reduce_64,
|
184
|
+
1, 53, :_reduce_65,
|
185
|
+
1, 53, :_reduce_66,
|
186
|
+
1, 53, :_reduce_67,
|
187
|
+
1, 53, :_reduce_68,
|
188
|
+
3, 52, :_reduce_69,
|
189
|
+
1, 54, :_reduce_none,
|
190
|
+
2, 54, :_reduce_none,
|
191
|
+
1, 54, :_reduce_none,
|
192
|
+
1, 35, :_reduce_none,
|
193
|
+
0, 35, :_reduce_none ]
|
194
|
+
|
195
|
+
racc_reduce_n = 75
|
196
|
+
|
197
|
+
racc_shift_n = 110
|
198
|
+
|
199
|
+
racc_token_table = {
|
200
|
+
false => 0,
|
201
|
+
:error => 1,
|
202
|
+
:FUNCTION => 2,
|
203
|
+
:INCLUDES => 3,
|
204
|
+
:DASHMATCH => 4,
|
205
|
+
:LBRACE => 5,
|
206
|
+
:HASH => 6,
|
207
|
+
:PLUS => 7,
|
208
|
+
:GREATER => 8,
|
209
|
+
:S => 9,
|
210
|
+
:STRING => 10,
|
211
|
+
:IDENT => 11,
|
212
|
+
:COMMA => 12,
|
213
|
+
:NUMBER => 13,
|
214
|
+
:PREFIXMATCH => 14,
|
215
|
+
:SUFFIXMATCH => 15,
|
216
|
+
:SUBSTRINGMATCH => 16,
|
217
|
+
:TILDE => 17,
|
218
|
+
:NOT_EQUAL => 18,
|
219
|
+
:SLASH => 19,
|
220
|
+
:DOUBLESLASH => 20,
|
221
|
+
:NOT => 21,
|
222
|
+
:EQUAL => 22,
|
223
|
+
:RPAREN => 23,
|
224
|
+
:LSQUARE => 24,
|
225
|
+
:RSQUARE => 25,
|
226
|
+
:HAS => 26,
|
227
|
+
"." => 27,
|
228
|
+
"*" => 28,
|
229
|
+
"|" => 29,
|
230
|
+
":" => 30 }
|
231
|
+
|
232
|
+
racc_nt_base = 31
|
233
|
+
|
234
|
+
racc_use_result_var = true
|
235
|
+
|
236
|
+
Racc_arg = [
|
237
|
+
racc_action_table,
|
238
|
+
racc_action_check,
|
239
|
+
racc_action_default,
|
240
|
+
racc_action_pointer,
|
241
|
+
racc_goto_table,
|
242
|
+
racc_goto_check,
|
243
|
+
racc_goto_default,
|
244
|
+
racc_goto_pointer,
|
245
|
+
racc_nt_base,
|
246
|
+
racc_reduce_table,
|
247
|
+
racc_token_table,
|
248
|
+
racc_shift_n,
|
249
|
+
racc_reduce_n,
|
250
|
+
racc_use_result_var ]
|
251
|
+
|
252
|
+
Racc_token_to_s_table = [
|
253
|
+
"$end",
|
254
|
+
"error",
|
255
|
+
"FUNCTION",
|
256
|
+
"INCLUDES",
|
257
|
+
"DASHMATCH",
|
258
|
+
"LBRACE",
|
259
|
+
"HASH",
|
260
|
+
"PLUS",
|
261
|
+
"GREATER",
|
262
|
+
"S",
|
263
|
+
"STRING",
|
264
|
+
"IDENT",
|
265
|
+
"COMMA",
|
266
|
+
"NUMBER",
|
267
|
+
"PREFIXMATCH",
|
268
|
+
"SUFFIXMATCH",
|
269
|
+
"SUBSTRINGMATCH",
|
270
|
+
"TILDE",
|
271
|
+
"NOT_EQUAL",
|
272
|
+
"SLASH",
|
273
|
+
"DOUBLESLASH",
|
274
|
+
"NOT",
|
275
|
+
"EQUAL",
|
276
|
+
"RPAREN",
|
277
|
+
"LSQUARE",
|
278
|
+
"RSQUARE",
|
279
|
+
"HAS",
|
280
|
+
"\".\"",
|
281
|
+
"\"*\"",
|
282
|
+
"\"|\"",
|
283
|
+
"\":\"",
|
284
|
+
"$start",
|
285
|
+
"selector",
|
286
|
+
"simple_selector_1toN",
|
287
|
+
"prefixless_combinator_selector",
|
288
|
+
"optional_S",
|
289
|
+
"combinator",
|
290
|
+
"simple_selector",
|
291
|
+
"element_name",
|
292
|
+
"hcap_0toN",
|
293
|
+
"function",
|
294
|
+
"pseudo",
|
295
|
+
"attrib",
|
296
|
+
"hcap_1toN",
|
297
|
+
"class",
|
298
|
+
"namespaced_ident",
|
299
|
+
"namespace",
|
300
|
+
"attrib_name",
|
301
|
+
"attrib_val_0or1",
|
302
|
+
"expr",
|
303
|
+
"nth",
|
304
|
+
"attribute_id",
|
305
|
+
"negation",
|
306
|
+
"eql_incl_dash",
|
307
|
+
"negation_arg" ]
|
308
|
+
|
309
|
+
Racc_debug_parser = false
|
310
|
+
|
311
|
+
##### State transition tables end #####
|
312
|
+
|
313
|
+
# reduce 0 omitted
|
314
|
+
|
315
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 9)
|
316
|
+
def _reduce_1(val, _values, result)
|
317
|
+
result = [val.first, val.last].flatten
|
318
|
+
|
319
|
+
result
|
320
|
+
end
|
321
|
+
.,.,
|
322
|
+
|
323
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 11)
|
324
|
+
def _reduce_2(val, _values, result)
|
325
|
+
result = val.flatten
|
326
|
+
result
|
327
|
+
end
|
328
|
+
.,.,
|
329
|
+
|
330
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 12)
|
331
|
+
def _reduce_3(val, _values, result)
|
332
|
+
result = [val.last].flatten
|
333
|
+
result
|
334
|
+
end
|
335
|
+
.,.,
|
336
|
+
|
337
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 15)
|
338
|
+
def _reduce_4(val, _values, result)
|
339
|
+
result = :DIRECT_ADJACENT_SELECTOR
|
340
|
+
result
|
341
|
+
end
|
342
|
+
.,.,
|
343
|
+
|
344
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 16)
|
345
|
+
def _reduce_5(val, _values, result)
|
346
|
+
result = :CHILD_SELECTOR
|
347
|
+
result
|
348
|
+
end
|
349
|
+
.,.,
|
350
|
+
|
351
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 17)
|
352
|
+
def _reduce_6(val, _values, result)
|
353
|
+
result = :FOLLOWING_SELECTOR
|
354
|
+
result
|
355
|
+
end
|
356
|
+
.,.,
|
357
|
+
|
358
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 18)
|
359
|
+
def _reduce_7(val, _values, result)
|
360
|
+
result = :DESCENDANT_SELECTOR
|
361
|
+
result
|
362
|
+
end
|
363
|
+
.,.,
|
364
|
+
|
365
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 19)
|
366
|
+
def _reduce_8(val, _values, result)
|
367
|
+
result = :CHILD_SELECTOR
|
368
|
+
result
|
369
|
+
end
|
370
|
+
.,.,
|
371
|
+
|
372
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 23)
|
373
|
+
def _reduce_9(val, _values, result)
|
374
|
+
result = if val[1].nil?
|
375
|
+
val.first
|
376
|
+
else
|
377
|
+
Node.new(:CONDITIONAL_SELECTOR, [val.first, val[1]])
|
378
|
+
end
|
379
|
+
|
380
|
+
result
|
381
|
+
end
|
382
|
+
.,.,
|
383
|
+
|
384
|
+
# reduce 10 omitted
|
385
|
+
|
386
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 31)
|
387
|
+
def _reduce_11(val, _values, result)
|
388
|
+
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
389
|
+
|
390
|
+
result
|
391
|
+
end
|
392
|
+
.,.,
|
393
|
+
|
394
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 34)
|
395
|
+
def _reduce_12(val, _values, result)
|
396
|
+
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
397
|
+
|
398
|
+
result
|
399
|
+
end
|
400
|
+
.,.,
|
401
|
+
|
402
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 37)
|
403
|
+
def _reduce_13(val, _values, result)
|
404
|
+
result = Node.new(:CONDITIONAL_SELECTOR,
|
405
|
+
[Node.new(:ELEMENT_NAME, ['*']), val.first]
|
406
|
+
)
|
407
|
+
|
408
|
+
result
|
409
|
+
end
|
410
|
+
.,.,
|
411
|
+
|
412
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 44)
|
413
|
+
def _reduce_14(val, _values, result)
|
414
|
+
result = Node.new(val.first, [nil, val.last])
|
415
|
+
|
416
|
+
result
|
417
|
+
end
|
418
|
+
.,.,
|
419
|
+
|
420
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 49)
|
421
|
+
def _reduce_15(val, _values, result)
|
422
|
+
result = Node.new(val[1], [val.first, val.last])
|
423
|
+
|
424
|
+
result
|
425
|
+
end
|
426
|
+
.,.,
|
427
|
+
|
428
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 52)
|
429
|
+
def _reduce_16(val, _values, result)
|
430
|
+
result = Node.new(:DESCENDANT_SELECTOR, [val.first, val.last])
|
431
|
+
|
432
|
+
result
|
433
|
+
end
|
434
|
+
.,.,
|
435
|
+
|
436
|
+
# reduce 17 omitted
|
437
|
+
|
438
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 57)
|
439
|
+
def _reduce_18(val, _values, result)
|
440
|
+
result = Node.new(:CLASS_CONDITION, [val[1]])
|
441
|
+
result
|
442
|
+
end
|
443
|
+
.,.,
|
444
|
+
|
445
|
+
# reduce 19 omitted
|
446
|
+
|
447
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 61)
|
448
|
+
def _reduce_20(val, _values, result)
|
449
|
+
result = Node.new(:ELEMENT_NAME, val)
|
450
|
+
result
|
451
|
+
end
|
452
|
+
.,.,
|
453
|
+
|
454
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 65)
|
455
|
+
def _reduce_21(val, _values, result)
|
456
|
+
result = Node.new(:ELEMENT_NAME,
|
457
|
+
[[val.first, val.last].compact.join(':')]
|
458
|
+
)
|
459
|
+
|
460
|
+
result
|
461
|
+
end
|
462
|
+
.,.,
|
463
|
+
|
464
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 70)
|
465
|
+
def _reduce_22(val, _values, result)
|
466
|
+
name = @namespaces.key?('xmlns') ? "xmlns:#{val.first}" : val.first
|
467
|
+
result = Node.new(:ELEMENT_NAME, [name])
|
468
|
+
|
469
|
+
result
|
470
|
+
end
|
471
|
+
.,.,
|
472
|
+
|
473
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 75)
|
474
|
+
def _reduce_23(val, _values, result)
|
475
|
+
result = val[0]
|
476
|
+
result
|
477
|
+
end
|
478
|
+
.,.,
|
479
|
+
|
480
|
+
# reduce 24 omitted
|
481
|
+
|
482
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 80)
|
483
|
+
def _reduce_25(val, _values, result)
|
484
|
+
result = Node.new(:ATTRIBUTE_CONDITION,
|
485
|
+
[val[1]] + (val[2] || [])
|
486
|
+
)
|
487
|
+
|
488
|
+
result
|
489
|
+
end
|
490
|
+
.,.,
|
491
|
+
|
492
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 85)
|
493
|
+
def _reduce_26(val, _values, result)
|
494
|
+
result = Node.new(:ATTRIBUTE_CONDITION,
|
495
|
+
[val[1]] + (val[2] || [])
|
496
|
+
)
|
497
|
+
|
498
|
+
result
|
499
|
+
end
|
500
|
+
.,.,
|
501
|
+
|
502
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 90)
|
503
|
+
def _reduce_27(val, _values, result)
|
504
|
+
# Non standard, but hpricot supports it.
|
505
|
+
result = Node.new(:PSEUDO_CLASS,
|
506
|
+
[Node.new(:FUNCTION, ['nth-child(', val[1]])]
|
507
|
+
)
|
508
|
+
|
509
|
+
result
|
510
|
+
end
|
511
|
+
.,.,
|
512
|
+
|
513
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 98)
|
514
|
+
def _reduce_28(val, _values, result)
|
515
|
+
result = Node.new(:ELEMENT_NAME,
|
516
|
+
[[val.first, val.last].compact.join(':')]
|
517
|
+
)
|
518
|
+
|
519
|
+
result
|
520
|
+
end
|
521
|
+
.,.,
|
522
|
+
|
523
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 103)
|
524
|
+
def _reduce_29(val, _values, result)
|
525
|
+
# Default namespace is not applied to attributes.
|
526
|
+
# So we don't add prefix "xmlns:" as in namespaced_ident.
|
527
|
+
result = Node.new(:ELEMENT_NAME, [val.first])
|
528
|
+
|
529
|
+
result
|
530
|
+
end
|
531
|
+
.,.,
|
532
|
+
|
533
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 110)
|
534
|
+
def _reduce_30(val, _values, result)
|
535
|
+
result = Node.new(:FUNCTION, [val.first.strip])
|
536
|
+
|
537
|
+
result
|
538
|
+
end
|
539
|
+
.,.,
|
540
|
+
|
541
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 113)
|
542
|
+
def _reduce_31(val, _values, result)
|
543
|
+
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
544
|
+
|
545
|
+
result
|
546
|
+
end
|
547
|
+
.,.,
|
548
|
+
|
549
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 116)
|
550
|
+
def _reduce_32(val, _values, result)
|
551
|
+
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
552
|
+
|
553
|
+
result
|
554
|
+
end
|
555
|
+
.,.,
|
556
|
+
|
557
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 119)
|
558
|
+
def _reduce_33(val, _values, result)
|
559
|
+
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
560
|
+
|
561
|
+
result
|
562
|
+
end
|
563
|
+
.,.,
|
564
|
+
|
565
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 122)
|
566
|
+
def _reduce_34(val, _values, result)
|
567
|
+
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
568
|
+
|
569
|
+
result
|
570
|
+
end
|
571
|
+
.,.,
|
572
|
+
|
573
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 126)
|
574
|
+
def _reduce_35(val, _values, result)
|
575
|
+
result = [val.first, val.last]
|
576
|
+
result
|
577
|
+
end
|
578
|
+
.,.,
|
579
|
+
|
580
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 127)
|
581
|
+
def _reduce_36(val, _values, result)
|
582
|
+
result = [val.first, val.last]
|
583
|
+
result
|
584
|
+
end
|
585
|
+
.,.,
|
586
|
+
|
587
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 128)
|
588
|
+
def _reduce_37(val, _values, result)
|
589
|
+
result = [val.first, val.last]
|
590
|
+
result
|
591
|
+
end
|
592
|
+
.,.,
|
593
|
+
|
594
|
+
# reduce 38 omitted
|
595
|
+
|
596
|
+
# reduce 39 omitted
|
597
|
+
|
598
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 133)
|
599
|
+
def _reduce_40(val, _values, result)
|
600
|
+
case val[0]
|
601
|
+
when 'even'
|
602
|
+
result = Node.new(:NTH, ['2','n','+','0'])
|
603
|
+
when 'odd'
|
604
|
+
result = Node.new(:NTH, ['2','n','+','1'])
|
605
|
+
when 'n'
|
606
|
+
result = Node.new(:NTH, ['1','n','+','0'])
|
607
|
+
else
|
608
|
+
# This is not CSS standard. It allows us to support this:
|
609
|
+
# assert_xpath("//a[foo(., @href)]", @parser.parse('a:foo(@href)'))
|
610
|
+
# assert_xpath("//a[foo(., @a, b)]", @parser.parse('a:foo(@a, b)'))
|
611
|
+
# assert_xpath("//a[foo(., a, 10)]", @parser.parse('a:foo(a, 10)'))
|
612
|
+
result = val
|
613
|
+
end
|
614
|
+
|
615
|
+
result
|
616
|
+
end
|
617
|
+
.,.,
|
618
|
+
|
619
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 152)
|
620
|
+
def _reduce_41(val, _values, result)
|
621
|
+
if val[1] == 'n'
|
622
|
+
result = Node.new(:NTH, val)
|
623
|
+
else
|
624
|
+
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
625
|
+
end
|
626
|
+
|
627
|
+
result
|
628
|
+
end
|
629
|
+
.,.,
|
630
|
+
|
631
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 158)
|
632
|
+
def _reduce_42(val, _values, result)
|
633
|
+
# n+3, -n+3
|
634
|
+
if val[0] == 'n'
|
635
|
+
val.unshift("1")
|
636
|
+
result = Node.new(:NTH, val)
|
637
|
+
elsif val[0] == '-n'
|
638
|
+
val[0] = 'n'
|
639
|
+
val.unshift("-1")
|
640
|
+
result = Node.new(:NTH, val)
|
641
|
+
else
|
642
|
+
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
643
|
+
end
|
644
|
+
|
645
|
+
result
|
646
|
+
end
|
647
|
+
.,.,
|
648
|
+
|
649
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 170)
|
650
|
+
def _reduce_43(val, _values, result)
|
651
|
+
# 5n, -5n, 10n-1
|
652
|
+
n = val[1]
|
653
|
+
if n[0, 2] == 'n-'
|
654
|
+
val[1] = 'n'
|
655
|
+
val << "-"
|
656
|
+
# b is contained in n as n is the string "n-b"
|
657
|
+
val << n[2, n.size]
|
658
|
+
result = Node.new(:NTH, val)
|
659
|
+
elsif n == 'n'
|
660
|
+
val << "+"
|
661
|
+
val << "0"
|
662
|
+
result = Node.new(:NTH, val)
|
663
|
+
else
|
664
|
+
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
665
|
+
end
|
666
|
+
|
667
|
+
result
|
668
|
+
end
|
669
|
+
.,.,
|
670
|
+
|
671
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 189)
|
672
|
+
def _reduce_44(val, _values, result)
|
673
|
+
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
674
|
+
|
675
|
+
result
|
676
|
+
end
|
677
|
+
.,.,
|
678
|
+
|
679
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 191)
|
680
|
+
def _reduce_45(val, _values, result)
|
681
|
+
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
682
|
+
result
|
683
|
+
end
|
684
|
+
.,.,
|
685
|
+
|
686
|
+
# reduce 46 omitted
|
687
|
+
|
688
|
+
# reduce 47 omitted
|
689
|
+
|
690
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 199)
|
691
|
+
def _reduce_48(val, _values, result)
|
692
|
+
result = Node.new(:COMBINATOR, val)
|
693
|
+
|
694
|
+
result
|
695
|
+
end
|
696
|
+
.,.,
|
697
|
+
|
698
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 202)
|
699
|
+
def _reduce_49(val, _values, result)
|
700
|
+
result = Node.new(:COMBINATOR, val)
|
701
|
+
|
702
|
+
result
|
703
|
+
end
|
704
|
+
.,.,
|
705
|
+
|
706
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 205)
|
707
|
+
def _reduce_50(val, _values, result)
|
708
|
+
result = Node.new(:COMBINATOR, val)
|
709
|
+
|
710
|
+
result
|
711
|
+
end
|
712
|
+
.,.,
|
713
|
+
|
714
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 208)
|
715
|
+
def _reduce_51(val, _values, result)
|
716
|
+
result = Node.new(:COMBINATOR, val)
|
717
|
+
|
718
|
+
result
|
719
|
+
end
|
720
|
+
.,.,
|
721
|
+
|
722
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 211)
|
723
|
+
def _reduce_52(val, _values, result)
|
724
|
+
result = Node.new(:COMBINATOR, val)
|
725
|
+
|
726
|
+
result
|
727
|
+
end
|
728
|
+
.,.,
|
729
|
+
|
730
|
+
# reduce 53 omitted
|
731
|
+
|
732
|
+
# reduce 54 omitted
|
733
|
+
|
734
|
+
# reduce 55 omitted
|
735
|
+
|
736
|
+
# reduce 56 omitted
|
737
|
+
|
738
|
+
# reduce 57 omitted
|
739
|
+
|
740
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 220)
|
741
|
+
def _reduce_58(val, _values, result)
|
742
|
+
result = Node.new(:ID, val)
|
743
|
+
result
|
744
|
+
end
|
745
|
+
.,.,
|
746
|
+
|
747
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 223)
|
748
|
+
def _reduce_59(val, _values, result)
|
749
|
+
result = [val.first, val[1]]
|
750
|
+
result
|
751
|
+
end
|
752
|
+
.,.,
|
753
|
+
|
754
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 224)
|
755
|
+
def _reduce_60(val, _values, result)
|
756
|
+
result = [val.first, val[1]]
|
757
|
+
result
|
758
|
+
end
|
759
|
+
.,.,
|
760
|
+
|
761
|
+
# reduce 61 omitted
|
762
|
+
|
763
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 228)
|
764
|
+
def _reduce_62(val, _values, result)
|
765
|
+
result = :equal
|
766
|
+
result
|
767
|
+
end
|
768
|
+
.,.,
|
769
|
+
|
770
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 229)
|
771
|
+
def _reduce_63(val, _values, result)
|
772
|
+
result = :prefix_match
|
773
|
+
result
|
774
|
+
end
|
775
|
+
.,.,
|
776
|
+
|
777
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 230)
|
778
|
+
def _reduce_64(val, _values, result)
|
779
|
+
result = :suffix_match
|
780
|
+
result
|
781
|
+
end
|
782
|
+
.,.,
|
783
|
+
|
784
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 231)
|
785
|
+
def _reduce_65(val, _values, result)
|
786
|
+
result = :substring_match
|
787
|
+
result
|
788
|
+
end
|
789
|
+
.,.,
|
790
|
+
|
791
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 232)
|
792
|
+
def _reduce_66(val, _values, result)
|
793
|
+
result = :not_equal
|
794
|
+
result
|
795
|
+
end
|
796
|
+
.,.,
|
797
|
+
|
798
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 233)
|
799
|
+
def _reduce_67(val, _values, result)
|
800
|
+
result = :includes
|
801
|
+
result
|
802
|
+
end
|
803
|
+
.,.,
|
804
|
+
|
805
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 234)
|
806
|
+
def _reduce_68(val, _values, result)
|
807
|
+
result = :dash_match
|
808
|
+
result
|
809
|
+
end
|
810
|
+
.,.,
|
811
|
+
|
812
|
+
module_eval(<<'.,.,', 'nokogiri-css.y', 238)
|
813
|
+
def _reduce_69(val, _values, result)
|
814
|
+
result = Node.new(:NOT, [val[1]])
|
815
|
+
|
816
|
+
result
|
817
|
+
end
|
818
|
+
.,.,
|
819
|
+
|
820
|
+
# reduce 70 omitted
|
821
|
+
|
822
|
+
# reduce 71 omitted
|
823
|
+
|
824
|
+
# reduce 72 omitted
|
825
|
+
|
826
|
+
# reduce 73 omitted
|
827
|
+
|
828
|
+
# reduce 74 omitted
|
829
|
+
|
830
|
+
def _reduce_none(val, _values, result)
|
831
|
+
val[0]
|
832
|
+
end
|
833
|
+
|
834
|
+
end # class Parser
|
835
|
+
end # module CSS
|
836
|
+
end # module Nokogiri
|