hotcell 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +4 -1
- data/.rspec +1 -0
- data/.rvmrc +1 -1
- data/.travis.yml +7 -0
- data/Gemfile +4 -1
- data/README.md +361 -2
- data/Rakefile +28 -6
- data/ext/lexerc/extconf.rb +3 -0
- data/ext/lexerc/lexerc.c +618 -0
- data/ext/lexerc/lexerc.h +20 -0
- data/ext/lexerc/lexerc.rl +167 -0
- data/hotcell.gemspec +8 -7
- data/lib/hotcell/commands/case.rb +59 -0
- data/lib/hotcell/commands/cycle.rb +38 -0
- data/lib/hotcell/commands/for.rb +70 -0
- data/lib/hotcell/commands/if.rb +51 -0
- data/lib/hotcell/commands/include.rb +21 -0
- data/lib/hotcell/commands/scope.rb +13 -0
- data/lib/hotcell/commands/unless.rb +23 -0
- data/lib/hotcell/commands.rb +13 -0
- data/lib/hotcell/config.rb +33 -6
- data/lib/hotcell/context.rb +40 -7
- data/lib/hotcell/errors.rb +37 -28
- data/lib/hotcell/extensions.rb +4 -0
- data/lib/hotcell/lexer.rb +19 -635
- data/lib/hotcell/lexerr.rb +572 -0
- data/lib/hotcell/lexerr.rl +137 -0
- data/lib/hotcell/node/assigner.rb +1 -5
- data/lib/hotcell/node/block.rb +17 -40
- data/lib/hotcell/node/command.rb +29 -22
- data/lib/hotcell/node/hasher.rb +1 -1
- data/lib/hotcell/node/summoner.rb +2 -6
- data/lib/hotcell/node/tag.rb +10 -7
- data/lib/hotcell/node.rb +12 -1
- data/lib/hotcell/parser.rb +474 -408
- data/lib/hotcell/parser.y +175 -117
- data/lib/hotcell/resolver.rb +44 -0
- data/lib/hotcell/source.rb +35 -0
- data/lib/hotcell/template.rb +15 -6
- data/lib/hotcell/version.rb +1 -1
- data/lib/hotcell.rb +15 -10
- data/spec/data/templates/simple.hc +1 -0
- data/spec/lib/hotcell/commands/case_spec.rb +39 -0
- data/spec/lib/hotcell/commands/cycle_spec.rb +29 -0
- data/spec/lib/hotcell/commands/for_spec.rb +65 -0
- data/spec/lib/hotcell/commands/if_spec.rb +35 -0
- data/spec/lib/hotcell/commands/include_spec.rb +39 -0
- data/spec/lib/hotcell/commands/scope_spec.rb +16 -0
- data/spec/lib/hotcell/commands/unless_spec.rb +23 -0
- data/spec/lib/hotcell/config_spec.rb +35 -10
- data/spec/lib/hotcell/context_spec.rb +58 -18
- data/spec/lib/hotcell/lexer_spec.rb +37 -28
- data/spec/lib/hotcell/node/block_spec.rb +28 -56
- data/spec/lib/hotcell/node/command_spec.rb +7 -31
- data/spec/lib/hotcell/node/tag_spec.rb +16 -0
- data/spec/lib/hotcell/parser_spec.rb +152 -123
- data/spec/lib/hotcell/resolver_spec.rb +28 -0
- data/spec/lib/hotcell/source_spec.rb +41 -0
- data/spec/lib/hotcell/template_spec.rb +47 -4
- data/spec/lib/hotcell_spec.rb +2 -1
- data/spec/spec_helper.rb +6 -2
- metadata +54 -24
- data/lib/hotcell/.DS_Store +0 -0
- data/lib/hotcell/lexer.rl +0 -299
- data/misc/rage.rl +0 -1999
- data/misc/unicode2ragel.rb +0 -305
data/lib/hotcell/lexer.rb
CHANGED
@@ -1,10 +1,3 @@
|
|
1
|
-
|
2
|
-
# line 1 "lib/hotcell/lexer.rl"
|
3
|
-
|
4
|
-
# line 97 "lib/hotcell/lexer.rl"
|
5
|
-
|
6
|
-
#%
|
7
|
-
|
8
1
|
module Hotcell
|
9
2
|
class Lexer
|
10
3
|
OPERATIONS = {
|
@@ -49,210 +42,11 @@ module Hotcell
|
|
49
42
|
]
|
50
43
|
|
51
44
|
def initialize source
|
52
|
-
@source = source
|
53
|
-
@data = @source.unpack 'c*'
|
54
|
-
|
55
|
-
|
56
|
-
# line 57 "lib/hotcell/lexer.rb"
|
57
|
-
class << self
|
58
|
-
attr_accessor :_puffer_lexer_actions
|
59
|
-
private :_puffer_lexer_actions, :_puffer_lexer_actions=
|
60
|
-
end
|
61
|
-
self._puffer_lexer_actions = [
|
62
|
-
0, 1, 0, 1, 1, 1, 3, 1,
|
63
|
-
4, 1, 5, 1, 8, 1, 9, 1,
|
64
|
-
10, 1, 11, 1, 12, 1, 13, 1,
|
65
|
-
14, 1, 15, 1, 16, 1, 17, 1,
|
66
|
-
18, 1, 19, 1, 20, 1, 21, 1,
|
67
|
-
22, 1, 23, 1, 24, 1, 25, 1,
|
68
|
-
26, 1, 27, 1, 28, 2, 5, 2,
|
69
|
-
2, 5, 6, 2, 5, 7
|
70
|
-
]
|
71
|
-
|
72
|
-
class << self
|
73
|
-
attr_accessor :_puffer_lexer_key_offsets
|
74
|
-
private :_puffer_lexer_key_offsets, :_puffer_lexer_key_offsets=
|
75
|
-
end
|
76
|
-
self._puffer_lexer_key_offsets = [
|
77
|
-
0, 0, 2, 2, 3, 4, 6, 6,
|
78
|
-
8, 8, 10, 11, 12, 13, 14, 15,
|
79
|
-
17, 48, 49, 51, 52, 54, 56, 60,
|
80
|
-
63, 72, 73, 74, 75
|
81
|
-
]
|
82
|
-
|
83
|
-
class << self
|
84
|
-
attr_accessor :_puffer_lexer_trans_keys
|
85
|
-
private :_puffer_lexer_trans_keys, :_puffer_lexer_trans_keys=
|
86
|
-
end
|
87
|
-
self._puffer_lexer_trans_keys = [
|
88
|
-
34, 92, 125, 38, 39, 92, 47, 92,
|
89
|
-
48, 57, 124, 125, 123, 123, 123, 33,
|
90
|
-
35, 10, 32, 33, 34, 35, 38, 39,
|
91
|
-
42, 46, 47, 63, 91, 93, 95, 123,
|
92
|
-
124, 125, 9, 13, 37, 45, 48, 57,
|
93
|
-
58, 59, 60, 62, 65, 90, 97, 122,
|
94
|
-
61, 10, 125, 42, 48, 57, 47, 92,
|
95
|
-
65, 90, 97, 122, 46, 48, 57, 33,
|
96
|
-
63, 95, 48, 57, 65, 90, 97, 122,
|
97
|
-
125, 35, 35, 125, 0
|
98
|
-
]
|
99
|
-
|
100
|
-
class << self
|
101
|
-
attr_accessor :_puffer_lexer_single_lengths
|
102
|
-
private :_puffer_lexer_single_lengths, :_puffer_lexer_single_lengths=
|
103
|
-
end
|
104
|
-
self._puffer_lexer_single_lengths = [
|
105
|
-
0, 2, 0, 1, 1, 2, 0, 2,
|
106
|
-
0, 0, 1, 1, 1, 1, 1, 2,
|
107
|
-
17, 1, 2, 1, 0, 2, 0, 1,
|
108
|
-
3, 1, 1, 1, 1
|
109
|
-
]
|
110
|
-
|
111
|
-
class << self
|
112
|
-
attr_accessor :_puffer_lexer_range_lengths
|
113
|
-
private :_puffer_lexer_range_lengths, :_puffer_lexer_range_lengths=
|
114
|
-
end
|
115
|
-
self._puffer_lexer_range_lengths = [
|
116
|
-
0, 0, 0, 0, 0, 0, 0, 0,
|
117
|
-
0, 1, 0, 0, 0, 0, 0, 0,
|
118
|
-
7, 0, 0, 0, 1, 0, 2, 1,
|
119
|
-
3, 0, 0, 0, 0
|
120
|
-
]
|
121
|
-
|
122
|
-
class << self
|
123
|
-
attr_accessor :_puffer_lexer_index_offsets
|
124
|
-
private :_puffer_lexer_index_offsets, :_puffer_lexer_index_offsets=
|
125
|
-
end
|
126
|
-
self._puffer_lexer_index_offsets = [
|
127
|
-
0, 0, 3, 4, 6, 8, 11, 12,
|
128
|
-
15, 16, 18, 20, 22, 24, 26, 28,
|
129
|
-
31, 56, 58, 61, 63, 65, 68, 71,
|
130
|
-
74, 81, 83, 85, 87
|
131
|
-
]
|
132
|
-
|
133
|
-
class << self
|
134
|
-
attr_accessor :_puffer_lexer_trans_targs
|
135
|
-
private :_puffer_lexer_trans_targs, :_puffer_lexer_trans_targs=
|
136
|
-
end
|
137
|
-
self._puffer_lexer_trans_targs = [
|
138
|
-
16, 2, 1, 1, 16, 18, 16, 0,
|
139
|
-
16, 6, 5, 5, 22, 8, 7, 7,
|
140
|
-
20, 16, 16, 0, 26, 26, 14, 13,
|
141
|
-
12, 13, 15, 12, 12, 12, 12, 16,
|
142
|
-
16, 17, 1, 18, 4, 5, 19, 20,
|
143
|
-
21, 16, 16, 16, 24, 16, 10, 25,
|
144
|
-
16, 16, 23, 16, 17, 24, 24, 0,
|
145
|
-
16, 16, 16, 3, 18, 16, 16, 20,
|
146
|
-
16, 22, 8, 7, 22, 22, 16, 9,
|
147
|
-
23, 16, 16, 16, 24, 24, 24, 24,
|
148
|
-
16, 16, 16, 28, 27, 26, 27, 11,
|
149
|
-
26, 16, 16, 16, 16, 26, 12, 12,
|
150
|
-
12, 16, 16, 16, 16, 16, 16, 16,
|
151
|
-
16, 16, 26, 26, 0
|
152
|
-
]
|
153
|
-
|
154
|
-
class << self
|
155
|
-
attr_accessor :_puffer_lexer_trans_actions
|
156
|
-
private :_puffer_lexer_trans_actions, :_puffer_lexer_trans_actions=
|
157
|
-
end
|
158
|
-
self._puffer_lexer_trans_actions = [
|
159
|
-
19, 0, 0, 0, 37, 9, 13, 0,
|
160
|
-
17, 0, 0, 0, 0, 0, 0, 0,
|
161
|
-
59, 35, 13, 0, 41, 45, 0, 0,
|
162
|
-
51, 0, 0, 51, 47, 47, 49, 13,
|
163
|
-
21, 0, 0, 9, 0, 0, 0, 56,
|
164
|
-
53, 13, 13, 13, 0, 13, 0, 0,
|
165
|
-
21, 13, 9, 13, 0, 0, 0, 0,
|
166
|
-
13, 23, 31, 0, 9, 13, 23, 59,
|
167
|
-
39, 0, 0, 0, 0, 0, 29, 0,
|
168
|
-
9, 25, 15, 15, 0, 0, 0, 0,
|
169
|
-
27, 11, 23, 9, 0, 43, 0, 0,
|
170
|
-
43, 37, 33, 33, 35, 45, 51, 51,
|
171
|
-
49, 23, 31, 23, 39, 23, 29, 25,
|
172
|
-
27, 23, 43, 43, 0
|
173
|
-
]
|
174
|
-
|
175
|
-
class << self
|
176
|
-
attr_accessor :_puffer_lexer_to_state_actions
|
177
|
-
private :_puffer_lexer_to_state_actions, :_puffer_lexer_to_state_actions=
|
178
|
-
end
|
179
|
-
self._puffer_lexer_to_state_actions = [
|
180
|
-
0, 0, 0, 0, 0, 0, 0, 0,
|
181
|
-
0, 0, 0, 0, 5, 0, 0, 0,
|
182
|
-
5, 0, 0, 0, 0, 0, 0, 0,
|
183
|
-
0, 0, 5, 0, 0
|
184
|
-
]
|
185
|
-
|
186
|
-
class << self
|
187
|
-
attr_accessor :_puffer_lexer_from_state_actions
|
188
|
-
private :_puffer_lexer_from_state_actions, :_puffer_lexer_from_state_actions=
|
189
|
-
end
|
190
|
-
self._puffer_lexer_from_state_actions = [
|
191
|
-
0, 0, 0, 0, 0, 0, 0, 0,
|
192
|
-
0, 0, 0, 0, 7, 0, 0, 0,
|
193
|
-
7, 0, 0, 0, 0, 0, 0, 0,
|
194
|
-
0, 0, 7, 0, 0
|
195
|
-
]
|
196
|
-
|
197
|
-
class << self
|
198
|
-
attr_accessor :_puffer_lexer_eof_actions
|
199
|
-
private :_puffer_lexer_eof_actions, :_puffer_lexer_eof_actions=
|
200
|
-
end
|
201
|
-
self._puffer_lexer_eof_actions = [
|
202
|
-
0, 3, 0, 0, 0, 1, 0, 0,
|
203
|
-
0, 0, 0, 0, 0, 0, 0, 0,
|
204
|
-
0, 0, 0, 0, 0, 0, 0, 0,
|
205
|
-
0, 0, 0, 0, 0
|
206
|
-
]
|
207
|
-
|
208
|
-
class << self
|
209
|
-
attr_accessor :_puffer_lexer_eof_trans
|
210
|
-
private :_puffer_lexer_eof_trans, :_puffer_lexer_eof_trans=
|
211
|
-
end
|
212
|
-
self._puffer_lexer_eof_trans = [
|
213
|
-
0, 0, 0, 90, 0, 0, 0, 92,
|
214
|
-
92, 93, 0, 94, 0, 96, 96, 97,
|
215
|
-
0, 106, 99, 106, 101, 106, 103, 104,
|
216
|
-
105, 106, 0, 108, 108
|
217
|
-
]
|
218
|
-
|
219
|
-
class << self
|
220
|
-
attr_accessor :puffer_lexer_start
|
221
|
-
end
|
222
|
-
self.puffer_lexer_start = 12;
|
223
|
-
class << self
|
224
|
-
attr_accessor :puffer_lexer_first_final
|
225
|
-
end
|
226
|
-
self.puffer_lexer_first_final = 12;
|
227
|
-
class << self
|
228
|
-
attr_accessor :puffer_lexer_error
|
229
|
-
end
|
230
|
-
self.puffer_lexer_error = 0;
|
231
|
-
|
232
|
-
class << self
|
233
|
-
attr_accessor :puffer_lexer_en_expression
|
234
|
-
end
|
235
|
-
self.puffer_lexer_en_expression = 16;
|
236
|
-
class << self
|
237
|
-
attr_accessor :puffer_lexer_en_template_comment
|
238
|
-
end
|
239
|
-
self.puffer_lexer_en_template_comment = 26;
|
240
|
-
class << self
|
241
|
-
attr_accessor :puffer_lexer_en_main
|
242
|
-
end
|
243
|
-
self.puffer_lexer_en_main = 12;
|
244
|
-
|
245
|
-
|
246
|
-
# line 148 "lib/hotcell/lexer.rl"
|
247
|
-
#%
|
45
|
+
@source = Source.wrap(source)
|
248
46
|
end
|
249
47
|
|
250
48
|
def emit symbol, value
|
251
|
-
@token_array << [symbol, value]
|
252
|
-
end
|
253
|
-
|
254
|
-
def current_value
|
255
|
-
@data[@ts...@te].pack('c*').force_encoding('UTF-8')
|
49
|
+
@token_array << [symbol, [value, current_position]]
|
256
50
|
end
|
257
51
|
|
258
52
|
def emit_operator
|
@@ -261,12 +55,6 @@ self.puffer_lexer_en_main = 12;
|
|
261
55
|
end
|
262
56
|
|
263
57
|
def emit_numeric
|
264
|
-
# last = @token_array[-1]
|
265
|
-
# pre_last = @token_array[-2]
|
266
|
-
# # This need to give unary minus with numeric higher precedence then unari minus with
|
267
|
-
# last[0] = :NEGATIVE if last && last[0] == :MINUS &&
|
268
|
-
# (!pre_last || pre_last[0].in?())
|
269
|
-
|
270
58
|
value = current_value
|
271
59
|
if value =~ /\./
|
272
60
|
emit :FLOAT, Float(value)
|
@@ -286,7 +74,7 @@ self.puffer_lexer_en_main = 12;
|
|
286
74
|
|
287
75
|
def emit_sstring
|
288
76
|
emit :STRING, current_value[1..-2].gsub(SSTRING_ESCAPE_REGEXP) { |match|
|
289
|
-
SSTRING_ESCAPE_MAP[match] }
|
77
|
+
SSTRING_ESCAPE_MAP[match] }
|
290
78
|
end
|
291
79
|
|
292
80
|
def emit_dstring
|
@@ -324,23 +112,12 @@ self.puffer_lexer_en_main = 12;
|
|
324
112
|
# Hack this to glue templates going straight
|
325
113
|
last = @token_array[-1]
|
326
114
|
if last && last[0] == :TEMPLATE
|
327
|
-
last[1] += current_value
|
115
|
+
last[1][0] += current_value
|
328
116
|
else
|
329
117
|
emit :TEMPLATE, current_value
|
330
118
|
end
|
331
119
|
end
|
332
120
|
|
333
|
-
def emit_tag_or_comment if_tag, if_comment
|
334
|
-
value = current_value
|
335
|
-
if value == '{{#'
|
336
|
-
emit_comment
|
337
|
-
if_comment.call
|
338
|
-
else
|
339
|
-
emit_tag
|
340
|
-
if_tag.call
|
341
|
-
end
|
342
|
-
end
|
343
|
-
|
344
121
|
def emit_tag
|
345
122
|
value = current_value
|
346
123
|
emit TAGS[value], value
|
@@ -349,435 +126,42 @@ self.puffer_lexer_en_main = 12;
|
|
349
126
|
def emit_comment
|
350
127
|
last = @token_array[-1]
|
351
128
|
if last && last[0] == :COMMENT
|
352
|
-
last[1] += current_value
|
129
|
+
last[1][0] += current_value
|
353
130
|
else
|
354
131
|
emit :COMMENT, current_value
|
355
132
|
end
|
356
133
|
end
|
357
134
|
|
358
|
-
def current_position
|
359
|
-
parsed = @data[0..@ts].pack('c*').force_encoding('UTF-8')
|
360
|
-
line = parsed.count("\n") + 1
|
361
|
-
column = parsed.size - 1 - (parsed.rindex("\n") || -1)
|
362
|
-
[line, column]
|
363
|
-
end
|
364
|
-
|
365
135
|
def raise_unexpected_symbol
|
366
|
-
raise Hotcell::
|
136
|
+
raise Hotcell::UnexpectedSymbol.new *current_error
|
367
137
|
end
|
368
138
|
|
369
139
|
def raise_unterminated_string
|
370
|
-
raise Hotcell::
|
140
|
+
raise Hotcell::UnterminatedString.new *current_error
|
371
141
|
end
|
372
142
|
|
373
143
|
def raise_unterminated_regexp
|
374
|
-
raise Hotcell::
|
144
|
+
raise Hotcell::UnterminatedRegexp.new *current_error
|
375
145
|
end
|
376
146
|
|
377
147
|
def tokens
|
378
148
|
@tokens ||= tokenize
|
379
149
|
end
|
380
150
|
|
381
|
-
def
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
# line 386 "lib/hotcell/lexer.rb"
|
386
|
-
begin
|
387
|
-
p ||= 0
|
388
|
-
pe ||= @data.length
|
389
|
-
cs = puffer_lexer_start
|
390
|
-
top = 0
|
391
|
-
@ts = nil
|
392
|
-
@te = nil
|
393
|
-
act = 0
|
394
|
-
end
|
395
|
-
|
396
|
-
# line 286 "lib/hotcell/lexer.rl"
|
397
|
-
#%
|
398
|
-
|
399
|
-
eof = pe
|
400
|
-
stack = []
|
401
|
-
|
402
|
-
|
403
|
-
# line 404 "lib/hotcell/lexer.rb"
|
404
|
-
begin
|
405
|
-
_klen, _trans, _keys, _acts, _nacts = nil
|
406
|
-
_goto_level = 0
|
407
|
-
_resume = 10
|
408
|
-
_eof_trans = 15
|
409
|
-
_again = 20
|
410
|
-
_test_eof = 30
|
411
|
-
_out = 40
|
412
|
-
while true
|
413
|
-
_trigger_goto = false
|
414
|
-
if _goto_level <= 0
|
415
|
-
if p == pe
|
416
|
-
_goto_level = _test_eof
|
417
|
-
next
|
418
|
-
end
|
419
|
-
if cs == 0
|
420
|
-
_goto_level = _out
|
421
|
-
next
|
422
|
-
end
|
423
|
-
end
|
424
|
-
if _goto_level <= _resume
|
425
|
-
_acts = _puffer_lexer_from_state_actions[cs]
|
426
|
-
_nacts = _puffer_lexer_actions[_acts]
|
427
|
-
_acts += 1
|
428
|
-
while _nacts > 0
|
429
|
-
_nacts -= 1
|
430
|
-
_acts += 1
|
431
|
-
case _puffer_lexer_actions[_acts - 1]
|
432
|
-
when 4 then
|
433
|
-
# line 1 "NONE"
|
434
|
-
begin
|
435
|
-
@ts = p
|
436
|
-
end
|
437
|
-
# line 438 "lib/hotcell/lexer.rb"
|
438
|
-
end # from state action switch
|
439
|
-
end
|
440
|
-
if _trigger_goto
|
441
|
-
next
|
442
|
-
end
|
443
|
-
_keys = _puffer_lexer_key_offsets[cs]
|
444
|
-
_trans = _puffer_lexer_index_offsets[cs]
|
445
|
-
_klen = _puffer_lexer_single_lengths[cs]
|
446
|
-
_break_match = false
|
447
|
-
|
448
|
-
begin
|
449
|
-
if _klen > 0
|
450
|
-
_lower = _keys
|
451
|
-
_upper = _keys + _klen - 1
|
452
|
-
|
453
|
-
loop do
|
454
|
-
break if _upper < _lower
|
455
|
-
_mid = _lower + ( (_upper - _lower) >> 1 )
|
456
|
-
|
457
|
-
if @data[p].ord < _puffer_lexer_trans_keys[_mid]
|
458
|
-
_upper = _mid - 1
|
459
|
-
elsif @data[p].ord > _puffer_lexer_trans_keys[_mid]
|
460
|
-
_lower = _mid + 1
|
461
|
-
else
|
462
|
-
_trans += (_mid - _keys)
|
463
|
-
_break_match = true
|
464
|
-
break
|
465
|
-
end
|
466
|
-
end # loop
|
467
|
-
break if _break_match
|
468
|
-
_keys += _klen
|
469
|
-
_trans += _klen
|
470
|
-
end
|
471
|
-
_klen = _puffer_lexer_range_lengths[cs]
|
472
|
-
if _klen > 0
|
473
|
-
_lower = _keys
|
474
|
-
_upper = _keys + (_klen << 1) - 2
|
475
|
-
loop do
|
476
|
-
break if _upper < _lower
|
477
|
-
_mid = _lower + (((_upper-_lower) >> 1) & ~1)
|
478
|
-
if @data[p].ord < _puffer_lexer_trans_keys[_mid]
|
479
|
-
_upper = _mid - 2
|
480
|
-
elsif @data[p].ord > _puffer_lexer_trans_keys[_mid+1]
|
481
|
-
_lower = _mid + 2
|
482
|
-
else
|
483
|
-
_trans += ((_mid - _keys) >> 1)
|
484
|
-
_break_match = true
|
485
|
-
break
|
486
|
-
end
|
487
|
-
end # loop
|
488
|
-
break if _break_match
|
489
|
-
_trans += _klen
|
490
|
-
end
|
491
|
-
end while false
|
492
|
-
end
|
493
|
-
if _goto_level <= _eof_trans
|
494
|
-
cs = _puffer_lexer_trans_targs[_trans]
|
495
|
-
if _puffer_lexer_trans_actions[_trans] != 0
|
496
|
-
_acts = _puffer_lexer_trans_actions[_trans]
|
497
|
-
_nacts = _puffer_lexer_actions[_acts]
|
498
|
-
_acts += 1
|
499
|
-
while _nacts > 0
|
500
|
-
_nacts -= 1
|
501
|
-
_acts += 1
|
502
|
-
case _puffer_lexer_actions[_acts - 1]
|
503
|
-
when 2 then
|
504
|
-
# line 58 "lib/hotcell/lexer.rl"
|
505
|
-
begin
|
506
|
-
regexp_ambiguity { begin
|
507
|
-
cs = 16
|
508
|
-
_trigger_goto = true
|
509
|
-
_goto_level = _again
|
510
|
-
break
|
511
|
-
end
|
512
|
-
} end
|
513
|
-
when 5 then
|
514
|
-
# line 1 "NONE"
|
515
|
-
begin
|
516
|
-
@te = p+1
|
517
|
-
end
|
518
|
-
when 6 then
|
519
|
-
# line 78 "lib/hotcell/lexer.rl"
|
520
|
-
begin
|
521
|
-
act = 2; end
|
522
|
-
when 7 then
|
523
|
-
# line 79 "lib/hotcell/lexer.rl"
|
524
|
-
begin
|
525
|
-
act = 3; end
|
526
|
-
when 8 then
|
527
|
-
# line 77 "lib/hotcell/lexer.rl"
|
528
|
-
begin
|
529
|
-
@te = p+1
|
530
|
-
begin emit_tag; begin
|
531
|
-
top -= 1
|
532
|
-
cs = stack[top]
|
533
|
-
_trigger_goto = true
|
534
|
-
_goto_level = _again
|
535
|
-
break
|
536
|
-
end
|
537
|
-
end
|
538
|
-
end
|
539
|
-
when 9 then
|
540
|
-
# line 78 "lib/hotcell/lexer.rl"
|
541
|
-
begin
|
542
|
-
@te = p+1
|
543
|
-
begin emit_operator end
|
544
|
-
end
|
545
|
-
when 10 then
|
546
|
-
# line 80 "lib/hotcell/lexer.rl"
|
547
|
-
begin
|
548
|
-
@te = p+1
|
549
|
-
begin emit_identifer end
|
550
|
-
end
|
551
|
-
when 11 then
|
552
|
-
# line 81 "lib/hotcell/lexer.rl"
|
553
|
-
begin
|
554
|
-
@te = p+1
|
555
|
-
begin emit_sstring end
|
556
|
-
end
|
557
|
-
when 12 then
|
558
|
-
# line 82 "lib/hotcell/lexer.rl"
|
559
|
-
begin
|
560
|
-
@te = p+1
|
561
|
-
begin emit_dstring end
|
562
|
-
end
|
563
|
-
when 13 then
|
564
|
-
# line 85 "lib/hotcell/lexer.rl"
|
565
|
-
begin
|
566
|
-
@te = p+1
|
567
|
-
end
|
568
|
-
when 14 then
|
569
|
-
# line 78 "lib/hotcell/lexer.rl"
|
570
|
-
begin
|
571
|
-
@te = p
|
572
|
-
p = p - 1; begin emit_operator end
|
573
|
-
end
|
574
|
-
when 15 then
|
575
|
-
# line 79 "lib/hotcell/lexer.rl"
|
576
|
-
begin
|
577
|
-
@te = p
|
578
|
-
p = p - 1; begin emit_numeric end
|
579
|
-
end
|
580
|
-
when 16 then
|
581
|
-
# line 80 "lib/hotcell/lexer.rl"
|
582
|
-
begin
|
583
|
-
@te = p
|
584
|
-
p = p - 1; begin emit_identifer end
|
585
|
-
end
|
586
|
-
when 17 then
|
587
|
-
# line 83 "lib/hotcell/lexer.rl"
|
588
|
-
begin
|
589
|
-
@te = p
|
590
|
-
p = p - 1; begin emit_regexp end
|
591
|
-
end
|
592
|
-
when 18 then
|
593
|
-
# line 84 "lib/hotcell/lexer.rl"
|
594
|
-
begin
|
595
|
-
@te = p
|
596
|
-
p = p - 1; begin emit_comment end
|
597
|
-
end
|
598
|
-
when 19 then
|
599
|
-
# line 78 "lib/hotcell/lexer.rl"
|
600
|
-
begin
|
601
|
-
begin p = (( @te))-1; end
|
602
|
-
begin emit_operator end
|
603
|
-
end
|
604
|
-
when 20 then
|
605
|
-
# line 79 "lib/hotcell/lexer.rl"
|
606
|
-
begin
|
607
|
-
begin p = (( @te))-1; end
|
608
|
-
begin emit_numeric end
|
609
|
-
end
|
610
|
-
when 21 then
|
611
|
-
# line 84 "lib/hotcell/lexer.rl"
|
612
|
-
begin
|
613
|
-
begin p = (( @te))-1; end
|
614
|
-
begin emit_comment end
|
615
|
-
end
|
616
|
-
when 22 then
|
617
|
-
# line 1 "NONE"
|
618
|
-
begin
|
619
|
-
case act
|
620
|
-
when 2 then
|
621
|
-
begin begin p = (( @te))-1; end
|
622
|
-
emit_operator end
|
623
|
-
when 3 then
|
624
|
-
begin begin p = (( @te))-1; end
|
625
|
-
emit_numeric end
|
626
|
-
end
|
627
|
-
end
|
628
|
-
when 23 then
|
629
|
-
# line 89 "lib/hotcell/lexer.rl"
|
630
|
-
begin
|
631
|
-
@te = p+1
|
632
|
-
begin emit_comment; begin
|
633
|
-
top -= 1
|
634
|
-
cs = stack[top]
|
635
|
-
_trigger_goto = true
|
636
|
-
_goto_level = _again
|
637
|
-
break
|
638
|
-
end
|
639
|
-
end
|
640
|
-
end
|
641
|
-
when 24 then
|
642
|
-
# line 90 "lib/hotcell/lexer.rl"
|
643
|
-
begin
|
644
|
-
@te = p
|
645
|
-
p = p - 1; begin emit_comment end
|
646
|
-
end
|
647
|
-
when 25 then
|
648
|
-
# line 90 "lib/hotcell/lexer.rl"
|
649
|
-
begin
|
650
|
-
begin p = (( @te))-1; end
|
651
|
-
begin emit_comment end
|
652
|
-
end
|
653
|
-
when 26 then
|
654
|
-
# line 94 "lib/hotcell/lexer.rl"
|
655
|
-
begin
|
656
|
-
@te = p+1
|
657
|
-
begin emit_tag_or_comment ->{ begin
|
658
|
-
stack[top] = cs
|
659
|
-
top+= 1
|
660
|
-
cs = 16
|
661
|
-
_trigger_goto = true
|
662
|
-
_goto_level = _again
|
663
|
-
break
|
664
|
-
end
|
665
|
-
}, ->{ begin
|
666
|
-
stack[top] = cs
|
667
|
-
top+= 1
|
668
|
-
cs = 26
|
669
|
-
_trigger_goto = true
|
670
|
-
_goto_level = _again
|
671
|
-
break
|
672
|
-
end
|
673
|
-
} end
|
674
|
-
end
|
675
|
-
when 27 then
|
676
|
-
# line 94 "lib/hotcell/lexer.rl"
|
677
|
-
begin
|
678
|
-
@te = p
|
679
|
-
p = p - 1; begin emit_tag_or_comment ->{ begin
|
680
|
-
stack[top] = cs
|
681
|
-
top+= 1
|
682
|
-
cs = 16
|
683
|
-
_trigger_goto = true
|
684
|
-
_goto_level = _again
|
685
|
-
break
|
686
|
-
end
|
687
|
-
}, ->{ begin
|
688
|
-
stack[top] = cs
|
689
|
-
top+= 1
|
690
|
-
cs = 26
|
691
|
-
_trigger_goto = true
|
692
|
-
_goto_level = _again
|
693
|
-
break
|
694
|
-
end
|
695
|
-
} end
|
696
|
-
end
|
697
|
-
when 28 then
|
698
|
-
# line 95 "lib/hotcell/lexer.rl"
|
699
|
-
begin
|
700
|
-
@te = p
|
701
|
-
p = p - 1; begin emit_template end
|
702
|
-
end
|
703
|
-
# line 704 "lib/hotcell/lexer.rb"
|
704
|
-
end # action switch
|
705
|
-
end
|
706
|
-
end
|
707
|
-
if _trigger_goto
|
708
|
-
next
|
709
|
-
end
|
710
|
-
end
|
711
|
-
if _goto_level <= _again
|
712
|
-
_acts = _puffer_lexer_to_state_actions[cs]
|
713
|
-
_nacts = _puffer_lexer_actions[_acts]
|
714
|
-
_acts += 1
|
715
|
-
while _nacts > 0
|
716
|
-
_nacts -= 1
|
717
|
-
_acts += 1
|
718
|
-
case _puffer_lexer_actions[_acts - 1]
|
719
|
-
when 3 then
|
720
|
-
# line 1 "NONE"
|
721
|
-
begin
|
722
|
-
@ts = nil; end
|
723
|
-
# line 724 "lib/hotcell/lexer.rb"
|
724
|
-
end # to state action switch
|
725
|
-
end
|
726
|
-
if _trigger_goto
|
727
|
-
next
|
728
|
-
end
|
729
|
-
if cs == 0
|
730
|
-
_goto_level = _out
|
731
|
-
next
|
732
|
-
end
|
733
|
-
p += 1
|
734
|
-
if p != pe
|
735
|
-
_goto_level = _resume
|
736
|
-
next
|
737
|
-
end
|
738
|
-
end
|
739
|
-
if _goto_level <= _test_eof
|
740
|
-
if p == eof
|
741
|
-
if _puffer_lexer_eof_trans[cs] > 0
|
742
|
-
_trans = _puffer_lexer_eof_trans[cs] - 1;
|
743
|
-
_goto_level = _eof_trans
|
744
|
-
next;
|
745
|
-
end
|
746
|
-
__acts = _puffer_lexer_eof_actions[cs]
|
747
|
-
__nacts = _puffer_lexer_actions[__acts]
|
748
|
-
__acts += 1
|
749
|
-
while __nacts > 0
|
750
|
-
__nacts -= 1
|
751
|
-
__acts += 1
|
752
|
-
case _puffer_lexer_actions[__acts - 1]
|
753
|
-
when 0 then
|
754
|
-
# line 50 "lib/hotcell/lexer.rl"
|
755
|
-
begin
|
756
|
-
raise_unterminated_string end
|
757
|
-
when 1 then
|
758
|
-
# line 54 "lib/hotcell/lexer.rl"
|
759
|
-
begin
|
760
|
-
raise_unterminated_string end
|
761
|
-
# line 762 "lib/hotcell/lexer.rb"
|
762
|
-
end # eof action switch
|
763
|
-
end
|
764
|
-
if _trigger_goto
|
765
|
-
next
|
766
|
-
end
|
767
|
-
end
|
768
|
-
end
|
769
|
-
if _goto_level <= _out
|
770
|
-
break
|
771
|
-
end
|
772
|
-
end
|
773
|
-
end
|
151
|
+
def current_position
|
152
|
+
raise NotImplementedError
|
153
|
+
end
|
774
154
|
|
775
|
-
|
776
|
-
|
155
|
+
def current_value
|
156
|
+
raise NotImplementedError
|
157
|
+
end
|
777
158
|
|
778
|
-
|
159
|
+
def current_error
|
160
|
+
raise NotImplementedError
|
161
|
+
end
|
779
162
|
|
780
|
-
|
163
|
+
def tokenize
|
164
|
+
raise NotImplementedError
|
781
165
|
end
|
782
166
|
end
|
783
167
|
end
|