synvert-core 1.2.1 → 1.3.0

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