liquidscript 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/Guardfile +0 -4
- data/Rakefile +2 -2
- data/lib/liquidscript/compiler/icr/expressions.rb +2 -1
- data/lib/liquidscript/compiler/icr/literals.rb +17 -3
- data/lib/liquidscript/generator/javascript/literals.rb +18 -2
- data/lib/liquidscript/scanner.rb +3 -31
- data/lib/liquidscript/scanner/base.rb +84 -0
- data/lib/liquidscript/scanner/base/builder.rb +38 -0
- data/lib/liquidscript/scanner/base/context.rb +83 -0
- data/lib/liquidscript/scanner/base/dsl.rb +27 -0
- data/lib/liquidscript/scanner/base/lexer.rb +80 -0
- data/lib/liquidscript/scanner/liquidscript.rb +128 -0
- data/lib/liquidscript/scanner/token.rb +2 -6
- data/lib/liquidscript/template.rb +0 -1
- data/lib/liquidscript/version.rb +1 -1
- data/spec/fixtures/complex.generate.yml +1 -0
- data/spec/fixtures/main.compile.yml +1 -1
- data/spec/fixtures/string.compile.yml +15 -0
- data/spec/fixtures/string.generate.yml +3 -1
- data/spec/{lib/liquidscript → liquidscript}/buffer_spec.rb +0 -0
- data/spec/{lib/liquidscript → liquidscript}/compiler/icr_spec.rb +0 -0
- data/spec/{lib/liquidscript → liquidscript}/generator/javascript_spec.rb +7 -2
- data/spec/{lib/liquidscript → liquidscript}/icr/code_spec.rb +0 -0
- data/spec/{lib/liquidscript → liquidscript}/icr/context_spec.rb +0 -0
- data/spec/{lib/liquidscript → liquidscript}/icr/set_spec.rb +0 -0
- data/spec/{lib/liquidscript → liquidscript}/scanner/lexer_spec.rb +13 -15
- data/spec/{lib/liquidscript → liquidscript}/scanner/token_spec.rb +0 -0
- data/spec/{lib/liquidscript → liquidscript}/scanner_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -0
- data/spec/support/helpers/lexer_helper.rb +1 -1
- data/spec/support/matchers/compile.rb +1 -1
- data/spec/support/matchers/generate.rb +2 -2
- metadata +28 -22
- data/lib/liquidscript/scanner/lexer.rb +0 -805
- data/lib/liquidscript/scanner/lexer.rl +0 -118
@@ -1,805 +0,0 @@
|
|
1
|
-
|
2
|
-
# line 1 "lib/liquidscript/scanner/lexer.rl"
|
3
|
-
|
4
|
-
# line 56 "lib/liquidscript/scanner/lexer.rl"
|
5
|
-
|
6
|
-
|
7
|
-
module Liquidscript
|
8
|
-
class Scanner
|
9
|
-
|
10
|
-
# A lexer, built from ragel.
|
11
|
-
#
|
12
|
-
# @private
|
13
|
-
class Lexer
|
14
|
-
|
15
|
-
attr_reader :tokens
|
16
|
-
|
17
|
-
def initialize
|
18
|
-
|
19
|
-
# line 20 "lib/liquidscript/scanner/lexer.rb"
|
20
|
-
class << self
|
21
|
-
attr_accessor :_lexer_actions
|
22
|
-
private :_lexer_actions, :_lexer_actions=
|
23
|
-
end
|
24
|
-
self._lexer_actions = [
|
25
|
-
0, 1, 0, 1, 1, 1, 2, 1,
|
26
|
-
17, 1, 18, 1, 19, 1, 20, 1,
|
27
|
-
21, 1, 22, 1, 23, 1, 24, 1,
|
28
|
-
25, 1, 26, 1, 27, 1, 28, 1,
|
29
|
-
29, 1, 30, 1, 31, 1, 32, 1,
|
30
|
-
33, 1, 34, 1, 35, 1, 36, 1,
|
31
|
-
37, 2, 2, 3, 2, 2, 4, 2,
|
32
|
-
2, 5, 2, 2, 6, 2, 2, 7,
|
33
|
-
2, 2, 8, 2, 2, 9, 2, 2,
|
34
|
-
10, 2, 2, 11, 2, 2, 12, 2,
|
35
|
-
2, 13, 2, 2, 14, 2, 2, 15,
|
36
|
-
2, 2, 16
|
37
|
-
]
|
38
|
-
|
39
|
-
class << self
|
40
|
-
attr_accessor :_lexer_key_offsets
|
41
|
-
private :_lexer_key_offsets, :_lexer_key_offsets=
|
42
|
-
end
|
43
|
-
self._lexer_key_offsets = [
|
44
|
-
0, 2, 4, 6, 10, 12, 58, 59,
|
45
|
-
60, 62, 70, 71, 80, 81, 85, 90,
|
46
|
-
94, 96, 98, 100, 101, 110, 119, 128,
|
47
|
-
137, 146, 155, 164, 173, 183, 192, 201,
|
48
|
-
210, 219, 228, 238, 247, 256, 265, 274,
|
49
|
-
283, 292, 301, 310, 319, 328, 337, 346,
|
50
|
-
355, 365, 374, 383, 392, 401, 410, 419,
|
51
|
-
428, 437, 446, 456, 465, 474, 483, 492,
|
52
|
-
501, 510, 520, 529, 538, 547, 556, 565,
|
53
|
-
574, 583, 592, 601
|
54
|
-
]
|
55
|
-
|
56
|
-
class << self
|
57
|
-
attr_accessor :_lexer_trans_keys
|
58
|
-
private :_lexer_trans_keys, :_lexer_trans_keys=
|
59
|
-
end
|
60
|
-
self._lexer_trans_keys = [
|
61
|
-
34, 92, 34, 92, 48, 57, 43, 45,
|
62
|
-
48, 57, 48, 57, 10, 32, 33, 34,
|
63
|
-
36, 38, 39, 40, 41, 43, 44, 45,
|
64
|
-
46, 58, 60, 61, 62, 91, 93, 94,
|
65
|
-
95, 97, 99, 101, 102, 105, 109, 110,
|
66
|
-
111, 114, 116, 117, 123, 124, 125, 126,
|
67
|
-
9, 13, 42, 47, 48, 57, 65, 90,
|
68
|
-
98, 122, 61, 61, 34, 92, 36, 95,
|
69
|
-
48, 57, 65, 90, 97, 122, 38, 36,
|
70
|
-
45, 95, 48, 57, 65, 90, 97, 122,
|
71
|
-
43, 45, 62, 48, 57, 46, 69, 101,
|
72
|
-
49, 57, 69, 101, 48, 57, 48, 57,
|
73
|
-
60, 61, 61, 62, 62, 36, 95, 110,
|
74
|
-
48, 57, 65, 90, 97, 122, 36, 95,
|
75
|
-
100, 48, 57, 65, 90, 97, 122, 36,
|
76
|
-
95, 108, 48, 57, 65, 90, 97, 122,
|
77
|
-
36, 95, 97, 48, 57, 65, 90, 98,
|
78
|
-
122, 36, 95, 115, 48, 57, 65, 90,
|
79
|
-
97, 122, 36, 95, 115, 48, 57, 65,
|
80
|
-
90, 97, 122, 36, 95, 108, 48, 57,
|
81
|
-
65, 90, 97, 122, 36, 95, 115, 48,
|
82
|
-
57, 65, 90, 97, 122, 36, 95, 101,
|
83
|
-
105, 48, 57, 65, 90, 97, 122, 36,
|
84
|
-
95, 102, 48, 57, 65, 90, 97, 122,
|
85
|
-
36, 95, 97, 48, 57, 65, 90, 98,
|
86
|
-
122, 36, 95, 108, 48, 57, 65, 90,
|
87
|
-
97, 122, 36, 95, 115, 48, 57, 65,
|
88
|
-
90, 97, 122, 36, 95, 101, 48, 57,
|
89
|
-
65, 90, 97, 122, 36, 95, 102, 110,
|
90
|
-
48, 57, 65, 90, 97, 122, 36, 95,
|
91
|
-
115, 48, 57, 65, 90, 97, 122, 36,
|
92
|
-
95, 116, 48, 57, 65, 90, 97, 122,
|
93
|
-
36, 95, 97, 48, 57, 65, 90, 98,
|
94
|
-
122, 36, 95, 110, 48, 57, 65, 90,
|
95
|
-
97, 122, 36, 95, 99, 48, 57, 65,
|
96
|
-
90, 97, 122, 36, 95, 101, 48, 57,
|
97
|
-
65, 90, 97, 122, 36, 95, 111, 48,
|
98
|
-
57, 65, 90, 97, 122, 36, 95, 102,
|
99
|
-
48, 57, 65, 90, 97, 122, 36, 95,
|
100
|
-
111, 48, 57, 65, 90, 97, 122, 36,
|
101
|
-
95, 100, 48, 57, 65, 90, 97, 122,
|
102
|
-
36, 95, 117, 48, 57, 65, 90, 97,
|
103
|
-
122, 36, 95, 108, 48, 57, 65, 90,
|
104
|
-
97, 122, 36, 95, 101, 48, 57, 65,
|
105
|
-
90, 97, 122, 36, 95, 101, 117, 48,
|
106
|
-
57, 65, 90, 97, 122, 36, 95, 119,
|
107
|
-
48, 57, 65, 90, 97, 122, 36, 95,
|
108
|
-
108, 48, 57, 65, 90, 97, 122, 36,
|
109
|
-
95, 108, 48, 57, 65, 90, 97, 122,
|
110
|
-
36, 95, 114, 48, 57, 65, 90, 97,
|
111
|
-
122, 36, 95, 101, 48, 57, 65, 90,
|
112
|
-
97, 122, 36, 95, 116, 48, 57, 65,
|
113
|
-
90, 97, 122, 36, 95, 117, 48, 57,
|
114
|
-
65, 90, 97, 122, 36, 95, 114, 48,
|
115
|
-
57, 65, 90, 97, 122, 36, 95, 110,
|
116
|
-
48, 57, 65, 90, 97, 122, 36, 95,
|
117
|
-
114, 121, 48, 57, 65, 90, 97, 122,
|
118
|
-
36, 95, 117, 48, 57, 65, 90, 97,
|
119
|
-
122, 36, 95, 112, 48, 57, 65, 90,
|
120
|
-
97, 122, 36, 95, 101, 48, 57, 65,
|
121
|
-
90, 97, 122, 36, 95, 111, 48, 57,
|
122
|
-
65, 90, 97, 122, 36, 95, 102, 48,
|
123
|
-
57, 65, 90, 97, 122, 36, 95, 110,
|
124
|
-
48, 57, 65, 90, 97, 122, 36, 95,
|
125
|
-
100, 108, 48, 57, 65, 90, 97, 122,
|
126
|
-
36, 95, 101, 48, 57, 65, 90, 97,
|
127
|
-
122, 36, 95, 102, 48, 57, 65, 90,
|
128
|
-
97, 122, 36, 95, 105, 48, 57, 65,
|
129
|
-
90, 97, 122, 36, 95, 110, 48, 57,
|
130
|
-
65, 90, 97, 122, 36, 95, 101, 48,
|
131
|
-
57, 65, 90, 97, 122, 36, 95, 100,
|
132
|
-
48, 57, 65, 90, 97, 122, 36, 95,
|
133
|
-
101, 48, 57, 65, 90, 97, 122, 36,
|
134
|
-
95, 115, 48, 57, 65, 90, 97, 122,
|
135
|
-
36, 95, 115, 48, 57, 65, 90, 97,
|
136
|
-
122, 124, 0
|
137
|
-
]
|
138
|
-
|
139
|
-
class << self
|
140
|
-
attr_accessor :_lexer_single_lengths
|
141
|
-
private :_lexer_single_lengths, :_lexer_single_lengths=
|
142
|
-
end
|
143
|
-
self._lexer_single_lengths = [
|
144
|
-
2, 2, 0, 2, 0, 36, 1, 1,
|
145
|
-
2, 2, 1, 3, 1, 2, 3, 2,
|
146
|
-
0, 0, 2, 1, 3, 3, 3, 3,
|
147
|
-
3, 3, 3, 3, 4, 3, 3, 3,
|
148
|
-
3, 3, 4, 3, 3, 3, 3, 3,
|
149
|
-
3, 3, 3, 3, 3, 3, 3, 3,
|
150
|
-
4, 3, 3, 3, 3, 3, 3, 3,
|
151
|
-
3, 3, 4, 3, 3, 3, 3, 3,
|
152
|
-
3, 4, 3, 3, 3, 3, 3, 3,
|
153
|
-
3, 3, 3, 1
|
154
|
-
]
|
155
|
-
|
156
|
-
class << self
|
157
|
-
attr_accessor :_lexer_range_lengths
|
158
|
-
private :_lexer_range_lengths, :_lexer_range_lengths=
|
159
|
-
end
|
160
|
-
self._lexer_range_lengths = [
|
161
|
-
0, 0, 1, 1, 1, 5, 0, 0,
|
162
|
-
0, 3, 0, 3, 0, 1, 1, 1,
|
163
|
-
1, 1, 0, 0, 3, 3, 3, 3,
|
164
|
-
3, 3, 3, 3, 3, 3, 3, 3,
|
165
|
-
3, 3, 3, 3, 3, 3, 3, 3,
|
166
|
-
3, 3, 3, 3, 3, 3, 3, 3,
|
167
|
-
3, 3, 3, 3, 3, 3, 3, 3,
|
168
|
-
3, 3, 3, 3, 3, 3, 3, 3,
|
169
|
-
3, 3, 3, 3, 3, 3, 3, 3,
|
170
|
-
3, 3, 3, 0
|
171
|
-
]
|
172
|
-
|
173
|
-
class << self
|
174
|
-
attr_accessor :_lexer_index_offsets
|
175
|
-
private :_lexer_index_offsets, :_lexer_index_offsets=
|
176
|
-
end
|
177
|
-
self._lexer_index_offsets = [
|
178
|
-
0, 3, 6, 8, 12, 14, 56, 58,
|
179
|
-
60, 63, 69, 71, 78, 80, 84, 89,
|
180
|
-
93, 95, 97, 100, 102, 109, 116, 123,
|
181
|
-
130, 137, 144, 151, 158, 166, 173, 180,
|
182
|
-
187, 194, 201, 209, 216, 223, 230, 237,
|
183
|
-
244, 251, 258, 265, 272, 279, 286, 293,
|
184
|
-
300, 308, 315, 322, 329, 336, 343, 350,
|
185
|
-
357, 364, 371, 379, 386, 393, 400, 407,
|
186
|
-
414, 421, 429, 436, 443, 450, 457, 464,
|
187
|
-
471, 478, 485, 492
|
188
|
-
]
|
189
|
-
|
190
|
-
class << self
|
191
|
-
attr_accessor :_lexer_indicies
|
192
|
-
private :_lexer_indicies, :_lexer_indicies=
|
193
|
-
end
|
194
|
-
self._lexer_indicies = [
|
195
|
-
2, 3, 1, 4, 3, 1, 6, 5,
|
196
|
-
7, 7, 8, 5, 8, 5, 11, 10,
|
197
|
-
12, 13, 14, 15, 16, 17, 18, 20,
|
198
|
-
21, 22, 23, 25, 26, 27, 28, 29,
|
199
|
-
30, 19, 14, 31, 32, 33, 34, 35,
|
200
|
-
36, 37, 38, 39, 40, 41, 42, 43,
|
201
|
-
44, 45, 10, 19, 24, 14, 14, 9,
|
202
|
-
46, 0, 19, 47, 2, 3, 1, 14,
|
203
|
-
14, 14, 14, 14, 0, 19, 47, 48,
|
204
|
-
48, 48, 48, 48, 48, 0, 45, 47,
|
205
|
-
45, 49, 24, 47, 51, 52, 52, 24,
|
206
|
-
50, 52, 52, 6, 50, 8, 50, 19,
|
207
|
-
47, 19, 53, 47, 19, 47, 14, 14,
|
208
|
-
55, 14, 14, 14, 54, 14, 14, 56,
|
209
|
-
14, 14, 14, 54, 14, 14, 57, 14,
|
210
|
-
14, 14, 54, 14, 14, 58, 14, 14,
|
211
|
-
14, 54, 14, 14, 59, 14, 14, 14,
|
212
|
-
54, 14, 14, 60, 14, 14, 14, 54,
|
213
|
-
14, 14, 61, 14, 14, 14, 54, 14,
|
214
|
-
14, 62, 14, 14, 14, 54, 14, 14,
|
215
|
-
63, 64, 14, 14, 14, 54, 14, 14,
|
216
|
-
65, 14, 14, 14, 54, 14, 14, 66,
|
217
|
-
14, 14, 14, 54, 14, 14, 67, 14,
|
218
|
-
14, 14, 54, 14, 14, 68, 14, 14,
|
219
|
-
14, 54, 14, 14, 69, 14, 14, 14,
|
220
|
-
54, 14, 14, 70, 71, 14, 14, 14,
|
221
|
-
54, 14, 14, 72, 14, 14, 14, 54,
|
222
|
-
14, 14, 73, 14, 14, 14, 54, 14,
|
223
|
-
14, 74, 14, 14, 14, 54, 14, 14,
|
224
|
-
75, 14, 14, 14, 54, 14, 14, 76,
|
225
|
-
14, 14, 14, 54, 14, 14, 77, 14,
|
226
|
-
14, 14, 54, 14, 14, 78, 14, 14,
|
227
|
-
14, 54, 14, 14, 56, 14, 14, 14,
|
228
|
-
54, 14, 14, 79, 14, 14, 14, 54,
|
229
|
-
14, 14, 80, 14, 14, 14, 54, 14,
|
230
|
-
14, 81, 14, 14, 14, 54, 14, 14,
|
231
|
-
82, 14, 14, 14, 54, 14, 14, 83,
|
232
|
-
14, 14, 14, 54, 14, 14, 84, 85,
|
233
|
-
14, 14, 14, 54, 14, 14, 86, 14,
|
234
|
-
14, 14, 54, 14, 14, 87, 14, 14,
|
235
|
-
14, 54, 14, 14, 69, 14, 14, 14,
|
236
|
-
54, 14, 14, 56, 14, 14, 14, 54,
|
237
|
-
14, 14, 88, 14, 14, 14, 54, 14,
|
238
|
-
14, 89, 14, 14, 14, 54, 14, 14,
|
239
|
-
90, 14, 14, 14, 54, 14, 14, 91,
|
240
|
-
14, 14, 14, 54, 14, 14, 86, 14,
|
241
|
-
14, 14, 54, 14, 14, 92, 93, 14,
|
242
|
-
14, 14, 54, 14, 14, 68, 14, 14,
|
243
|
-
14, 54, 14, 14, 94, 14, 14, 14,
|
244
|
-
54, 14, 14, 95, 14, 14, 14, 54,
|
245
|
-
14, 14, 96, 14, 14, 14, 54, 14,
|
246
|
-
14, 86, 14, 14, 14, 54, 14, 14,
|
247
|
-
97, 14, 14, 14, 54, 14, 14, 98,
|
248
|
-
99, 14, 14, 14, 54, 14, 14, 100,
|
249
|
-
14, 14, 14, 54, 14, 14, 101, 14,
|
250
|
-
14, 14, 54, 14, 14, 102, 14, 14,
|
251
|
-
14, 54, 14, 14, 103, 14, 14, 14,
|
252
|
-
54, 14, 14, 104, 14, 14, 14, 54,
|
253
|
-
14, 14, 69, 14, 14, 14, 54, 14,
|
254
|
-
14, 105, 14, 14, 14, 54, 14, 14,
|
255
|
-
106, 14, 14, 14, 54, 14, 14, 107,
|
256
|
-
14, 14, 14, 54, 19, 47, 0
|
257
|
-
]
|
258
|
-
|
259
|
-
class << self
|
260
|
-
attr_accessor :_lexer_trans_targs
|
261
|
-
private :_lexer_trans_targs, :_lexer_trans_targs=
|
262
|
-
end
|
263
|
-
self._lexer_trans_targs = [
|
264
|
-
5, 0, 5, 1, 8, 5, 15, 4,
|
265
|
-
16, 5, 5, 5, 6, 8, 9, 10,
|
266
|
-
11, 5, 5, 5, 12, 5, 13, 5,
|
267
|
-
14, 5, 17, 6, 18, 5, 5, 20,
|
268
|
-
22, 26, 30, 34, 43, 48, 52, 53,
|
269
|
-
58, 64, 5, 75, 5, 5, 7, 5,
|
270
|
-
11, 5, 5, 2, 3, 19, 5, 21,
|
271
|
-
9, 23, 24, 25, 9, 27, 28, 9,
|
272
|
-
29, 9, 31, 32, 33, 9, 9, 35,
|
273
|
-
36, 37, 38, 39, 40, 41, 42, 44,
|
274
|
-
45, 46, 47, 9, 49, 50, 9, 51,
|
275
|
-
54, 55, 56, 57, 59, 60, 61, 62,
|
276
|
-
63, 65, 66, 72, 67, 68, 69, 70,
|
277
|
-
71, 73, 74, 9
|
278
|
-
]
|
279
|
-
|
280
|
-
class << self
|
281
|
-
attr_accessor :_lexer_trans_actions
|
282
|
-
private :_lexer_trans_actions, :_lexer_trans_actions=
|
283
|
-
end
|
284
|
-
self._lexer_trans_actions = [
|
285
|
-
47, 0, 7, 0, 49, 45, 5, 0,
|
286
|
-
0, 37, 35, 33, 73, 88, 82, 0,
|
287
|
-
88, 17, 23, 11, 0, 31, 0, 29,
|
288
|
-
5, 27, 0, 85, 0, 19, 25, 0,
|
289
|
-
0, 0, 0, 0, 0, 0, 0, 0,
|
290
|
-
0, 0, 15, 0, 21, 9, 0, 41,
|
291
|
-
52, 13, 39, 0, 0, 0, 43, 0,
|
292
|
-
76, 0, 0, 0, 55, 0, 0, 70,
|
293
|
-
0, 67, 0, 0, 0, 79, 61, 0,
|
294
|
-
0, 0, 0, 0, 0, 0, 0, 0,
|
295
|
-
0, 0, 0, 58, 0, 0, 73, 0,
|
296
|
-
0, 0, 0, 0, 0, 0, 0, 0,
|
297
|
-
0, 0, 0, 0, 0, 0, 0, 0,
|
298
|
-
0, 0, 0, 64
|
299
|
-
]
|
300
|
-
|
301
|
-
class << self
|
302
|
-
attr_accessor :_lexer_to_state_actions
|
303
|
-
private :_lexer_to_state_actions, :_lexer_to_state_actions=
|
304
|
-
end
|
305
|
-
self._lexer_to_state_actions = [
|
306
|
-
0, 0, 0, 0, 0, 1, 0, 0,
|
307
|
-
0, 0, 0, 0, 0, 0, 0, 0,
|
308
|
-
0, 0, 0, 0, 0, 0, 0, 0,
|
309
|
-
0, 0, 0, 0, 0, 0, 0, 0,
|
310
|
-
0, 0, 0, 0, 0, 0, 0, 0,
|
311
|
-
0, 0, 0, 0, 0, 0, 0, 0,
|
312
|
-
0, 0, 0, 0, 0, 0, 0, 0,
|
313
|
-
0, 0, 0, 0, 0, 0, 0, 0,
|
314
|
-
0, 0, 0, 0, 0, 0, 0, 0,
|
315
|
-
0, 0, 0, 0
|
316
|
-
]
|
317
|
-
|
318
|
-
class << self
|
319
|
-
attr_accessor :_lexer_from_state_actions
|
320
|
-
private :_lexer_from_state_actions, :_lexer_from_state_actions=
|
321
|
-
end
|
322
|
-
self._lexer_from_state_actions = [
|
323
|
-
0, 0, 0, 0, 0, 3, 0, 0,
|
324
|
-
0, 0, 0, 0, 0, 0, 0, 0,
|
325
|
-
0, 0, 0, 0, 0, 0, 0, 0,
|
326
|
-
0, 0, 0, 0, 0, 0, 0, 0,
|
327
|
-
0, 0, 0, 0, 0, 0, 0, 0,
|
328
|
-
0, 0, 0, 0, 0, 0, 0, 0,
|
329
|
-
0, 0, 0, 0, 0, 0, 0, 0,
|
330
|
-
0, 0, 0, 0, 0, 0, 0, 0,
|
331
|
-
0, 0, 0, 0, 0, 0, 0, 0,
|
332
|
-
0, 0, 0, 0
|
333
|
-
]
|
334
|
-
|
335
|
-
class << self
|
336
|
-
attr_accessor :_lexer_eof_trans
|
337
|
-
private :_lexer_eof_trans, :_lexer_eof_trans=
|
338
|
-
end
|
339
|
-
self._lexer_eof_trans = [
|
340
|
-
1, 1, 6, 6, 6, 0, 1, 48,
|
341
|
-
1, 1, 48, 1, 48, 48, 51, 51,
|
342
|
-
51, 48, 48, 48, 55, 55, 55, 55,
|
343
|
-
55, 55, 55, 55, 55, 55, 55, 55,
|
344
|
-
55, 55, 55, 55, 55, 55, 55, 55,
|
345
|
-
55, 55, 55, 55, 55, 55, 55, 55,
|
346
|
-
55, 55, 55, 55, 55, 55, 55, 55,
|
347
|
-
55, 55, 55, 55, 55, 55, 55, 55,
|
348
|
-
55, 55, 55, 55, 55, 55, 55, 55,
|
349
|
-
55, 55, 55, 48
|
350
|
-
]
|
351
|
-
|
352
|
-
class << self
|
353
|
-
attr_accessor :lexer_start
|
354
|
-
end
|
355
|
-
self.lexer_start = 5;
|
356
|
-
class << self
|
357
|
-
attr_accessor :lexer_first_final
|
358
|
-
end
|
359
|
-
self.lexer_first_final = 5;
|
360
|
-
class << self
|
361
|
-
attr_accessor :lexer_error
|
362
|
-
end
|
363
|
-
self.lexer_error = -1;
|
364
|
-
|
365
|
-
class << self
|
366
|
-
attr_accessor :lexer_en_main
|
367
|
-
end
|
368
|
-
self.lexer_en_main = 5;
|
369
|
-
|
370
|
-
|
371
|
-
# line 70 "lib/liquidscript/scanner/lexer.rl"
|
372
|
-
# %% # fix
|
373
|
-
@tokens = []
|
374
|
-
clean!
|
375
|
-
end
|
376
|
-
|
377
|
-
def clean!
|
378
|
-
@p = nil
|
379
|
-
@pe = nil
|
380
|
-
@te = nil
|
381
|
-
@ts = nil
|
382
|
-
@act = nil
|
383
|
-
@eof = nil
|
384
|
-
@top = nil
|
385
|
-
@line = { :start => 0, :num => 0 }
|
386
|
-
@data = nil
|
387
|
-
@stack = nil
|
388
|
-
end
|
389
|
-
|
390
|
-
def emit(type)
|
391
|
-
@tokens << Token.new(type, @data[@ts..(@te - 1)],
|
392
|
-
@line[:num], @ts - @line[:start])
|
393
|
-
end
|
394
|
-
|
395
|
-
def error
|
396
|
-
raise SyntaxError, "Unexpected #{@data[@ts..(@te-1)].pack('c*')}"
|
397
|
-
end
|
398
|
-
|
399
|
-
def perform(data)
|
400
|
-
@data = data.unpack("c*") if data.is_a? String
|
401
|
-
@eof = data.length
|
402
|
-
|
403
|
-
@tokens = []
|
404
|
-
|
405
|
-
line = proc do
|
406
|
-
@line[:start] = @ts
|
407
|
-
@line[:num] += 1
|
408
|
-
emit :newline
|
409
|
-
end
|
410
|
-
|
411
|
-
|
412
|
-
# line 413 "lib/liquidscript/scanner/lexer.rb"
|
413
|
-
begin
|
414
|
-
@p ||= 0
|
415
|
-
@pe ||= @data.length
|
416
|
-
@cs = lexer_start
|
417
|
-
@ts = nil
|
418
|
-
@te = nil
|
419
|
-
@act = 0
|
420
|
-
end
|
421
|
-
|
422
|
-
# line 110 "lib/liquidscript/scanner/lexer.rl"
|
423
|
-
|
424
|
-
# line 425 "lib/liquidscript/scanner/lexer.rb"
|
425
|
-
begin
|
426
|
-
_klen, _trans, _keys, _acts, _nacts = nil
|
427
|
-
_goto_level = 0
|
428
|
-
_resume = 10
|
429
|
-
_eof_trans = 15
|
430
|
-
_again = 20
|
431
|
-
_test_eof = 30
|
432
|
-
_out = 40
|
433
|
-
while true
|
434
|
-
_trigger_goto = false
|
435
|
-
if _goto_level <= 0
|
436
|
-
if @p == @pe
|
437
|
-
_goto_level = _test_eof
|
438
|
-
next
|
439
|
-
end
|
440
|
-
end
|
441
|
-
if _goto_level <= _resume
|
442
|
-
_acts = _lexer_from_state_actions[ @cs]
|
443
|
-
_nacts = _lexer_actions[_acts]
|
444
|
-
_acts += 1
|
445
|
-
while _nacts > 0
|
446
|
-
_nacts -= 1
|
447
|
-
_acts += 1
|
448
|
-
case _lexer_actions[_acts - 1]
|
449
|
-
when 1 then
|
450
|
-
# line 1 "NONE"
|
451
|
-
begin
|
452
|
-
@ts = @p
|
453
|
-
end
|
454
|
-
# line 455 "lib/liquidscript/scanner/lexer.rb"
|
455
|
-
end # from state action switch
|
456
|
-
end
|
457
|
-
if _trigger_goto
|
458
|
-
next
|
459
|
-
end
|
460
|
-
_keys = _lexer_key_offsets[ @cs]
|
461
|
-
_trans = _lexer_index_offsets[ @cs]
|
462
|
-
_klen = _lexer_single_lengths[ @cs]
|
463
|
-
_break_match = false
|
464
|
-
|
465
|
-
begin
|
466
|
-
if _klen > 0
|
467
|
-
_lower = _keys
|
468
|
-
_upper = _keys + _klen - 1
|
469
|
-
|
470
|
-
loop do
|
471
|
-
break if _upper < _lower
|
472
|
-
_mid = _lower + ( (_upper - _lower) >> 1 )
|
473
|
-
|
474
|
-
if @data[ @p].ord < _lexer_trans_keys[_mid]
|
475
|
-
_upper = _mid - 1
|
476
|
-
elsif @data[ @p].ord > _lexer_trans_keys[_mid]
|
477
|
-
_lower = _mid + 1
|
478
|
-
else
|
479
|
-
_trans += (_mid - _keys)
|
480
|
-
_break_match = true
|
481
|
-
break
|
482
|
-
end
|
483
|
-
end # loop
|
484
|
-
break if _break_match
|
485
|
-
_keys += _klen
|
486
|
-
_trans += _klen
|
487
|
-
end
|
488
|
-
_klen = _lexer_range_lengths[ @cs]
|
489
|
-
if _klen > 0
|
490
|
-
_lower = _keys
|
491
|
-
_upper = _keys + (_klen << 1) - 2
|
492
|
-
loop do
|
493
|
-
break if _upper < _lower
|
494
|
-
_mid = _lower + (((_upper-_lower) >> 1) & ~1)
|
495
|
-
if @data[ @p].ord < _lexer_trans_keys[_mid]
|
496
|
-
_upper = _mid - 2
|
497
|
-
elsif @data[ @p].ord > _lexer_trans_keys[_mid+1]
|
498
|
-
_lower = _mid + 2
|
499
|
-
else
|
500
|
-
_trans += ((_mid - _keys) >> 1)
|
501
|
-
_break_match = true
|
502
|
-
break
|
503
|
-
end
|
504
|
-
end # loop
|
505
|
-
break if _break_match
|
506
|
-
_trans += _klen
|
507
|
-
end
|
508
|
-
end while false
|
509
|
-
_trans = _lexer_indicies[_trans]
|
510
|
-
end
|
511
|
-
if _goto_level <= _eof_trans
|
512
|
-
@cs = _lexer_trans_targs[_trans]
|
513
|
-
if _lexer_trans_actions[_trans] != 0
|
514
|
-
_acts = _lexer_trans_actions[_trans]
|
515
|
-
_nacts = _lexer_actions[_acts]
|
516
|
-
_acts += 1
|
517
|
-
while _nacts > 0
|
518
|
-
_nacts -= 1
|
519
|
-
_acts += 1
|
520
|
-
case _lexer_actions[_acts - 1]
|
521
|
-
when 2 then
|
522
|
-
# line 1 "NONE"
|
523
|
-
begin
|
524
|
-
@te = @p+1
|
525
|
-
end
|
526
|
-
when 3 then
|
527
|
-
# line 29 "lib/liquidscript/scanner/lexer.rl"
|
528
|
-
begin
|
529
|
-
@act = 2; end
|
530
|
-
when 4 then
|
531
|
-
# line 30 "lib/liquidscript/scanner/lexer.rl"
|
532
|
-
begin
|
533
|
-
@act = 3; end
|
534
|
-
when 5 then
|
535
|
-
# line 31 "lib/liquidscript/scanner/lexer.rl"
|
536
|
-
begin
|
537
|
-
@act = 4; end
|
538
|
-
when 6 then
|
539
|
-
# line 32 "lib/liquidscript/scanner/lexer.rl"
|
540
|
-
begin
|
541
|
-
@act = 5; end
|
542
|
-
when 7 then
|
543
|
-
# line 33 "lib/liquidscript/scanner/lexer.rl"
|
544
|
-
begin
|
545
|
-
@act = 6; end
|
546
|
-
when 8 then
|
547
|
-
# line 34 "lib/liquidscript/scanner/lexer.rl"
|
548
|
-
begin
|
549
|
-
@act = 7; end
|
550
|
-
when 9 then
|
551
|
-
# line 35 "lib/liquidscript/scanner/lexer.rl"
|
552
|
-
begin
|
553
|
-
@act = 8; end
|
554
|
-
when 10 then
|
555
|
-
# line 36 "lib/liquidscript/scanner/lexer.rl"
|
556
|
-
begin
|
557
|
-
@act = 9; end
|
558
|
-
when 11 then
|
559
|
-
# line 37 "lib/liquidscript/scanner/lexer.rl"
|
560
|
-
begin
|
561
|
-
@act = 10; end
|
562
|
-
when 12 then
|
563
|
-
# line 38 "lib/liquidscript/scanner/lexer.rl"
|
564
|
-
begin
|
565
|
-
@act = 11; end
|
566
|
-
when 13 then
|
567
|
-
# line 39 "lib/liquidscript/scanner/lexer.rl"
|
568
|
-
begin
|
569
|
-
@act = 12; end
|
570
|
-
when 14 then
|
571
|
-
# line 40 "lib/liquidscript/scanner/lexer.rl"
|
572
|
-
begin
|
573
|
-
@act = 13; end
|
574
|
-
when 15 then
|
575
|
-
# line 42 "lib/liquidscript/scanner/lexer.rl"
|
576
|
-
begin
|
577
|
-
@act = 15; end
|
578
|
-
when 16 then
|
579
|
-
# line 54 "lib/liquidscript/scanner/lexer.rl"
|
580
|
-
begin
|
581
|
-
@act = 27; end
|
582
|
-
when 17 then
|
583
|
-
# line 29 "lib/liquidscript/scanner/lexer.rl"
|
584
|
-
begin
|
585
|
-
@te = @p+1
|
586
|
-
begin emit :dstring end
|
587
|
-
end
|
588
|
-
when 18 then
|
589
|
-
# line 37 "lib/liquidscript/scanner/lexer.rl"
|
590
|
-
begin
|
591
|
-
@te = @p+1
|
592
|
-
begin emit :unop end
|
593
|
-
end
|
594
|
-
when 19 then
|
595
|
-
# line 38 "lib/liquidscript/scanner/lexer.rl"
|
596
|
-
begin
|
597
|
-
@te = @p+1
|
598
|
-
begin emit :binop end
|
599
|
-
end
|
600
|
-
when 20 then
|
601
|
-
# line 41 "lib/liquidscript/scanner/lexer.rl"
|
602
|
-
begin
|
603
|
-
@te = @p+1
|
604
|
-
begin emit :arrow end
|
605
|
-
end
|
606
|
-
when 21 then
|
607
|
-
# line 43 "lib/liquidscript/scanner/lexer.rl"
|
608
|
-
begin
|
609
|
-
@te = @p+1
|
610
|
-
begin emit :lbrack end
|
611
|
-
end
|
612
|
-
when 22 then
|
613
|
-
# line 44 "lib/liquidscript/scanner/lexer.rl"
|
614
|
-
begin
|
615
|
-
@te = @p+1
|
616
|
-
begin emit :lparen end
|
617
|
-
end
|
618
|
-
when 23 then
|
619
|
-
# line 45 "lib/liquidscript/scanner/lexer.rl"
|
620
|
-
begin
|
621
|
-
@te = @p+1
|
622
|
-
begin emit :lbrace end
|
623
|
-
end
|
624
|
-
when 24 then
|
625
|
-
# line 46 "lib/liquidscript/scanner/lexer.rl"
|
626
|
-
begin
|
627
|
-
@te = @p+1
|
628
|
-
begin emit :rbrack end
|
629
|
-
end
|
630
|
-
when 25 then
|
631
|
-
# line 47 "lib/liquidscript/scanner/lexer.rl"
|
632
|
-
begin
|
633
|
-
@te = @p+1
|
634
|
-
begin emit :rparen end
|
635
|
-
end
|
636
|
-
when 26 then
|
637
|
-
# line 48 "lib/liquidscript/scanner/lexer.rl"
|
638
|
-
begin
|
639
|
-
@te = @p+1
|
640
|
-
begin emit :rbrace end
|
641
|
-
end
|
642
|
-
when 27 then
|
643
|
-
# line 49 "lib/liquidscript/scanner/lexer.rl"
|
644
|
-
begin
|
645
|
-
@te = @p+1
|
646
|
-
begin emit :colon end
|
647
|
-
end
|
648
|
-
when 28 then
|
649
|
-
# line 50 "lib/liquidscript/scanner/lexer.rl"
|
650
|
-
begin
|
651
|
-
@te = @p+1
|
652
|
-
begin emit :prop end
|
653
|
-
end
|
654
|
-
when 29 then
|
655
|
-
# line 51 "lib/liquidscript/scanner/lexer.rl"
|
656
|
-
begin
|
657
|
-
@te = @p+1
|
658
|
-
begin emit :comma end
|
659
|
-
end
|
660
|
-
when 30 then
|
661
|
-
# line 52 "lib/liquidscript/scanner/lexer.rl"
|
662
|
-
begin
|
663
|
-
@te = @p+1
|
664
|
-
begin line.call end
|
665
|
-
end
|
666
|
-
when 31 then
|
667
|
-
# line 53 "lib/liquidscript/scanner/lexer.rl"
|
668
|
-
begin
|
669
|
-
@te = @p+1
|
670
|
-
begin end
|
671
|
-
end
|
672
|
-
when 32 then
|
673
|
-
# line 54 "lib/liquidscript/scanner/lexer.rl"
|
674
|
-
begin
|
675
|
-
@te = @p+1
|
676
|
-
begin error end
|
677
|
-
end
|
678
|
-
when 33 then
|
679
|
-
# line 28 "lib/liquidscript/scanner/lexer.rl"
|
680
|
-
begin
|
681
|
-
@te = @p
|
682
|
-
@p = @p - 1; begin emit :number end
|
683
|
-
end
|
684
|
-
when 34 then
|
685
|
-
# line 38 "lib/liquidscript/scanner/lexer.rl"
|
686
|
-
begin
|
687
|
-
@te = @p
|
688
|
-
@p = @p - 1; begin emit :binop end
|
689
|
-
end
|
690
|
-
when 35 then
|
691
|
-
# line 40 "lib/liquidscript/scanner/lexer.rl"
|
692
|
-
begin
|
693
|
-
@te = @p
|
694
|
-
@p = @p - 1; begin emit :identifier end
|
695
|
-
end
|
696
|
-
when 36 then
|
697
|
-
# line 28 "lib/liquidscript/scanner/lexer.rl"
|
698
|
-
begin
|
699
|
-
begin @p = (( @te))-1; end
|
700
|
-
begin emit :number end
|
701
|
-
end
|
702
|
-
when 37 then
|
703
|
-
# line 1 "NONE"
|
704
|
-
begin
|
705
|
-
case @act
|
706
|
-
when 2 then
|
707
|
-
begin begin @p = (( @te))-1; end
|
708
|
-
emit :dstring end
|
709
|
-
when 3 then
|
710
|
-
begin begin @p = (( @te))-1; end
|
711
|
-
emit :sstring end
|
712
|
-
when 4 then
|
713
|
-
begin begin @p = (( @te))-1; end
|
714
|
-
emit :class end
|
715
|
-
when 5 then
|
716
|
-
begin begin @p = (( @te))-1; end
|
717
|
-
emit :module end
|
718
|
-
when 6 then
|
719
|
-
begin begin @p = (( @te))-1; end
|
720
|
-
emit :if end
|
721
|
-
when 7 then
|
722
|
-
begin begin @p = (( @te))-1; end
|
723
|
-
emit :unless end
|
724
|
-
when 8 then
|
725
|
-
begin begin @p = (( @te))-1; end
|
726
|
-
emit :elsif end
|
727
|
-
when 9 then
|
728
|
-
begin begin @p = (( @te))-1; end
|
729
|
-
emit :else end
|
730
|
-
when 10 then
|
731
|
-
begin begin @p = (( @te))-1; end
|
732
|
-
emit :unop end
|
733
|
-
when 11 then
|
734
|
-
begin begin @p = (( @te))-1; end
|
735
|
-
emit :binop end
|
736
|
-
when 12 then
|
737
|
-
begin begin @p = (( @te))-1; end
|
738
|
-
emit :keyword end
|
739
|
-
when 13 then
|
740
|
-
begin begin @p = (( @te))-1; end
|
741
|
-
emit :identifier end
|
742
|
-
when 15 then
|
743
|
-
begin begin @p = (( @te))-1; end
|
744
|
-
emit :equal end
|
745
|
-
when 27 then
|
746
|
-
begin begin @p = (( @te))-1; end
|
747
|
-
error end
|
748
|
-
end
|
749
|
-
end
|
750
|
-
# line 751 "lib/liquidscript/scanner/lexer.rb"
|
751
|
-
end # action switch
|
752
|
-
end
|
753
|
-
end
|
754
|
-
if _trigger_goto
|
755
|
-
next
|
756
|
-
end
|
757
|
-
end
|
758
|
-
if _goto_level <= _again
|
759
|
-
_acts = _lexer_to_state_actions[ @cs]
|
760
|
-
_nacts = _lexer_actions[_acts]
|
761
|
-
_acts += 1
|
762
|
-
while _nacts > 0
|
763
|
-
_nacts -= 1
|
764
|
-
_acts += 1
|
765
|
-
case _lexer_actions[_acts - 1]
|
766
|
-
when 0 then
|
767
|
-
# line 1 "NONE"
|
768
|
-
begin
|
769
|
-
@ts = nil; end
|
770
|
-
# line 771 "lib/liquidscript/scanner/lexer.rb"
|
771
|
-
end # to state action switch
|
772
|
-
end
|
773
|
-
if _trigger_goto
|
774
|
-
next
|
775
|
-
end
|
776
|
-
@p += 1
|
777
|
-
if @p != @pe
|
778
|
-
_goto_level = _resume
|
779
|
-
next
|
780
|
-
end
|
781
|
-
end
|
782
|
-
if _goto_level <= _test_eof
|
783
|
-
if @p == @eof
|
784
|
-
if _lexer_eof_trans[ @cs] > 0
|
785
|
-
_trans = _lexer_eof_trans[ @cs] - 1;
|
786
|
-
_goto_level = _eof_trans
|
787
|
-
next;
|
788
|
-
end
|
789
|
-
end
|
790
|
-
end
|
791
|
-
if _goto_level <= _out
|
792
|
-
break
|
793
|
-
end
|
794
|
-
end
|
795
|
-
end
|
796
|
-
|
797
|
-
# line 111 "lib/liquidscript/scanner/lexer.rl"
|
798
|
-
|
799
|
-
clean!
|
800
|
-
|
801
|
-
@tokens
|
802
|
-
end
|
803
|
-
end
|
804
|
-
end
|
805
|
-
end
|