zunscript 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2225 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # ZunScript.g
4
+ # --
5
+ # Generated using ANTLR version: 3.5
6
+ # Ruby runtime library version: 1.10.0
7
+ # Input grammar file: ZunScript.g
8
+ # Generated at: 2015-04-29 05:09:24
9
+ #
10
+
11
+ # ~~~> start load path setup
12
+ this_directory = File.expand_path( File.dirname( __FILE__ ) )
13
+ $LOAD_PATH.unshift( this_directory ) unless $LOAD_PATH.include?( this_directory )
14
+
15
+ antlr_load_failed = proc do
16
+ load_path = $LOAD_PATH.map { |dir| ' - ' << dir }.join( $/ )
17
+ raise LoadError, <<-END.strip!
18
+
19
+ Failed to load the ANTLR3 runtime library (version 1.10.0):
20
+
21
+ Ensure the library has been installed on your system and is available
22
+ on the load path. If rubygems is available on your system, this can
23
+ be done with the command:
24
+
25
+ gem install antlr3
26
+
27
+ Current load path:
28
+ #{ load_path }
29
+
30
+ END
31
+ end
32
+
33
+ defined?( ANTLR3 ) or begin
34
+
35
+ # 1: try to load the ruby antlr3 runtime library from the system path
36
+ require 'antlr3'
37
+
38
+ rescue LoadError
39
+
40
+ # 2: try to load rubygems if it isn't already loaded
41
+ defined?( Gem ) or begin
42
+ require 'rubygems'
43
+ rescue LoadError
44
+ antlr_load_failed.call
45
+ end
46
+
47
+ # 3: try to activate the antlr3 gem
48
+ begin
49
+ defined?( gem ) and gem( 'antlr3', '~> 1.10.0' )
50
+ rescue Gem::LoadError
51
+ antlr_load_failed.call
52
+ end
53
+
54
+ require 'antlr3'
55
+
56
+ end
57
+ # <~~~ end load path setup
58
+
59
+ module ZunScript
60
+ # TokenData defines all of the token type integer values
61
+ # as constants, which will be included in all
62
+ # ANTLR-generated recognizers.
63
+ const_defined?( :TokenData ) or TokenData = ANTLR3::TokenScheme.new
64
+
65
+ module TokenData
66
+
67
+ # define the token constants
68
+ define_tokens( :EOF => -1, :T__38 => 38, :ARITH_SIGN => 4, :ASSIGN => 5,
69
+ :BANG => 6, :BIND => 7, :BLK => 8, :BLOCK_END => 9, :BLOCK_LEFT => 10,
70
+ :BLOCK_RIGHT => 11, :BODY => 12, :COMMA => 13, :COMMENT => 14,
71
+ :DIGIT => 15, :FLOAT => 16, :INDEX => 17, :INTEGER => 18,
72
+ :INVOKE => 19, :LEFTBLOCK => 20, :LETTER => 21, :LOWER => 22,
73
+ :LPAREN => 23, :NAME => 24, :NEWLINE => 25, :NONCONTROL_CHAR => 26,
74
+ :NUM => 27, :NUMBER => 28, :PARAM => 29, :RPAREN => 30,
75
+ :SPACE => 31, :STR => 32, :STRING => 33, :SYMBOL => 34,
76
+ :UPPER => 35, :VARIABLE => 36, :WHITESPACE => 37 )
77
+
78
+
79
+ # register the proper human-readable name or literal value
80
+ # for each token type
81
+ #
82
+ # this is necessary because anonymous tokens, which are
83
+ # created from literal values in the grammar, do not
84
+ # have descriptive names
85
+ register_names( "ARITH_SIGN", "ASSIGN", "BANG", "BIND", "BLK", "BLOCK_END",
86
+ "BLOCK_LEFT", "BLOCK_RIGHT", "BODY", "COMMA", "COMMENT",
87
+ "DIGIT", "FLOAT", "INDEX", "INTEGER", "INVOKE", "LEFTBLOCK",
88
+ "LETTER", "LOWER", "LPAREN", "NAME", "NEWLINE", "NONCONTROL_CHAR",
89
+ "NUM", "NUMBER", "PARAM", "RPAREN", "SPACE", "STR",
90
+ "STRING", "SYMBOL", "UPPER", "VARIABLE", "WHITESPACE",
91
+ "'.'" )
92
+
93
+
94
+ end
95
+
96
+
97
+ class Parser < ANTLR3::Parser
98
+ @grammar_home = ZunScript
99
+ include ANTLR3::ASTBuilder
100
+
101
+ RULE_METHODS = [ :script, :line, :comment, :open_expression, :closed_expression,
102
+ :variable, :value, :block, :block_body, :arguments,
103
+ :assign, :invoke, :bind, :closed_invoke, :closed_bind,
104
+ :params, :param, :synpred5_ZunScript, :synpred6_ZunScript,
105
+ :synpred7_ZunScript ].freeze
106
+
107
+ include TokenData
108
+
109
+ begin
110
+ generated_using( "ZunScript.g", "3.5", "1.10.0" )
111
+ rescue NoMethodError => error
112
+ # ignore
113
+ end
114
+
115
+ def initialize( input, options = {} )
116
+ super( input, options )
117
+ end
118
+ # - - - - - - - - - - - - Rules - - - - - - - - - - - - -
119
+ ScriptReturnValue = define_return_scope
120
+
121
+ #
122
+ # parser rule script
123
+ #
124
+ # (in ZunScript.g)
125
+ # 50:1: script : ( line )* EOF !;
126
+ #
127
+ def script
128
+ # -> uncomment the next line to manually enable rule tracing
129
+ # trace_in( __method__, 1 )
130
+
131
+
132
+ return_value = ScriptReturnValue.new
133
+
134
+ # $rule.start = the first token seen before matching
135
+ return_value.start = @input.look
136
+
137
+
138
+ root_0 = nil
139
+
140
+ __EOF2__ = nil
141
+ line1 = nil
142
+
143
+
144
+ tree_for_EOF2 = nil
145
+
146
+ begin
147
+ root_0 = @adaptor.create_flat_list
148
+
149
+
150
+ # at line 50:9: ( line )* EOF !
151
+ # at line 50:9: ( line )*
152
+ while true # decision 1
153
+ alt_1 = 2
154
+ look_1_0 = @input.peek( 1 )
155
+
156
+ if ( look_1_0 == BLOCK_RIGHT || look_1_0 == COMMENT || look_1_0.between?( LPAREN, NEWLINE ) || look_1_0 == NUMBER || look_1_0 == STRING )
157
+ alt_1 = 1
158
+
159
+ end
160
+ case alt_1
161
+ when 1
162
+ # at line 50:9: line
163
+ @state.following.push( TOKENS_FOLLOWING_line_IN_script_385 )
164
+ line1 = line
165
+ @state.following.pop
166
+ if @state.backtracking == 0
167
+ @adaptor.add_child( root_0, line1.tree )
168
+ end
169
+
170
+
171
+ else
172
+ break # out of loop for decision 1
173
+ end
174
+ end # loop for decision 1
175
+
176
+ __EOF2__ = match( EOF, TOKENS_FOLLOWING_EOF_IN_script_388 )
177
+
178
+ # - - - - - - - rule clean up - - - - - - - -
179
+ return_value.stop = @input.look( -1 )
180
+
181
+
182
+ if @state.backtracking == 0
183
+ return_value.tree = @adaptor.rule_post_processing( root_0 )
184
+ @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )
185
+
186
+ end
187
+
188
+ rescue ANTLR3::Error::RecognitionError => re
189
+ report_error(re)
190
+ recover(re)
191
+ return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )
192
+
193
+
194
+ ensure
195
+ # -> uncomment the next line to manually enable rule tracing
196
+ # trace_out( __method__, 1 )
197
+
198
+
199
+ end
200
+
201
+ return return_value
202
+ end
203
+
204
+ LineReturnValue = define_return_scope
205
+
206
+ #
207
+ # parser rule line
208
+ #
209
+ # (in ZunScript.g)
210
+ # 51:1: line : ( open_expression )? ( comment !)? NEWLINE !;
211
+ #
212
+ def line
213
+ # -> uncomment the next line to manually enable rule tracing
214
+ # trace_in( __method__, 2 )
215
+
216
+
217
+ return_value = LineReturnValue.new
218
+
219
+ # $rule.start = the first token seen before matching
220
+ return_value.start = @input.look
221
+
222
+
223
+ root_0 = nil
224
+
225
+ __NEWLINE5__ = nil
226
+ open_expression3 = nil
227
+ comment4 = nil
228
+
229
+
230
+ tree_for_NEWLINE5 = nil
231
+
232
+ begin
233
+ root_0 = @adaptor.create_flat_list
234
+
235
+
236
+ # at line 51:7: ( open_expression )? ( comment !)? NEWLINE !
237
+ # at line 51:7: ( open_expression )?
238
+ alt_2 = 2
239
+ look_2_0 = @input.peek( 1 )
240
+
241
+ if ( look_2_0 == BLOCK_RIGHT || look_2_0.between?( LPAREN, NAME ) || look_2_0 == NUMBER || look_2_0 == STRING )
242
+ alt_2 = 1
243
+ end
244
+ case alt_2
245
+ when 1
246
+ # at line 51:7: open_expression
247
+ @state.following.push( TOKENS_FOLLOWING_open_expression_IN_line_395 )
248
+ open_expression3 = open_expression
249
+ @state.following.pop
250
+ if @state.backtracking == 0
251
+ @adaptor.add_child( root_0, open_expression3.tree )
252
+ end
253
+
254
+
255
+ end
256
+ # at line 51:31: ( comment !)?
257
+ alt_3 = 2
258
+ look_3_0 = @input.peek( 1 )
259
+
260
+ if ( look_3_0 == COMMENT )
261
+ alt_3 = 1
262
+ end
263
+ case alt_3
264
+ when 1
265
+ # at line 51:31: comment !
266
+ @state.following.push( TOKENS_FOLLOWING_comment_IN_line_398 )
267
+ comment4 = comment
268
+ @state.following.pop
269
+
270
+ end
271
+ __NEWLINE5__ = match( NEWLINE, TOKENS_FOLLOWING_NEWLINE_IN_line_402 )
272
+
273
+ # - - - - - - - rule clean up - - - - - - - -
274
+ return_value.stop = @input.look( -1 )
275
+
276
+
277
+ if @state.backtracking == 0
278
+ return_value.tree = @adaptor.rule_post_processing( root_0 )
279
+ @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )
280
+
281
+ end
282
+
283
+ rescue ANTLR3::Error::RecognitionError => re
284
+ report_error(re)
285
+ recover(re)
286
+ return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )
287
+
288
+
289
+ ensure
290
+ # -> uncomment the next line to manually enable rule tracing
291
+ # trace_out( __method__, 2 )
292
+
293
+
294
+ end
295
+
296
+ return return_value
297
+ end
298
+
299
+ CommentReturnValue = define_return_scope
300
+
301
+ #
302
+ # parser rule comment
303
+ #
304
+ # (in ZunScript.g)
305
+ # 53:1: comment : COMMENT (~ NEWLINE )* ;
306
+ #
307
+ def comment
308
+ # -> uncomment the next line to manually enable rule tracing
309
+ # trace_in( __method__, 3 )
310
+
311
+
312
+ return_value = CommentReturnValue.new
313
+
314
+ # $rule.start = the first token seen before matching
315
+ return_value.start = @input.look
316
+
317
+
318
+ root_0 = nil
319
+
320
+ __COMMENT6__ = nil
321
+ set7 = nil
322
+
323
+
324
+ tree_for_COMMENT6 = nil
325
+ tree_for_set7 = nil
326
+
327
+ begin
328
+ root_0 = @adaptor.create_flat_list
329
+
330
+
331
+ # at line 53:10: COMMENT (~ NEWLINE )*
332
+ __COMMENT6__ = match( COMMENT, TOKENS_FOLLOWING_COMMENT_IN_comment_410 )
333
+ if @state.backtracking == 0
334
+ tree_for_COMMENT6 = @adaptor.create_with_payload( __COMMENT6__ )
335
+ @adaptor.add_child( root_0, tree_for_COMMENT6 )
336
+
337
+ end
338
+
339
+ # at line 53:18: (~ NEWLINE )*
340
+ while true # decision 4
341
+ alt_4 = 2
342
+ look_4_0 = @input.peek( 1 )
343
+
344
+ if ( look_4_0.between?( ARITH_SIGN, NAME ) || look_4_0.between?( NONCONTROL_CHAR, T__38 ) )
345
+ alt_4 = 1
346
+
347
+ end
348
+ case alt_4
349
+ when 1
350
+ # at line
351
+ set7 = @input.look
352
+
353
+ if @input.peek( 1 ).between?( ARITH_SIGN, NAME ) || @input.peek( 1 ).between?( NONCONTROL_CHAR, T__38 )
354
+ @input.consume
355
+ if @state.backtracking == 0
356
+ @adaptor.add_child( root_0, @adaptor.create_with_payload( set7 ) )
357
+ end
358
+
359
+ @state.error_recovery = false
360
+
361
+ else
362
+ @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )
363
+
364
+
365
+ mse = MismatchedSet( nil )
366
+ raise mse
367
+
368
+ end
369
+
370
+
371
+
372
+ else
373
+ break # out of loop for decision 4
374
+ end
375
+ end # loop for decision 4
376
+
377
+
378
+ # - - - - - - - rule clean up - - - - - - - -
379
+ return_value.stop = @input.look( -1 )
380
+
381
+
382
+ if @state.backtracking == 0
383
+ return_value.tree = @adaptor.rule_post_processing( root_0 )
384
+ @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )
385
+
386
+ end
387
+
388
+ rescue ANTLR3::Error::RecognitionError => re
389
+ report_error(re)
390
+ recover(re)
391
+ return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )
392
+
393
+
394
+ ensure
395
+ # -> uncomment the next line to manually enable rule tracing
396
+ # trace_out( __method__, 3 )
397
+
398
+
399
+ end
400
+
401
+ return return_value
402
+ end
403
+
404
+ OpenExpressionReturnValue = define_return_scope
405
+
406
+ #
407
+ # parser rule open_expression
408
+ #
409
+ # (in ZunScript.g)
410
+ # 55:1: open_expression : ( assign | invoke | bind | closed_expression );
411
+ #
412
+ def open_expression
413
+ # -> uncomment the next line to manually enable rule tracing
414
+ # trace_in( __method__, 4 )
415
+
416
+
417
+ return_value = OpenExpressionReturnValue.new
418
+
419
+ # $rule.start = the first token seen before matching
420
+ return_value.start = @input.look
421
+
422
+
423
+ root_0 = nil
424
+
425
+ assign8 = nil
426
+ invoke9 = nil
427
+ bind10 = nil
428
+ closed_expression11 = nil
429
+
430
+
431
+
432
+ begin
433
+ # at line 55:16: ( assign | invoke | bind | closed_expression )
434
+ alt_5 = 4
435
+ look_5_0 = @input.peek( 1 )
436
+
437
+ if ( look_5_0 == NAME )
438
+ look_5_1 = @input.peek( 2 )
439
+
440
+ if ( syntactic_predicate?( :synpred5_ZunScript ) )
441
+ alt_5 = 1
442
+ elsif ( syntactic_predicate?( :synpred6_ZunScript ) )
443
+ alt_5 = 2
444
+ elsif ( syntactic_predicate?( :synpred7_ZunScript ) )
445
+ alt_5 = 3
446
+ elsif ( true )
447
+ alt_5 = 4
448
+ else
449
+ @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )
450
+
451
+
452
+
453
+ raise NoViableAlternative( "", 5, 1 )
454
+
455
+ end
456
+ elsif ( look_5_0 == BLOCK_RIGHT || look_5_0 == LPAREN || look_5_0 == NUMBER || look_5_0 == STRING )
457
+ alt_5 = 4
458
+ else
459
+ @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )
460
+
461
+
462
+
463
+ raise NoViableAlternative( "", 5, 0 )
464
+
465
+ end
466
+ case alt_5
467
+ when 1
468
+ root_0 = @adaptor.create_flat_list
469
+
470
+
471
+ # at line 56:5: assign
472
+ @state.following.push( TOKENS_FOLLOWING_assign_IN_open_expression_427 )
473
+ assign8 = assign
474
+ @state.following.pop
475
+ if @state.backtracking == 0
476
+ @adaptor.add_child( root_0, assign8.tree )
477
+ end
478
+
479
+
480
+ when 2
481
+ root_0 = @adaptor.create_flat_list
482
+
483
+
484
+ # at line 56:14: invoke
485
+ @state.following.push( TOKENS_FOLLOWING_invoke_IN_open_expression_431 )
486
+ invoke9 = invoke
487
+ @state.following.pop
488
+ if @state.backtracking == 0
489
+ @adaptor.add_child( root_0, invoke9.tree )
490
+ end
491
+
492
+
493
+ when 3
494
+ root_0 = @adaptor.create_flat_list
495
+
496
+
497
+ # at line 56:23: bind
498
+ @state.following.push( TOKENS_FOLLOWING_bind_IN_open_expression_435 )
499
+ bind10 = bind
500
+ @state.following.pop
501
+ if @state.backtracking == 0
502
+ @adaptor.add_child( root_0, bind10.tree )
503
+ end
504
+
505
+
506
+ when 4
507
+ root_0 = @adaptor.create_flat_list
508
+
509
+
510
+ # at line 56:30: closed_expression
511
+ @state.following.push( TOKENS_FOLLOWING_closed_expression_IN_open_expression_439 )
512
+ closed_expression11 = closed_expression
513
+ @state.following.pop
514
+ if @state.backtracking == 0
515
+ @adaptor.add_child( root_0, closed_expression11.tree )
516
+ end
517
+
518
+
519
+ end
520
+ # - - - - - - - rule clean up - - - - - - - -
521
+ return_value.stop = @input.look( -1 )
522
+
523
+
524
+ if @state.backtracking == 0
525
+ return_value.tree = @adaptor.rule_post_processing( root_0 )
526
+ @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )
527
+
528
+ end
529
+
530
+ rescue ANTLR3::Error::RecognitionError => re
531
+ report_error(re)
532
+ recover(re)
533
+ return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )
534
+
535
+
536
+ ensure
537
+ # -> uncomment the next line to manually enable rule tracing
538
+ # trace_out( __method__, 4 )
539
+
540
+
541
+ end
542
+
543
+ return return_value
544
+ end
545
+
546
+ ClosedExpressionReturnValue = define_return_scope
547
+
548
+ #
549
+ # parser rule closed_expression
550
+ #
551
+ # (in ZunScript.g)
552
+ # 57:1: closed_expression : ( value | variable | closed_invoke | closed_bind | LPAREN ! open_expression RPAREN !);
553
+ #
554
+ def closed_expression
555
+ # -> uncomment the next line to manually enable rule tracing
556
+ # trace_in( __method__, 5 )
557
+
558
+
559
+ return_value = ClosedExpressionReturnValue.new
560
+
561
+ # $rule.start = the first token seen before matching
562
+ return_value.start = @input.look
563
+
564
+
565
+ root_0 = nil
566
+
567
+ __LPAREN16__ = nil
568
+ __RPAREN18__ = nil
569
+ value12 = nil
570
+ variable13 = nil
571
+ closed_invoke14 = nil
572
+ closed_bind15 = nil
573
+ open_expression17 = nil
574
+
575
+
576
+ tree_for_LPAREN16 = nil
577
+ tree_for_RPAREN18 = nil
578
+
579
+ begin
580
+ # at line 57:18: ( value | variable | closed_invoke | closed_bind | LPAREN ! open_expression RPAREN !)
581
+ alt_6 = 5
582
+ alt_6 = @dfa6.predict( @input )
583
+ case alt_6
584
+ when 1
585
+ root_0 = @adaptor.create_flat_list
586
+
587
+
588
+ # at line 58:5: value
589
+ @state.following.push( TOKENS_FOLLOWING_value_IN_closed_expression_449 )
590
+ value12 = value
591
+ @state.following.pop
592
+ if @state.backtracking == 0
593
+ @adaptor.add_child( root_0, value12.tree )
594
+ end
595
+
596
+
597
+ when 2
598
+ root_0 = @adaptor.create_flat_list
599
+
600
+
601
+ # at line 58:13: variable
602
+ @state.following.push( TOKENS_FOLLOWING_variable_IN_closed_expression_453 )
603
+ variable13 = variable
604
+ @state.following.pop
605
+ if @state.backtracking == 0
606
+ @adaptor.add_child( root_0, variable13.tree )
607
+ end
608
+
609
+
610
+ when 3
611
+ root_0 = @adaptor.create_flat_list
612
+
613
+
614
+ # at line 58:24: closed_invoke
615
+ @state.following.push( TOKENS_FOLLOWING_closed_invoke_IN_closed_expression_457 )
616
+ closed_invoke14 = closed_invoke
617
+ @state.following.pop
618
+ if @state.backtracking == 0
619
+ @adaptor.add_child( root_0, closed_invoke14.tree )
620
+ end
621
+
622
+
623
+ when 4
624
+ root_0 = @adaptor.create_flat_list
625
+
626
+
627
+ # at line 58:40: closed_bind
628
+ @state.following.push( TOKENS_FOLLOWING_closed_bind_IN_closed_expression_461 )
629
+ closed_bind15 = closed_bind
630
+ @state.following.pop
631
+ if @state.backtracking == 0
632
+ @adaptor.add_child( root_0, closed_bind15.tree )
633
+ end
634
+
635
+
636
+ when 5
637
+ root_0 = @adaptor.create_flat_list
638
+
639
+
640
+ # at line 59:5: LPAREN ! open_expression RPAREN !
641
+ __LPAREN16__ = match( LPAREN, TOKENS_FOLLOWING_LPAREN_IN_closed_expression_467 )
642
+ @state.following.push( TOKENS_FOLLOWING_open_expression_IN_closed_expression_470 )
643
+ open_expression17 = open_expression
644
+ @state.following.pop
645
+ if @state.backtracking == 0
646
+ @adaptor.add_child( root_0, open_expression17.tree )
647
+ end
648
+
649
+ __RPAREN18__ = match( RPAREN, TOKENS_FOLLOWING_RPAREN_IN_closed_expression_472 )
650
+
651
+ end
652
+ # - - - - - - - rule clean up - - - - - - - -
653
+ return_value.stop = @input.look( -1 )
654
+
655
+
656
+ if @state.backtracking == 0
657
+ return_value.tree = @adaptor.rule_post_processing( root_0 )
658
+ @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )
659
+
660
+ end
661
+
662
+ rescue ANTLR3::Error::RecognitionError => re
663
+ report_error(re)
664
+ recover(re)
665
+ return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )
666
+
667
+
668
+ ensure
669
+ # -> uncomment the next line to manually enable rule tracing
670
+ # trace_out( __method__, 5 )
671
+
672
+
673
+ end
674
+
675
+ return return_value
676
+ end
677
+
678
+ VariableReturnValue = define_return_scope
679
+
680
+ #
681
+ # parser rule variable
682
+ #
683
+ # (in ZunScript.g)
684
+ # 61:1: variable : ( NAME '.' )* NAME -> ^( VARIABLE ( NAME )* ) ;
685
+ #
686
+ def variable
687
+ # -> uncomment the next line to manually enable rule tracing
688
+ # trace_in( __method__, 6 )
689
+
690
+
691
+ return_value = VariableReturnValue.new
692
+
693
+ # $rule.start = the first token seen before matching
694
+ return_value.start = @input.look
695
+
696
+
697
+ root_0 = nil
698
+
699
+ __NAME19__ = nil
700
+ char_literal20 = nil
701
+ __NAME21__ = nil
702
+
703
+
704
+ tree_for_NAME19 = nil
705
+ tree_for_char_literal20 = nil
706
+ tree_for_NAME21 = nil
707
+ stream_NAME = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, "token NAME" )
708
+ stream_T__38 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, "token T__38" )
709
+
710
+ begin
711
+ # at line 61:11: ( NAME '.' )* NAME
712
+ # at line 61:11: ( NAME '.' )*
713
+ while true # decision 7
714
+ alt_7 = 2
715
+ look_7_0 = @input.peek( 1 )
716
+
717
+ if ( look_7_0 == NAME )
718
+ look_7_1 = @input.peek( 2 )
719
+
720
+ if ( look_7_1 == T__38 )
721
+ alt_7 = 1
722
+
723
+ end
724
+
725
+ end
726
+ case alt_7
727
+ when 1
728
+ # at line 61:12: NAME '.'
729
+ __NAME19__ = match( NAME, TOKENS_FOLLOWING_NAME_IN_variable_481 )
730
+ if @state.backtracking == 0
731
+ stream_NAME.add( __NAME19__ )
732
+ end
733
+
734
+ char_literal20 = match( T__38, TOKENS_FOLLOWING_T__38_IN_variable_483 )
735
+ if @state.backtracking == 0
736
+ stream_T__38.add( char_literal20 )
737
+ end
738
+
739
+
740
+ else
741
+ break # out of loop for decision 7
742
+ end
743
+ end # loop for decision 7
744
+
745
+ __NAME21__ = match( NAME, TOKENS_FOLLOWING_NAME_IN_variable_487 )
746
+ if @state.backtracking == 0
747
+ stream_NAME.add( __NAME21__ )
748
+ end
749
+
750
+ # AST Rewrite
751
+ # elements: NAME
752
+ # token labels:
753
+ # rule labels: return_value
754
+ # token list labels:
755
+ # rule list labels:
756
+ # wildcard labels:
757
+ if @state.backtracking == 0
758
+ return_value.tree = root_0
759
+ stream_return_value = return_value ? subtree_stream( "rule return_value", return_value.tree ) : subtree_stream( "token return_value" )
760
+
761
+ root_0 = @adaptor.create_flat_list
762
+ # 61:28: -> ^( VARIABLE ( NAME )* )
763
+ # at line 61:31: ^( VARIABLE ( NAME )* )
764
+ root_1 = @adaptor.create_flat_list
765
+ root_1 = @adaptor.become_root( @adaptor.create_from_type( VARIABLE, "VARIABLE" ), root_1 )
766
+
767
+ # at line 61:42: ( NAME )*
768
+ while stream_NAME.has_next?
769
+ @adaptor.add_child( root_1, stream_NAME.next_node )
770
+
771
+ end
772
+
773
+ stream_NAME.reset();
774
+
775
+ @adaptor.add_child( root_0, root_1 )
776
+
777
+
778
+
779
+
780
+ return_value.tree = root_0
781
+
782
+
783
+ end
784
+
785
+ # - - - - - - - rule clean up - - - - - - - -
786
+ return_value.stop = @input.look( -1 )
787
+
788
+
789
+ if @state.backtracking == 0
790
+ return_value.tree = @adaptor.rule_post_processing( root_0 )
791
+ @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )
792
+
793
+ end
794
+
795
+ rescue ANTLR3::Error::RecognitionError => re
796
+ report_error(re)
797
+ recover(re)
798
+ return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )
799
+
800
+
801
+ ensure
802
+ # -> uncomment the next line to manually enable rule tracing
803
+ # trace_out( __method__, 6 )
804
+
805
+
806
+ end
807
+
808
+ return return_value
809
+ end
810
+
811
+ ValueReturnValue = define_return_scope
812
+
813
+ #
814
+ # parser rule value
815
+ #
816
+ # (in ZunScript.g)
817
+ # 63:1: value : (v= NUMBER -> ^( NUM $v) |v= STRING -> ^( STR $v) | block );
818
+ #
819
+ def value
820
+ # -> uncomment the next line to manually enable rule tracing
821
+ # trace_in( __method__, 7 )
822
+
823
+
824
+ return_value = ValueReturnValue.new
825
+
826
+ # $rule.start = the first token seen before matching
827
+ return_value.start = @input.look
828
+
829
+
830
+ root_0 = nil
831
+
832
+ v = nil
833
+ block22 = nil
834
+
835
+
836
+ tree_for_v = nil
837
+ stream_STRING = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, "token STRING" )
838
+ stream_NUMBER = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, "token NUMBER" )
839
+
840
+ begin
841
+ # at line 63:6: (v= NUMBER -> ^( NUM $v) |v= STRING -> ^( STR $v) | block )
842
+ alt_8 = 3
843
+ case look_8 = @input.peek( 1 )
844
+ when NUMBER then alt_8 = 1
845
+ when STRING then alt_8 = 2
846
+ when BLOCK_RIGHT then alt_8 = 3
847
+ else
848
+ @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )
849
+
850
+
851
+
852
+ raise NoViableAlternative( "", 8, 0 )
853
+
854
+ end
855
+ case alt_8
856
+ when 1
857
+ # at line 64:5: v= NUMBER
858
+ v = match( NUMBER, TOKENS_FOLLOWING_NUMBER_IN_value_509 )
859
+ if @state.backtracking == 0
860
+ stream_NUMBER.add( v )
861
+ end
862
+
863
+ # AST Rewrite
864
+ # elements: v
865
+ # token labels: v
866
+ # rule labels: return_value
867
+ # token list labels:
868
+ # rule list labels:
869
+ # wildcard labels:
870
+ if @state.backtracking == 0
871
+ return_value.tree = root_0
872
+ stream_v = token_stream( "token v", v )
873
+ stream_return_value = return_value ? subtree_stream( "rule return_value", return_value.tree ) : subtree_stream( "token return_value" )
874
+
875
+ root_0 = @adaptor.create_flat_list
876
+ # 64:14: -> ^( NUM $v)
877
+ # at line 64:17: ^( NUM $v)
878
+ root_1 = @adaptor.create_flat_list
879
+ root_1 = @adaptor.become_root( @adaptor.create_from_type( NUM, "NUM" ), root_1 )
880
+
881
+ @adaptor.add_child( root_1, stream_v.next_node )
882
+
883
+ @adaptor.add_child( root_0, root_1 )
884
+
885
+
886
+
887
+
888
+ return_value.tree = root_0
889
+
890
+
891
+ end
892
+
893
+ when 2
894
+ # at line 65:5: v= STRING
895
+ v = match( STRING, TOKENS_FOLLOWING_STRING_IN_value_526 )
896
+ if @state.backtracking == 0
897
+ stream_STRING.add( v )
898
+ end
899
+
900
+ # AST Rewrite
901
+ # elements: v
902
+ # token labels: v
903
+ # rule labels: return_value
904
+ # token list labels:
905
+ # rule list labels:
906
+ # wildcard labels:
907
+ if @state.backtracking == 0
908
+ return_value.tree = root_0
909
+ stream_v = token_stream( "token v", v )
910
+ stream_return_value = return_value ? subtree_stream( "rule return_value", return_value.tree ) : subtree_stream( "token return_value" )
911
+
912
+ root_0 = @adaptor.create_flat_list
913
+ # 65:14: -> ^( STR $v)
914
+ # at line 65:17: ^( STR $v)
915
+ root_1 = @adaptor.create_flat_list
916
+ root_1 = @adaptor.become_root( @adaptor.create_from_type( STR, "STR" ), root_1 )
917
+
918
+ @adaptor.add_child( root_1, stream_v.next_node )
919
+
920
+ @adaptor.add_child( root_0, root_1 )
921
+
922
+
923
+
924
+
925
+ return_value.tree = root_0
926
+
927
+
928
+ end
929
+
930
+ when 3
931
+ root_0 = @adaptor.create_flat_list
932
+
933
+
934
+ # at line 66:5: block
935
+ @state.following.push( TOKENS_FOLLOWING_block_IN_value_541 )
936
+ block22 = block
937
+ @state.following.pop
938
+ if @state.backtracking == 0
939
+ @adaptor.add_child( root_0, block22.tree )
940
+ end
941
+
942
+
943
+ end
944
+ # - - - - - - - rule clean up - - - - - - - -
945
+ return_value.stop = @input.look( -1 )
946
+
947
+
948
+ if @state.backtracking == 0
949
+ return_value.tree = @adaptor.rule_post_processing( root_0 )
950
+ @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )
951
+
952
+ end
953
+
954
+ rescue ANTLR3::Error::RecognitionError => re
955
+ report_error(re)
956
+ recover(re)
957
+ return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )
958
+
959
+
960
+ ensure
961
+ # -> uncomment the next line to manually enable rule tracing
962
+ # trace_out( __method__, 7 )
963
+
964
+
965
+ end
966
+
967
+ return return_value
968
+ end
969
+
970
+ BlockReturnValue = define_return_scope
971
+
972
+ #
973
+ # parser rule block
974
+ #
975
+ # (in ZunScript.g)
976
+ # 68:1: block : BLOCK_RIGHT arguments NEWLINE block_body BLOCK_END -> ^( BLK ( arguments )* block_body ) ;
977
+ #
978
+ def block
979
+ # -> uncomment the next line to manually enable rule tracing
980
+ # trace_in( __method__, 8 )
981
+
982
+
983
+ return_value = BlockReturnValue.new
984
+
985
+ # $rule.start = the first token seen before matching
986
+ return_value.start = @input.look
987
+
988
+
989
+ root_0 = nil
990
+
991
+ __BLOCK_RIGHT23__ = nil
992
+ __NEWLINE25__ = nil
993
+ __BLOCK_END27__ = nil
994
+ arguments24 = nil
995
+ block_body26 = nil
996
+
997
+
998
+ tree_for_BLOCK_RIGHT23 = nil
999
+ tree_for_NEWLINE25 = nil
1000
+ tree_for_BLOCK_END27 = nil
1001
+ stream_BLOCK_RIGHT = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, "token BLOCK_RIGHT" )
1002
+ stream_NEWLINE = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, "token NEWLINE" )
1003
+ stream_BLOCK_END = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, "token BLOCK_END" )
1004
+ stream_arguments = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule arguments" )
1005
+ stream_block_body = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule block_body" )
1006
+ begin
1007
+ # at line 68:8: BLOCK_RIGHT arguments NEWLINE block_body BLOCK_END
1008
+ __BLOCK_RIGHT23__ = match( BLOCK_RIGHT, TOKENS_FOLLOWING_BLOCK_RIGHT_IN_block_548 )
1009
+ if @state.backtracking == 0
1010
+ stream_BLOCK_RIGHT.add( __BLOCK_RIGHT23__ )
1011
+ end
1012
+
1013
+ @state.following.push( TOKENS_FOLLOWING_arguments_IN_block_550 )
1014
+ arguments24 = arguments
1015
+ @state.following.pop
1016
+ if @state.backtracking == 0
1017
+ stream_arguments.add( arguments24.tree )
1018
+ end
1019
+
1020
+ __NEWLINE25__ = match( NEWLINE, TOKENS_FOLLOWING_NEWLINE_IN_block_552 )
1021
+ if @state.backtracking == 0
1022
+ stream_NEWLINE.add( __NEWLINE25__ )
1023
+ end
1024
+
1025
+ @state.following.push( TOKENS_FOLLOWING_block_body_IN_block_554 )
1026
+ block_body26 = block_body
1027
+ @state.following.pop
1028
+ if @state.backtracking == 0
1029
+ stream_block_body.add( block_body26.tree )
1030
+ end
1031
+
1032
+ __BLOCK_END27__ = match( BLOCK_END, TOKENS_FOLLOWING_BLOCK_END_IN_block_556 )
1033
+ if @state.backtracking == 0
1034
+ stream_BLOCK_END.add( __BLOCK_END27__ )
1035
+ end
1036
+
1037
+ # AST Rewrite
1038
+ # elements: block_body, arguments
1039
+ # token labels:
1040
+ # rule labels: return_value
1041
+ # token list labels:
1042
+ # rule list labels:
1043
+ # wildcard labels:
1044
+ if @state.backtracking == 0
1045
+ return_value.tree = root_0
1046
+ stream_return_value = return_value ? subtree_stream( "rule return_value", return_value.tree ) : subtree_stream( "token return_value" )
1047
+
1048
+ root_0 = @adaptor.create_flat_list
1049
+ # 68:59: -> ^( BLK ( arguments )* block_body )
1050
+ # at line 68:62: ^( BLK ( arguments )* block_body )
1051
+ root_1 = @adaptor.create_flat_list
1052
+ root_1 = @adaptor.become_root( @adaptor.create_from_type( BLK, "BLK" ), root_1 )
1053
+
1054
+ # at line 68:68: ( arguments )*
1055
+ while stream_arguments.has_next?
1056
+ @adaptor.add_child( root_1, stream_arguments.next_tree )
1057
+
1058
+ end
1059
+
1060
+ stream_arguments.reset();
1061
+
1062
+ @adaptor.add_child( root_1, stream_block_body.next_tree )
1063
+
1064
+ @adaptor.add_child( root_0, root_1 )
1065
+
1066
+
1067
+
1068
+
1069
+ return_value.tree = root_0
1070
+
1071
+
1072
+ end
1073
+
1074
+ # - - - - - - - rule clean up - - - - - - - -
1075
+ return_value.stop = @input.look( -1 )
1076
+
1077
+
1078
+ if @state.backtracking == 0
1079
+ return_value.tree = @adaptor.rule_post_processing( root_0 )
1080
+ @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )
1081
+
1082
+ end
1083
+
1084
+ rescue ANTLR3::Error::RecognitionError => re
1085
+ report_error(re)
1086
+ recover(re)
1087
+ return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )
1088
+
1089
+
1090
+ ensure
1091
+ # -> uncomment the next line to manually enable rule tracing
1092
+ # trace_out( __method__, 8 )
1093
+
1094
+
1095
+ end
1096
+
1097
+ return return_value
1098
+ end
1099
+
1100
+ BlockBodyReturnValue = define_return_scope
1101
+
1102
+ #
1103
+ # parser rule block_body
1104
+ #
1105
+ # (in ZunScript.g)
1106
+ # 69:1: block_body : ( line )* -> ^( BODY ( line )* ) ;
1107
+ #
1108
+ def block_body
1109
+ # -> uncomment the next line to manually enable rule tracing
1110
+ # trace_in( __method__, 9 )
1111
+
1112
+
1113
+ return_value = BlockBodyReturnValue.new
1114
+
1115
+ # $rule.start = the first token seen before matching
1116
+ return_value.start = @input.look
1117
+
1118
+
1119
+ root_0 = nil
1120
+
1121
+ line28 = nil
1122
+
1123
+
1124
+ stream_line = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule line" )
1125
+ begin
1126
+ # at line 69:13: ( line )*
1127
+ # at line 69:13: ( line )*
1128
+ while true # decision 9
1129
+ alt_9 = 2
1130
+ look_9_0 = @input.peek( 1 )
1131
+
1132
+ if ( look_9_0 == BLOCK_RIGHT || look_9_0 == COMMENT || look_9_0.between?( LPAREN, NEWLINE ) || look_9_0 == NUMBER || look_9_0 == STRING )
1133
+ alt_9 = 1
1134
+
1135
+ end
1136
+ case alt_9
1137
+ when 1
1138
+ # at line 69:13: line
1139
+ @state.following.push( TOKENS_FOLLOWING_line_IN_block_body_573 )
1140
+ line28 = line
1141
+ @state.following.pop
1142
+ if @state.backtracking == 0
1143
+ stream_line.add( line28.tree )
1144
+ end
1145
+
1146
+
1147
+ else
1148
+ break # out of loop for decision 9
1149
+ end
1150
+ end # loop for decision 9
1151
+
1152
+ # AST Rewrite
1153
+ # elements: line
1154
+ # token labels:
1155
+ # rule labels: return_value
1156
+ # token list labels:
1157
+ # rule list labels:
1158
+ # wildcard labels:
1159
+ if @state.backtracking == 0
1160
+ return_value.tree = root_0
1161
+ stream_return_value = return_value ? subtree_stream( "rule return_value", return_value.tree ) : subtree_stream( "token return_value" )
1162
+
1163
+ root_0 = @adaptor.create_flat_list
1164
+ # 69:19: -> ^( BODY ( line )* )
1165
+ # at line 69:22: ^( BODY ( line )* )
1166
+ root_1 = @adaptor.create_flat_list
1167
+ root_1 = @adaptor.become_root( @adaptor.create_from_type( BODY, "BODY" ), root_1 )
1168
+
1169
+ # at line 69:29: ( line )*
1170
+ while stream_line.has_next?
1171
+ @adaptor.add_child( root_1, stream_line.next_tree )
1172
+
1173
+ end
1174
+
1175
+ stream_line.reset();
1176
+
1177
+ @adaptor.add_child( root_0, root_1 )
1178
+
1179
+
1180
+
1181
+
1182
+ return_value.tree = root_0
1183
+
1184
+
1185
+ end
1186
+
1187
+ # - - - - - - - rule clean up - - - - - - - -
1188
+ return_value.stop = @input.look( -1 )
1189
+
1190
+
1191
+ if @state.backtracking == 0
1192
+ return_value.tree = @adaptor.rule_post_processing( root_0 )
1193
+ @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )
1194
+
1195
+ end
1196
+
1197
+ rescue ANTLR3::Error::RecognitionError => re
1198
+ report_error(re)
1199
+ recover(re)
1200
+ return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )
1201
+
1202
+
1203
+ ensure
1204
+ # -> uncomment the next line to manually enable rule tracing
1205
+ # trace_out( __method__, 9 )
1206
+
1207
+
1208
+ end
1209
+
1210
+ return return_value
1211
+ end
1212
+
1213
+ ArgumentsReturnValue = define_return_scope
1214
+
1215
+ #
1216
+ # parser rule arguments
1217
+ #
1218
+ # (in ZunScript.g)
1219
+ # 71:1: arguments : (| NAME ( COMMA ! NAME )* );
1220
+ #
1221
+ def arguments
1222
+ # -> uncomment the next line to manually enable rule tracing
1223
+ # trace_in( __method__, 10 )
1224
+
1225
+
1226
+ return_value = ArgumentsReturnValue.new
1227
+
1228
+ # $rule.start = the first token seen before matching
1229
+ return_value.start = @input.look
1230
+
1231
+
1232
+ root_0 = nil
1233
+
1234
+ __NAME29__ = nil
1235
+ __COMMA30__ = nil
1236
+ __NAME31__ = nil
1237
+
1238
+
1239
+ tree_for_NAME29 = nil
1240
+ tree_for_COMMA30 = nil
1241
+ tree_for_NAME31 = nil
1242
+
1243
+ begin
1244
+ # at line 71:10: (| NAME ( COMMA ! NAME )* )
1245
+ alt_11 = 2
1246
+ look_11_0 = @input.peek( 1 )
1247
+
1248
+ if ( look_11_0 == NEWLINE )
1249
+ alt_11 = 1
1250
+ elsif ( look_11_0 == NAME )
1251
+ alt_11 = 2
1252
+ else
1253
+ @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )
1254
+
1255
+
1256
+
1257
+ raise NoViableAlternative( "", 11, 0 )
1258
+
1259
+ end
1260
+ case alt_11
1261
+ when 1
1262
+ root_0 = @adaptor.create_flat_list
1263
+
1264
+
1265
+ # at line 71:12:
1266
+
1267
+ when 2
1268
+ root_0 = @adaptor.create_flat_list
1269
+
1270
+
1271
+ # at line 71:13: NAME ( COMMA ! NAME )*
1272
+ __NAME29__ = match( NAME, TOKENS_FOLLOWING_NAME_IN_arguments_591 )
1273
+ if @state.backtracking == 0
1274
+ tree_for_NAME29 = @adaptor.create_with_payload( __NAME29__ )
1275
+ @adaptor.add_child( root_0, tree_for_NAME29 )
1276
+
1277
+ end
1278
+
1279
+ # at line 71:18: ( COMMA ! NAME )*
1280
+ while true # decision 10
1281
+ alt_10 = 2
1282
+ look_10_0 = @input.peek( 1 )
1283
+
1284
+ if ( look_10_0 == COMMA )
1285
+ alt_10 = 1
1286
+
1287
+ end
1288
+ case alt_10
1289
+ when 1
1290
+ # at line 71:19: COMMA ! NAME
1291
+ __COMMA30__ = match( COMMA, TOKENS_FOLLOWING_COMMA_IN_arguments_594 )
1292
+ __NAME31__ = match( NAME, TOKENS_FOLLOWING_NAME_IN_arguments_597 )
1293
+ if @state.backtracking == 0
1294
+ tree_for_NAME31 = @adaptor.create_with_payload( __NAME31__ )
1295
+ @adaptor.add_child( root_0, tree_for_NAME31 )
1296
+
1297
+ end
1298
+
1299
+
1300
+ else
1301
+ break # out of loop for decision 10
1302
+ end
1303
+ end # loop for decision 10
1304
+
1305
+
1306
+ end
1307
+ # - - - - - - - rule clean up - - - - - - - -
1308
+ return_value.stop = @input.look( -1 )
1309
+
1310
+
1311
+ if @state.backtracking == 0
1312
+ return_value.tree = @adaptor.rule_post_processing( root_0 )
1313
+ @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )
1314
+
1315
+ end
1316
+
1317
+ rescue ANTLR3::Error::RecognitionError => re
1318
+ report_error(re)
1319
+ recover(re)
1320
+ return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )
1321
+
1322
+
1323
+ ensure
1324
+ # -> uncomment the next line to manually enable rule tracing
1325
+ # trace_out( __method__, 10 )
1326
+
1327
+
1328
+ end
1329
+
1330
+ return return_value
1331
+ end
1332
+
1333
+ AssignReturnValue = define_return_scope
1334
+
1335
+ #
1336
+ # parser rule assign
1337
+ #
1338
+ # (in ZunScript.g)
1339
+ # 73:1: assign : variable ASSIGN open_expression -> ^( ASSIGN variable open_expression ) ;
1340
+ #
1341
+ def assign
1342
+ # -> uncomment the next line to manually enable rule tracing
1343
+ # trace_in( __method__, 11 )
1344
+
1345
+
1346
+ return_value = AssignReturnValue.new
1347
+
1348
+ # $rule.start = the first token seen before matching
1349
+ return_value.start = @input.look
1350
+
1351
+
1352
+ root_0 = nil
1353
+
1354
+ __ASSIGN33__ = nil
1355
+ variable32 = nil
1356
+ open_expression34 = nil
1357
+
1358
+
1359
+ tree_for_ASSIGN33 = nil
1360
+ stream_ASSIGN = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, "token ASSIGN" )
1361
+ stream_open_expression = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule open_expression" )
1362
+ stream_variable = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule variable" )
1363
+ begin
1364
+ # at line 74:5: variable ASSIGN open_expression
1365
+ @state.following.push( TOKENS_FOLLOWING_variable_IN_assign_610 )
1366
+ variable32 = variable
1367
+ @state.following.pop
1368
+ if @state.backtracking == 0
1369
+ stream_variable.add( variable32.tree )
1370
+ end
1371
+
1372
+ __ASSIGN33__ = match( ASSIGN, TOKENS_FOLLOWING_ASSIGN_IN_assign_612 )
1373
+ if @state.backtracking == 0
1374
+ stream_ASSIGN.add( __ASSIGN33__ )
1375
+ end
1376
+
1377
+ @state.following.push( TOKENS_FOLLOWING_open_expression_IN_assign_614 )
1378
+ open_expression34 = open_expression
1379
+ @state.following.pop
1380
+ if @state.backtracking == 0
1381
+ stream_open_expression.add( open_expression34.tree )
1382
+ end
1383
+
1384
+ # AST Rewrite
1385
+ # elements: variable, open_expression, ASSIGN
1386
+ # token labels:
1387
+ # rule labels: return_value
1388
+ # token list labels:
1389
+ # rule list labels:
1390
+ # wildcard labels:
1391
+ if @state.backtracking == 0
1392
+ return_value.tree = root_0
1393
+ stream_return_value = return_value ? subtree_stream( "rule return_value", return_value.tree ) : subtree_stream( "token return_value" )
1394
+
1395
+ root_0 = @adaptor.create_flat_list
1396
+ # 74:37: -> ^( ASSIGN variable open_expression )
1397
+ # at line 74:40: ^( ASSIGN variable open_expression )
1398
+ root_1 = @adaptor.create_flat_list
1399
+ root_1 = @adaptor.become_root( stream_ASSIGN.next_node, root_1 )
1400
+
1401
+ @adaptor.add_child( root_1, stream_variable.next_tree )
1402
+
1403
+ @adaptor.add_child( root_1, stream_open_expression.next_tree )
1404
+
1405
+ @adaptor.add_child( root_0, root_1 )
1406
+
1407
+
1408
+
1409
+
1410
+ return_value.tree = root_0
1411
+
1412
+
1413
+ end
1414
+
1415
+ # - - - - - - - rule clean up - - - - - - - -
1416
+ return_value.stop = @input.look( -1 )
1417
+
1418
+
1419
+ if @state.backtracking == 0
1420
+ return_value.tree = @adaptor.rule_post_processing( root_0 )
1421
+ @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )
1422
+
1423
+ end
1424
+
1425
+ rescue ANTLR3::Error::RecognitionError => re
1426
+ report_error(re)
1427
+ recover(re)
1428
+ return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )
1429
+
1430
+
1431
+ ensure
1432
+ # -> uncomment the next line to manually enable rule tracing
1433
+ # trace_out( __method__, 11 )
1434
+
1435
+
1436
+ end
1437
+
1438
+ return return_value
1439
+ end
1440
+
1441
+ InvokeReturnValue = define_return_scope
1442
+
1443
+ #
1444
+ # parser rule invoke
1445
+ #
1446
+ # (in ZunScript.g)
1447
+ # 76:1: invoke : variable BANG params -> ^( INVOKE variable ( params )* ) ;
1448
+ #
1449
+ def invoke
1450
+ # -> uncomment the next line to manually enable rule tracing
1451
+ # trace_in( __method__, 12 )
1452
+
1453
+
1454
+ return_value = InvokeReturnValue.new
1455
+
1456
+ # $rule.start = the first token seen before matching
1457
+ return_value.start = @input.look
1458
+
1459
+
1460
+ root_0 = nil
1461
+
1462
+ __BANG36__ = nil
1463
+ variable35 = nil
1464
+ params37 = nil
1465
+
1466
+
1467
+ tree_for_BANG36 = nil
1468
+ stream_BANG = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, "token BANG" )
1469
+ stream_params = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule params" )
1470
+ stream_variable = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule variable" )
1471
+ begin
1472
+ # at line 77:5: variable BANG params
1473
+ @state.following.push( TOKENS_FOLLOWING_variable_IN_invoke_635 )
1474
+ variable35 = variable
1475
+ @state.following.pop
1476
+ if @state.backtracking == 0
1477
+ stream_variable.add( variable35.tree )
1478
+ end
1479
+
1480
+ __BANG36__ = match( BANG, TOKENS_FOLLOWING_BANG_IN_invoke_637 )
1481
+ if @state.backtracking == 0
1482
+ stream_BANG.add( __BANG36__ )
1483
+ end
1484
+
1485
+ @state.following.push( TOKENS_FOLLOWING_params_IN_invoke_639 )
1486
+ params37 = params
1487
+ @state.following.pop
1488
+ if @state.backtracking == 0
1489
+ stream_params.add( params37.tree )
1490
+ end
1491
+
1492
+ # AST Rewrite
1493
+ # elements: variable, params
1494
+ # token labels:
1495
+ # rule labels: return_value
1496
+ # token list labels:
1497
+ # rule list labels:
1498
+ # wildcard labels:
1499
+ if @state.backtracking == 0
1500
+ return_value.tree = root_0
1501
+ stream_return_value = return_value ? subtree_stream( "rule return_value", return_value.tree ) : subtree_stream( "token return_value" )
1502
+
1503
+ root_0 = @adaptor.create_flat_list
1504
+ # 77:26: -> ^( INVOKE variable ( params )* )
1505
+ # at line 77:29: ^( INVOKE variable ( params )* )
1506
+ root_1 = @adaptor.create_flat_list
1507
+ root_1 = @adaptor.become_root( @adaptor.create_from_type( INVOKE, "INVOKE" ), root_1 )
1508
+
1509
+ @adaptor.add_child( root_1, stream_variable.next_tree )
1510
+
1511
+ # at line 77:47: ( params )*
1512
+ while stream_params.has_next?
1513
+ @adaptor.add_child( root_1, stream_params.next_tree )
1514
+
1515
+ end
1516
+
1517
+ stream_params.reset();
1518
+
1519
+ @adaptor.add_child( root_0, root_1 )
1520
+
1521
+
1522
+
1523
+
1524
+ return_value.tree = root_0
1525
+
1526
+
1527
+ end
1528
+
1529
+ # - - - - - - - rule clean up - - - - - - - -
1530
+ return_value.stop = @input.look( -1 )
1531
+
1532
+
1533
+ if @state.backtracking == 0
1534
+ return_value.tree = @adaptor.rule_post_processing( root_0 )
1535
+ @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )
1536
+
1537
+ end
1538
+
1539
+ rescue ANTLR3::Error::RecognitionError => re
1540
+ report_error(re)
1541
+ recover(re)
1542
+ return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )
1543
+
1544
+
1545
+ ensure
1546
+ # -> uncomment the next line to manually enable rule tracing
1547
+ # trace_out( __method__, 12 )
1548
+
1549
+
1550
+ end
1551
+
1552
+ return return_value
1553
+ end
1554
+
1555
+ BindReturnValue = define_return_scope
1556
+
1557
+ #
1558
+ # parser rule bind
1559
+ #
1560
+ # (in ZunScript.g)
1561
+ # 78:1: bind : variable params -> ^( BIND variable ( params )* ) ;
1562
+ #
1563
+ def bind
1564
+ # -> uncomment the next line to manually enable rule tracing
1565
+ # trace_in( __method__, 13 )
1566
+
1567
+
1568
+ return_value = BindReturnValue.new
1569
+
1570
+ # $rule.start = the first token seen before matching
1571
+ return_value.start = @input.look
1572
+
1573
+
1574
+ root_0 = nil
1575
+
1576
+ variable38 = nil
1577
+ params39 = nil
1578
+
1579
+
1580
+ stream_params = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule params" )
1581
+ stream_variable = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule variable" )
1582
+ begin
1583
+ # at line 79:5: variable params
1584
+ @state.following.push( TOKENS_FOLLOWING_variable_IN_bind_660 )
1585
+ variable38 = variable
1586
+ @state.following.pop
1587
+ if @state.backtracking == 0
1588
+ stream_variable.add( variable38.tree )
1589
+ end
1590
+
1591
+ @state.following.push( TOKENS_FOLLOWING_params_IN_bind_662 )
1592
+ params39 = params
1593
+ @state.following.pop
1594
+ if @state.backtracking == 0
1595
+ stream_params.add( params39.tree )
1596
+ end
1597
+
1598
+ # AST Rewrite
1599
+ # elements: variable, params
1600
+ # token labels:
1601
+ # rule labels: return_value
1602
+ # token list labels:
1603
+ # rule list labels:
1604
+ # wildcard labels:
1605
+ if @state.backtracking == 0
1606
+ return_value.tree = root_0
1607
+ stream_return_value = return_value ? subtree_stream( "rule return_value", return_value.tree ) : subtree_stream( "token return_value" )
1608
+
1609
+ root_0 = @adaptor.create_flat_list
1610
+ # 79:21: -> ^( BIND variable ( params )* )
1611
+ # at line 79:24: ^( BIND variable ( params )* )
1612
+ root_1 = @adaptor.create_flat_list
1613
+ root_1 = @adaptor.become_root( @adaptor.create_from_type( BIND, "BIND" ), root_1 )
1614
+
1615
+ @adaptor.add_child( root_1, stream_variable.next_tree )
1616
+
1617
+ # at line 79:40: ( params )*
1618
+ while stream_params.has_next?
1619
+ @adaptor.add_child( root_1, stream_params.next_tree )
1620
+
1621
+ end
1622
+
1623
+ stream_params.reset();
1624
+
1625
+ @adaptor.add_child( root_0, root_1 )
1626
+
1627
+
1628
+
1629
+
1630
+ return_value.tree = root_0
1631
+
1632
+
1633
+ end
1634
+
1635
+ # - - - - - - - rule clean up - - - - - - - -
1636
+ return_value.stop = @input.look( -1 )
1637
+
1638
+
1639
+ if @state.backtracking == 0
1640
+ return_value.tree = @adaptor.rule_post_processing( root_0 )
1641
+ @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )
1642
+
1643
+ end
1644
+
1645
+ rescue ANTLR3::Error::RecognitionError => re
1646
+ report_error(re)
1647
+ recover(re)
1648
+ return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )
1649
+
1650
+
1651
+ ensure
1652
+ # -> uncomment the next line to manually enable rule tracing
1653
+ # trace_out( __method__, 13 )
1654
+
1655
+
1656
+ end
1657
+
1658
+ return return_value
1659
+ end
1660
+
1661
+ ClosedInvokeReturnValue = define_return_scope
1662
+
1663
+ #
1664
+ # parser rule closed_invoke
1665
+ #
1666
+ # (in ZunScript.g)
1667
+ # 80:1: closed_invoke : variable BANG ( param )? -> ^( INVOKE variable ( param )* ) ;
1668
+ #
1669
+ def closed_invoke
1670
+ # -> uncomment the next line to manually enable rule tracing
1671
+ # trace_in( __method__, 14 )
1672
+
1673
+
1674
+ return_value = ClosedInvokeReturnValue.new
1675
+
1676
+ # $rule.start = the first token seen before matching
1677
+ return_value.start = @input.look
1678
+
1679
+
1680
+ root_0 = nil
1681
+
1682
+ __BANG41__ = nil
1683
+ variable40 = nil
1684
+ param42 = nil
1685
+
1686
+
1687
+ tree_for_BANG41 = nil
1688
+ stream_BANG = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, "token BANG" )
1689
+ stream_param = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule param" )
1690
+ stream_variable = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule variable" )
1691
+ begin
1692
+ # at line 81:5: variable BANG ( param )?
1693
+ @state.following.push( TOKENS_FOLLOWING_variable_IN_closed_invoke_684 )
1694
+ variable40 = variable
1695
+ @state.following.pop
1696
+ if @state.backtracking == 0
1697
+ stream_variable.add( variable40.tree )
1698
+ end
1699
+
1700
+ __BANG41__ = match( BANG, TOKENS_FOLLOWING_BANG_IN_closed_invoke_686 )
1701
+ if @state.backtracking == 0
1702
+ stream_BANG.add( __BANG41__ )
1703
+ end
1704
+
1705
+ # at line 81:19: ( param )?
1706
+ alt_12 = 2
1707
+ look_12_0 = @input.peek( 1 )
1708
+
1709
+ if ( look_12_0 == BLOCK_RIGHT || look_12_0.between?( LPAREN, NAME ) || look_12_0 == NUMBER || look_12_0 == STRING )
1710
+ alt_12 = 1
1711
+ end
1712
+ case alt_12
1713
+ when 1
1714
+ # at line 81:19: param
1715
+ @state.following.push( TOKENS_FOLLOWING_param_IN_closed_invoke_688 )
1716
+ param42 = param
1717
+ @state.following.pop
1718
+ if @state.backtracking == 0
1719
+ stream_param.add( param42.tree )
1720
+ end
1721
+
1722
+
1723
+ end
1724
+ # AST Rewrite
1725
+ # elements: param, variable
1726
+ # token labels:
1727
+ # rule labels: return_value
1728
+ # token list labels:
1729
+ # rule list labels:
1730
+ # wildcard labels:
1731
+ if @state.backtracking == 0
1732
+ return_value.tree = root_0
1733
+ stream_return_value = return_value ? subtree_stream( "rule return_value", return_value.tree ) : subtree_stream( "token return_value" )
1734
+
1735
+ root_0 = @adaptor.create_flat_list
1736
+ # 81:26: -> ^( INVOKE variable ( param )* )
1737
+ # at line 81:29: ^( INVOKE variable ( param )* )
1738
+ root_1 = @adaptor.create_flat_list
1739
+ root_1 = @adaptor.become_root( @adaptor.create_from_type( INVOKE, "INVOKE" ), root_1 )
1740
+
1741
+ @adaptor.add_child( root_1, stream_variable.next_tree )
1742
+
1743
+ # at line 81:47: ( param )*
1744
+ while stream_param.has_next?
1745
+ @adaptor.add_child( root_1, stream_param.next_tree )
1746
+
1747
+ end
1748
+
1749
+ stream_param.reset();
1750
+
1751
+ @adaptor.add_child( root_0, root_1 )
1752
+
1753
+
1754
+
1755
+
1756
+ return_value.tree = root_0
1757
+
1758
+
1759
+ end
1760
+
1761
+ # - - - - - - - rule clean up - - - - - - - -
1762
+ return_value.stop = @input.look( -1 )
1763
+
1764
+
1765
+ if @state.backtracking == 0
1766
+ return_value.tree = @adaptor.rule_post_processing( root_0 )
1767
+ @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )
1768
+
1769
+ end
1770
+
1771
+ rescue ANTLR3::Error::RecognitionError => re
1772
+ report_error(re)
1773
+ recover(re)
1774
+ return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )
1775
+
1776
+
1777
+ ensure
1778
+ # -> uncomment the next line to manually enable rule tracing
1779
+ # trace_out( __method__, 14 )
1780
+
1781
+
1782
+ end
1783
+
1784
+ return return_value
1785
+ end
1786
+
1787
+ ClosedBindReturnValue = define_return_scope
1788
+
1789
+ #
1790
+ # parser rule closed_bind
1791
+ #
1792
+ # (in ZunScript.g)
1793
+ # 82:1: closed_bind : variable param -> ^( BIND variable param ) ;
1794
+ #
1795
+ def closed_bind
1796
+ # -> uncomment the next line to manually enable rule tracing
1797
+ # trace_in( __method__, 15 )
1798
+
1799
+
1800
+ return_value = ClosedBindReturnValue.new
1801
+
1802
+ # $rule.start = the first token seen before matching
1803
+ return_value.start = @input.look
1804
+
1805
+
1806
+ root_0 = nil
1807
+
1808
+ variable43 = nil
1809
+ param44 = nil
1810
+
1811
+
1812
+ stream_param = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule param" )
1813
+ stream_variable = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule variable" )
1814
+ begin
1815
+ # at line 83:5: variable param
1816
+ @state.following.push( TOKENS_FOLLOWING_variable_IN_closed_bind_710 )
1817
+ variable43 = variable
1818
+ @state.following.pop
1819
+ if @state.backtracking == 0
1820
+ stream_variable.add( variable43.tree )
1821
+ end
1822
+
1823
+ @state.following.push( TOKENS_FOLLOWING_param_IN_closed_bind_712 )
1824
+ param44 = param
1825
+ @state.following.pop
1826
+ if @state.backtracking == 0
1827
+ stream_param.add( param44.tree )
1828
+ end
1829
+
1830
+ # AST Rewrite
1831
+ # elements: variable, param
1832
+ # token labels:
1833
+ # rule labels: return_value
1834
+ # token list labels:
1835
+ # rule list labels:
1836
+ # wildcard labels:
1837
+ if @state.backtracking == 0
1838
+ return_value.tree = root_0
1839
+ stream_return_value = return_value ? subtree_stream( "rule return_value", return_value.tree ) : subtree_stream( "token return_value" )
1840
+
1841
+ root_0 = @adaptor.create_flat_list
1842
+ # 83:20: -> ^( BIND variable param )
1843
+ # at line 83:23: ^( BIND variable param )
1844
+ root_1 = @adaptor.create_flat_list
1845
+ root_1 = @adaptor.become_root( @adaptor.create_from_type( BIND, "BIND" ), root_1 )
1846
+
1847
+ @adaptor.add_child( root_1, stream_variable.next_tree )
1848
+
1849
+ @adaptor.add_child( root_1, stream_param.next_tree )
1850
+
1851
+ @adaptor.add_child( root_0, root_1 )
1852
+
1853
+
1854
+
1855
+
1856
+ return_value.tree = root_0
1857
+
1858
+
1859
+ end
1860
+
1861
+ # - - - - - - - rule clean up - - - - - - - -
1862
+ return_value.stop = @input.look( -1 )
1863
+
1864
+
1865
+ if @state.backtracking == 0
1866
+ return_value.tree = @adaptor.rule_post_processing( root_0 )
1867
+ @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )
1868
+
1869
+ end
1870
+
1871
+ rescue ANTLR3::Error::RecognitionError => re
1872
+ report_error(re)
1873
+ recover(re)
1874
+ return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )
1875
+
1876
+
1877
+ ensure
1878
+ # -> uncomment the next line to manually enable rule tracing
1879
+ # trace_out( __method__, 15 )
1880
+
1881
+
1882
+ end
1883
+
1884
+ return return_value
1885
+ end
1886
+
1887
+ ParamsReturnValue = define_return_scope
1888
+
1889
+ #
1890
+ # parser rule params
1891
+ #
1892
+ # (in ZunScript.g)
1893
+ # 85:1: params : param ( COMMA ! param )* ;
1894
+ #
1895
+ def params
1896
+ # -> uncomment the next line to manually enable rule tracing
1897
+ # trace_in( __method__, 16 )
1898
+
1899
+
1900
+ return_value = ParamsReturnValue.new
1901
+
1902
+ # $rule.start = the first token seen before matching
1903
+ return_value.start = @input.look
1904
+
1905
+
1906
+ root_0 = nil
1907
+
1908
+ __COMMA46__ = nil
1909
+ param45 = nil
1910
+ param47 = nil
1911
+
1912
+
1913
+ tree_for_COMMA46 = nil
1914
+
1915
+ begin
1916
+ root_0 = @adaptor.create_flat_list
1917
+
1918
+
1919
+ # at line 86:5: param ( COMMA ! param )*
1920
+ @state.following.push( TOKENS_FOLLOWING_param_IN_params_733 )
1921
+ param45 = param
1922
+ @state.following.pop
1923
+ if @state.backtracking == 0
1924
+ @adaptor.add_child( root_0, param45.tree )
1925
+ end
1926
+
1927
+ # at line 86:11: ( COMMA ! param )*
1928
+ while true # decision 13
1929
+ alt_13 = 2
1930
+ look_13_0 = @input.peek( 1 )
1931
+
1932
+ if ( look_13_0 == COMMA )
1933
+ alt_13 = 1
1934
+
1935
+ end
1936
+ case alt_13
1937
+ when 1
1938
+ # at line 86:12: COMMA ! param
1939
+ __COMMA46__ = match( COMMA, TOKENS_FOLLOWING_COMMA_IN_params_736 )
1940
+ @state.following.push( TOKENS_FOLLOWING_param_IN_params_739 )
1941
+ param47 = param
1942
+ @state.following.pop
1943
+ if @state.backtracking == 0
1944
+ @adaptor.add_child( root_0, param47.tree )
1945
+ end
1946
+
1947
+
1948
+ else
1949
+ break # out of loop for decision 13
1950
+ end
1951
+ end # loop for decision 13
1952
+
1953
+
1954
+ # - - - - - - - rule clean up - - - - - - - -
1955
+ return_value.stop = @input.look( -1 )
1956
+
1957
+
1958
+ if @state.backtracking == 0
1959
+ return_value.tree = @adaptor.rule_post_processing( root_0 )
1960
+ @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )
1961
+
1962
+ end
1963
+
1964
+ rescue ANTLR3::Error::RecognitionError => re
1965
+ report_error(re)
1966
+ recover(re)
1967
+ return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )
1968
+
1969
+
1970
+ ensure
1971
+ # -> uncomment the next line to manually enable rule tracing
1972
+ # trace_out( __method__, 16 )
1973
+
1974
+
1975
+ end
1976
+
1977
+ return return_value
1978
+ end
1979
+
1980
+ ParamReturnValue = define_return_scope
1981
+
1982
+ #
1983
+ # parser rule param
1984
+ #
1985
+ # (in ZunScript.g)
1986
+ # 87:1: param : closed_expression ;
1987
+ #
1988
+ def param
1989
+ # -> uncomment the next line to manually enable rule tracing
1990
+ # trace_in( __method__, 17 )
1991
+
1992
+
1993
+ return_value = ParamReturnValue.new
1994
+
1995
+ # $rule.start = the first token seen before matching
1996
+ return_value.start = @input.look
1997
+
1998
+
1999
+ root_0 = nil
2000
+
2001
+ closed_expression48 = nil
2002
+
2003
+
2004
+
2005
+ begin
2006
+ root_0 = @adaptor.create_flat_list
2007
+
2008
+
2009
+ # at line 87:8: closed_expression
2010
+ @state.following.push( TOKENS_FOLLOWING_closed_expression_IN_param_747 )
2011
+ closed_expression48 = closed_expression
2012
+ @state.following.pop
2013
+ if @state.backtracking == 0
2014
+ @adaptor.add_child( root_0, closed_expression48.tree )
2015
+ end
2016
+
2017
+
2018
+ # - - - - - - - rule clean up - - - - - - - -
2019
+ return_value.stop = @input.look( -1 )
2020
+
2021
+
2022
+ if @state.backtracking == 0
2023
+ return_value.tree = @adaptor.rule_post_processing( root_0 )
2024
+ @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )
2025
+
2026
+ end
2027
+
2028
+ rescue ANTLR3::Error::RecognitionError => re
2029
+ report_error(re)
2030
+ recover(re)
2031
+ return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )
2032
+
2033
+
2034
+ ensure
2035
+ # -> uncomment the next line to manually enable rule tracing
2036
+ # trace_out( __method__, 17 )
2037
+
2038
+
2039
+ end
2040
+
2041
+ return return_value
2042
+ end
2043
+
2044
+ #
2045
+ # syntactic predicate synpred5_ZunScript
2046
+ #
2047
+ # (in ZunScript.g)
2048
+ # 56:5: synpred5_ZunScript : assign ;
2049
+ #
2050
+ # This is an imaginary rule inserted by ANTLR to
2051
+ # implement a syntactic predicate decision
2052
+ #
2053
+ def synpred5_ZunScript
2054
+ # -> uncomment the next line to manually enable rule tracing
2055
+ # trace_in( __method__, 22 )
2056
+
2057
+
2058
+ # at line 56:5: assign
2059
+ @state.following.push( TOKENS_FOLLOWING_assign_IN_synpred5_ZunScript_427 )
2060
+ assign
2061
+ @state.following.pop
2062
+
2063
+ ensure
2064
+ # -> uncomment the next line to manually enable rule tracing
2065
+ # trace_out( __method__, 22 )
2066
+
2067
+
2068
+ end
2069
+ #
2070
+ # syntactic predicate synpred6_ZunScript
2071
+ #
2072
+ # (in ZunScript.g)
2073
+ # 56:14: synpred6_ZunScript : invoke ;
2074
+ #
2075
+ # This is an imaginary rule inserted by ANTLR to
2076
+ # implement a syntactic predicate decision
2077
+ #
2078
+ def synpred6_ZunScript
2079
+ # -> uncomment the next line to manually enable rule tracing
2080
+ # trace_in( __method__, 23 )
2081
+
2082
+
2083
+ # at line 56:14: invoke
2084
+ @state.following.push( TOKENS_FOLLOWING_invoke_IN_synpred6_ZunScript_431 )
2085
+ invoke
2086
+ @state.following.pop
2087
+
2088
+ ensure
2089
+ # -> uncomment the next line to manually enable rule tracing
2090
+ # trace_out( __method__, 23 )
2091
+
2092
+
2093
+ end
2094
+ #
2095
+ # syntactic predicate synpred7_ZunScript
2096
+ #
2097
+ # (in ZunScript.g)
2098
+ # 56:23: synpred7_ZunScript : bind ;
2099
+ #
2100
+ # This is an imaginary rule inserted by ANTLR to
2101
+ # implement a syntactic predicate decision
2102
+ #
2103
+ def synpred7_ZunScript
2104
+ # -> uncomment the next line to manually enable rule tracing
2105
+ # trace_in( __method__, 24 )
2106
+
2107
+
2108
+ # at line 56:23: bind
2109
+ @state.following.push( TOKENS_FOLLOWING_bind_IN_synpred7_ZunScript_435 )
2110
+ bind
2111
+ @state.following.pop
2112
+
2113
+ ensure
2114
+ # -> uncomment the next line to manually enable rule tracing
2115
+ # trace_out( __method__, 24 )
2116
+
2117
+
2118
+ end
2119
+
2120
+
2121
+ # - - - - - - - - - - DFA definitions - - - - - - - - - - -
2122
+ class DFA6 < ANTLR3::DFA
2123
+ EOT = unpack( 8, -1 )
2124
+ EOF = unpack( 2, -1, 1, 5, 5, -1 )
2125
+ MIN = unpack( 1, 11, 1, -1, 1, 6, 1, -1, 1, 24, 3, -1 )
2126
+ MAX = unpack( 1, 33, 1, -1, 1, 38, 1, -1, 1, 24, 3, -1 )
2127
+ ACCEPT = unpack( 1, -1, 1, 1, 1, -1, 1, 5, 1, -1, 1, 2, 1, 3, 1, 4 )
2128
+ SPECIAL = unpack( 8, -1 )
2129
+ TRANSITION = [
2130
+ unpack( 1, 1, 11, -1, 1, 3, 1, 2, 3, -1, 1, 1, 4, -1, 1, 1 ),
2131
+ unpack( ),
2132
+ unpack( 1, 6, 4, -1, 1, 7, 1, -1, 2, 5, 8, -1, 2, 7, 1, 5, 2, -1,
2133
+ 1, 7, 1, -1, 1, 5, 2, -1, 1, 7, 4, -1, 1, 4 ),
2134
+ unpack( ),
2135
+ unpack( 1, 2 ),
2136
+ unpack( ),
2137
+ unpack( ),
2138
+ unpack( )
2139
+ ].freeze
2140
+
2141
+ ( 0 ... MIN.length ).zip( MIN, MAX ) do | i, a, z |
2142
+ if a > 0 and z < 0
2143
+ MAX[ i ] %= 0x10000
2144
+ end
2145
+ end
2146
+
2147
+ @decision = 6
2148
+
2149
+
2150
+ def description
2151
+ <<-'__dfa_description__'.strip!
2152
+ 57:1: closed_expression : ( value | variable | closed_invoke | closed_bind | LPAREN ! open_expression RPAREN !);
2153
+ __dfa_description__
2154
+ end
2155
+
2156
+ end
2157
+
2158
+
2159
+ private
2160
+
2161
+ def initialize_dfas
2162
+ super rescue nil
2163
+ @dfa6 = DFA6.new( self, 6 )
2164
+
2165
+
2166
+ end
2167
+
2168
+ TOKENS_FOLLOWING_line_IN_script_385 = Set[ 11, 14, 23, 24, 25, 28, 33 ]
2169
+ TOKENS_FOLLOWING_EOF_IN_script_388 = Set[ 1 ]
2170
+ TOKENS_FOLLOWING_open_expression_IN_line_395 = Set[ 14, 25 ]
2171
+ TOKENS_FOLLOWING_comment_IN_line_398 = Set[ 25 ]
2172
+ TOKENS_FOLLOWING_NEWLINE_IN_line_402 = Set[ 1 ]
2173
+ TOKENS_FOLLOWING_COMMENT_IN_comment_410 = Set[ 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38 ]
2174
+ TOKENS_FOLLOWING_assign_IN_open_expression_427 = Set[ 1 ]
2175
+ TOKENS_FOLLOWING_invoke_IN_open_expression_431 = Set[ 1 ]
2176
+ TOKENS_FOLLOWING_bind_IN_open_expression_435 = Set[ 1 ]
2177
+ TOKENS_FOLLOWING_closed_expression_IN_open_expression_439 = Set[ 1 ]
2178
+ TOKENS_FOLLOWING_value_IN_closed_expression_449 = Set[ 1 ]
2179
+ TOKENS_FOLLOWING_variable_IN_closed_expression_453 = Set[ 1 ]
2180
+ TOKENS_FOLLOWING_closed_invoke_IN_closed_expression_457 = Set[ 1 ]
2181
+ TOKENS_FOLLOWING_closed_bind_IN_closed_expression_461 = Set[ 1 ]
2182
+ TOKENS_FOLLOWING_LPAREN_IN_closed_expression_467 = Set[ 11, 23, 24, 28, 33 ]
2183
+ TOKENS_FOLLOWING_open_expression_IN_closed_expression_470 = Set[ 30 ]
2184
+ TOKENS_FOLLOWING_RPAREN_IN_closed_expression_472 = Set[ 1 ]
2185
+ TOKENS_FOLLOWING_NAME_IN_variable_481 = Set[ 38 ]
2186
+ TOKENS_FOLLOWING_T__38_IN_variable_483 = Set[ 24 ]
2187
+ TOKENS_FOLLOWING_NAME_IN_variable_487 = Set[ 1 ]
2188
+ TOKENS_FOLLOWING_NUMBER_IN_value_509 = Set[ 1 ]
2189
+ TOKENS_FOLLOWING_STRING_IN_value_526 = Set[ 1 ]
2190
+ TOKENS_FOLLOWING_block_IN_value_541 = Set[ 1 ]
2191
+ TOKENS_FOLLOWING_BLOCK_RIGHT_IN_block_548 = Set[ 24, 25 ]
2192
+ TOKENS_FOLLOWING_arguments_IN_block_550 = Set[ 25 ]
2193
+ TOKENS_FOLLOWING_NEWLINE_IN_block_552 = Set[ 9, 11, 14, 23, 24, 25, 28, 33 ]
2194
+ TOKENS_FOLLOWING_block_body_IN_block_554 = Set[ 9 ]
2195
+ TOKENS_FOLLOWING_BLOCK_END_IN_block_556 = Set[ 1 ]
2196
+ TOKENS_FOLLOWING_line_IN_block_body_573 = Set[ 1, 11, 14, 23, 24, 25, 28, 33 ]
2197
+ TOKENS_FOLLOWING_NAME_IN_arguments_591 = Set[ 1, 13 ]
2198
+ TOKENS_FOLLOWING_COMMA_IN_arguments_594 = Set[ 24 ]
2199
+ TOKENS_FOLLOWING_NAME_IN_arguments_597 = Set[ 1, 13 ]
2200
+ TOKENS_FOLLOWING_variable_IN_assign_610 = Set[ 5 ]
2201
+ TOKENS_FOLLOWING_ASSIGN_IN_assign_612 = Set[ 11, 23, 24, 28, 33 ]
2202
+ TOKENS_FOLLOWING_open_expression_IN_assign_614 = Set[ 1 ]
2203
+ TOKENS_FOLLOWING_variable_IN_invoke_635 = Set[ 6 ]
2204
+ TOKENS_FOLLOWING_BANG_IN_invoke_637 = Set[ 11, 23, 24, 28, 33 ]
2205
+ TOKENS_FOLLOWING_params_IN_invoke_639 = Set[ 1 ]
2206
+ TOKENS_FOLLOWING_variable_IN_bind_660 = Set[ 11, 23, 24, 28, 33 ]
2207
+ TOKENS_FOLLOWING_params_IN_bind_662 = Set[ 1 ]
2208
+ TOKENS_FOLLOWING_variable_IN_closed_invoke_684 = Set[ 6 ]
2209
+ TOKENS_FOLLOWING_BANG_IN_closed_invoke_686 = Set[ 1, 11, 23, 24, 28, 33 ]
2210
+ TOKENS_FOLLOWING_param_IN_closed_invoke_688 = Set[ 1 ]
2211
+ TOKENS_FOLLOWING_variable_IN_closed_bind_710 = Set[ 11, 23, 24, 28, 33 ]
2212
+ TOKENS_FOLLOWING_param_IN_closed_bind_712 = Set[ 1 ]
2213
+ TOKENS_FOLLOWING_param_IN_params_733 = Set[ 1, 13 ]
2214
+ TOKENS_FOLLOWING_COMMA_IN_params_736 = Set[ 11, 23, 24, 28, 33 ]
2215
+ TOKENS_FOLLOWING_param_IN_params_739 = Set[ 1, 13 ]
2216
+ TOKENS_FOLLOWING_closed_expression_IN_param_747 = Set[ 1 ]
2217
+ TOKENS_FOLLOWING_assign_IN_synpred5_ZunScript_427 = Set[ 1 ]
2218
+ TOKENS_FOLLOWING_invoke_IN_synpred6_ZunScript_431 = Set[ 1 ]
2219
+ TOKENS_FOLLOWING_bind_IN_synpred7_ZunScript_435 = Set[ 1 ]
2220
+
2221
+ end # class Parser < ANTLR3::Parser
2222
+
2223
+ at_exit { Parser.main( ARGV ) } if __FILE__ == $0
2224
+
2225
+ end