ceml 0.7.13 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Makefile +1 -1
- data/VERSION +1 -1
- data/ceml.gemspec +62 -50
- data/guide/guide.html +69 -14
- data/guide/guide.md +74 -15
- data/guide/guide.pdf +0 -0
- data/lib/ceml/driver.rb +0 -181
- data/lib/ceml/lang/basic_instruction.rb +49 -0
- data/lib/ceml/{casting_statement.rb → lang/casting_statement.rb} +19 -9
- data/lib/ceml/{instruction_statements.rb → lang/instruction_statements.rb} +5 -16
- data/lib/ceml/{script.rb → lang/script.rb} +53 -43
- data/lib/ceml/lang/tt/casting.rb +432 -0
- data/lib/ceml/lang/tt/casting.treetop +29 -0
- data/lib/ceml/lang/tt/instructions.rb +1130 -0
- data/lib/ceml/lang/tt/instructions.treetop +86 -0
- data/lib/ceml/lang/tt/lexer.rb +1804 -0
- data/lib/ceml/{tt → lang/tt}/lexer.treetop +70 -7
- data/lib/ceml/lang/tt/scripts.rb +647 -0
- data/lib/ceml/{tt → lang/tt}/scripts.treetop +2 -2
- data/lib/ceml/lang.rb +10 -0
- data/lib/ceml/models/audition.rb +65 -0
- data/lib/ceml/models/bundle.rb +64 -0
- data/lib/ceml/models/cast.rb +108 -0
- data/lib/ceml/models/castable.rb +81 -0
- data/lib/ceml/{incident.rb → models/incident.rb} +63 -15
- data/lib/ceml/models/incident_model.rb +100 -0
- data/lib/ceml/models/incident_role_slot.rb +16 -0
- data/lib/ceml/models/player.rb +80 -0
- data/lib/ceml/models/queue.rb +12 -0
- data/lib/ceml/models/waiting_room.rb +40 -0
- data/lib/ceml/models.rb +16 -0
- data/lib/ceml/processor.rb +162 -0
- data/lib/ceml.rb +7 -14
- data/test/askchain.ceml +6 -0
- data/test/compliment.ceml +4 -0
- data/test/dialogues/accept.ceml +24 -0
- data/test/dialogues/basic_seed.ceml +26 -0
- data/test/dialogues/jordan.ceml +121 -0
- data/test/helper.rb +44 -39
- data/test/jane.ceml +48 -0
- data/test/{test_casting.rb → lang/test_casting.rb} +5 -0
- data/test/lang/test_instructions.rb +42 -0
- data/test/{test_scripts.rb → lang/test_scripts.rb} +3 -2
- data/test/sync.ceml +6 -0
- data/test/test_castable.rb +20 -0
- data/test/test_dialogues.rb +58 -0
- data/test/test_incident.rb +64 -127
- metadata +54 -30
- data/.gitignore +0 -23
- data/lib/ceml/confluence.rb +0 -63
- data/lib/ceml/role.rb +0 -61
- data/lib/ceml/tt/casting.treetop +0 -65
- data/lib/ceml/tt/instructions.treetop +0 -91
- data/test/test_instructions.rb +0 -27
- data/test/test_release.rb +0 -78
@@ -0,0 +1,1130 @@
|
|
1
|
+
# Autogenerated from a Treetop grammar. Edits may be lost.
|
2
|
+
|
3
|
+
|
4
|
+
module CEML
|
5
|
+
module Instructions
|
6
|
+
include Treetop::Runtime
|
7
|
+
|
8
|
+
def root
|
9
|
+
@root ||= :basic_statement
|
10
|
+
end
|
11
|
+
|
12
|
+
include Lexer
|
13
|
+
|
14
|
+
def _nt_basic_statement
|
15
|
+
start_index = index
|
16
|
+
if node_cache[:basic_statement].has_key?(index)
|
17
|
+
cached = node_cache[:basic_statement][index]
|
18
|
+
if cached
|
19
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
20
|
+
@index = cached.interval.end
|
21
|
+
end
|
22
|
+
return cached
|
23
|
+
end
|
24
|
+
|
25
|
+
i0 = index
|
26
|
+
r1 = _nt_ask_stmt
|
27
|
+
if r1
|
28
|
+
r0 = r1
|
29
|
+
else
|
30
|
+
r2 = _nt_tell_stmt
|
31
|
+
if r2
|
32
|
+
r0 = r2
|
33
|
+
else
|
34
|
+
r3 = _nt_assign_stmt
|
35
|
+
if r3
|
36
|
+
r0 = r3
|
37
|
+
else
|
38
|
+
r4 = _nt_record_stmt
|
39
|
+
if r4
|
40
|
+
r0 = r4
|
41
|
+
else
|
42
|
+
r5 = _nt_set_stmt
|
43
|
+
if r5
|
44
|
+
r0 = r5
|
45
|
+
else
|
46
|
+
r6 = _nt_pick_stmt
|
47
|
+
if r6
|
48
|
+
r0 = r6
|
49
|
+
else
|
50
|
+
r7 = _nt_seed_stmt
|
51
|
+
if r7
|
52
|
+
r0 = r7
|
53
|
+
else
|
54
|
+
r8 = _nt_sync_stmt
|
55
|
+
if r8
|
56
|
+
r0 = r8
|
57
|
+
else
|
58
|
+
r9 = _nt_replace_stmt
|
59
|
+
if r9
|
60
|
+
r0 = r9
|
61
|
+
else
|
62
|
+
r10 = _nt_release_stmt
|
63
|
+
if r10
|
64
|
+
r0 = r10
|
65
|
+
else
|
66
|
+
@index = i0
|
67
|
+
r0 = nil
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
node_cache[:basic_statement][start_index] = r0
|
80
|
+
|
81
|
+
r0
|
82
|
+
end
|
83
|
+
|
84
|
+
module InstructionStmt0
|
85
|
+
def later
|
86
|
+
elements[0]
|
87
|
+
end
|
88
|
+
|
89
|
+
def basic_statement
|
90
|
+
elements[1]
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
module InstructionStmt1
|
95
|
+
def delay
|
96
|
+
later.duration.seconds if respond_to? :later and not later.empty?
|
97
|
+
end
|
98
|
+
|
99
|
+
def bytecode
|
100
|
+
if delay
|
101
|
+
[[[role], :start_delay, delay], [[role], :complete_delay]] + elements[1].bytecode
|
102
|
+
else
|
103
|
+
elements[1].bytecode
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def _nt_instruction_stmt
|
109
|
+
start_index = index
|
110
|
+
if node_cache[:instruction_stmt].has_key?(index)
|
111
|
+
cached = node_cache[:instruction_stmt][index]
|
112
|
+
if cached
|
113
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
114
|
+
@index = cached.interval.end
|
115
|
+
end
|
116
|
+
return cached
|
117
|
+
end
|
118
|
+
|
119
|
+
i0, s0 = index, []
|
120
|
+
r2 = _nt_later
|
121
|
+
if r2
|
122
|
+
r1 = r2
|
123
|
+
else
|
124
|
+
r1 = instantiate_node(SyntaxNode,input, index...index)
|
125
|
+
end
|
126
|
+
s0 << r1
|
127
|
+
if r1
|
128
|
+
r3 = _nt_basic_statement
|
129
|
+
s0 << r3
|
130
|
+
end
|
131
|
+
if s0.last
|
132
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
133
|
+
r0.extend(InstructionStmt0)
|
134
|
+
r0.extend(InstructionStmt1)
|
135
|
+
else
|
136
|
+
@index = i0
|
137
|
+
r0 = nil
|
138
|
+
end
|
139
|
+
|
140
|
+
node_cache[:instruction_stmt][start_index] = r0
|
141
|
+
|
142
|
+
r0
|
143
|
+
end
|
144
|
+
|
145
|
+
module Later0
|
146
|
+
def duration
|
147
|
+
elements[0]
|
148
|
+
end
|
149
|
+
|
150
|
+
def ws1
|
151
|
+
elements[1]
|
152
|
+
end
|
153
|
+
|
154
|
+
def ws2
|
155
|
+
elements[4]
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
def _nt_later
|
160
|
+
start_index = index
|
161
|
+
if node_cache[:later].has_key?(index)
|
162
|
+
cached = node_cache[:later][index]
|
163
|
+
if cached
|
164
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
165
|
+
@index = cached.interval.end
|
166
|
+
end
|
167
|
+
return cached
|
168
|
+
end
|
169
|
+
|
170
|
+
i0, s0 = index, []
|
171
|
+
r1 = _nt_duration
|
172
|
+
s0 << r1
|
173
|
+
if r1
|
174
|
+
r2 = _nt_ws
|
175
|
+
s0 << r2
|
176
|
+
if r2
|
177
|
+
if has_terminal?('later', false, index)
|
178
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 5))
|
179
|
+
@index += 5
|
180
|
+
else
|
181
|
+
terminal_parse_failure('later')
|
182
|
+
r3 = nil
|
183
|
+
end
|
184
|
+
s0 << r3
|
185
|
+
if r3
|
186
|
+
if has_terminal?(',', false, index)
|
187
|
+
r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
188
|
+
@index += 1
|
189
|
+
else
|
190
|
+
terminal_parse_failure(',')
|
191
|
+
r5 = nil
|
192
|
+
end
|
193
|
+
if r5
|
194
|
+
r4 = r5
|
195
|
+
else
|
196
|
+
r4 = instantiate_node(SyntaxNode,input, index...index)
|
197
|
+
end
|
198
|
+
s0 << r4
|
199
|
+
if r4
|
200
|
+
r6 = _nt_ws
|
201
|
+
s0 << r6
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
if s0.last
|
207
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
208
|
+
r0.extend(Later0)
|
209
|
+
else
|
210
|
+
@index = i0
|
211
|
+
r0 = nil
|
212
|
+
end
|
213
|
+
|
214
|
+
node_cache[:later][start_index] = r0
|
215
|
+
|
216
|
+
r0
|
217
|
+
end
|
218
|
+
|
219
|
+
module SeedStmt0
|
220
|
+
def ws1
|
221
|
+
elements[1]
|
222
|
+
end
|
223
|
+
|
224
|
+
def varname
|
225
|
+
elements[2]
|
226
|
+
end
|
227
|
+
|
228
|
+
def ws2
|
229
|
+
elements[3]
|
230
|
+
end
|
231
|
+
|
232
|
+
def ws3
|
233
|
+
elements[5]
|
234
|
+
end
|
235
|
+
|
236
|
+
def rolemap
|
237
|
+
elements[6]
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
module SeedStmt1
|
242
|
+
def roles
|
243
|
+
rolemap.value.map do |x| x[:from].to_sym end
|
244
|
+
end
|
245
|
+
def bytecode
|
246
|
+
[[roles, :seed, {:target => varname.text_value, :rolemap => rolemap.value}]]
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
def _nt_seed_stmt
|
251
|
+
start_index = index
|
252
|
+
if node_cache[:seed_stmt].has_key?(index)
|
253
|
+
cached = node_cache[:seed_stmt][index]
|
254
|
+
if cached
|
255
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
256
|
+
@index = cached.interval.end
|
257
|
+
end
|
258
|
+
return cached
|
259
|
+
end
|
260
|
+
|
261
|
+
i0, s0 = index, []
|
262
|
+
if has_terminal?('seed', false, index)
|
263
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
264
|
+
@index += 4
|
265
|
+
else
|
266
|
+
terminal_parse_failure('seed')
|
267
|
+
r1 = nil
|
268
|
+
end
|
269
|
+
s0 << r1
|
270
|
+
if r1
|
271
|
+
r2 = _nt_ws
|
272
|
+
s0 << r2
|
273
|
+
if r2
|
274
|
+
r3 = _nt_id
|
275
|
+
s0 << r3
|
276
|
+
if r3
|
277
|
+
r4 = _nt_ws
|
278
|
+
s0 << r4
|
279
|
+
if r4
|
280
|
+
if has_terminal?('with', false, index)
|
281
|
+
r5 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
282
|
+
@index += 4
|
283
|
+
else
|
284
|
+
terminal_parse_failure('with')
|
285
|
+
r5 = nil
|
286
|
+
end
|
287
|
+
s0 << r5
|
288
|
+
if r5
|
289
|
+
r6 = _nt_ws
|
290
|
+
s0 << r6
|
291
|
+
if r6
|
292
|
+
r7 = _nt_rolemap
|
293
|
+
s0 << r7
|
294
|
+
end
|
295
|
+
end
|
296
|
+
end
|
297
|
+
end
|
298
|
+
end
|
299
|
+
end
|
300
|
+
if s0.last
|
301
|
+
r0 = instantiate_node(BasicInstruction,input, i0...index, s0)
|
302
|
+
r0.extend(SeedStmt0)
|
303
|
+
r0.extend(SeedStmt1)
|
304
|
+
else
|
305
|
+
@index = i0
|
306
|
+
r0 = nil
|
307
|
+
end
|
308
|
+
|
309
|
+
node_cache[:seed_stmt][start_index] = r0
|
310
|
+
|
311
|
+
r0
|
312
|
+
end
|
313
|
+
|
314
|
+
module RecordStmt0
|
315
|
+
def ws1
|
316
|
+
elements[1]
|
317
|
+
end
|
318
|
+
|
319
|
+
def id
|
320
|
+
elements[2]
|
321
|
+
end
|
322
|
+
|
323
|
+
def ws2
|
324
|
+
elements[3]
|
325
|
+
end
|
326
|
+
|
327
|
+
def varname
|
328
|
+
elements[4]
|
329
|
+
end
|
330
|
+
end
|
331
|
+
|
332
|
+
def _nt_record_stmt
|
333
|
+
start_index = index
|
334
|
+
if node_cache[:record_stmt].has_key?(index)
|
335
|
+
cached = node_cache[:record_stmt][index]
|
336
|
+
if cached
|
337
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
338
|
+
@index = cached.interval.end
|
339
|
+
end
|
340
|
+
return cached
|
341
|
+
end
|
342
|
+
|
343
|
+
i0, s0 = index, []
|
344
|
+
if has_terminal?('record', false, index)
|
345
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
346
|
+
@index += 6
|
347
|
+
else
|
348
|
+
terminal_parse_failure('record')
|
349
|
+
r1 = nil
|
350
|
+
end
|
351
|
+
s0 << r1
|
352
|
+
if r1
|
353
|
+
r2 = _nt_ws
|
354
|
+
s0 << r2
|
355
|
+
if r2
|
356
|
+
r3 = _nt_id
|
357
|
+
s0 << r3
|
358
|
+
if r3
|
359
|
+
r4 = _nt_ws
|
360
|
+
s0 << r4
|
361
|
+
if r4
|
362
|
+
r5 = _nt_id
|
363
|
+
s0 << r5
|
364
|
+
end
|
365
|
+
end
|
366
|
+
end
|
367
|
+
end
|
368
|
+
if s0.last
|
369
|
+
r0 = instantiate_node(BasicInstruction,input, i0...index, s0)
|
370
|
+
r0.extend(RecordStmt0)
|
371
|
+
else
|
372
|
+
@index = i0
|
373
|
+
r0 = nil
|
374
|
+
end
|
375
|
+
|
376
|
+
node_cache[:record_stmt][start_index] = r0
|
377
|
+
|
378
|
+
r0
|
379
|
+
end
|
380
|
+
|
381
|
+
module TellStmt0
|
382
|
+
def ws
|
383
|
+
elements[1]
|
384
|
+
end
|
385
|
+
|
386
|
+
def id
|
387
|
+
elements[2]
|
388
|
+
end
|
389
|
+
|
390
|
+
def text
|
391
|
+
elements[5]
|
392
|
+
end
|
393
|
+
end
|
394
|
+
|
395
|
+
def _nt_tell_stmt
|
396
|
+
start_index = index
|
397
|
+
if node_cache[:tell_stmt].has_key?(index)
|
398
|
+
cached = node_cache[:tell_stmt][index]
|
399
|
+
if cached
|
400
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
401
|
+
@index = cached.interval.end
|
402
|
+
end
|
403
|
+
return cached
|
404
|
+
end
|
405
|
+
|
406
|
+
i0, s0 = index, []
|
407
|
+
if has_terminal?('tell', false, index)
|
408
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
409
|
+
@index += 4
|
410
|
+
else
|
411
|
+
terminal_parse_failure('tell')
|
412
|
+
r1 = nil
|
413
|
+
end
|
414
|
+
s0 << r1
|
415
|
+
if r1
|
416
|
+
r2 = _nt_ws
|
417
|
+
s0 << r2
|
418
|
+
if r2
|
419
|
+
r3 = _nt_id
|
420
|
+
s0 << r3
|
421
|
+
if r3
|
422
|
+
if has_terminal?(':', false, index)
|
423
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
424
|
+
@index += 1
|
425
|
+
else
|
426
|
+
terminal_parse_failure(':')
|
427
|
+
r4 = nil
|
428
|
+
end
|
429
|
+
s0 << r4
|
430
|
+
if r4
|
431
|
+
r6 = _nt_ws
|
432
|
+
if r6
|
433
|
+
r5 = r6
|
434
|
+
else
|
435
|
+
r5 = instantiate_node(SyntaxNode,input, index...index)
|
436
|
+
end
|
437
|
+
s0 << r5
|
438
|
+
if r5
|
439
|
+
r7 = _nt_text
|
440
|
+
s0 << r7
|
441
|
+
end
|
442
|
+
end
|
443
|
+
end
|
444
|
+
end
|
445
|
+
end
|
446
|
+
if s0.last
|
447
|
+
r0 = instantiate_node(BasicInstruction,input, i0...index, s0)
|
448
|
+
r0.extend(TellStmt0)
|
449
|
+
else
|
450
|
+
@index = i0
|
451
|
+
r0 = nil
|
452
|
+
end
|
453
|
+
|
454
|
+
node_cache[:tell_stmt][start_index] = r0
|
455
|
+
|
456
|
+
r0
|
457
|
+
end
|
458
|
+
|
459
|
+
module AssignStmt0
|
460
|
+
def ws
|
461
|
+
elements[1]
|
462
|
+
end
|
463
|
+
|
464
|
+
def id
|
465
|
+
elements[2]
|
466
|
+
end
|
467
|
+
|
468
|
+
def text
|
469
|
+
elements[5]
|
470
|
+
end
|
471
|
+
end
|
472
|
+
|
473
|
+
def _nt_assign_stmt
|
474
|
+
start_index = index
|
475
|
+
if node_cache[:assign_stmt].has_key?(index)
|
476
|
+
cached = node_cache[:assign_stmt][index]
|
477
|
+
if cached
|
478
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
479
|
+
@index = cached.interval.end
|
480
|
+
end
|
481
|
+
return cached
|
482
|
+
end
|
483
|
+
|
484
|
+
i0, s0 = index, []
|
485
|
+
if has_terminal?('assign', false, index)
|
486
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
487
|
+
@index += 6
|
488
|
+
else
|
489
|
+
terminal_parse_failure('assign')
|
490
|
+
r1 = nil
|
491
|
+
end
|
492
|
+
s0 << r1
|
493
|
+
if r1
|
494
|
+
r2 = _nt_ws
|
495
|
+
s0 << r2
|
496
|
+
if r2
|
497
|
+
r3 = _nt_id
|
498
|
+
s0 << r3
|
499
|
+
if r3
|
500
|
+
if has_terminal?(':', false, index)
|
501
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
502
|
+
@index += 1
|
503
|
+
else
|
504
|
+
terminal_parse_failure(':')
|
505
|
+
r4 = nil
|
506
|
+
end
|
507
|
+
s0 << r4
|
508
|
+
if r4
|
509
|
+
r6 = _nt_ws
|
510
|
+
if r6
|
511
|
+
r5 = r6
|
512
|
+
else
|
513
|
+
r5 = instantiate_node(SyntaxNode,input, index...index)
|
514
|
+
end
|
515
|
+
s0 << r5
|
516
|
+
if r5
|
517
|
+
r7 = _nt_text
|
518
|
+
s0 << r7
|
519
|
+
end
|
520
|
+
end
|
521
|
+
end
|
522
|
+
end
|
523
|
+
end
|
524
|
+
if s0.last
|
525
|
+
r0 = instantiate_node(BasicInstruction,input, i0...index, s0)
|
526
|
+
r0.extend(AssignStmt0)
|
527
|
+
else
|
528
|
+
@index = i0
|
529
|
+
r0 = nil
|
530
|
+
end
|
531
|
+
|
532
|
+
node_cache[:assign_stmt][start_index] = r0
|
533
|
+
|
534
|
+
r0
|
535
|
+
end
|
536
|
+
|
537
|
+
module AskStmt0
|
538
|
+
def ws1
|
539
|
+
elements[0]
|
540
|
+
end
|
541
|
+
|
542
|
+
def ws2
|
543
|
+
elements[2]
|
544
|
+
end
|
545
|
+
|
546
|
+
def varname
|
547
|
+
elements[3]
|
548
|
+
end
|
549
|
+
end
|
550
|
+
|
551
|
+
module AskStmt1
|
552
|
+
def ws
|
553
|
+
elements[1]
|
554
|
+
end
|
555
|
+
|
556
|
+
def id
|
557
|
+
elements[2]
|
558
|
+
end
|
559
|
+
|
560
|
+
def about
|
561
|
+
elements[3]
|
562
|
+
end
|
563
|
+
|
564
|
+
def text
|
565
|
+
elements[6]
|
566
|
+
end
|
567
|
+
end
|
568
|
+
|
569
|
+
def _nt_ask_stmt
|
570
|
+
start_index = index
|
571
|
+
if node_cache[:ask_stmt].has_key?(index)
|
572
|
+
cached = node_cache[:ask_stmt][index]
|
573
|
+
if cached
|
574
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
575
|
+
@index = cached.interval.end
|
576
|
+
end
|
577
|
+
return cached
|
578
|
+
end
|
579
|
+
|
580
|
+
i0, s0 = index, []
|
581
|
+
if has_terminal?('ask', false, index)
|
582
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
583
|
+
@index += 3
|
584
|
+
else
|
585
|
+
terminal_parse_failure('ask')
|
586
|
+
r1 = nil
|
587
|
+
end
|
588
|
+
s0 << r1
|
589
|
+
if r1
|
590
|
+
r2 = _nt_ws
|
591
|
+
s0 << r2
|
592
|
+
if r2
|
593
|
+
r3 = _nt_id
|
594
|
+
s0 << r3
|
595
|
+
if r3
|
596
|
+
i5, s5 = index, []
|
597
|
+
r6 = _nt_ws
|
598
|
+
s5 << r6
|
599
|
+
if r6
|
600
|
+
if has_terminal?('re', false, index)
|
601
|
+
r7 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
602
|
+
@index += 2
|
603
|
+
else
|
604
|
+
terminal_parse_failure('re')
|
605
|
+
r7 = nil
|
606
|
+
end
|
607
|
+
s5 << r7
|
608
|
+
if r7
|
609
|
+
r8 = _nt_ws
|
610
|
+
s5 << r8
|
611
|
+
if r8
|
612
|
+
r9 = _nt_id
|
613
|
+
s5 << r9
|
614
|
+
end
|
615
|
+
end
|
616
|
+
end
|
617
|
+
if s5.last
|
618
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
619
|
+
r5.extend(AskStmt0)
|
620
|
+
else
|
621
|
+
@index = i5
|
622
|
+
r5 = nil
|
623
|
+
end
|
624
|
+
if r5
|
625
|
+
r4 = r5
|
626
|
+
else
|
627
|
+
r4 = instantiate_node(SyntaxNode,input, index...index)
|
628
|
+
end
|
629
|
+
s0 << r4
|
630
|
+
if r4
|
631
|
+
if has_terminal?(':', false, index)
|
632
|
+
r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
633
|
+
@index += 1
|
634
|
+
else
|
635
|
+
terminal_parse_failure(':')
|
636
|
+
r10 = nil
|
637
|
+
end
|
638
|
+
s0 << r10
|
639
|
+
if r10
|
640
|
+
r12 = _nt_ws
|
641
|
+
if r12
|
642
|
+
r11 = r12
|
643
|
+
else
|
644
|
+
r11 = instantiate_node(SyntaxNode,input, index...index)
|
645
|
+
end
|
646
|
+
s0 << r11
|
647
|
+
if r11
|
648
|
+
r13 = _nt_text
|
649
|
+
s0 << r13
|
650
|
+
end
|
651
|
+
end
|
652
|
+
end
|
653
|
+
end
|
654
|
+
end
|
655
|
+
end
|
656
|
+
if s0.last
|
657
|
+
r0 = instantiate_node(BasicInstruction,input, i0...index, s0)
|
658
|
+
r0.extend(AskStmt1)
|
659
|
+
else
|
660
|
+
@index = i0
|
661
|
+
r0 = nil
|
662
|
+
end
|
663
|
+
|
664
|
+
node_cache[:ask_stmt][start_index] = r0
|
665
|
+
|
666
|
+
r0
|
667
|
+
end
|
668
|
+
|
669
|
+
module SetStmt0
|
670
|
+
def ws1
|
671
|
+
elements[1]
|
672
|
+
end
|
673
|
+
|
674
|
+
def id
|
675
|
+
elements[2]
|
676
|
+
end
|
677
|
+
|
678
|
+
def ws2
|
679
|
+
elements[3]
|
680
|
+
end
|
681
|
+
|
682
|
+
def varname
|
683
|
+
elements[4]
|
684
|
+
end
|
685
|
+
|
686
|
+
def text
|
687
|
+
elements[7]
|
688
|
+
end
|
689
|
+
end
|
690
|
+
|
691
|
+
def _nt_set_stmt
|
692
|
+
start_index = index
|
693
|
+
if node_cache[:set_stmt].has_key?(index)
|
694
|
+
cached = node_cache[:set_stmt][index]
|
695
|
+
if cached
|
696
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
697
|
+
@index = cached.interval.end
|
698
|
+
end
|
699
|
+
return cached
|
700
|
+
end
|
701
|
+
|
702
|
+
i0, s0 = index, []
|
703
|
+
if has_terminal?('set', false, index)
|
704
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
705
|
+
@index += 3
|
706
|
+
else
|
707
|
+
terminal_parse_failure('set')
|
708
|
+
r1 = nil
|
709
|
+
end
|
710
|
+
s0 << r1
|
711
|
+
if r1
|
712
|
+
r2 = _nt_ws
|
713
|
+
s0 << r2
|
714
|
+
if r2
|
715
|
+
r3 = _nt_id
|
716
|
+
s0 << r3
|
717
|
+
if r3
|
718
|
+
r4 = _nt_ws
|
719
|
+
s0 << r4
|
720
|
+
if r4
|
721
|
+
r5 = _nt_id
|
722
|
+
s0 << r5
|
723
|
+
if r5
|
724
|
+
if has_terminal?(':', false, index)
|
725
|
+
r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
726
|
+
@index += 1
|
727
|
+
else
|
728
|
+
terminal_parse_failure(':')
|
729
|
+
r6 = nil
|
730
|
+
end
|
731
|
+
s0 << r6
|
732
|
+
if r6
|
733
|
+
r8 = _nt_ws
|
734
|
+
if r8
|
735
|
+
r7 = r8
|
736
|
+
else
|
737
|
+
r7 = instantiate_node(SyntaxNode,input, index...index)
|
738
|
+
end
|
739
|
+
s0 << r7
|
740
|
+
if r7
|
741
|
+
r9 = _nt_text
|
742
|
+
s0 << r9
|
743
|
+
end
|
744
|
+
end
|
745
|
+
end
|
746
|
+
end
|
747
|
+
end
|
748
|
+
end
|
749
|
+
end
|
750
|
+
if s0.last
|
751
|
+
r0 = instantiate_node(BasicInstruction,input, i0...index, s0)
|
752
|
+
r0.extend(SetStmt0)
|
753
|
+
else
|
754
|
+
@index = i0
|
755
|
+
r0 = nil
|
756
|
+
end
|
757
|
+
|
758
|
+
node_cache[:set_stmt][start_index] = r0
|
759
|
+
|
760
|
+
r0
|
761
|
+
end
|
762
|
+
|
763
|
+
module PickStmt0
|
764
|
+
def ws1
|
765
|
+
elements[1]
|
766
|
+
end
|
767
|
+
|
768
|
+
def id
|
769
|
+
elements[2]
|
770
|
+
end
|
771
|
+
|
772
|
+
def ws2
|
773
|
+
elements[3]
|
774
|
+
end
|
775
|
+
|
776
|
+
def varname
|
777
|
+
elements[4]
|
778
|
+
end
|
779
|
+
|
780
|
+
def text
|
781
|
+
elements[7]
|
782
|
+
end
|
783
|
+
end
|
784
|
+
|
785
|
+
def _nt_pick_stmt
|
786
|
+
start_index = index
|
787
|
+
if node_cache[:pick_stmt].has_key?(index)
|
788
|
+
cached = node_cache[:pick_stmt][index]
|
789
|
+
if cached
|
790
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
791
|
+
@index = cached.interval.end
|
792
|
+
end
|
793
|
+
return cached
|
794
|
+
end
|
795
|
+
|
796
|
+
i0, s0 = index, []
|
797
|
+
if has_terminal?('pick', false, index)
|
798
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
799
|
+
@index += 4
|
800
|
+
else
|
801
|
+
terminal_parse_failure('pick')
|
802
|
+
r1 = nil
|
803
|
+
end
|
804
|
+
s0 << r1
|
805
|
+
if r1
|
806
|
+
r2 = _nt_ws
|
807
|
+
s0 << r2
|
808
|
+
if r2
|
809
|
+
r3 = _nt_id
|
810
|
+
s0 << r3
|
811
|
+
if r3
|
812
|
+
r4 = _nt_ws
|
813
|
+
s0 << r4
|
814
|
+
if r4
|
815
|
+
r5 = _nt_id
|
816
|
+
s0 << r5
|
817
|
+
if r5
|
818
|
+
if has_terminal?(':', false, index)
|
819
|
+
r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
820
|
+
@index += 1
|
821
|
+
else
|
822
|
+
terminal_parse_failure(':')
|
823
|
+
r6 = nil
|
824
|
+
end
|
825
|
+
s0 << r6
|
826
|
+
if r6
|
827
|
+
r8 = _nt_ws
|
828
|
+
if r8
|
829
|
+
r7 = r8
|
830
|
+
else
|
831
|
+
r7 = instantiate_node(SyntaxNode,input, index...index)
|
832
|
+
end
|
833
|
+
s0 << r7
|
834
|
+
if r7
|
835
|
+
r9 = _nt_text
|
836
|
+
s0 << r9
|
837
|
+
end
|
838
|
+
end
|
839
|
+
end
|
840
|
+
end
|
841
|
+
end
|
842
|
+
end
|
843
|
+
end
|
844
|
+
if s0.last
|
845
|
+
r0 = instantiate_node(BasicInstruction,input, i0...index, s0)
|
846
|
+
r0.extend(PickStmt0)
|
847
|
+
else
|
848
|
+
@index = i0
|
849
|
+
r0 = nil
|
850
|
+
end
|
851
|
+
|
852
|
+
node_cache[:pick_stmt][start_index] = r0
|
853
|
+
|
854
|
+
r0
|
855
|
+
end
|
856
|
+
|
857
|
+
module SyncStmt0
|
858
|
+
def ws
|
859
|
+
elements[1]
|
860
|
+
end
|
861
|
+
|
862
|
+
def id
|
863
|
+
elements[2]
|
864
|
+
end
|
865
|
+
end
|
866
|
+
|
867
|
+
def _nt_sync_stmt
|
868
|
+
start_index = index
|
869
|
+
if node_cache[:sync_stmt].has_key?(index)
|
870
|
+
cached = node_cache[:sync_stmt][index]
|
871
|
+
if cached
|
872
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
873
|
+
@index = cached.interval.end
|
874
|
+
end
|
875
|
+
return cached
|
876
|
+
end
|
877
|
+
|
878
|
+
i0, s0 = index, []
|
879
|
+
if has_terminal?('sync', false, index)
|
880
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
881
|
+
@index += 4
|
882
|
+
else
|
883
|
+
terminal_parse_failure('sync')
|
884
|
+
r1 = nil
|
885
|
+
end
|
886
|
+
s0 << r1
|
887
|
+
if r1
|
888
|
+
r2 = _nt_ws
|
889
|
+
s0 << r2
|
890
|
+
if r2
|
891
|
+
r3 = _nt_id
|
892
|
+
s0 << r3
|
893
|
+
end
|
894
|
+
end
|
895
|
+
if s0.last
|
896
|
+
r0 = instantiate_node(BasicInstruction,input, i0...index, s0)
|
897
|
+
r0.extend(SyncStmt0)
|
898
|
+
else
|
899
|
+
@index = i0
|
900
|
+
r0 = nil
|
901
|
+
end
|
902
|
+
|
903
|
+
node_cache[:sync_stmt][start_index] = r0
|
904
|
+
|
905
|
+
r0
|
906
|
+
end
|
907
|
+
|
908
|
+
module ReleaseStmt0
|
909
|
+
def ws
|
910
|
+
elements[1]
|
911
|
+
end
|
912
|
+
|
913
|
+
def id
|
914
|
+
elements[2]
|
915
|
+
end
|
916
|
+
|
917
|
+
def condition
|
918
|
+
elements[3]
|
919
|
+
end
|
920
|
+
end
|
921
|
+
|
922
|
+
def _nt_release_stmt
|
923
|
+
start_index = index
|
924
|
+
if node_cache[:release_stmt].has_key?(index)
|
925
|
+
cached = node_cache[:release_stmt][index]
|
926
|
+
if cached
|
927
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
928
|
+
@index = cached.interval.end
|
929
|
+
end
|
930
|
+
return cached
|
931
|
+
end
|
932
|
+
|
933
|
+
i0, s0 = index, []
|
934
|
+
if has_terminal?('release', false, index)
|
935
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 7))
|
936
|
+
@index += 7
|
937
|
+
else
|
938
|
+
terminal_parse_failure('release')
|
939
|
+
r1 = nil
|
940
|
+
end
|
941
|
+
s0 << r1
|
942
|
+
if r1
|
943
|
+
r2 = _nt_ws
|
944
|
+
s0 << r2
|
945
|
+
if r2
|
946
|
+
r3 = _nt_id
|
947
|
+
s0 << r3
|
948
|
+
if r3
|
949
|
+
r5 = _nt_condition
|
950
|
+
if r5
|
951
|
+
r4 = r5
|
952
|
+
else
|
953
|
+
r4 = instantiate_node(SyntaxNode,input, index...index)
|
954
|
+
end
|
955
|
+
s0 << r4
|
956
|
+
end
|
957
|
+
end
|
958
|
+
end
|
959
|
+
if s0.last
|
960
|
+
r0 = instantiate_node(BasicInstruction,input, i0...index, s0)
|
961
|
+
r0.extend(ReleaseStmt0)
|
962
|
+
else
|
963
|
+
@index = i0
|
964
|
+
r0 = nil
|
965
|
+
end
|
966
|
+
|
967
|
+
node_cache[:release_stmt][start_index] = r0
|
968
|
+
|
969
|
+
r0
|
970
|
+
end
|
971
|
+
|
972
|
+
module ReplaceStmt0
|
973
|
+
def ws
|
974
|
+
elements[1]
|
975
|
+
end
|
976
|
+
|
977
|
+
def id
|
978
|
+
elements[2]
|
979
|
+
end
|
980
|
+
|
981
|
+
def condition
|
982
|
+
elements[3]
|
983
|
+
end
|
984
|
+
end
|
985
|
+
|
986
|
+
def _nt_replace_stmt
|
987
|
+
start_index = index
|
988
|
+
if node_cache[:replace_stmt].has_key?(index)
|
989
|
+
cached = node_cache[:replace_stmt][index]
|
990
|
+
if cached
|
991
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
992
|
+
@index = cached.interval.end
|
993
|
+
end
|
994
|
+
return cached
|
995
|
+
end
|
996
|
+
|
997
|
+
i0, s0 = index, []
|
998
|
+
if has_terminal?('replace', false, index)
|
999
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 7))
|
1000
|
+
@index += 7
|
1001
|
+
else
|
1002
|
+
terminal_parse_failure('replace')
|
1003
|
+
r1 = nil
|
1004
|
+
end
|
1005
|
+
s0 << r1
|
1006
|
+
if r1
|
1007
|
+
r2 = _nt_ws
|
1008
|
+
s0 << r2
|
1009
|
+
if r2
|
1010
|
+
r3 = _nt_id
|
1011
|
+
s0 << r3
|
1012
|
+
if r3
|
1013
|
+
r5 = _nt_condition
|
1014
|
+
if r5
|
1015
|
+
r4 = r5
|
1016
|
+
else
|
1017
|
+
r4 = instantiate_node(SyntaxNode,input, index...index)
|
1018
|
+
end
|
1019
|
+
s0 << r4
|
1020
|
+
end
|
1021
|
+
end
|
1022
|
+
end
|
1023
|
+
if s0.last
|
1024
|
+
r0 = instantiate_node(BasicInstruction,input, i0...index, s0)
|
1025
|
+
r0.extend(ReplaceStmt0)
|
1026
|
+
else
|
1027
|
+
@index = i0
|
1028
|
+
r0 = nil
|
1029
|
+
end
|
1030
|
+
|
1031
|
+
node_cache[:replace_stmt][start_index] = r0
|
1032
|
+
|
1033
|
+
r0
|
1034
|
+
end
|
1035
|
+
|
1036
|
+
module Condition0
|
1037
|
+
def ws1
|
1038
|
+
elements[0]
|
1039
|
+
end
|
1040
|
+
|
1041
|
+
def type
|
1042
|
+
elements[1]
|
1043
|
+
end
|
1044
|
+
|
1045
|
+
def ws2
|
1046
|
+
elements[2]
|
1047
|
+
end
|
1048
|
+
|
1049
|
+
def thing
|
1050
|
+
elements[3]
|
1051
|
+
end
|
1052
|
+
end
|
1053
|
+
|
1054
|
+
module Condition1
|
1055
|
+
def value
|
1056
|
+
[type.text_value.to_sym, thing.text_value.to_sym]
|
1057
|
+
end
|
1058
|
+
end
|
1059
|
+
|
1060
|
+
def _nt_condition
|
1061
|
+
start_index = index
|
1062
|
+
if node_cache[:condition].has_key?(index)
|
1063
|
+
cached = node_cache[:condition][index]
|
1064
|
+
if cached
|
1065
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1066
|
+
@index = cached.interval.end
|
1067
|
+
end
|
1068
|
+
return cached
|
1069
|
+
end
|
1070
|
+
|
1071
|
+
i0, s0 = index, []
|
1072
|
+
r1 = _nt_ws
|
1073
|
+
s0 << r1
|
1074
|
+
if r1
|
1075
|
+
i2 = index
|
1076
|
+
if has_terminal?('if', false, index)
|
1077
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
1078
|
+
@index += 2
|
1079
|
+
else
|
1080
|
+
terminal_parse_failure('if')
|
1081
|
+
r3 = nil
|
1082
|
+
end
|
1083
|
+
if r3
|
1084
|
+
r2 = r3
|
1085
|
+
else
|
1086
|
+
if has_terminal?('unless', false, index)
|
1087
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
1088
|
+
@index += 6
|
1089
|
+
else
|
1090
|
+
terminal_parse_failure('unless')
|
1091
|
+
r4 = nil
|
1092
|
+
end
|
1093
|
+
if r4
|
1094
|
+
r2 = r4
|
1095
|
+
else
|
1096
|
+
@index = i2
|
1097
|
+
r2 = nil
|
1098
|
+
end
|
1099
|
+
end
|
1100
|
+
s0 << r2
|
1101
|
+
if r2
|
1102
|
+
r5 = _nt_ws
|
1103
|
+
s0 << r5
|
1104
|
+
if r5
|
1105
|
+
r6 = _nt_id
|
1106
|
+
s0 << r6
|
1107
|
+
end
|
1108
|
+
end
|
1109
|
+
end
|
1110
|
+
if s0.last
|
1111
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1112
|
+
r0.extend(Condition0)
|
1113
|
+
r0.extend(Condition1)
|
1114
|
+
else
|
1115
|
+
@index = i0
|
1116
|
+
r0 = nil
|
1117
|
+
end
|
1118
|
+
|
1119
|
+
node_cache[:condition][start_index] = r0
|
1120
|
+
|
1121
|
+
r0
|
1122
|
+
end
|
1123
|
+
|
1124
|
+
end
|
1125
|
+
|
1126
|
+
class InstructionsParser < Treetop::Runtime::CompiledParser
|
1127
|
+
include Instructions
|
1128
|
+
end
|
1129
|
+
|
1130
|
+
end
|