synvert-core 1.2.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/Gemfile +9 -0
- data/lib/synvert/core/node_ext.rb +14 -2
- data/lib/synvert/core/node_query/compiler/attribute.rb +6 -18
- data/lib/synvert/core/node_query/compiler/comparable.rb +26 -19
- data/lib/synvert/core/node_query/compiler/expression.rb +8 -76
- data/lib/synvert/core/node_query/compiler/identifier.rb +1 -1
- data/lib/synvert/core/node_query/compiler/regexp.rb +2 -2
- data/lib/synvert/core/node_query/compiler/selector.rb +102 -20
- data/lib/synvert/core/node_query/compiler/simple_selector.rb +29 -0
- data/lib/synvert/core/node_query/compiler/string.rb +1 -1
- data/lib/synvert/core/node_query/compiler.rb +1 -0
- data/lib/synvert/core/node_query/lexer.rex +19 -16
- data/lib/synvert/core/node_query/lexer.rex.rb +34 -27
- data/lib/synvert/core/node_query/parser.racc.rb +118 -287
- data/lib/synvert/core/node_query/parser.y +17 -36
- data/lib/synvert/core/node_query.rb +7 -7
- data/lib/synvert/core/rewriter/action/delete_action.rb +4 -2
- data/lib/synvert/core/rewriter/action/remove_action.rb +5 -2
- data/lib/synvert/core/rewriter/instance.rb +8 -4
- data/lib/synvert/core/version.rb +1 -1
- data/spec/synvert/core/node_ext_spec.rb +7 -5
- data/spec/synvert/core/node_query/lexer_spec.rb +48 -48
- data/spec/synvert/core/node_query/parser_spec.rb +139 -107
- data/spec/synvert/core/rewriter/instance_spec.rb +12 -7
- data/spec/synvert/core/rewriter/scope/query_scope_spec.rb +3 -3
- data/synvert-core-ruby.gemspec +0 -10
- metadata +3 -128
@@ -1,3 +1,4 @@
|
|
1
|
+
# typed: false
|
1
2
|
# frozen_string_literal: true
|
2
3
|
# encoding: UTF-8
|
3
4
|
#--
|
@@ -35,8 +36,8 @@ class Synvert::Core::NodeQuery::Lexer
|
|
35
36
|
REGEXP = /\/(#{REGEXP_BODY})(?<!\\)\/([imxo]*)/
|
36
37
|
SYMBOL = /:[\w!\?<>=]+/
|
37
38
|
TRUE = /true/
|
38
|
-
SINGLE_QUOTE_STRING = /'
|
39
|
-
DOUBLE_QUOTE_STRING = /"
|
39
|
+
SINGLE_QUOTE_STRING = /'.*?'/
|
40
|
+
DOUBLE_QUOTE_STRING = /".*?"/
|
40
41
|
# :startdoc:
|
41
42
|
# :stopdoc:
|
42
43
|
class LexerError < StandardError ; end
|
@@ -142,11 +143,11 @@ class Synvert::Core::NodeQuery::Lexer
|
|
142
143
|
when text = ss.scan(/#{NODE_TYPE}/) then
|
143
144
|
action { [:tNODE_TYPE, text[1..]] }
|
144
145
|
when text = ss.scan(/>/) then
|
145
|
-
action { [:
|
146
|
+
action { [:tRELATIONSHIP, text] }
|
146
147
|
when text = ss.scan(/~/) then
|
147
|
-
action { [:
|
148
|
+
action { [:tRELATIONSHIP, text] }
|
148
149
|
when text = ss.scan(/\+/) then
|
149
|
-
action { [:
|
150
|
+
action { [:tRELATIONSHIP, text] }
|
150
151
|
when text = ss.scan(/#{OPEN_SELECTOR}/) then
|
151
152
|
action { [:tOPEN_SELECTOR, text] }
|
152
153
|
when text = ss.scan(/#{CLOSE_SELECTOR}/) then
|
@@ -175,28 +176,34 @@ class Synvert::Core::NodeQuery::Lexer
|
|
175
176
|
case
|
176
177
|
when ss.skip(/\s+/) then
|
177
178
|
# do nothing
|
178
|
-
when
|
179
|
-
action { @state = :VALUE; [:
|
180
|
-
when
|
181
|
-
action { @state = :VALUE; [:
|
182
|
-
when
|
183
|
-
action { @state = :VALUE; [:
|
184
|
-
when
|
185
|
-
action { @state = :VALUE; [:
|
186
|
-
when
|
187
|
-
action { @state = :VALUE; [:
|
188
|
-
when
|
189
|
-
action { @state = :VALUE; [:
|
190
|
-
when
|
191
|
-
action { @state = :VALUE; [:
|
192
|
-
when
|
193
|
-
action { @state = :VALUE; [:
|
194
|
-
when
|
195
|
-
action { @state = :VALUE; [:
|
196
|
-
when
|
197
|
-
action { @state = :VALUE; [:
|
198
|
-
when
|
199
|
-
action { @state = :VALUE; [:
|
179
|
+
when ss.skip(/\^=/) then
|
180
|
+
action { @state = :VALUE; [:tOPERATOR, '^='] }
|
181
|
+
when ss.skip(/\$=/) then
|
182
|
+
action { @state = :VALUE; [:tOPERATOR, '$='] }
|
183
|
+
when ss.skip(/\*=/) then
|
184
|
+
action { @state = :VALUE; [:tOPERATOR, '*='] }
|
185
|
+
when ss.skip(/!=/) then
|
186
|
+
action { @state = :VALUE; [:tOPERATOR, '!='] }
|
187
|
+
when ss.skip(/=~/) then
|
188
|
+
action { @state = :VALUE; [:tOPERATOR, '=~'] }
|
189
|
+
when ss.skip(/!~/) then
|
190
|
+
action { @state = :VALUE; [:tOPERATOR, '!~'] }
|
191
|
+
when ss.skip(/>=/) then
|
192
|
+
action { @state = :VALUE; [:tOPERATOR, '>='] }
|
193
|
+
when ss.skip(/<=/) then
|
194
|
+
action { @state = :VALUE; [:tOPERATOR, '<='] }
|
195
|
+
when ss.skip(/>/) then
|
196
|
+
action { @state = :VALUE; [:tOPERATOR, '>'] }
|
197
|
+
when ss.skip(/</) then
|
198
|
+
action { @state = :VALUE; [:tOPERATOR, '<'] }
|
199
|
+
when ss.skip(/=/) then
|
200
|
+
action { @state = :VALUE; [:tOPERATOR, '=='] }
|
201
|
+
when ss.skip(/includes/i) then
|
202
|
+
action { @state = :VALUE; [:tOPERATOR, 'includes'] }
|
203
|
+
when ss.skip(/not in/i) then
|
204
|
+
action { @state = :VALUE; [:tOPERATOR, 'not_in'] }
|
205
|
+
when ss.skip(/in/i) then
|
206
|
+
action { @state = :VALUE; [:tOPERATOR, 'in'] }
|
200
207
|
when text = ss.scan(/#{IDENTIFIER}/) then
|
201
208
|
action { [:tKEY, text] }
|
202
209
|
else
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# typed: true
|
1
2
|
#
|
2
3
|
# DO NOT MODIFY!!!!
|
3
4
|
# This file is automatically generated by Racc 1.6.0
|
@@ -25,167 +26,88 @@ module Synvert
|
|
25
26
|
##### State transition tables begin ###
|
26
27
|
|
27
28
|
racc_action_table = [
|
28
|
-
8,
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
47, 48, 49, 50, 51, 52, 46, 47, 48, 49,
|
38
|
-
50, 51, 52, 46, 47, 48, 49, 50, 51, 52,
|
39
|
-
8, nil, nil, nil, 53, nil, nil, 8, nil, nil,
|
40
|
-
10, 53, 45, nil, 8, nil, nil, 10, 53, 45,
|
41
|
-
nil, 61, nil, nil, 10, nil, 45, nil, nil, nil,
|
42
|
-
nil, nil, nil, 46, 47, 48, 49, 50, 51, 52,
|
43
|
-
46, 47, 48, 49, 50, 51, 52, 46, 47, 48,
|
44
|
-
49, 50, 51, 52, 8, nil, nil, nil, 53, nil,
|
45
|
-
nil, 8, nil, nil, 10, 53, 45, nil, 8, 65,
|
46
|
-
nil, 10, 53, 45, nil, nil, 69, nil, 10, nil,
|
47
|
-
45, nil, nil, 71, nil, nil, nil, 46, 47, 48,
|
48
|
-
49, 50, 51, 52, 46, 47, 48, 49, 50, 51,
|
49
|
-
52, 46, 47, 48, 49, 50, 51, 52, 8, nil,
|
50
|
-
nil, nil, 53, nil, nil, 8, nil, nil, 10, 53,
|
51
|
-
45, nil, 8, 73, nil, 10, nil, 45, 6, 2,
|
52
|
-
3, 4, 10, nil, nil, nil, nil, nil, nil, nil,
|
53
|
-
5, 46, 47, 48, 49, 50, 51, 52, 46, 47,
|
54
|
-
48, 49, 50, 51, 52, 8, nil, nil, nil, nil,
|
55
|
-
8, 6, 2, 3, 4, 10, 6, 2, 3, 4,
|
56
|
-
10, nil, nil, 5, 8, nil, nil, nil, 5, 8,
|
57
|
-
6, 2, 3, 4, 10, 6, 2, 3, 4, 10,
|
58
|
-
nil, nil, 5, 8, nil, nil, nil, 5, 8, 6,
|
59
|
-
2, 3, 4, 10, 6, 2, 3, 4, 10, nil,
|
60
|
-
nil, 5, nil, nil, nil, nil, 5, 35, 28, 30,
|
61
|
-
29, 32, 31, 34, 33, 38, 37, 36 ]
|
29
|
+
7, 8, 7, 12, 41, 10, 11, 7, 4, 5,
|
30
|
+
33, 41, 31, 14, 16, 17, 18, 33, 6, 20,
|
31
|
+
42, 34, 35, 36, 37, 38, 39, 40, 34, 35,
|
32
|
+
36, 37, 38, 39, 40, 7, 7, 22, 24, 41,
|
33
|
+
26, 27, 4, 5, 28, 33, 16, 7, 45, 46,
|
34
|
+
48, nil, 6, 4, 5, nil, 34, 35, 36, 37,
|
35
|
+
38, 39, 40, 6, 7, nil, 7, nil, 7, nil,
|
36
|
+
4, 5, 4, 5, 4, 5, nil, nil, nil, nil,
|
37
|
+
6, nil, 6, nil, 6 ]
|
62
38
|
|
63
39
|
racc_action_check = [
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
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
|
-
34, 35, 34, nil, 36, nil, nil, 35, 36, 35,
|
77
|
-
nil, 35, nil, nil, 36, 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, 43, nil, nil, nil, 43, nil,
|
81
|
-
nil, 61, nil, nil, 43, 61, 43, nil, 63, 43,
|
82
|
-
nil, 61, 63, 61, nil, nil, 61, nil, 63, nil,
|
83
|
-
63, nil, nil, 63, nil, nil, nil, 43, 43, 43,
|
84
|
-
43, 43, 43, 43, 61, 61, 61, 61, 61, 61,
|
85
|
-
61, 63, 63, 63, 63, 63, 63, 63, 64, nil,
|
86
|
-
nil, nil, 64, nil, nil, 67, nil, nil, 64, 67,
|
87
|
-
64, nil, 0, 64, nil, 67, nil, 67, 0, 0,
|
88
|
-
0, 0, 0, nil, nil, nil, nil, nil, nil, nil,
|
89
|
-
0, 64, 64, 64, 64, 64, 64, 64, 67, 67,
|
90
|
-
67, 67, 67, 67, 67, 2, nil, nil, nil, nil,
|
91
|
-
3, 2, 2, 2, 2, 2, 3, 3, 3, 3,
|
92
|
-
3, nil, nil, 2, 4, nil, nil, nil, 3, 7,
|
93
|
-
4, 4, 4, 4, 4, 7, 7, 7, 7, 7,
|
94
|
-
nil, nil, 4, 16, nil, nil, nil, 7, 24, 16,
|
95
|
-
16, 16, 16, 16, 24, 24, 24, 24, 24, nil,
|
96
|
-
nil, 16, nil, nil, nil, nil, 24, 22, 22, 22,
|
97
|
-
22, 22, 22, 22, 22, 22, 22, 22 ]
|
40
|
+
27, 1, 0, 4, 27, 3, 3, 31, 0, 0,
|
41
|
+
27, 31, 27, 6, 7, 8, 11, 31, 0, 14,
|
42
|
+
31, 27, 27, 27, 27, 27, 27, 27, 31, 31,
|
43
|
+
31, 31, 31, 31, 31, 44, 2, 16, 19, 44,
|
44
|
+
21, 22, 2, 2, 23, 44, 26, 5, 33, 43,
|
45
|
+
45, nil, 2, 5, 5, nil, 44, 44, 44, 44,
|
46
|
+
44, 44, 44, 5, 12, nil, 18, nil, 20, nil,
|
47
|
+
12, 12, 18, 18, 20, 20, nil, nil, nil, nil,
|
48
|
+
12, nil, 18, nil, 20 ]
|
98
49
|
|
99
50
|
racc_action_pointer = [
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
nil, nil, nil,
|
105
|
-
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
106
|
-
nil, 169, nil, 176, 216, nil, 12, 223, 15, nil,
|
107
|
-
14, nil, 15, nil, 30, nil, nil, nil, nil, nil,
|
108
|
-
nil ]
|
51
|
+
0, 1, 34, -2, -13, 45, 8, 4, 15, nil,
|
52
|
+
nil, 0, 62, nil, 0, nil, 33, nil, 64, 21,
|
53
|
+
66, 29, 21, 27, nil, nil, 36, -2, nil, nil,
|
54
|
+
nil, 5, nil, 26, nil, nil, nil, nil, nil, nil,
|
55
|
+
nil, nil, nil, 34, 33, 37, nil, nil, nil ]
|
109
56
|
|
110
57
|
racc_action_default = [
|
111
|
-
-
|
112
|
-
|
113
|
-
-
|
114
|
-
-
|
115
|
-
|
116
|
-
-41, -42, -43, -44, -17, -18, -19, -20, -21, -22,
|
117
|
-
-23, -45, -24, -45, -45, -25, -45, -34, -45, -26,
|
118
|
-
-45, -27, -45, -28, -45, -29, -33, -36, -30, -31,
|
119
|
-
-32 ]
|
58
|
+
-28, -28, -2, -3, -28, -28, -28, -9, -28, -1,
|
59
|
+
-4, -28, -28, -7, -28, -10, -28, 49, -28, -28,
|
60
|
+
-28, -28, -28, -28, -6, -8, -12, -28, -5, -11,
|
61
|
+
-13, -28, -18, -28, -20, -21, -22, -23, -24, -25,
|
62
|
+
-26, -27, -14, -28, -17, -28, -15, -16, -19 ]
|
120
63
|
|
121
64
|
racc_goto_table = [
|
122
|
-
|
123
|
-
|
124
|
-
41, nil, 7, 70, 39, 72, 74, nil, nil, 76,
|
125
|
-
7, 42, 54, 55, 56, 57, 58, 59, 60, 62 ]
|
65
|
+
15, 32, 13, 43, 1, 32, 9, 21, 30, 19,
|
66
|
+
nil, nil, nil, nil, nil, 23, 47, 25, 32, 29 ]
|
126
67
|
|
127
68
|
racc_goto_check = [
|
128
|
-
|
129
|
-
|
130
|
-
3, nil, 2, 6, 1, 6, 6, nil, nil, 6,
|
131
|
-
2, 5, 5, 5, 5, 5, 5, 5, 5, 5 ]
|
69
|
+
4, 3, 2, 7, 1, 3, 1, 5, 6, 2,
|
70
|
+
nil, nil, nil, nil, nil, 2, 7, 2, 3, 4 ]
|
132
71
|
|
133
72
|
racc_goto_pointer = [
|
134
|
-
nil,
|
73
|
+
nil, 4, -3, -26, -7, -9, -19, -28 ]
|
135
74
|
|
136
75
|
racc_goto_default = [
|
137
|
-
nil, nil,
|
76
|
+
nil, nil, 2, 3, nil, nil, 44, nil ]
|
138
77
|
|
139
78
|
racc_reduce_table = [
|
140
79
|
0, 0, :racc_error,
|
141
|
-
2,
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
2,
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
4,
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
3,
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
5, 46, :_reduce_32,
|
173
|
-
2, 48, :_reduce_33,
|
174
|
-
1, 48, :_reduce_34,
|
175
|
-
1, 47, :_reduce_none,
|
176
|
-
3, 47, :_reduce_36,
|
177
|
-
1, 47, :_reduce_37,
|
178
|
-
1, 47, :_reduce_38,
|
179
|
-
1, 47, :_reduce_39,
|
180
|
-
1, 47, :_reduce_40,
|
181
|
-
1, 47, :_reduce_41,
|
182
|
-
1, 47, :_reduce_42,
|
183
|
-
1, 47, :_reduce_43,
|
184
|
-
1, 47, :_reduce_44 ]
|
185
|
-
|
186
|
-
racc_reduce_n = 45
|
187
|
-
|
188
|
-
racc_shift_n = 81
|
80
|
+
2, 31, :_reduce_1,
|
81
|
+
1, 31, :_reduce_2,
|
82
|
+
1, 32, :_reduce_3,
|
83
|
+
2, 32, :_reduce_4,
|
84
|
+
5, 32, :_reduce_5,
|
85
|
+
4, 32, :_reduce_6,
|
86
|
+
2, 32, :_reduce_7,
|
87
|
+
4, 32, :_reduce_8,
|
88
|
+
1, 33, :_reduce_9,
|
89
|
+
2, 33, :_reduce_10,
|
90
|
+
4, 34, :_reduce_11,
|
91
|
+
3, 34, :_reduce_12,
|
92
|
+
3, 35, :_reduce_13,
|
93
|
+
4, 35, :_reduce_14,
|
94
|
+
5, 35, :_reduce_15,
|
95
|
+
2, 37, :_reduce_16,
|
96
|
+
1, 37, :_reduce_17,
|
97
|
+
1, 36, :_reduce_none,
|
98
|
+
3, 36, :_reduce_19,
|
99
|
+
1, 36, :_reduce_20,
|
100
|
+
1, 36, :_reduce_21,
|
101
|
+
1, 36, :_reduce_22,
|
102
|
+
1, 36, :_reduce_23,
|
103
|
+
1, 36, :_reduce_24,
|
104
|
+
1, 36, :_reduce_25,
|
105
|
+
1, 36, :_reduce_26,
|
106
|
+
1, 36, :_reduce_27 ]
|
107
|
+
|
108
|
+
racc_reduce_n = 28
|
109
|
+
|
110
|
+
racc_shift_n = 49
|
189
111
|
|
190
112
|
racc_token_table = {
|
191
113
|
false => 0,
|
@@ -197,41 +119,29 @@ racc_token_table = {
|
|
197
119
|
:tIDENTIFIER_VALUE => 6,
|
198
120
|
:tINDEX => 7,
|
199
121
|
:tPSEUDO_CLASS => 8,
|
200
|
-
:
|
201
|
-
:
|
202
|
-
:
|
203
|
-
:
|
204
|
-
:
|
205
|
-
:
|
206
|
-
:
|
207
|
-
:
|
208
|
-
:
|
209
|
-
:
|
210
|
-
:
|
211
|
-
:
|
212
|
-
:
|
213
|
-
:
|
214
|
-
:
|
215
|
-
:
|
216
|
-
:
|
217
|
-
:
|
218
|
-
:
|
219
|
-
:
|
220
|
-
:
|
221
|
-
|
222
|
-
|
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
|
122
|
+
:tRELATIONSHIP => 9,
|
123
|
+
:tOPEN_ATTRIBUTE => 10,
|
124
|
+
:tCLOSE_ATTRIBUTE => 11,
|
125
|
+
:tOPEN_DYNAMIC_ATTRIBUTE => 12,
|
126
|
+
:tCLOSE_DYNAMIC_ATTRIBUTE => 13,
|
127
|
+
:tOPEN_ARRAY => 14,
|
128
|
+
:tCLOSE_ARRAY => 15,
|
129
|
+
:tOPEN_SELECTOR => 16,
|
130
|
+
:tCLOSE_SELECTOR => 17,
|
131
|
+
:tOPEN_GOTO_SCOPE => 18,
|
132
|
+
:tCLOSE_GOTO_SCOPE => 19,
|
133
|
+
:tOPERATOR => 20,
|
134
|
+
:tARRAY_VALUE => 21,
|
135
|
+
:tDYNAMIC_ATTRIBUTE => 22,
|
136
|
+
:tBOOLEAN => 23,
|
137
|
+
:tFLOAT => 24,
|
138
|
+
:tINTEGER => 25,
|
139
|
+
:tNIL => 26,
|
140
|
+
:tREGEXP => 27,
|
141
|
+
:tSTRING => 28,
|
142
|
+
:tSYMBOL => 29 }
|
143
|
+
|
144
|
+
racc_nt_base = 30
|
235
145
|
|
236
146
|
racc_use_result_var = false
|
237
147
|
|
@@ -261,9 +171,7 @@ Racc_token_to_s_table = [
|
|
261
171
|
"tIDENTIFIER_VALUE",
|
262
172
|
"tINDEX",
|
263
173
|
"tPSEUDO_CLASS",
|
264
|
-
"
|
265
|
-
"tSUBSEQUENT_SIBLING",
|
266
|
-
"tNEXT_SIBLING",
|
174
|
+
"tRELATIONSHIP",
|
267
175
|
"tOPEN_ATTRIBUTE",
|
268
176
|
"tCLOSE_ATTRIBUTE",
|
269
177
|
"tOPEN_DYNAMIC_ATTRIBUTE",
|
@@ -274,17 +182,7 @@ Racc_token_to_s_table = [
|
|
274
182
|
"tCLOSE_SELECTOR",
|
275
183
|
"tOPEN_GOTO_SCOPE",
|
276
184
|
"tCLOSE_GOTO_SCOPE",
|
277
|
-
"
|
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",
|
185
|
+
"tOPERATOR",
|
288
186
|
"tARRAY_VALUE",
|
289
187
|
"tDYNAMIC_ATTRIBUTE",
|
290
188
|
"tBOOLEAN",
|
@@ -297,6 +195,7 @@ Racc_token_to_s_table = [
|
|
297
195
|
"$start",
|
298
196
|
"expression",
|
299
197
|
"selector",
|
198
|
+
"simple_selector",
|
300
199
|
"attribute_list",
|
301
200
|
"attribute",
|
302
201
|
"value",
|
@@ -309,176 +208,108 @@ Racc_debug_parser = false
|
|
309
208
|
# reduce 0 omitted
|
310
209
|
|
311
210
|
def _reduce_1(val, _values)
|
312
|
-
Compiler::Expression.new(
|
211
|
+
Compiler::Expression.new(selector: val[0], rest: val[1])
|
313
212
|
end
|
314
213
|
|
315
214
|
def _reduce_2(val, _values)
|
316
|
-
Compiler::Expression.new(
|
215
|
+
Compiler::Expression.new(selector: val[0])
|
317
216
|
end
|
318
217
|
|
319
218
|
def _reduce_3(val, _values)
|
320
|
-
Compiler::
|
219
|
+
Compiler::Selector.new(simple_selector: val[0])
|
321
220
|
end
|
322
221
|
|
323
222
|
def _reduce_4(val, _values)
|
324
|
-
Compiler::
|
223
|
+
Compiler::Selector.new(simple_selector: val[0], index: val[1])
|
325
224
|
end
|
326
225
|
|
327
226
|
def _reduce_5(val, _values)
|
328
|
-
Compiler::
|
227
|
+
Compiler::Selector.new(simple_selector: val[0], pseudo_class: val[1], pseudo_selector: val[3])
|
329
228
|
end
|
330
229
|
|
331
230
|
def _reduce_6(val, _values)
|
332
|
-
Compiler::
|
231
|
+
Compiler::Selector.new(pseudo_class: val[0], pseudo_selector: val[2])
|
333
232
|
end
|
334
233
|
|
335
234
|
def _reduce_7(val, _values)
|
336
|
-
Compiler::
|
235
|
+
Compiler::Selector.new(relationship: val[0], rest: val[1])
|
337
236
|
end
|
338
237
|
|
339
238
|
def _reduce_8(val, _values)
|
340
|
-
Compiler::Selector.new(
|
239
|
+
Compiler::Selector.new(goto_scope: val[1], rest: val[3])
|
341
240
|
end
|
342
241
|
|
343
242
|
def _reduce_9(val, _values)
|
344
|
-
Compiler::
|
243
|
+
Compiler::SimpleSelector.new(node_type: val[0])
|
345
244
|
end
|
346
245
|
|
347
246
|
def _reduce_10(val, _values)
|
348
|
-
Compiler::
|
247
|
+
Compiler::SimpleSelector.new(node_type: val[0], attribute_list: val[1])
|
349
248
|
end
|
350
249
|
|
351
250
|
def _reduce_11(val, _values)
|
352
|
-
Compiler::
|
251
|
+
Compiler::AttributeList.new(attribute: val[1], rest: val[3])
|
353
252
|
end
|
354
253
|
|
355
254
|
def _reduce_12(val, _values)
|
356
|
-
Compiler::
|
255
|
+
Compiler::AttributeList.new(attribute: val[1])
|
357
256
|
end
|
358
257
|
|
359
258
|
def _reduce_13(val, _values)
|
360
|
-
Compiler::
|
259
|
+
Compiler::Attribute.new(key: val[0], value: val[2], operator: val[1])
|
361
260
|
end
|
362
261
|
|
363
262
|
def _reduce_14(val, _values)
|
364
|
-
Compiler::
|
263
|
+
Compiler::Attribute.new(key: val[0], value: Compiler::Array.new, operator: val[1])
|
365
264
|
end
|
366
265
|
|
367
266
|
def _reduce_15(val, _values)
|
368
|
-
Compiler::
|
267
|
+
Compiler::Attribute.new(key: val[0], value: val[3], operator: val[1])
|
369
268
|
end
|
370
269
|
|
371
270
|
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: :<)
|
397
|
-
end
|
398
|
-
|
399
|
-
def _reduce_23(val, _values)
|
400
|
-
Compiler::Attribute.new(key: val[0], value: val[2], operator: :==)
|
401
|
-
end
|
402
|
-
|
403
|
-
def _reduce_24(val, _values)
|
404
|
-
Compiler::Attribute.new(key: val[0], value: val[2], operator: :includes)
|
405
|
-
end
|
406
|
-
|
407
|
-
def _reduce_25(val, _values)
|
408
|
-
Compiler::Attribute.new(key: val[0], value: Compiler::Array.new, operator: :!=)
|
409
|
-
end
|
410
|
-
|
411
|
-
def _reduce_26(val, _values)
|
412
|
-
Compiler::Attribute.new(key: val[0], value: Compiler::Array.new, operator: :==)
|
413
|
-
end
|
414
|
-
|
415
|
-
def _reduce_27(val, _values)
|
416
|
-
Compiler::Attribute.new(key: val[0], value: Compiler::Array.new, operator: :not_in)
|
417
|
-
end
|
418
|
-
|
419
|
-
def _reduce_28(val, _values)
|
420
|
-
Compiler::Attribute.new(key: val[0], value: Compiler::Array.new, operator: :in)
|
421
|
-
end
|
422
|
-
|
423
|
-
def _reduce_29(val, _values)
|
424
|
-
Compiler::Attribute.new(key: val[0], value: val[3], operator: :!=)
|
425
|
-
end
|
426
|
-
|
427
|
-
def _reduce_30(val, _values)
|
428
|
-
Compiler::Attribute.new(key: val[0], value: val[3], operator: :==)
|
429
|
-
end
|
430
|
-
|
431
|
-
def _reduce_31(val, _values)
|
432
|
-
Compiler::Attribute.new(key: val[0], value: val[3], operator: :not_in)
|
433
|
-
end
|
434
|
-
|
435
|
-
def _reduce_32(val, _values)
|
436
|
-
Compiler::Attribute.new(key: val[0], value: val[3], operator: :in)
|
437
|
-
end
|
438
|
-
|
439
|
-
def _reduce_33(val, _values)
|
440
271
|
Compiler::Array.new(value: val[0], rest: val[1])
|
441
272
|
end
|
442
273
|
|
443
|
-
def
|
274
|
+
def _reduce_17(val, _values)
|
444
275
|
Compiler::Array.new(value: val[0])
|
445
276
|
end
|
446
277
|
|
447
|
-
# reduce
|
278
|
+
# reduce 18 omitted
|
448
279
|
|
449
|
-
def
|
280
|
+
def _reduce_19(val, _values)
|
450
281
|
Compiler::DynamicAttribute.new(value: val[1])
|
451
282
|
end
|
452
283
|
|
453
|
-
def
|
284
|
+
def _reduce_20(val, _values)
|
454
285
|
Compiler::Boolean.new(value: val[0])
|
455
286
|
end
|
456
287
|
|
457
|
-
def
|
288
|
+
def _reduce_21(val, _values)
|
458
289
|
Compiler::Float.new(value: val[0])
|
459
290
|
end
|
460
291
|
|
461
|
-
def
|
292
|
+
def _reduce_22(val, _values)
|
462
293
|
Compiler::Integer.new(value: val[0])
|
463
294
|
end
|
464
295
|
|
465
|
-
def
|
296
|
+
def _reduce_23(val, _values)
|
466
297
|
Compiler::Nil.new(value: val[0])
|
467
298
|
end
|
468
299
|
|
469
|
-
def
|
300
|
+
def _reduce_24(val, _values)
|
470
301
|
Compiler::Regexp.new(value: val[0])
|
471
302
|
end
|
472
303
|
|
473
|
-
def
|
304
|
+
def _reduce_25(val, _values)
|
474
305
|
Compiler::String.new(value: val[0])
|
475
306
|
end
|
476
307
|
|
477
|
-
def
|
308
|
+
def _reduce_26(val, _values)
|
478
309
|
Compiler::Symbol.new(value: val[0])
|
479
310
|
end
|
480
311
|
|
481
|
-
def
|
312
|
+
def _reduce_27(val, _values)
|
482
313
|
Compiler::Identifier.new(value: val[0])
|
483
314
|
end
|
484
315
|
|