synvert-core 1.1.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,179 +25,88 @@ module Synvert
25
25
  ##### State transition tables begin ###
26
26
 
27
27
  racc_action_table = [
28
- 6, 18, 19, 9, 59, 20, 21, 8, 6, 28,
29
- 29, 8, 59, 51, 6, 49, 6, 23, 24, 8,
30
- 59, 51, 3, 4, 5, 8, 30, 8, 31, 51,
31
- 32, 44, 52, 53, 54, 55, 56, 57, 58, 8,
32
- 52, 53, 54, 55, 56, 57, 58, 69, 52, 53,
33
- 54, 55, 56, 57, 58, 6, 70, 72, 73, 59,
34
- 77, 84, 85, 6, 86, 87, 8, 59, 51, 6,
35
- 88, 6, 89, 90, 8, 59, 51, 10, 11, 12,
36
- 8, nil, 8, nil, 51, nil, nil, 52, 53, 54,
37
- 55, 56, 57, 58, nil, 52, 53, 54, 55, 56,
38
- 57, 58, nil, 52, 53, 54, 55, 56, 57, 58,
39
- 6, nil, nil, nil, 59, nil, nil, nil, 6, nil,
40
- nil, 8, 59, 51, nil, nil, 6, nil, nil, 8,
41
- 59, 51, nil, 67, nil, nil, nil, 8, nil, 51,
42
- nil, nil, 52, 53, 54, 55, 56, 57, 58, nil,
43
- 52, 53, 54, 55, 56, 57, 58, nil, 52, 53,
44
- 54, 55, 56, 57, 58, 6, nil, nil, nil, 59,
45
- nil, nil, nil, 6, nil, nil, 8, 59, 51, nil,
46
- nil, 74, 6, nil, 8, nil, 51, nil, nil, 78,
47
- 3, 4, 5, 8, nil, nil, nil, 52, 53, 54,
48
- 55, 56, 57, 58, nil, 52, 53, 54, 55, 56,
49
- 57, 58, 6, nil, nil, nil, 59, nil, nil, nil,
50
- 6, nil, nil, 8, 59, 51, nil, nil, 80, 6,
51
- 6, 8, nil, 51, 59, nil, 82, 3, 4, 5,
52
- 8, 8, nil, 51, 52, 53, 54, 55, 56, 57,
53
- 58, nil, 52, 53, 54, 55, 56, 57, 58, nil,
54
- nil, 6, 52, 53, 54, 55, 56, 57, 58, 3,
55
- 4, 5, 8, 6, nil, nil, nil, 6, nil, nil,
56
- nil, 3, 4, 5, 8, 3, 4, 5, 8, 6,
57
- nil, nil, nil, 6, nil, nil, nil, 3, 4, 5,
58
- 8, 3, 4, 5, 8, 6, nil, nil, nil, 6,
59
- nil, nil, nil, 3, 4, 5, 8, 3, 4, 5,
60
- 8, 40, 33, 35, 34, 37, 36, 39, 38, 43,
61
- 42, 41 ]
28
+ 7, 8, 7, 12, 41, 10, 11, 7, 4, 5,
29
+ 33, 41, 31, 14, 16, 17, 18, 33, 6, 20,
30
+ 42, 34, 35, 36, 37, 38, 39, 40, 34, 35,
31
+ 36, 37, 38, 39, 40, 7, 7, 22, 24, 41,
32
+ 26, 27, 4, 5, 28, 33, 16, 7, 45, 46,
33
+ 48, nil, 6, 4, 5, nil, 34, 35, 36, 37,
34
+ 38, 39, 40, 6, 7, nil, 7, nil, 7, nil,
35
+ 4, 5, 4, 5, 4, 5, nil, nil, nil, nil,
36
+ 6, nil, 6, nil, 6 ]
62
37
 
63
38
  racc_action_check = [
64
- 33, 6, 6, 1, 33, 7, 7, 6, 34, 17,
65
- 17, 33, 34, 33, 0, 33, 35, 8, 9, 34,
66
- 35, 34, 0, 0, 0, 0, 19, 35, 21, 35,
67
- 22, 29, 33, 33, 33, 33, 33, 33, 33, 32,
68
- 34, 34, 34, 34, 34, 34, 34, 42, 35, 35,
69
- 35, 35, 35, 35, 35, 36, 43, 45, 46, 36,
70
- 51, 71, 75, 37, 76, 77, 36, 37, 36, 2,
71
- 79, 38, 81, 83, 37, 38, 37, 2, 2, 2,
72
- 2, nil, 38, nil, 38, nil, nil, 36, 36, 36,
73
- 36, 36, 36, 36, nil, 37, 37, 37, 37, 37,
74
- 37, 37, nil, 38, 38, 38, 38, 38, 38, 38,
75
- 39, nil, nil, nil, 39, nil, nil, nil, 40, nil,
76
- nil, 39, 40, 39, nil, nil, 41, nil, nil, 40,
77
- 41, 40, nil, 40, nil, nil, nil, 41, nil, 41,
78
- nil, nil, 39, 39, 39, 39, 39, 39, 39, nil,
79
- 40, 40, 40, 40, 40, 40, 40, nil, 41, 41,
80
- 41, 41, 41, 41, 41, 49, nil, nil, nil, 49,
81
- nil, nil, nil, 67, nil, nil, 49, 67, 49, nil,
82
- nil, 49, 3, nil, 67, nil, 67, nil, nil, 67,
83
- 3, 3, 3, 3, nil, nil, nil, 49, 49, 49,
84
- 49, 49, 49, 49, nil, 67, 67, 67, 67, 67,
85
- 67, 67, 69, nil, nil, nil, 69, nil, nil, nil,
86
- 70, nil, nil, 69, 70, 69, nil, nil, 69, 4,
87
- 86, 70, nil, 70, 86, nil, 70, 4, 4, 4,
88
- 4, 86, nil, 86, 69, 69, 69, 69, 69, 69,
89
- 69, nil, 70, 70, 70, 70, 70, 70, 70, nil,
90
- nil, 5, 86, 86, 86, 86, 86, 86, 86, 5,
91
- 5, 5, 5, 10, nil, nil, nil, 11, nil, nil,
92
- nil, 10, 10, 10, 10, 11, 11, 11, 11, 12,
93
- nil, nil, nil, 30, nil, nil, nil, 12, 12, 12,
94
- 12, 30, 30, 30, 30, 31, nil, nil, nil, 44,
95
- nil, nil, nil, 31, 31, 31, 31, 44, 44, 44,
96
- 44, 23, 23, 23, 23, 23, 23, 23, 23, 23,
97
- 23, 23 ]
39
+ 27, 1, 0, 4, 27, 3, 3, 31, 0, 0,
40
+ 27, 31, 27, 6, 7, 8, 11, 31, 0, 14,
41
+ 31, 27, 27, 27, 27, 27, 27, 27, 31, 31,
42
+ 31, 31, 31, 31, 31, 44, 2, 16, 19, 44,
43
+ 21, 22, 2, 2, 23, 44, 26, 5, 33, 43,
44
+ 45, nil, 2, 5, 5, nil, 44, 44, 44, 44,
45
+ 44, 44, 44, 5, 12, nil, 18, nil, 20, nil,
46
+ 12, 12, 18, 18, 20, 20, nil, nil, nil, nil,
47
+ 12, nil, 18, nil, 20 ]
98
48
 
99
49
  racc_action_pointer = [
100
- 12, 3, 67, 180, 227, 259, -6, -2, 13, 18,
101
- 271, 275, 287, nil, nil, nil, nil, 2, nil, 7,
102
- nil, 9, 16, 300, nil, nil, nil, nil, nil, 12,
103
- 291, 303, 26, -2, 6, 14, 53, 61, 69, 108,
104
- 116, 124, 30, 39, 307, 37, 38, nil, nil, 163,
105
- nil, 27, nil, nil, nil, nil, nil, nil, nil, nil,
106
- nil, nil, nil, nil, nil, nil, nil, 171, nil, 210,
107
- 218, 41, nil, nil, nil, 44, 55, 49, nil, 52,
108
- nil, 54, nil, 55, nil, nil, 228, nil, nil, nil,
109
- nil, nil ]
50
+ 0, 1, 34, -2, -13, 45, 8, 4, 15, nil,
51
+ nil, 0, 62, nil, 0, nil, 33, nil, 64, 21,
52
+ 66, 29, 21, 27, nil, nil, 36, -2, nil, nil,
53
+ nil, 5, nil, 26, nil, nil, nil, nil, nil, nil,
54
+ nil, nil, nil, 34, 33, 37, nil, nil, nil ]
110
55
 
111
56
  racc_action_default = [
112
- -49, -49, -5, -49, -49, -49, -16, -17, -49, -49,
113
- -49, -49, -49, -4, -6, -7, -8, -15, -10, -49,
114
- -11, -49, -49, -49, 92, -1, -2, -3, -9, -49,
115
- -49, -49, -19, -49, -49, -49, -49, -49, -49, -49,
116
- -49, -49, -49, -49, -49, -49, -49, -18, -20, -49,
117
- -39, -49, -41, -42, -43, -44, -45, -46, -47, -48,
118
- -21, -22, -23, -24, -25, -26, -27, -49, -28, -49,
119
- -49, -49, -13, -14, -29, -49, -38, -49, -30, -49,
120
- -31, -49, -32, -49, -12, -33, -49, -40, -34, -35,
121
- -36, -37 ]
57
+ -28, -28, -2, -3, -28, -28, -28, -9, -28, -1,
58
+ -4, -28, -28, -7, -28, -10, -28, 49, -28, -28,
59
+ -28, -28, -28, -28, -6, -8, -12, -28, -5, -11,
60
+ -13, -28, -18, -28, -20, -21, -22, -23, -24, -25,
61
+ -26, -27, -14, -28, -17, -28, -15, -16, -19 ]
122
62
 
123
63
  racc_goto_table = [
124
- 1, 22, 13, 14, 15, 16, nil, 17, nil, nil,
125
- 25, 26, 27, nil, 75, 2, nil, 2, 2, 2,
126
- 2, nil, nil, nil, nil, 2, 2, 2, nil, nil,
127
- 45, 46, 79, 47, 81, 83, nil, nil, nil, nil,
128
- nil, nil, nil, nil, 71, 2, 2, nil, nil, nil,
129
- nil, 91, nil, nil, nil, nil, nil, nil, nil, 2,
130
- 48, 60, 61, 62, 63, 64, 65, 66, 68 ]
64
+ 15, 32, 13, 43, 1, 32, 9, 21, 30, 19,
65
+ nil, nil, nil, nil, nil, 23, 47, 25, 32, 29 ]
131
66
 
132
67
  racc_goto_check = [
133
- 1, 4, 1, 1, 1, 1, nil, 3, nil, nil,
134
- 1, 1, 1, nil, 6, 2, nil, 2, 2, 2,
135
- 2, nil, nil, nil, nil, 2, 2, 2, nil, nil,
136
- 1, 1, 6, 3, 6, 6, nil, nil, nil, nil,
137
- nil, nil, nil, nil, 1, 2, 2, nil, nil, nil,
138
- nil, 6, nil, nil, nil, nil, nil, nil, nil, 2,
139
- 5, 5, 5, 5, 5, 5, 5, 5, 5 ]
68
+ 4, 3, 2, 7, 1, 3, 1, 5, 6, 2,
69
+ nil, nil, nil, nil, nil, 2, 7, 2, 3, 4 ]
140
70
 
141
71
  racc_goto_pointer = [
142
- nil, 0, 15, 1, -7, 27, -35 ]
72
+ nil, 4, -3, -26, -7, -9, -19, -28 ]
143
73
 
144
74
  racc_goto_default = [
145
- nil, nil, 50, 7, nil, 76, nil ]
75
+ nil, nil, 2, 3, nil, nil, 44, nil ]
146
76
 
147
77
  racc_reduce_table = [
148
78
  0, 0, :racc_error,
149
- 3, 42, :_reduce_1,
150
- 3, 42, :_reduce_2,
151
- 3, 42, :_reduce_3,
152
- 2, 42, :_reduce_4,
153
- 1, 42, :_reduce_5,
154
- 2, 42, :_reduce_6,
155
- 2, 42, :_reduce_7,
156
- 2, 42, :_reduce_8,
157
- 3, 43, :_reduce_9,
158
- 2, 43, :_reduce_10,
159
- 2, 43, :_reduce_11,
160
- 6, 43, :_reduce_12,
161
- 5, 43, :_reduce_13,
162
- 5, 43, :_reduce_14,
163
- 2, 43, :_reduce_15,
164
- 1, 43, :_reduce_16,
165
- 1, 43, :_reduce_17,
166
- 4, 44, :_reduce_18,
167
- 3, 44, :_reduce_19,
168
- 3, 45, :_reduce_20,
169
- 3, 45, :_reduce_21,
170
- 3, 45, :_reduce_22,
171
- 3, 45, :_reduce_23,
172
- 3, 45, :_reduce_24,
173
- 3, 45, :_reduce_25,
174
- 3, 45, :_reduce_26,
175
- 3, 45, :_reduce_27,
176
- 3, 45, :_reduce_28,
177
- 4, 45, :_reduce_29,
178
- 4, 45, :_reduce_30,
179
- 4, 45, :_reduce_31,
180
- 4, 45, :_reduce_32,
181
- 5, 45, :_reduce_33,
182
- 5, 45, :_reduce_34,
183
- 5, 45, :_reduce_35,
184
- 5, 45, :_reduce_36,
185
- 3, 47, :_reduce_37,
186
- 1, 47, :_reduce_38,
187
- 1, 46, :_reduce_none,
188
- 3, 46, :_reduce_40,
189
- 1, 46, :_reduce_41,
190
- 1, 46, :_reduce_42,
191
- 1, 46, :_reduce_43,
192
- 1, 46, :_reduce_44,
193
- 1, 46, :_reduce_45,
194
- 1, 46, :_reduce_46,
195
- 1, 46, :_reduce_47,
196
- 1, 46, :_reduce_48 ]
197
-
198
- racc_reduce_n = 49
199
-
200
- racc_shift_n = 92
79
+ 2, 31, :_reduce_1,
80
+ 1, 31, :_reduce_2,
81
+ 1, 32, :_reduce_3,
82
+ 2, 32, :_reduce_4,
83
+ 5, 32, :_reduce_5,
84
+ 4, 32, :_reduce_6,
85
+ 2, 32, :_reduce_7,
86
+ 4, 32, :_reduce_8,
87
+ 1, 33, :_reduce_9,
88
+ 2, 33, :_reduce_10,
89
+ 4, 34, :_reduce_11,
90
+ 3, 34, :_reduce_12,
91
+ 3, 35, :_reduce_13,
92
+ 4, 35, :_reduce_14,
93
+ 5, 35, :_reduce_15,
94
+ 2, 37, :_reduce_16,
95
+ 1, 37, :_reduce_17,
96
+ 1, 36, :_reduce_none,
97
+ 3, 36, :_reduce_19,
98
+ 1, 36, :_reduce_20,
99
+ 1, 36, :_reduce_21,
100
+ 1, 36, :_reduce_22,
101
+ 1, 36, :_reduce_23,
102
+ 1, 36, :_reduce_24,
103
+ 1, 36, :_reduce_25,
104
+ 1, 36, :_reduce_26,
105
+ 1, 36, :_reduce_27 ]
106
+
107
+ racc_reduce_n = 28
108
+
109
+ racc_shift_n = 49
201
110
 
202
111
  racc_token_table = {
203
112
  false => 0,
@@ -209,40 +118,29 @@ racc_token_table = {
209
118
  :tIDENTIFIER_VALUE => 6,
210
119
  :tINDEX => 7,
211
120
  :tPSEUDO_CLASS => 8,
212
- :tCOMMA => 9,
213
- :tCHILD => 10,
214
- :tSUBSEQUENT_SIBLING => 11,
215
- :tNEXT_SIBLING => 12,
216
- :tOPEN_ATTRIBUTE => 13,
217
- :tCLOSE_ATTRIBUTE => 14,
218
- :tOPEN_DYNAMIC_ATTRIBUTE => 15,
219
- :tCLOSE_DYNAMIC_ATTRIBUTE => 16,
220
- :tOPEN_ARRAY => 17,
221
- :tCLOSE_ARRAY => 18,
222
- :tOPEN_SELECTOR => 19,
223
- :tCLOSE_SELECTOR => 20,
224
- :tEQUAL => 21,
225
- :tNOT_EQUAL => 22,
226
- :tMATCH => 23,
227
- :tNOT_MATCH => 24,
228
- :tGREATER_THAN => 25,
229
- :tGREATER_THAN_OR_EQUAL => 26,
230
- :tLESS_THAN => 27,
231
- :tLESS_THAN_OR_EQUAL => 28,
232
- :tIN => 29,
233
- :tNOT_IN => 30,
234
- :tINCLUDES => 31,
235
- :tARRAY_VALUE => 32,
236
- :tDYNAMIC_ATTRIBUTE => 33,
237
- :tBOOLEAN => 34,
238
- :tFLOAT => 35,
239
- :tINTEGER => 36,
240
- :tNIL => 37,
241
- :tREGEXP => 38,
242
- :tSTRING => 39,
243
- :tSYMBOL => 40 }
244
-
245
- racc_nt_base = 41
121
+ :tRELATIONSHIP => 9,
122
+ :tOPEN_ATTRIBUTE => 10,
123
+ :tCLOSE_ATTRIBUTE => 11,
124
+ :tOPEN_DYNAMIC_ATTRIBUTE => 12,
125
+ :tCLOSE_DYNAMIC_ATTRIBUTE => 13,
126
+ :tOPEN_ARRAY => 14,
127
+ :tCLOSE_ARRAY => 15,
128
+ :tOPEN_SELECTOR => 16,
129
+ :tCLOSE_SELECTOR => 17,
130
+ :tOPEN_GOTO_SCOPE => 18,
131
+ :tCLOSE_GOTO_SCOPE => 19,
132
+ :tOPERATOR => 20,
133
+ :tARRAY_VALUE => 21,
134
+ :tDYNAMIC_ATTRIBUTE => 22,
135
+ :tBOOLEAN => 23,
136
+ :tFLOAT => 24,
137
+ :tINTEGER => 25,
138
+ :tNIL => 26,
139
+ :tREGEXP => 27,
140
+ :tSTRING => 28,
141
+ :tSYMBOL => 29 }
142
+
143
+ racc_nt_base = 30
246
144
 
247
145
  racc_use_result_var = false
248
146
 
@@ -272,10 +170,7 @@ Racc_token_to_s_table = [
272
170
  "tIDENTIFIER_VALUE",
273
171
  "tINDEX",
274
172
  "tPSEUDO_CLASS",
275
- "tCOMMA",
276
- "tCHILD",
277
- "tSUBSEQUENT_SIBLING",
278
- "tNEXT_SIBLING",
173
+ "tRELATIONSHIP",
279
174
  "tOPEN_ATTRIBUTE",
280
175
  "tCLOSE_ATTRIBUTE",
281
176
  "tOPEN_DYNAMIC_ATTRIBUTE",
@@ -284,17 +179,9 @@ Racc_token_to_s_table = [
284
179
  "tCLOSE_ARRAY",
285
180
  "tOPEN_SELECTOR",
286
181
  "tCLOSE_SELECTOR",
287
- "tEQUAL",
288
- "tNOT_EQUAL",
289
- "tMATCH",
290
- "tNOT_MATCH",
291
- "tGREATER_THAN",
292
- "tGREATER_THAN_OR_EQUAL",
293
- "tLESS_THAN",
294
- "tLESS_THAN_OR_EQUAL",
295
- "tIN",
296
- "tNOT_IN",
297
- "tINCLUDES",
182
+ "tOPEN_GOTO_SCOPE",
183
+ "tCLOSE_GOTO_SCOPE",
184
+ "tOPERATOR",
298
185
  "tARRAY_VALUE",
299
186
  "tDYNAMIC_ATTRIBUTE",
300
187
  "tBOOLEAN",
@@ -307,6 +194,7 @@ Racc_token_to_s_table = [
307
194
  "$start",
308
195
  "expression",
309
196
  "selector",
197
+ "simple_selector",
310
198
  "attribute_list",
311
199
  "attribute",
312
200
  "value",
@@ -319,192 +207,108 @@ Racc_debug_parser = false
319
207
  # reduce 0 omitted
320
208
 
321
209
  def _reduce_1(val, _values)
322
- Compiler::Expression.new(selector: val[0], rest: val[2], relationship: :child)
210
+ Compiler::Expression.new(selector: val[0], rest: val[1])
323
211
  end
324
212
 
325
213
  def _reduce_2(val, _values)
326
- Compiler::Expression.new(selector: val[0], rest: val[2], relationship: :subsequent_sibling)
214
+ Compiler::Expression.new(selector: val[0])
327
215
  end
328
216
 
329
217
  def _reduce_3(val, _values)
330
- Compiler::Expression.new(selector: val[0], rest: val[2], relationship: :next_sibling)
218
+ Compiler::Selector.new(simple_selector: val[0])
331
219
  end
332
220
 
333
221
  def _reduce_4(val, _values)
334
- Compiler::Expression.new(selector: val[0], rest: val[1], relationship: :descendant)
222
+ Compiler::Selector.new(simple_selector: val[0], index: val[1])
335
223
  end
336
224
 
337
225
  def _reduce_5(val, _values)
338
- Compiler::Expression.new(selector: val[0])
226
+ Compiler::Selector.new(simple_selector: val[0], pseudo_class: val[1], pseudo_selector: val[3])
339
227
  end
340
228
 
341
229
  def _reduce_6(val, _values)
342
- Compiler::Expression.new(rest: val[1], relationship: :child)
230
+ Compiler::Selector.new(pseudo_class: val[0], pseudo_selector: val[2])
343
231
  end
344
232
 
345
233
  def _reduce_7(val, _values)
346
- Compiler::Expression.new(rest: val[1], relationship: :subsequent_sibling)
234
+ Compiler::Selector.new(relationship: val[0], rest: val[1])
347
235
  end
348
236
 
349
237
  def _reduce_8(val, _values)
350
- Compiler::Expression.new(rest: val[1], relationship: :next_sibling)
238
+ Compiler::Selector.new(goto_scope: val[1], rest: val[3])
351
239
  end
352
240
 
353
241
  def _reduce_9(val, _values)
354
- Compiler::Selector.new(node_type: val[0], attribute_list: val[1], index: val[2])
242
+ Compiler::SimpleSelector.new(node_type: val[0])
355
243
  end
356
244
 
357
245
  def _reduce_10(val, _values)
358
- Compiler::Selector.new(node_type: val[0], index: val[1])
246
+ Compiler::SimpleSelector.new(node_type: val[0], attribute_list: val[1])
359
247
  end
360
248
 
361
249
  def _reduce_11(val, _values)
362
- Compiler::Selector.new(attribute_list: val[0], index: val[1])
250
+ Compiler::AttributeList.new(attribute: val[1], rest: val[3])
363
251
  end
364
252
 
365
253
  def _reduce_12(val, _values)
366
- Compiler::Selector.new(node_type: val[0], attribute_list: val[1], pseudo_class: val[2], pseudo_expression: val[4])
254
+ Compiler::AttributeList.new(attribute: val[1])
367
255
  end
368
256
 
369
257
  def _reduce_13(val, _values)
370
- Compiler::Selector.new(node_type: val[0], pseudo_class: val[1], pseudo_expression: val[3])
258
+ Compiler::Attribute.new(key: val[0], value: val[2], operator: val[1])
371
259
  end
372
260
 
373
261
  def _reduce_14(val, _values)
374
- Compiler::Selector.new(attribute_list: val[0], pseudo_class: val[1], pseudo_expression: val[3])
262
+ Compiler::Attribute.new(key: val[0], value: Compiler::Array.new, operator: val[1])
375
263
  end
376
264
 
377
265
  def _reduce_15(val, _values)
378
- Compiler::Selector.new(node_type: val[0], attribute_list: val[1])
266
+ Compiler::Attribute.new(key: val[0], value: val[3], operator: val[1])
379
267
  end
380
268
 
381
269
  def _reduce_16(val, _values)
382
- Compiler::Selector.new(node_type: val[0])
270
+ Compiler::Array.new(value: val[0], rest: val[1])
383
271
  end
384
272
 
385
273
  def _reduce_17(val, _values)
386
- Compiler::Selector.new(attribute_list: val[0])
387
- end
388
-
389
- def _reduce_18(val, _values)
390
- Compiler::AttributeList.new(attribute: val[1], rest: val[3])
391
- end
392
-
393
- def _reduce_19(val, _values)
394
- Compiler::AttributeList.new(attribute: val[1])
395
- end
396
-
397
- def _reduce_20(val, _values)
398
- Compiler::Attribute.new(key: val[0], value: val[2], operator: :!=)
399
- end
400
-
401
- def _reduce_21(val, _values)
402
- Compiler::Attribute.new(key: val[0], value: val[2], operator: :!~)
403
- end
404
-
405
- def _reduce_22(val, _values)
406
- Compiler::Attribute.new(key: val[0], value: val[2], operator: :=~)
407
- end
408
-
409
- def _reduce_23(val, _values)
410
- Compiler::Attribute.new(key: val[0], value: val[2], operator: :>=)
411
- end
412
-
413
- def _reduce_24(val, _values)
414
- Compiler::Attribute.new(key: val[0], value: val[2], operator: :>)
415
- end
416
-
417
- def _reduce_25(val, _values)
418
- Compiler::Attribute.new(key: val[0], value: val[2], operator: :<=)
419
- end
420
-
421
- def _reduce_26(val, _values)
422
- Compiler::Attribute.new(key: val[0], value: val[2], operator: :<)
423
- end
424
-
425
- def _reduce_27(val, _values)
426
- Compiler::Attribute.new(key: val[0], value: val[2], operator: :==)
427
- end
428
-
429
- def _reduce_28(val, _values)
430
- Compiler::Attribute.new(key: val[0], value: val[2], operator: :includes)
431
- end
432
-
433
- def _reduce_29(val, _values)
434
- Compiler::Attribute.new(key: val[0], value: Compiler::Array.new, operator: :!=)
435
- end
436
-
437
- def _reduce_30(val, _values)
438
- Compiler::Attribute.new(key: val[0], value: Compiler::Array.new, operator: :==)
439
- end
440
-
441
- def _reduce_31(val, _values)
442
- Compiler::Attribute.new(key: val[0], value: Compiler::Array.new, operator: :not_in)
443
- end
444
-
445
- def _reduce_32(val, _values)
446
- Compiler::Attribute.new(key: val[0], value: Compiler::Array.new, operator: :in)
447
- end
448
-
449
- def _reduce_33(val, _values)
450
- Compiler::Attribute.new(key: val[0], value: val[3], operator: :!=)
451
- end
452
-
453
- def _reduce_34(val, _values)
454
- Compiler::Attribute.new(key: val[0], value: val[3], operator: :==)
455
- end
456
-
457
- def _reduce_35(val, _values)
458
- Compiler::Attribute.new(key: val[0], value: val[3], operator: :not_in)
459
- end
460
-
461
- def _reduce_36(val, _values)
462
- Compiler::Attribute.new(key: val[0], value: val[3], operator: :in)
463
- end
464
-
465
- def _reduce_37(val, _values)
466
- Compiler::Array.new(value: val[0], rest: val[2])
467
- end
468
-
469
- def _reduce_38(val, _values)
470
274
  Compiler::Array.new(value: val[0])
471
275
  end
472
276
 
473
- # reduce 39 omitted
277
+ # reduce 18 omitted
474
278
 
475
- def _reduce_40(val, _values)
279
+ def _reduce_19(val, _values)
476
280
  Compiler::DynamicAttribute.new(value: val[1])
477
281
  end
478
282
 
479
- def _reduce_41(val, _values)
283
+ def _reduce_20(val, _values)
480
284
  Compiler::Boolean.new(value: val[0])
481
285
  end
482
286
 
483
- def _reduce_42(val, _values)
287
+ def _reduce_21(val, _values)
484
288
  Compiler::Float.new(value: val[0])
485
289
  end
486
290
 
487
- def _reduce_43(val, _values)
291
+ def _reduce_22(val, _values)
488
292
  Compiler::Integer.new(value: val[0])
489
293
  end
490
294
 
491
- def _reduce_44(val, _values)
295
+ def _reduce_23(val, _values)
492
296
  Compiler::Nil.new(value: val[0])
493
297
  end
494
298
 
495
- def _reduce_45(val, _values)
299
+ def _reduce_24(val, _values)
496
300
  Compiler::Regexp.new(value: val[0])
497
301
  end
498
302
 
499
- def _reduce_46(val, _values)
303
+ def _reduce_25(val, _values)
500
304
  Compiler::String.new(value: val[0])
501
305
  end
502
306
 
503
- def _reduce_47(val, _values)
307
+ def _reduce_26(val, _values)
504
308
  Compiler::Symbol.new(value: val[0])
505
309
  end
506
310
 
507
- def _reduce_48(val, _values)
311
+ def _reduce_27(val, _values)
508
312
  Compiler::Identifier.new(value: val[0])
509
313
  end
510
314
 
@@ -1,63 +1,41 @@
1
1
  class Synvert::Core::NodeQuery::Parser
2
2
  options no_result_var
3
- token tNODE_TYPE tATTRIBUTE tKEY tIDENTIFIER tIDENTIFIER_VALUE tINDEX tPSEUDO_CLASS tCOMMA
4
- tCHILD tSUBSEQUENT_SIBLING tNEXT_SIBLING
5
- tOPEN_ATTRIBUTE tCLOSE_ATTRIBUTE tOPEN_DYNAMIC_ATTRIBUTE tCLOSE_DYNAMIC_ATTRIBUTE tOPEN_ARRAY tCLOSE_ARRAY tOPEN_SELECTOR tCLOSE_SELECTOR
6
- tEQUAL tNOT_EQUAL tMATCH tNOT_MATCH tGREATER_THAN tGREATER_THAN_OR_EQUAL tLESS_THAN tLESS_THAN_OR_EQUAL tIN tNOT_IN tINCLUDES
7
- tARRAY_VALUE tDYNAMIC_ATTRIBUTE tBOOLEAN tFLOAT tINTEGER tNIL tREGEXP tSTRING tSYMBOL
3
+ token tNODE_TYPE tATTRIBUTE tKEY tIDENTIFIER tIDENTIFIER_VALUE tINDEX tPSEUDO_CLASS tRELATIONSHIP
4
+ tOPEN_ATTRIBUTE tCLOSE_ATTRIBUTE tOPEN_DYNAMIC_ATTRIBUTE tCLOSE_DYNAMIC_ATTRIBUTE
5
+ tOPEN_ARRAY tCLOSE_ARRAY tOPEN_SELECTOR tCLOSE_SELECTOR tOPEN_GOTO_SCOPE tCLOSE_GOTO_SCOPE
6
+ tOPERATOR tARRAY_VALUE tDYNAMIC_ATTRIBUTE tBOOLEAN tFLOAT tINTEGER tNIL tREGEXP tSTRING tSYMBOL
8
7
  rule
9
8
  expression
10
- : selector tCHILD expression { Compiler::Expression.new(selector: val[0], rest: val[2], relationship: :child) }
11
- | selector tSUBSEQUENT_SIBLING expression { Compiler::Expression.new(selector: val[0], rest: val[2], relationship: :subsequent_sibling) }
12
- | selector tNEXT_SIBLING expression { Compiler::Expression.new(selector: val[0], rest: val[2], relationship: :next_sibling) }
13
- | selector expression { Compiler::Expression.new(selector: val[0], rest: val[1], relationship: :descendant) }
9
+ : selector expression { Compiler::Expression.new(selector: val[0], rest: val[1]) }
14
10
  | selector { Compiler::Expression.new(selector: val[0]) }
15
- | tCHILD expression { Compiler::Expression.new(rest: val[1], relationship: :child) }
16
- | tSUBSEQUENT_SIBLING expression { Compiler::Expression.new(rest: val[1], relationship: :subsequent_sibling) }
17
- | tNEXT_SIBLING expression { Compiler::Expression.new(rest: val[1], relationship: :next_sibling) }
18
11
 
19
12
  selector
20
- : tNODE_TYPE attribute_list tINDEX { Compiler::Selector.new(node_type: val[0], attribute_list: val[1], index: val[2]) }
21
- | tNODE_TYPE tINDEX { Compiler::Selector.new(node_type: val[0], index: val[1]) }
22
- | attribute_list tINDEX { Compiler::Selector.new(attribute_list: val[0], index: val[1]) }
23
- | tNODE_TYPE attribute_list tPSEUDO_CLASS tOPEN_SELECTOR expression tCLOSE_SELECTOR { Compiler::Selector.new(node_type: val[0], attribute_list: val[1], pseudo_class: val[2], pseudo_expression: val[4]) }
24
- | tNODE_TYPE tPSEUDO_CLASS tOPEN_SELECTOR expression tCLOSE_SELECTOR { Compiler::Selector.new(node_type: val[0], pseudo_class: val[1], pseudo_expression: val[3]) }
25
- | attribute_list tPSEUDO_CLASS tOPEN_SELECTOR expression tCLOSE_SELECTOR { Compiler::Selector.new(attribute_list: val[0], pseudo_class: val[1], pseudo_expression: val[3]) }
26
- | tNODE_TYPE attribute_list { Compiler::Selector.new(node_type: val[0], attribute_list: val[1]) }
27
- | tNODE_TYPE { Compiler::Selector.new(node_type: val[0]) }
28
- | attribute_list { Compiler::Selector.new(attribute_list: val[0]) }
29
- ;
13
+ : simple_selector { Compiler::Selector.new(simple_selector: val[0]) }
14
+ | simple_selector tINDEX { Compiler::Selector.new(simple_selector: val[0], index: val[1]) }
15
+ | simple_selector tPSEUDO_CLASS tOPEN_SELECTOR selector tCLOSE_SELECTOR { Compiler::Selector.new(simple_selector: val[0], pseudo_class: val[1], pseudo_selector: val[3]) }
16
+ | tPSEUDO_CLASS tOPEN_SELECTOR selector tCLOSE_SELECTOR { Compiler::Selector.new(pseudo_class: val[0], pseudo_selector: val[2]) }
17
+ | tRELATIONSHIP selector { Compiler::Selector.new(relationship: val[0], rest: val[1]) }
18
+ | tOPEN_GOTO_SCOPE tIDENTIFIER tCLOSE_GOTO_SCOPE selector { Compiler::Selector.new(goto_scope: val[1], rest: val[3]) }
19
+
20
+ simple_selector
21
+ : tNODE_TYPE { Compiler::SimpleSelector.new(node_type: val[0]) }
22
+ | tNODE_TYPE attribute_list { Compiler::SimpleSelector.new(node_type: val[0], attribute_list: val[1]) }
30
23
 
31
24
  attribute_list
32
25
  : tOPEN_ATTRIBUTE attribute tCLOSE_ATTRIBUTE attribute_list { Compiler::AttributeList.new(attribute: val[1], rest: val[3]) }
33
26
  | tOPEN_ATTRIBUTE attribute tCLOSE_ATTRIBUTE { Compiler::AttributeList.new(attribute: val[1]) }
34
- ;
35
27
 
36
28
  attribute
37
- : tKEY tNOT_EQUAL value { Compiler::Attribute.new(key: val[0], value: val[2], operator: :!=) }
38
- | tKEY tNOT_MATCH value { Compiler::Attribute.new(key: val[0], value: val[2], operator: :!~) }
39
- | tKEY tMATCH value { Compiler::Attribute.new(key: val[0], value: val[2], operator: :=~) }
40
- | tKEY tGREATER_THAN_OR_EQUAL value { Compiler::Attribute.new(key: val[0], value: val[2], operator: :>=) }
41
- | tKEY tGREATER_THAN value { Compiler::Attribute.new(key: val[0], value: val[2], operator: :>) }
42
- | tKEY tLESS_THAN_OR_EQUAL value { Compiler::Attribute.new(key: val[0], value: val[2], operator: :<=) }
43
- | tKEY tLESS_THAN value { Compiler::Attribute.new(key: val[0], value: val[2], operator: :<) }
44
- | tKEY tEQUAL value { Compiler::Attribute.new(key: val[0], value: val[2], operator: :==) }
45
- | tKEY tINCLUDES value { Compiler::Attribute.new(key: val[0], value: val[2], operator: :includes) }
46
- | tKEY tNOT_EQUAL tOPEN_ARRAY tCLOSE_ARRAY { Compiler::Attribute.new(key: val[0], value: Compiler::Array.new, operator: :!=) }
47
- | tKEY tEQUAL tOPEN_ARRAY tCLOSE_ARRAY { Compiler::Attribute.new(key: val[0], value: Compiler::Array.new, operator: :==) }
48
- | tKEY tNOT_IN tOPEN_ARRAY tCLOSE_ARRAY { Compiler::Attribute.new(key: val[0], value: Compiler::Array.new, operator: :not_in) }
49
- | tKEY tIN tOPEN_ARRAY tCLOSE_ARRAY { Compiler::Attribute.new(key: val[0], value: Compiler::Array.new, operator: :in) }
50
- | tKEY tNOT_EQUAL tOPEN_ARRAY array_value tCLOSE_ARRAY { Compiler::Attribute.new(key: val[0], value: val[3], operator: :!=) }
51
- | tKEY tEQUAL tOPEN_ARRAY array_value tCLOSE_ARRAY { Compiler::Attribute.new(key: val[0], value: val[3], operator: :==) }
52
- | tKEY tNOT_IN tOPEN_ARRAY array_value tCLOSE_ARRAY { Compiler::Attribute.new(key: val[0], value: val[3], operator: :not_in) }
53
- | tKEY tIN tOPEN_ARRAY array_value tCLOSE_ARRAY { Compiler::Attribute.new(key: val[0], value: val[3], operator: :in) }
29
+ : tKEY tOPERATOR value { Compiler::Attribute.new(key: val[0], value: val[2], operator: val[1]) }
30
+ | tKEY tOPERATOR tOPEN_ARRAY tCLOSE_ARRAY { Compiler::Attribute.new(key: val[0], value: Compiler::Array.new, operator: val[1]) }
31
+ | tKEY tOPERATOR tOPEN_ARRAY array_value tCLOSE_ARRAY { Compiler::Attribute.new(key: val[0], value: val[3], operator: val[1]) }
54
32
 
55
33
  array_value
56
- : value tCOMMA array_value { Compiler::Array.new(value: val[0], rest: val[2]) }
34
+ : value array_value { Compiler::Array.new(value: val[0], rest: val[1]) }
57
35
  | value { Compiler::Array.new(value: val[0]) }
58
36
 
59
37
  value
60
- : selector
38
+ : simple_selector
61
39
  | tOPEN_DYNAMIC_ATTRIBUTE tDYNAMIC_ATTRIBUTE tCLOSE_DYNAMIC_ATTRIBUTE { Compiler::DynamicAttribute.new(value: val[1]) }
62
40
  | tBOOLEAN { Compiler::Boolean.new(value: val[0]) }
63
41
  | tFLOAT { Compiler::Float.new(value: val[0]) }