ceml 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/VERSION +1 -1
- data/beginners-guide.md +7 -7
- data/ceml.gemspec +78 -0
- data/examples/sample_delegate.rb +4 -0
- data/lib/ceml/casting.rb +15 -33
- data/lib/ceml/casting_criterion.rb +39 -0
- data/lib/ceml/instructions.rb +11 -10
- data/lib/ceml/script.rb +136 -78
- data/lib/ceml/tt/casting.treetop +26 -29
- data/lib/ceml/tt/instructions.treetop +4 -8
- data/lib/ceml/tt/lexer.treetop +42 -3
- data/lib/ceml/tt/scripts.treetop +25 -10
- data/lib/ceml.rb +13 -14
- data/test/helper.rb +0 -19
- data/test/test_casting.rb +9 -10
- data/test/test_incident.rb +25 -0
- data/test/test_instructions.rb +2 -2
- data/test/test_scripts.rb +1 -1
- data/try +14 -0
- metadata +7 -7
- data/lib/ceml/tt/casting.rb +0 -618
- data/lib/ceml/tt/instructions.rb +0 -409
- data/lib/ceml/tt/lexer.rb +0 -400
- data/lib/ceml/tt/scripts.rb +0 -345
data/lib/ceml/tt/lexer.rb
DELETED
@@ -1,400 +0,0 @@
|
|
1
|
-
# Autogenerated from a Treetop grammar. Edits may be lost.
|
2
|
-
|
3
|
-
|
4
|
-
module CEML
|
5
|
-
module Lexer
|
6
|
-
include Treetop::Runtime
|
7
|
-
|
8
|
-
def root
|
9
|
-
@root || :text
|
10
|
-
end
|
11
|
-
|
12
|
-
module Text0
|
13
|
-
end
|
14
|
-
|
15
|
-
def _nt_text
|
16
|
-
start_index = index
|
17
|
-
if node_cache[:text].has_key?(index)
|
18
|
-
cached = node_cache[:text][index]
|
19
|
-
@index = cached.interval.end if cached
|
20
|
-
return cached
|
21
|
-
end
|
22
|
-
|
23
|
-
s0, i0 = [], index
|
24
|
-
loop do
|
25
|
-
i1, s1 = index, []
|
26
|
-
i2 = index
|
27
|
-
r3 = _nt_eol
|
28
|
-
if r3
|
29
|
-
r2 = nil
|
30
|
-
else
|
31
|
-
@index = i2
|
32
|
-
r2 = instantiate_node(SyntaxNode,input, index...index)
|
33
|
-
end
|
34
|
-
s1 << r2
|
35
|
-
if r2
|
36
|
-
if index < input_length
|
37
|
-
next_character = index + input[index..-1].match(/\A(.)/um).end(1)
|
38
|
-
r4 = instantiate_node(SyntaxNode,input, index...next_character)
|
39
|
-
@index = next_character
|
40
|
-
else
|
41
|
-
terminal_parse_failure("any character")
|
42
|
-
r4 = nil
|
43
|
-
end
|
44
|
-
s1 << r4
|
45
|
-
end
|
46
|
-
if s1.last
|
47
|
-
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
48
|
-
r1.extend(Text0)
|
49
|
-
else
|
50
|
-
@index = i1
|
51
|
-
r1 = nil
|
52
|
-
end
|
53
|
-
if r1
|
54
|
-
s0 << r1
|
55
|
-
else
|
56
|
-
break
|
57
|
-
end
|
58
|
-
end
|
59
|
-
if s0.empty?
|
60
|
-
@index = i0
|
61
|
-
r0 = nil
|
62
|
-
else
|
63
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
64
|
-
end
|
65
|
-
|
66
|
-
node_cache[:text][start_index] = r0
|
67
|
-
|
68
|
-
r0
|
69
|
-
end
|
70
|
-
|
71
|
-
module Nl0
|
72
|
-
def eol
|
73
|
-
elements[2]
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
def _nt_nl
|
78
|
-
start_index = index
|
79
|
-
if node_cache[:nl].has_key?(index)
|
80
|
-
cached = node_cache[:nl][index]
|
81
|
-
@index = cached.interval.end if cached
|
82
|
-
return cached
|
83
|
-
end
|
84
|
-
|
85
|
-
s0, i0 = [], index
|
86
|
-
loop do
|
87
|
-
i1, s1 = index, []
|
88
|
-
r3 = _nt_ws
|
89
|
-
if r3
|
90
|
-
r2 = r3
|
91
|
-
else
|
92
|
-
r2 = instantiate_node(SyntaxNode,input, index...index)
|
93
|
-
end
|
94
|
-
s1 << r2
|
95
|
-
if r2
|
96
|
-
r5 = _nt_comment
|
97
|
-
if r5
|
98
|
-
r4 = r5
|
99
|
-
else
|
100
|
-
r4 = instantiate_node(SyntaxNode,input, index...index)
|
101
|
-
end
|
102
|
-
s1 << r4
|
103
|
-
if r4
|
104
|
-
r6 = _nt_eol
|
105
|
-
s1 << r6
|
106
|
-
end
|
107
|
-
end
|
108
|
-
if s1.last
|
109
|
-
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
110
|
-
r1.extend(Nl0)
|
111
|
-
else
|
112
|
-
@index = i1
|
113
|
-
r1 = nil
|
114
|
-
end
|
115
|
-
if r1
|
116
|
-
s0 << r1
|
117
|
-
else
|
118
|
-
break
|
119
|
-
end
|
120
|
-
end
|
121
|
-
if s0.empty?
|
122
|
-
@index = i0
|
123
|
-
r0 = nil
|
124
|
-
else
|
125
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
126
|
-
end
|
127
|
-
|
128
|
-
node_cache[:nl][start_index] = r0
|
129
|
-
|
130
|
-
r0
|
131
|
-
end
|
132
|
-
|
133
|
-
def _nt_ws
|
134
|
-
start_index = index
|
135
|
-
if node_cache[:ws].has_key?(index)
|
136
|
-
cached = node_cache[:ws][index]
|
137
|
-
@index = cached.interval.end if cached
|
138
|
-
return cached
|
139
|
-
end
|
140
|
-
|
141
|
-
s0, i0 = [], index
|
142
|
-
loop do
|
143
|
-
if has_terminal?('\G[ \\t\\f]', true, index)
|
144
|
-
next_character = index + input[index..-1].match(/\A(.)/um).end(1)
|
145
|
-
r1 = true
|
146
|
-
@index = next_character
|
147
|
-
else
|
148
|
-
r1 = nil
|
149
|
-
end
|
150
|
-
if r1
|
151
|
-
s0 << r1
|
152
|
-
else
|
153
|
-
break
|
154
|
-
end
|
155
|
-
end
|
156
|
-
if s0.empty?
|
157
|
-
@index = i0
|
158
|
-
r0 = nil
|
159
|
-
else
|
160
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
161
|
-
end
|
162
|
-
|
163
|
-
node_cache[:ws][start_index] = r0
|
164
|
-
|
165
|
-
r0
|
166
|
-
end
|
167
|
-
|
168
|
-
module Comment0
|
169
|
-
def text
|
170
|
-
elements[1]
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
def _nt_comment
|
175
|
-
start_index = index
|
176
|
-
if node_cache[:comment].has_key?(index)
|
177
|
-
cached = node_cache[:comment][index]
|
178
|
-
@index = cached.interval.end if cached
|
179
|
-
return cached
|
180
|
-
end
|
181
|
-
|
182
|
-
i0, s0 = index, []
|
183
|
-
if has_terminal?('//', false, index)
|
184
|
-
r1 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
185
|
-
@index += 2
|
186
|
-
else
|
187
|
-
terminal_parse_failure('//')
|
188
|
-
r1 = nil
|
189
|
-
end
|
190
|
-
s0 << r1
|
191
|
-
if r1
|
192
|
-
r2 = _nt_text
|
193
|
-
s0 << r2
|
194
|
-
end
|
195
|
-
if s0.last
|
196
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
197
|
-
r0.extend(Comment0)
|
198
|
-
else
|
199
|
-
@index = i0
|
200
|
-
r0 = nil
|
201
|
-
end
|
202
|
-
|
203
|
-
node_cache[:comment][start_index] = r0
|
204
|
-
|
205
|
-
r0
|
206
|
-
end
|
207
|
-
|
208
|
-
module Eol0
|
209
|
-
end
|
210
|
-
|
211
|
-
def _nt_eol
|
212
|
-
start_index = index
|
213
|
-
if node_cache[:eol].has_key?(index)
|
214
|
-
cached = node_cache[:eol][index]
|
215
|
-
@index = cached.interval.end if cached
|
216
|
-
return cached
|
217
|
-
end
|
218
|
-
|
219
|
-
i0 = index
|
220
|
-
i1, s1 = index, []
|
221
|
-
if has_terminal?("\r", false, index)
|
222
|
-
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
223
|
-
@index += 1
|
224
|
-
else
|
225
|
-
terminal_parse_failure("\r")
|
226
|
-
r2 = nil
|
227
|
-
end
|
228
|
-
s1 << r2
|
229
|
-
if r2
|
230
|
-
if has_terminal?("\n", false, index)
|
231
|
-
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
232
|
-
@index += 1
|
233
|
-
else
|
234
|
-
terminal_parse_failure("\n")
|
235
|
-
r4 = nil
|
236
|
-
end
|
237
|
-
if r4
|
238
|
-
r3 = r4
|
239
|
-
else
|
240
|
-
r3 = instantiate_node(SyntaxNode,input, index...index)
|
241
|
-
end
|
242
|
-
s1 << r3
|
243
|
-
end
|
244
|
-
if s1.last
|
245
|
-
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
246
|
-
r1.extend(Eol0)
|
247
|
-
else
|
248
|
-
@index = i1
|
249
|
-
r1 = nil
|
250
|
-
end
|
251
|
-
if r1
|
252
|
-
r0 = r1
|
253
|
-
else
|
254
|
-
if has_terminal?("\n", false, index)
|
255
|
-
r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
256
|
-
@index += 1
|
257
|
-
else
|
258
|
-
terminal_parse_failure("\n")
|
259
|
-
r5 = nil
|
260
|
-
end
|
261
|
-
if r5
|
262
|
-
r0 = r5
|
263
|
-
else
|
264
|
-
@index = i0
|
265
|
-
r0 = nil
|
266
|
-
end
|
267
|
-
end
|
268
|
-
|
269
|
-
node_cache[:eol][start_index] = r0
|
270
|
-
|
271
|
-
r0
|
272
|
-
end
|
273
|
-
|
274
|
-
module Number0
|
275
|
-
end
|
276
|
-
|
277
|
-
def _nt_number
|
278
|
-
start_index = index
|
279
|
-
if node_cache[:number].has_key?(index)
|
280
|
-
cached = node_cache[:number][index]
|
281
|
-
@index = cached.interval.end if cached
|
282
|
-
return cached
|
283
|
-
end
|
284
|
-
|
285
|
-
i0 = index
|
286
|
-
i1, s1 = index, []
|
287
|
-
s2, i2 = [], index
|
288
|
-
loop do
|
289
|
-
if has_terminal?('\G[1-9]', true, index)
|
290
|
-
next_character = index + input[index..-1].match(/\A(.)/um).end(1)
|
291
|
-
r3 = true
|
292
|
-
@index = next_character
|
293
|
-
else
|
294
|
-
r3 = nil
|
295
|
-
end
|
296
|
-
if r3
|
297
|
-
s2 << r3
|
298
|
-
else
|
299
|
-
break
|
300
|
-
end
|
301
|
-
end
|
302
|
-
if s2.empty?
|
303
|
-
@index = i2
|
304
|
-
r2 = nil
|
305
|
-
else
|
306
|
-
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
307
|
-
end
|
308
|
-
s1 << r2
|
309
|
-
if r2
|
310
|
-
s4, i4 = [], index
|
311
|
-
loop do
|
312
|
-
if has_terminal?('\G[0-9]', true, index)
|
313
|
-
next_character = index + input[index..-1].match(/\A(.)/um).end(1)
|
314
|
-
r5 = true
|
315
|
-
@index = next_character
|
316
|
-
else
|
317
|
-
r5 = nil
|
318
|
-
end
|
319
|
-
if r5
|
320
|
-
s4 << r5
|
321
|
-
else
|
322
|
-
break
|
323
|
-
end
|
324
|
-
end
|
325
|
-
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
326
|
-
s1 << r4
|
327
|
-
end
|
328
|
-
if s1.last
|
329
|
-
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
330
|
-
r1.extend(Number0)
|
331
|
-
else
|
332
|
-
@index = i1
|
333
|
-
r1 = nil
|
334
|
-
end
|
335
|
-
if r1
|
336
|
-
r0 = r1
|
337
|
-
else
|
338
|
-
if has_terminal?('0', false, index)
|
339
|
-
r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
340
|
-
@index += 1
|
341
|
-
else
|
342
|
-
terminal_parse_failure('0')
|
343
|
-
r6 = nil
|
344
|
-
end
|
345
|
-
if r6
|
346
|
-
r0 = r6
|
347
|
-
else
|
348
|
-
@index = i0
|
349
|
-
r0 = nil
|
350
|
-
end
|
351
|
-
end
|
352
|
-
|
353
|
-
node_cache[:number][start_index] = r0
|
354
|
-
|
355
|
-
r0
|
356
|
-
end
|
357
|
-
|
358
|
-
def _nt_id
|
359
|
-
start_index = index
|
360
|
-
if node_cache[:id].has_key?(index)
|
361
|
-
cached = node_cache[:id][index]
|
362
|
-
@index = cached.interval.end if cached
|
363
|
-
return cached
|
364
|
-
end
|
365
|
-
|
366
|
-
s0, i0 = [], index
|
367
|
-
loop do
|
368
|
-
if has_terminal?('\G[a-zA-Z_-]', true, index)
|
369
|
-
next_character = index + input[index..-1].match(/\A(.)/um).end(1)
|
370
|
-
r1 = true
|
371
|
-
@index = next_character
|
372
|
-
else
|
373
|
-
r1 = nil
|
374
|
-
end
|
375
|
-
if r1
|
376
|
-
s0 << r1
|
377
|
-
else
|
378
|
-
break
|
379
|
-
end
|
380
|
-
end
|
381
|
-
if s0.empty?
|
382
|
-
@index = i0
|
383
|
-
r0 = nil
|
384
|
-
else
|
385
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
386
|
-
end
|
387
|
-
|
388
|
-
node_cache[:id][start_index] = r0
|
389
|
-
|
390
|
-
r0
|
391
|
-
end
|
392
|
-
|
393
|
-
end
|
394
|
-
|
395
|
-
class LexerParser < Treetop::Runtime::CompiledParser
|
396
|
-
include Lexer
|
397
|
-
end
|
398
|
-
|
399
|
-
end
|
400
|
-
|
data/lib/ceml/tt/scripts.rb
DELETED
@@ -1,345 +0,0 @@
|
|
1
|
-
# Autogenerated from a Treetop grammar. Edits may be lost.
|
2
|
-
|
3
|
-
|
4
|
-
module CEML
|
5
|
-
module Scripts
|
6
|
-
include Treetop::Runtime
|
7
|
-
|
8
|
-
def root
|
9
|
-
@root || :scripts
|
10
|
-
end
|
11
|
-
|
12
|
-
include Lexer
|
13
|
-
|
14
|
-
include Casting
|
15
|
-
|
16
|
-
include Instructions
|
17
|
-
|
18
|
-
def _nt_scripts
|
19
|
-
start_index = index
|
20
|
-
if node_cache[:scripts].has_key?(index)
|
21
|
-
cached = node_cache[:scripts][index]
|
22
|
-
@index = cached.interval.end if cached
|
23
|
-
return cached
|
24
|
-
end
|
25
|
-
|
26
|
-
s0, i0 = [], index
|
27
|
-
loop do
|
28
|
-
r1 = _nt_script
|
29
|
-
if r1
|
30
|
-
s0 << r1
|
31
|
-
else
|
32
|
-
break
|
33
|
-
end
|
34
|
-
end
|
35
|
-
if s0.empty?
|
36
|
-
@index = i0
|
37
|
-
r0 = nil
|
38
|
-
else
|
39
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
40
|
-
end
|
41
|
-
|
42
|
-
node_cache[:scripts][start_index] = r0
|
43
|
-
|
44
|
-
r0
|
45
|
-
end
|
46
|
-
|
47
|
-
def _nt_script
|
48
|
-
start_index = index
|
49
|
-
if node_cache[:script].has_key?(index)
|
50
|
-
cached = node_cache[:script][index]
|
51
|
-
@index = cached.interval.end if cached
|
52
|
-
return cached
|
53
|
-
end
|
54
|
-
|
55
|
-
i0 = index
|
56
|
-
r1 = _nt_script_with_title
|
57
|
-
if r1
|
58
|
-
r0 = r1
|
59
|
-
r0.extend(Script)
|
60
|
-
else
|
61
|
-
r2 = _nt_script_with_instructions
|
62
|
-
if r2
|
63
|
-
r0 = r2
|
64
|
-
r0.extend(Script)
|
65
|
-
else
|
66
|
-
@index = i0
|
67
|
-
r0 = nil
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
node_cache[:script][start_index] = r0
|
72
|
-
|
73
|
-
r0
|
74
|
-
end
|
75
|
-
|
76
|
-
module ScriptWithTitle0
|
77
|
-
def title
|
78
|
-
elements[1]
|
79
|
-
end
|
80
|
-
|
81
|
-
def casting_statement
|
82
|
-
elements[2]
|
83
|
-
end
|
84
|
-
|
85
|
-
def instructions
|
86
|
-
elements[3]
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
def _nt_script_with_title
|
91
|
-
start_index = index
|
92
|
-
if node_cache[:script_with_title].has_key?(index)
|
93
|
-
cached = node_cache[:script_with_title][index]
|
94
|
-
@index = cached.interval.end if cached
|
95
|
-
return cached
|
96
|
-
end
|
97
|
-
|
98
|
-
i0, s0 = index, []
|
99
|
-
r2 = _nt_nl
|
100
|
-
if r2
|
101
|
-
r1 = r2
|
102
|
-
else
|
103
|
-
r1 = instantiate_node(SyntaxNode,input, index...index)
|
104
|
-
end
|
105
|
-
s0 << r1
|
106
|
-
if r1
|
107
|
-
r3 = _nt_title
|
108
|
-
s0 << r3
|
109
|
-
if r3
|
110
|
-
r5 = _nt_casting_statement
|
111
|
-
if r5
|
112
|
-
r4 = r5
|
113
|
-
else
|
114
|
-
r4 = instantiate_node(SyntaxNode,input, index...index)
|
115
|
-
end
|
116
|
-
s0 << r4
|
117
|
-
if r4
|
118
|
-
r7 = _nt_instructions
|
119
|
-
if r7
|
120
|
-
r6 = r7
|
121
|
-
else
|
122
|
-
r6 = instantiate_node(SyntaxNode,input, index...index)
|
123
|
-
end
|
124
|
-
s0 << r6
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
|
-
if s0.last
|
129
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
130
|
-
r0.extend(ScriptWithTitle0)
|
131
|
-
else
|
132
|
-
@index = i0
|
133
|
-
r0 = nil
|
134
|
-
end
|
135
|
-
|
136
|
-
node_cache[:script_with_title][start_index] = r0
|
137
|
-
|
138
|
-
r0
|
139
|
-
end
|
140
|
-
|
141
|
-
module ScriptWithInstructions0
|
142
|
-
def title
|
143
|
-
elements[1]
|
144
|
-
end
|
145
|
-
|
146
|
-
def casting_statement
|
147
|
-
elements[2]
|
148
|
-
end
|
149
|
-
|
150
|
-
def instructions
|
151
|
-
elements[3]
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
def _nt_script_with_instructions
|
156
|
-
start_index = index
|
157
|
-
if node_cache[:script_with_instructions].has_key?(index)
|
158
|
-
cached = node_cache[:script_with_instructions][index]
|
159
|
-
@index = cached.interval.end if cached
|
160
|
-
return cached
|
161
|
-
end
|
162
|
-
|
163
|
-
i0, s0 = index, []
|
164
|
-
r2 = _nt_nl
|
165
|
-
if r2
|
166
|
-
r1 = r2
|
167
|
-
else
|
168
|
-
r1 = instantiate_node(SyntaxNode,input, index...index)
|
169
|
-
end
|
170
|
-
s0 << r1
|
171
|
-
if r1
|
172
|
-
r4 = _nt_title
|
173
|
-
if r4
|
174
|
-
r3 = r4
|
175
|
-
else
|
176
|
-
r3 = instantiate_node(SyntaxNode,input, index...index)
|
177
|
-
end
|
178
|
-
s0 << r3
|
179
|
-
if r3
|
180
|
-
r6 = _nt_casting_statement
|
181
|
-
if r6
|
182
|
-
r5 = r6
|
183
|
-
else
|
184
|
-
r5 = instantiate_node(SyntaxNode,input, index...index)
|
185
|
-
end
|
186
|
-
s0 << r5
|
187
|
-
if r5
|
188
|
-
r7 = _nt_instructions
|
189
|
-
s0 << r7
|
190
|
-
end
|
191
|
-
end
|
192
|
-
end
|
193
|
-
if s0.last
|
194
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
195
|
-
r0.extend(ScriptWithInstructions0)
|
196
|
-
else
|
197
|
-
@index = i0
|
198
|
-
r0 = nil
|
199
|
-
end
|
200
|
-
|
201
|
-
node_cache[:script_with_instructions][start_index] = r0
|
202
|
-
|
203
|
-
r0
|
204
|
-
end
|
205
|
-
|
206
|
-
module Title0
|
207
|
-
end
|
208
|
-
|
209
|
-
module Title1
|
210
|
-
def value
|
211
|
-
elements[1]
|
212
|
-
end
|
213
|
-
|
214
|
-
def nl
|
215
|
-
elements[3]
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
module Title2
|
220
|
-
def value
|
221
|
-
super.text_value.gsub(/\\"/, '"')
|
222
|
-
end
|
223
|
-
end
|
224
|
-
|
225
|
-
def _nt_title
|
226
|
-
start_index = index
|
227
|
-
if node_cache[:title].has_key?(index)
|
228
|
-
cached = node_cache[:title][index]
|
229
|
-
@index = cached.interval.end if cached
|
230
|
-
return cached
|
231
|
-
end
|
232
|
-
|
233
|
-
i0, s0 = index, []
|
234
|
-
if has_terminal?('"', false, index)
|
235
|
-
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
236
|
-
@index += 1
|
237
|
-
else
|
238
|
-
terminal_parse_failure('"')
|
239
|
-
r1 = nil
|
240
|
-
end
|
241
|
-
s0 << r1
|
242
|
-
if r1
|
243
|
-
s2, i2 = [], index
|
244
|
-
loop do
|
245
|
-
i3 = index
|
246
|
-
if has_terminal?('\\"', false, index)
|
247
|
-
r4 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
248
|
-
@index += 2
|
249
|
-
else
|
250
|
-
terminal_parse_failure('\\"')
|
251
|
-
r4 = nil
|
252
|
-
end
|
253
|
-
if r4
|
254
|
-
r3 = r4
|
255
|
-
else
|
256
|
-
i5, s5 = index, []
|
257
|
-
i6 = index
|
258
|
-
if has_terminal?('"', false, index)
|
259
|
-
r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
260
|
-
@index += 1
|
261
|
-
else
|
262
|
-
terminal_parse_failure('"')
|
263
|
-
r7 = nil
|
264
|
-
end
|
265
|
-
if r7
|
266
|
-
r6 = nil
|
267
|
-
else
|
268
|
-
@index = i6
|
269
|
-
r6 = instantiate_node(SyntaxNode,input, index...index)
|
270
|
-
end
|
271
|
-
s5 << r6
|
272
|
-
if r6
|
273
|
-
if index < input_length
|
274
|
-
next_character = index + input[index..-1].match(/\A(.)/um).end(1)
|
275
|
-
r8 = instantiate_node(SyntaxNode,input, index...next_character)
|
276
|
-
@index = next_character
|
277
|
-
else
|
278
|
-
terminal_parse_failure("any character")
|
279
|
-
r8 = nil
|
280
|
-
end
|
281
|
-
s5 << r8
|
282
|
-
end
|
283
|
-
if s5.last
|
284
|
-
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
285
|
-
r5.extend(Title0)
|
286
|
-
else
|
287
|
-
@index = i5
|
288
|
-
r5 = nil
|
289
|
-
end
|
290
|
-
if r5
|
291
|
-
r3 = r5
|
292
|
-
else
|
293
|
-
@index = i3
|
294
|
-
r3 = nil
|
295
|
-
end
|
296
|
-
end
|
297
|
-
if r3
|
298
|
-
s2 << r3
|
299
|
-
else
|
300
|
-
break
|
301
|
-
end
|
302
|
-
end
|
303
|
-
if s2.empty?
|
304
|
-
@index = i2
|
305
|
-
r2 = nil
|
306
|
-
else
|
307
|
-
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
308
|
-
end
|
309
|
-
s0 << r2
|
310
|
-
if r2
|
311
|
-
if has_terminal?('"', false, index)
|
312
|
-
r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
313
|
-
@index += 1
|
314
|
-
else
|
315
|
-
terminal_parse_failure('"')
|
316
|
-
r9 = nil
|
317
|
-
end
|
318
|
-
s0 << r9
|
319
|
-
if r9
|
320
|
-
r10 = _nt_nl
|
321
|
-
s0 << r10
|
322
|
-
end
|
323
|
-
end
|
324
|
-
end
|
325
|
-
if s0.last
|
326
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
327
|
-
r0.extend(Title1)
|
328
|
-
r0.extend(Title2)
|
329
|
-
else
|
330
|
-
@index = i0
|
331
|
-
r0 = nil
|
332
|
-
end
|
333
|
-
|
334
|
-
node_cache[:title][start_index] = r0
|
335
|
-
|
336
|
-
r0
|
337
|
-
end
|
338
|
-
|
339
|
-
end
|
340
|
-
|
341
|
-
class ScriptsParser < Treetop::Runtime::CompiledParser
|
342
|
-
include Scripts
|
343
|
-
end
|
344
|
-
|
345
|
-
end
|