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,432 @@
|
|
1
|
+
# Autogenerated from a Treetop grammar. Edits may be lost.
|
2
|
+
|
3
|
+
|
4
|
+
module CEML
|
5
|
+
module Casting
|
6
|
+
include Treetop::Runtime
|
7
|
+
|
8
|
+
def root
|
9
|
+
@root ||= :casting_statement
|
10
|
+
end
|
11
|
+
|
12
|
+
include Lexer
|
13
|
+
|
14
|
+
module CastingStatement0
|
15
|
+
def stanza_marker
|
16
|
+
elements[0]
|
17
|
+
end
|
18
|
+
|
19
|
+
def ws
|
20
|
+
elements[2]
|
21
|
+
end
|
22
|
+
|
23
|
+
def roles
|
24
|
+
elements[3]
|
25
|
+
end
|
26
|
+
|
27
|
+
def modifiers
|
28
|
+
elements[4]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def _nt_casting_statement
|
33
|
+
start_index = index
|
34
|
+
if node_cache[:casting_statement].has_key?(index)
|
35
|
+
cached = node_cache[:casting_statement][index]
|
36
|
+
if cached
|
37
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
38
|
+
@index = cached.interval.end
|
39
|
+
end
|
40
|
+
return cached
|
41
|
+
end
|
42
|
+
|
43
|
+
i0, s0 = index, []
|
44
|
+
r2 = _nt_stanza_marker
|
45
|
+
if r2
|
46
|
+
r1 = r2
|
47
|
+
else
|
48
|
+
r1 = instantiate_node(SyntaxNode,input, index...index)
|
49
|
+
end
|
50
|
+
s0 << r1
|
51
|
+
if r1
|
52
|
+
i3 = index
|
53
|
+
if has_terminal?('gather', false, index)
|
54
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
55
|
+
@index += 6
|
56
|
+
else
|
57
|
+
terminal_parse_failure('gather')
|
58
|
+
r4 = nil
|
59
|
+
end
|
60
|
+
if r4
|
61
|
+
r3 = r4
|
62
|
+
else
|
63
|
+
if has_terminal?('await', false, index)
|
64
|
+
r5 = instantiate_node(SyntaxNode,input, index...(index + 5))
|
65
|
+
@index += 5
|
66
|
+
else
|
67
|
+
terminal_parse_failure('await')
|
68
|
+
r5 = nil
|
69
|
+
end
|
70
|
+
if r5
|
71
|
+
r3 = r5
|
72
|
+
else
|
73
|
+
if has_terminal?('nab', false, index)
|
74
|
+
r6 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
75
|
+
@index += 3
|
76
|
+
else
|
77
|
+
terminal_parse_failure('nab')
|
78
|
+
r6 = nil
|
79
|
+
end
|
80
|
+
if r6
|
81
|
+
r3 = r6
|
82
|
+
else
|
83
|
+
if has_terminal?('accept', false, index)
|
84
|
+
r7 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
85
|
+
@index += 6
|
86
|
+
else
|
87
|
+
terminal_parse_failure('accept')
|
88
|
+
r7 = nil
|
89
|
+
end
|
90
|
+
if r7
|
91
|
+
r3 = r7
|
92
|
+
else
|
93
|
+
@index = i3
|
94
|
+
r3 = nil
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
s0 << r3
|
100
|
+
if r3
|
101
|
+
r8 = _nt_ws
|
102
|
+
s0 << r8
|
103
|
+
if r8
|
104
|
+
r9 = _nt_roles
|
105
|
+
s0 << r9
|
106
|
+
if r9
|
107
|
+
s10, i10 = [], index
|
108
|
+
loop do
|
109
|
+
r11 = _nt_modifier_phrase
|
110
|
+
if r11
|
111
|
+
s10 << r11
|
112
|
+
else
|
113
|
+
break
|
114
|
+
end
|
115
|
+
end
|
116
|
+
r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
|
117
|
+
s0 << r10
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
if s0.last
|
123
|
+
r0 = instantiate_node(CastingStatement,input, i0...index, s0)
|
124
|
+
r0.extend(CastingStatement0)
|
125
|
+
else
|
126
|
+
@index = i0
|
127
|
+
r0 = nil
|
128
|
+
end
|
129
|
+
|
130
|
+
node_cache[:casting_statement][start_index] = r0
|
131
|
+
|
132
|
+
r0
|
133
|
+
end
|
134
|
+
|
135
|
+
module StanzaMarker0
|
136
|
+
def name
|
137
|
+
elements[1]
|
138
|
+
end
|
139
|
+
|
140
|
+
def nl
|
141
|
+
elements[3]
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
def _nt_stanza_marker
|
146
|
+
start_index = index
|
147
|
+
if node_cache[:stanza_marker].has_key?(index)
|
148
|
+
cached = node_cache[:stanza_marker][index]
|
149
|
+
if cached
|
150
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
151
|
+
@index = cached.interval.end
|
152
|
+
end
|
153
|
+
return cached
|
154
|
+
end
|
155
|
+
|
156
|
+
i0, s0 = index, []
|
157
|
+
if has_terminal?('(', false, index)
|
158
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
159
|
+
@index += 1
|
160
|
+
else
|
161
|
+
terminal_parse_failure('(')
|
162
|
+
r1 = nil
|
163
|
+
end
|
164
|
+
s0 << r1
|
165
|
+
if r1
|
166
|
+
r2 = _nt_id
|
167
|
+
s0 << r2
|
168
|
+
if r2
|
169
|
+
if has_terminal?(')', false, index)
|
170
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
171
|
+
@index += 1
|
172
|
+
else
|
173
|
+
terminal_parse_failure(')')
|
174
|
+
r3 = nil
|
175
|
+
end
|
176
|
+
s0 << r3
|
177
|
+
if r3
|
178
|
+
r4 = _nt_nl
|
179
|
+
s0 << r4
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
if s0.last
|
184
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
185
|
+
r0.extend(StanzaMarker0)
|
186
|
+
else
|
187
|
+
@index = i0
|
188
|
+
r0 = nil
|
189
|
+
end
|
190
|
+
|
191
|
+
node_cache[:stanza_marker][start_index] = r0
|
192
|
+
|
193
|
+
r0
|
194
|
+
end
|
195
|
+
|
196
|
+
def _nt_modifier_phrase
|
197
|
+
start_index = index
|
198
|
+
if node_cache[:modifier_phrase].has_key?(index)
|
199
|
+
cached = node_cache[:modifier_phrase][index]
|
200
|
+
if cached
|
201
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
202
|
+
@index = cached.interval.end
|
203
|
+
end
|
204
|
+
return cached
|
205
|
+
end
|
206
|
+
|
207
|
+
i0 = index
|
208
|
+
r1 = _nt_over_phrase
|
209
|
+
if r1
|
210
|
+
r0 = r1
|
211
|
+
else
|
212
|
+
r2 = _nt_within_phrase
|
213
|
+
if r2
|
214
|
+
r0 = r2
|
215
|
+
else
|
216
|
+
r3 = _nt_with_matching_phrase
|
217
|
+
if r3
|
218
|
+
r0 = r3
|
219
|
+
else
|
220
|
+
@index = i0
|
221
|
+
r0 = nil
|
222
|
+
end
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
node_cache[:modifier_phrase][start_index] = r0
|
227
|
+
|
228
|
+
r0
|
229
|
+
end
|
230
|
+
|
231
|
+
module OverPhrase0
|
232
|
+
def ws1
|
233
|
+
elements[0]
|
234
|
+
end
|
235
|
+
|
236
|
+
def ws2
|
237
|
+
elements[2]
|
238
|
+
end
|
239
|
+
|
240
|
+
def duration
|
241
|
+
elements[3]
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
def _nt_over_phrase
|
246
|
+
start_index = index
|
247
|
+
if node_cache[:over_phrase].has_key?(index)
|
248
|
+
cached = node_cache[:over_phrase][index]
|
249
|
+
if cached
|
250
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
251
|
+
@index = cached.interval.end
|
252
|
+
end
|
253
|
+
return cached
|
254
|
+
end
|
255
|
+
|
256
|
+
i0, s0 = index, []
|
257
|
+
r1 = _nt_ws
|
258
|
+
s0 << r1
|
259
|
+
if r1
|
260
|
+
if has_terminal?('over', false, index)
|
261
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
262
|
+
@index += 4
|
263
|
+
else
|
264
|
+
terminal_parse_failure('over')
|
265
|
+
r2 = nil
|
266
|
+
end
|
267
|
+
s0 << r2
|
268
|
+
if r2
|
269
|
+
r3 = _nt_ws
|
270
|
+
s0 << r3
|
271
|
+
if r3
|
272
|
+
r4 = _nt_duration
|
273
|
+
s0 << r4
|
274
|
+
end
|
275
|
+
end
|
276
|
+
end
|
277
|
+
if s0.last
|
278
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
279
|
+
r0.extend(OverPhrase0)
|
280
|
+
else
|
281
|
+
@index = i0
|
282
|
+
r0 = nil
|
283
|
+
end
|
284
|
+
|
285
|
+
node_cache[:over_phrase][start_index] = r0
|
286
|
+
|
287
|
+
r0
|
288
|
+
end
|
289
|
+
|
290
|
+
module WithinPhrase0
|
291
|
+
def ws1
|
292
|
+
elements[0]
|
293
|
+
end
|
294
|
+
|
295
|
+
def ws2
|
296
|
+
elements[2]
|
297
|
+
end
|
298
|
+
|
299
|
+
def distance
|
300
|
+
elements[3]
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
def _nt_within_phrase
|
305
|
+
start_index = index
|
306
|
+
if node_cache[:within_phrase].has_key?(index)
|
307
|
+
cached = node_cache[:within_phrase][index]
|
308
|
+
if cached
|
309
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
310
|
+
@index = cached.interval.end
|
311
|
+
end
|
312
|
+
return cached
|
313
|
+
end
|
314
|
+
|
315
|
+
i0, s0 = index, []
|
316
|
+
r1 = _nt_ws
|
317
|
+
s0 << r1
|
318
|
+
if r1
|
319
|
+
if has_terminal?('within', false, index)
|
320
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
321
|
+
@index += 6
|
322
|
+
else
|
323
|
+
terminal_parse_failure('within')
|
324
|
+
r2 = nil
|
325
|
+
end
|
326
|
+
s0 << r2
|
327
|
+
if r2
|
328
|
+
r3 = _nt_ws
|
329
|
+
s0 << r3
|
330
|
+
if r3
|
331
|
+
r4 = _nt_distance
|
332
|
+
s0 << r4
|
333
|
+
end
|
334
|
+
end
|
335
|
+
end
|
336
|
+
if s0.last
|
337
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
338
|
+
r0.extend(WithinPhrase0)
|
339
|
+
else
|
340
|
+
@index = i0
|
341
|
+
r0 = nil
|
342
|
+
end
|
343
|
+
|
344
|
+
node_cache[:within_phrase][start_index] = r0
|
345
|
+
|
346
|
+
r0
|
347
|
+
end
|
348
|
+
|
349
|
+
module WithMatchingPhrase0
|
350
|
+
def ws1
|
351
|
+
elements[0]
|
352
|
+
end
|
353
|
+
|
354
|
+
def ws2
|
355
|
+
elements[2]
|
356
|
+
end
|
357
|
+
|
358
|
+
def ws3
|
359
|
+
elements[4]
|
360
|
+
end
|
361
|
+
|
362
|
+
def thing
|
363
|
+
elements[5]
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
367
|
+
def _nt_with_matching_phrase
|
368
|
+
start_index = index
|
369
|
+
if node_cache[:with_matching_phrase].has_key?(index)
|
370
|
+
cached = node_cache[:with_matching_phrase][index]
|
371
|
+
if cached
|
372
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
373
|
+
@index = cached.interval.end
|
374
|
+
end
|
375
|
+
return cached
|
376
|
+
end
|
377
|
+
|
378
|
+
i0, s0 = index, []
|
379
|
+
r1 = _nt_ws
|
380
|
+
s0 << r1
|
381
|
+
if r1
|
382
|
+
if has_terminal?('with', false, index)
|
383
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
384
|
+
@index += 4
|
385
|
+
else
|
386
|
+
terminal_parse_failure('with')
|
387
|
+
r2 = nil
|
388
|
+
end
|
389
|
+
s0 << r2
|
390
|
+
if r2
|
391
|
+
r3 = _nt_ws
|
392
|
+
s0 << r3
|
393
|
+
if r3
|
394
|
+
if has_terminal?('matching', false, index)
|
395
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 8))
|
396
|
+
@index += 8
|
397
|
+
else
|
398
|
+
terminal_parse_failure('matching')
|
399
|
+
r4 = nil
|
400
|
+
end
|
401
|
+
s0 << r4
|
402
|
+
if r4
|
403
|
+
r5 = _nt_ws
|
404
|
+
s0 << r5
|
405
|
+
if r5
|
406
|
+
r6 = _nt_id
|
407
|
+
s0 << r6
|
408
|
+
end
|
409
|
+
end
|
410
|
+
end
|
411
|
+
end
|
412
|
+
end
|
413
|
+
if s0.last
|
414
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
415
|
+
r0.extend(WithMatchingPhrase0)
|
416
|
+
else
|
417
|
+
@index = i0
|
418
|
+
r0 = nil
|
419
|
+
end
|
420
|
+
|
421
|
+
node_cache[:with_matching_phrase][start_index] = r0
|
422
|
+
|
423
|
+
r0
|
424
|
+
end
|
425
|
+
|
426
|
+
end
|
427
|
+
|
428
|
+
class CastingParser < Treetop::Runtime::CompiledParser
|
429
|
+
include Casting
|
430
|
+
end
|
431
|
+
|
432
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module CEML
|
2
|
+
grammar Casting
|
3
|
+
include Lexer
|
4
|
+
|
5
|
+
rule casting_statement
|
6
|
+
stanza_marker:stanza_marker? ('gather' / 'await' / 'nab' / 'accept') ws roles modifiers:modifier_phrase* <CastingStatement>
|
7
|
+
end
|
8
|
+
|
9
|
+
rule stanza_marker
|
10
|
+
'(' name:id ')' nl
|
11
|
+
end
|
12
|
+
|
13
|
+
rule modifier_phrase
|
14
|
+
over_phrase / within_phrase / with_matching_phrase
|
15
|
+
end
|
16
|
+
|
17
|
+
rule over_phrase
|
18
|
+
ws 'over' ws duration
|
19
|
+
end
|
20
|
+
|
21
|
+
rule within_phrase
|
22
|
+
ws 'within' ws distance
|
23
|
+
end
|
24
|
+
|
25
|
+
rule with_matching_phrase
|
26
|
+
ws 'with' ws 'matching' ws thing:id
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|