Module: CEML::Scripts

Includes:
Casting, Instructions, Lexer, Treetop::Runtime
Included in:
ScriptsParser
Defined in:
lib/ceml/lang/tt/scripts.rb

Defined Under Namespace

Modules: FreeScript0, FreeScripts0, Instructions0, Instructions1, Script0, Script1, Script2, Script3, Script4, Script5, Scripts0, Scripts1, Scripts2, Title0, Title1, Title2

Instance Method Summary collapse

Methods included from Instructions

#_nt_ask_stmt, #_nt_assign_stmt, #_nt_basic_statement, #_nt_condition, #_nt_instruction_stmt, #_nt_later, #_nt_pick_stmt, #_nt_record_stmt, #_nt_release_stmt, #_nt_replace_stmt, #_nt_seed_stmt, #_nt_set_stmt, #_nt_sync_stmt, #_nt_tell_stmt

Methods included from Lexer

#_nt_and, #_nt_comment, #_nt_distance, #_nt_duration, #_nt_eol, #_nt_id, #_nt_linebreak, #_nt_mapped_role, #_nt_nl, #_nt_number, #_nt_qualifier, #_nt_range, #_nt_reserved_word, #_nt_role, #_nt_rolemap, #_nt_rolename, #_nt_roles, #_nt_text, #_nt_ws

Methods included from Casting

#_nt_casting_statement, #_nt_modifier_phrase, #_nt_over_phrase, #_nt_stanza_marker, #_nt_with_matching_phrase, #_nt_within_phrase

Instance Method Details

#_nt_free_scriptObject



157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/ceml/lang/tt/scripts.rb', line 157

def _nt_free_script
  start_index = index
  if node_cache[:free_script].has_key?(index)
    cached = node_cache[:free_script][index]
    if cached
      cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  i0, s0 = index, []
  r2 = _nt_nl
  if r2
    r1 = r2
  else
    r1 = instantiate_node(SyntaxNode,input, index...index)
  end
  s0 << r1
  if r1
    r3 = _nt_script
    s0 << r3
    if r3
      r5 = _nt_nl
      if r5
        r4 = r5
      else
        r4 = instantiate_node(SyntaxNode,input, index...index)
      end
      s0 << r4
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(FreeScript0)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:free_script][start_index] = r0

  r0
end

#_nt_free_scriptsObject



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/ceml/lang/tt/scripts.rb', line 105

def _nt_free_scripts
  start_index = index
  if node_cache[:free_scripts].has_key?(index)
    cached = node_cache[:free_scripts][index]
    if cached
      cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  i0, s0 = index, []
  r2 = _nt_nl
  if r2
    r1 = r2
  else
    r1 = instantiate_node(SyntaxNode,input, index...index)
  end
  s0 << r1
  if r1
    r3 = _nt_scripts
    s0 << r3
    if r3
      r5 = _nt_nl
      if r5
        r4 = r5
      else
        r4 = instantiate_node(SyntaxNode,input, index...index)
      end
      s0 << r4
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(FreeScripts0)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:free_scripts][start_index] = r0

  r0
end

#_nt_instructionsObject



588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
# File 'lib/ceml/lang/tt/scripts.rb', line 588

def _nt_instructions
  start_index = index
  if node_cache[:instructions].has_key?(index)
    cached = node_cache[:instructions][index]
    if cached
      cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  i0, s0 = index, []
  r1 = _nt_instruction_stmt
  s0 << r1
  if r1
    s2, i2 = [], index
    loop do
      i3, s3 = index, []
      r4 = _nt_nl
      s3 << r4
      if r4
        r5 = _nt_instruction_stmt
        s3 << r5
      end
      if s3.last
        r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
        r3.extend(Instructions0)
      else
        @index = i3
        r3 = nil
      end
      if r3
        s2 << r3
      else
        break
      end
    end
    r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
    s0 << r2
  end
  if s0.last
    r0 = instantiate_node(InstructionStatements,input, i0...index, s0)
    r0.extend(Instructions1)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:instructions][start_index] = r0

  r0
end

#_nt_scriptObject



276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
# File 'lib/ceml/lang/tt/scripts.rb', line 276

def _nt_script
  start_index = index
  if node_cache[:script].has_key?(index)
    cached = node_cache[:script][index]
    if cached
      cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  i0, s0 = index, []
  i1 = index
  i2, s2 = index, []
  r3 = _nt_title
  s2 << r3
  if r3
    r4 = _nt_nl
    s2 << r4
    if r4
      r5 = _nt_casting_statement
      s2 << r5
      if r5
        r6 = _nt_nl
        s2 << r6
        if r6
          r7 = _nt_instructions
          s2 << r7
        end
      end
    end
  end
  if s2.last
    r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
    r2.extend(Script0)
  else
    @index = i2
    r2 = nil
  end
  if r2
    r1 = r2
  else
    i8, s8 = index, []
    r9 = _nt_title
    s8 << r9
    if r9
      r10 = _nt_nl
      s8 << r10
      if r10
        r11 = _nt_instructions
        s8 << r11
      end
    end
    if s8.last
      r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
      r8.extend(Script1)
    else
      @index = i8
      r8 = nil
    end
    if r8
      r1 = r8
    else
      i12, s12 = index, []
      r13 = _nt_casting_statement
      s12 << r13
      if r13
        r14 = _nt_nl
        s12 << r14
        if r14
          r15 = _nt_instructions
          s12 << r15
        end
      end
      if s12.last
        r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
        r12.extend(Script2)
      else
        @index = i12
        r12 = nil
      end
      if r12
        r1 = r12
      else
        i16, s16 = index, []
        r17 = _nt_title
        s16 << r17
        if r17
          r18 = _nt_nl
          s16 << r18
          if r18
            r19 = _nt_casting_statement
            s16 << r19
          end
        end
        if s16.last
          r16 = instantiate_node(SyntaxNode,input, i16...index, s16)
          r16.extend(Script3)
        else
          @index = i16
          r16 = nil
        end
        if r16
          r1 = r16
        else
          r20 = _nt_instructions
          if r20
            r1 = r20
          else
            i21, s21 = index, []
            r22 = _nt_title
            s21 << r22
            if r22
              if has_terminal?('', false, index)
                r23 = instantiate_node(SyntaxNode,input, index...(index + 0))
                @index += 0
              else
                terminal_parse_failure('')
                r23 = nil
              end
              s21 << r23
            end
            if s21.last
              r21 = instantiate_node(SyntaxNode,input, i21...index, s21)
              r21.extend(Script4)
            else
              @index = i21
              r21 = nil
            end
            if r21
              r1 = r21
            else
              @index = i1
              r1 = nil
            end
          end
        end
      end
    end
  end
  s0 << r1
  if r1
    if has_terminal?('', false, index)
      r24 = instantiate_node(SyntaxNode,input, index...(index + 0))
      @index += 0
    else
      terminal_parse_failure('')
      r24 = nil
    end
    s0 << r24
  end
  if s0.last
    r0 = instantiate_node(Script,input, i0...index, s0)
    r0.extend(Script5)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:script][start_index] = r0

  r0
end

#_nt_scriptsObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/ceml/lang/tt/scripts.rb', line 44

def _nt_scripts
  start_index = index
  if node_cache[:scripts].has_key?(index)
    cached = node_cache[:scripts][index]
    if cached
      cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  i0, s0 = index, []
  r1 = _nt_script
  s0 << r1
  if r1
    s2, i2 = [], index
    loop do
      i3, s3 = index, []
      r4 = _nt_nl
      s3 << r4
      if r4
        r5 = _nt_script
        s3 << r5
      end
      if s3.last
        r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
        r3.extend(Scripts0)
      else
        @index = i3
        r3 = nil
      end
      if r3
        s2 << r3
      else
        break
      end
    end
    r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
    s0 << r2
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(Scripts1)
    r0.extend(Scripts2)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:scripts][start_index] = r0

  r0
end

#_nt_titleObject



456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
# File 'lib/ceml/lang/tt/scripts.rb', line 456

def _nt_title
  start_index = index
  if node_cache[:title].has_key?(index)
    cached = node_cache[:title][index]
    if cached
      cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  i0, s0 = index, []
  if has_terminal?('"', false, index)
    r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
    @index += 1
  else
    terminal_parse_failure('"')
    r1 = nil
  end
  s0 << r1
  if r1
    s2, i2 = [], index
    loop do
      i3 = index
      if has_terminal?('\\"', false, index)
        r4 = instantiate_node(SyntaxNode,input, index...(index + 2))
        @index += 2
      else
        terminal_parse_failure('\\"')
        r4 = nil
      end
      if r4
        r3 = r4
      else
        i5, s5 = index, []
        i6 = index
        if has_terminal?('"', false, index)
          r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
          @index += 1
        else
          terminal_parse_failure('"')
          r7 = nil
        end
        if r7
          r6 = nil
        else
          @index = i6
          r6 = instantiate_node(SyntaxNode,input, index...index)
        end
        s5 << r6
        if r6
          if index < input_length
            r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
            @index += 1
          else
            terminal_parse_failure("any character")
            r8 = nil
          end
          s5 << r8
        end
        if s5.last
          r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
          r5.extend(Title0)
        else
          @index = i5
          r5 = nil
        end
        if r5
          r3 = r5
        else
          @index = i3
          r3 = nil
        end
      end
      if r3
        s2 << r3
      else
        break
      end
    end
    if s2.empty?
      @index = i2
      r2 = nil
    else
      r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
    end
    s0 << r2
    if r2
      if has_terminal?('"', false, index)
        r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
        @index += 1
      else
        terminal_parse_failure('"')
        r9 = nil
      end
      s0 << r9
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(Title1)
    r0.extend(Title2)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:title][start_index] = r0

  r0
end

#rootObject



8
9
10
# File 'lib/ceml/lang/tt/scripts.rb', line 8

def root
  @root ||= :scripts
end