sdl92Parser.py 1.05 MB
Newer Older
1
# $ANTLR 3.1.3 Mar 17, 2009 19:23:44 sdl92.g 2015-12-02 15:36:16
Maxime Perrotin's avatar
Maxime Perrotin committed
2
3
4
5
6
7
8
9
10
11
12
13
14

import sys
from antlr3 import *
from antlr3.compat import set, frozenset

from antlr3.tree import *



# for convenience in actions
HIDDEN = BaseRecognizer.HIDDEN

# token types
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
CREATE=159
ENTRY_POINT=32
ENDSTATE=138
STR=216
PROCESS=76
STOP=97
ENDFOR=161
PROVIDED=77
CONDITIONAL=19
CHANNEL=13
THEN=111
XOR=164
CALL=149
A=191
B=213
PFPAR=70
SET=88
C=195
D=194
E=197
F=204
G=205
H=207
L_BRACKET=189
I=203
OPEN_RANGE=63
J=214
K=198
L=196
M=201
ENDSYSTEM=122
N=192
O=206
P=199
Q=221
R=200
S=202
T=208
U=210
VARIABLE=118
V=211
56
GROUND=45
57
58
59
W=212
X=209
Y=193
60
FPAR=44
61
62
63
Z=222
PROCEDURE=73
PARAMNAMES=67
64
PAREN=69
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
APPEND=167
NEWTYPE=59
CONNECTION=21
DIV=168
SELECTOR=85
MINUS_INFINITY=176
STRING=99
VARIABLES=119
TO=113
REM=170
ASSIG_OP=188
SYSTEM=104
ROUTE=83
T__223=223
ENDCHANNEL=124
IFTHENELSE=48
TASK_BODY=106
ALPHA=217
PRIORITY=145
VIEW=182
HYPERLINK=46
LABEL=56
87
CIF=15
88
89
OUTPUT=64
FOR=43
90
INPUTLIST=54
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
EQ=153
FLOATING_LABEL=42
VIAPATH=121
FLOAT2=40
NOT=171
SPECIFIC=184
STIMULUS=96
THIS=160
ENDPROCEDURE=132
END=187
AGGREGATION=142
FI=36
DIGITS=26
STATE=92
OUTPUT_BODY=65
QUESTION=78
BITSTR=11
BASE=178
RETURN=81
STATE_AGGREGATION=93
111
ENDNEWTYPE=29
112
113
114
115
116
117
SEQUENCE=87
R_PAREN=147
WS=219
EOF=-1
GE=158
NEXTSTATE=60
118
ANSWER=7
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
MOD=169
SEQOF=86
T__230=230
PLUS_INFINITY=175
PARAM=66
R_BRACKET=190
GT=155
WITH=126
ACTION=4
T__229=229
STOPIF=98
T__228=228
START=135
FALSE=173
T__225=225
T__224=224
T__227=227
DEFAULT=143
T__226=226
IMPLIES=162
ENDCONNECTION=136
ENDDECISION=151
EXPORT=33
JOIN=55
TEXT=108
REFERENCED=130
ALTERNATIVE=6
SYNTYPE=103
ELSE=27
148
PROCEDURE_NAME=75
149
150
ID=123
NONE=144
151
IF=47
152
153
154
SUBSTRUCTURE=140
FIELDS=39
LITERAL=57
155
IN=49
156
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
FIELD=37
DOT=215
SYNONYM=101
OUT=133
ENDBLOCK=127
STATELIST=95
SEMI=137
CONNECT=20
ASN1=9
ASSIGN=10
COMMENT=17
IMPORT=181
MANTISSA=177
SAVE=84
CLOSED_RANGE=16
SIGNAL=89
COMMA=148
ENDTEXT=31
NUMBER_OF_INSTANCES=61
USE=116
RETURNS=82
CONSTANT=22
ASTERISK=139
COMMENT2=220
TRANSITION=114
NEG=58
LE=157
EXPONENT=179
NEQ=154
GEODE=185
186
EXPRESSION=34
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
ALL=5
SYNONYM_LIST=102
TERMINATOR=107
DECISION=25
TEXTAREA_CONTENT=110
ARRAY=8
INPUT=52
LT=156
STATE_PARTITION_CONNECTION=94
ENDALTERNATIVE=150
RESET=80
VALUE=117
FROM=125
DASH=166
TASK=105
NULL=174
KEEP=183
BLOCK=12
TRUE=172
ENDSYNTYPE=30
207
DCL=24
208
209
210
211
212
OCTSTR=62
AND=129
SORT=91
PARAMS=68
STRUCT=100
213
RANGE=79
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
PLUS=165
INOUT=51
FLOAT=41
CONSTANTS=23
ACTIVE=180
Exponent=218
L_PAREN=146
ANY=152
INT=134
CHOICE=14
EXTERNAL=35
FIELD_NAME=38
TYPE_INSTANCE=115
ENDSUBSTRUCTURE=141
PROCEDURE_CALL=74
TEXTAREA=109
OR=163
SIGNAL_LIST=90
INFORMAL_TEXT=50
TIMER=112
PRIMARY=72
COMPOSITE_STATE=18
VIA=120
ASNFILENAME=186
ENDPROCESS=131
EMPTYSTR=28
SIGNALROUTE=128
INPUT_NONE=53
POINT=71
Maxime Perrotin's avatar
Maxime Perrotin committed
243
244
245
246

# token names
tokenNames = [
    "<invalid>", "<EOR>", "<DOWN>", "<UP>", 
dbarbera's avatar
dbarbera committed
247
248
    "ACTION", "ALL", "ALTERNATIVE", "ANSWER", "ARRAY", "ASN1", "ASSIGN", 
    "BITSTR", "BLOCK", "CHANNEL", "CHOICE", "CIF", "CLOSED_RANGE", "COMMENT", 
249
250
    "COMPOSITE_STATE", "CONDITIONAL", "CONNECT", "CONNECTION", "CONSTANT", 
    "CONSTANTS", "DCL", "DECISION", "DIGITS", "ELSE", "EMPTYSTR", "ENDNEWTYPE", 
251
252
253
    "ENDSYNTYPE", "ENDTEXT", "ENTRY_POINT", "EXPORT", "EXPRESSION", "EXTERNAL", 
    "FI", "FIELD", "FIELD_NAME", "FIELDS", "FLOAT2", "FLOAT", "FLOATING_LABEL", 
    "FOR", "FPAR", "GROUND", "HYPERLINK", "IF", "IFTHENELSE", "IN", "INFORMAL_TEXT", 
254
255
    "INOUT", "INPUT", "INPUT_NONE", "INPUTLIST", "JOIN", "LABEL", "LITERAL", 
    "NEG", "NEWTYPE", "NEXTSTATE", "NUMBER_OF_INSTANCES", "OCTSTR", "OPEN_RANGE", 
256
    "OUTPUT", "OUTPUT_BODY", "PARAM", "PARAMNAMES", "PARAMS", "PAREN", "PFPAR", 
257
    "POINT", "PRIMARY", "PROCEDURE", "PROCEDURE_CALL", "PROCEDURE_NAME", 
258
259
    "PROCESS", "PROVIDED", "QUESTION", "RANGE", "RESET", "RETURN", "RETURNS", 
    "ROUTE", "SAVE", "SELECTOR", "SEQOF", "SEQUENCE", "SET", "SIGNAL", "SIGNAL_LIST", 
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
    "SORT", "STATE", "STATE_AGGREGATION", "STATE_PARTITION_CONNECTION", 
    "STATELIST", "STIMULUS", "STOP", "STOPIF", "STRING", "STRUCT", "SYNONYM", 
    "SYNONYM_LIST", "SYNTYPE", "SYSTEM", "TASK", "TASK_BODY", "TERMINATOR", 
    "TEXT", "TEXTAREA", "TEXTAREA_CONTENT", "THEN", "TIMER", "TO", "TRANSITION", 
    "TYPE_INSTANCE", "USE", "VALUE", "VARIABLE", "VARIABLES", "VIA", "VIAPATH", 
    "ENDSYSTEM", "ID", "ENDCHANNEL", "FROM", "WITH", "ENDBLOCK", "SIGNALROUTE", 
    "AND", "REFERENCED", "ENDPROCESS", "ENDPROCEDURE", "OUT", "INT", "START", 
    "ENDCONNECTION", "SEMI", "ENDSTATE", "ASTERISK", "SUBSTRUCTURE", "ENDSUBSTRUCTURE", 
    "AGGREGATION", "DEFAULT", "NONE", "PRIORITY", "L_PAREN", "R_PAREN", 
    "COMMA", "CALL", "ENDALTERNATIVE", "ENDDECISION", "ANY", "EQ", "NEQ", 
    "GT", "LT", "LE", "GE", "CREATE", "THIS", "ENDFOR", "IMPLIES", "OR", 
    "XOR", "PLUS", "DASH", "APPEND", "DIV", "MOD", "REM", "NOT", "TRUE", 
    "FALSE", "NULL", "PLUS_INFINITY", "MINUS_INFINITY", "MANTISSA", "BASE", 
    "EXPONENT", "ACTIVE", "IMPORT", "VIEW", "KEEP", "SPECIFIC", "GEODE", 
    "ASNFILENAME", "END", "ASSIG_OP", "L_BRACKET", "R_BRACKET", "A", "N", 
    "Y", "D", "C", "L", "E", "K", "P", "R", "M", "S", "I", "F", "G", "O", 
    "H", "T", "X", "U", "V", "W", "B", "J", "DOT", "STR", "ALPHA", "Exponent", 
277
    "WS", "COMMENT2", "Q", "Z", "':'", "'->'", "'!'", "'(.'", "'.)'", "'ERROR'", 
278
    "'/* CIF'", "'*/'"
Maxime Perrotin's avatar
Maxime Perrotin committed
279
280
281
282
283
284
285
]




class sdl92Parser(Parser):
    grammarFileName = "sdl92.g"
Maxime Perrotin's avatar
Maxime Perrotin committed
286
287
    antlr_version = version_str_to_tuple("3.1.3 Mar 17, 2009 19:23:44")
    antlr_version_str = "3.1.3 Mar 17, 2009 19:23:44"
Maxime Perrotin's avatar
Maxime Perrotin committed
288
289
290
291
292
293
294
295
    tokenNames = tokenNames

    def __init__(self, input, state=None, *args, **kwargs):
        if state is None:
            state = RecognizerSharedState()

        super(sdl92Parser, self).__init__(input, state, *args, **kwargs)

296
297
298
299
300
301
302
303
304
        self.dfa25 = self.DFA25(
            self, 25,
            eot = self.DFA25_eot,
            eof = self.DFA25_eof,
            min = self.DFA25_min,
            max = self.DFA25_max,
            accept = self.DFA25_accept,
            special = self.DFA25_special,
            transition = self.DFA25_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
305
306
            )

307
308
309
310
311
312
313
314
315
        self.dfa41 = self.DFA41(
            self, 41,
            eot = self.DFA41_eot,
            eof = self.DFA41_eof,
            min = self.DFA41_min,
            max = self.DFA41_max,
            accept = self.DFA41_accept,
            special = self.DFA41_special,
            transition = self.DFA41_transition
316
317
            )

318
319
320
321
322
323
324
325
326
        self.dfa48 = self.DFA48(
            self, 48,
            eot = self.DFA48_eot,
            eof = self.DFA48_eof,
            min = self.DFA48_min,
            max = self.DFA48_max,
            accept = self.DFA48_accept,
            special = self.DFA48_special,
            transition = self.DFA48_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
327
328
            )

329
330
331
332
333
334
335
336
337
        self.dfa54 = self.DFA54(
            self, 54,
            eot = self.DFA54_eot,
            eof = self.DFA54_eof,
            min = self.DFA54_min,
            max = self.DFA54_max,
            accept = self.DFA54_accept,
            special = self.DFA54_special,
            transition = self.DFA54_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
338
339
            )

340
341
342
343
344
345
346
347
348
        self.dfa55 = self.DFA55(
            self, 55,
            eot = self.DFA55_eot,
            eof = self.DFA55_eof,
            min = self.DFA55_min,
            max = self.DFA55_max,
            accept = self.DFA55_accept,
            special = self.DFA55_special,
            transition = self.DFA55_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
349
350
            )

351
352
353
354
355
356
357
358
359
        self.dfa59 = self.DFA59(
            self, 59,
            eot = self.DFA59_eot,
            eof = self.DFA59_eof,
            min = self.DFA59_min,
            max = self.DFA59_max,
            accept = self.DFA59_accept,
            special = self.DFA59_special,
            transition = self.DFA59_transition
360
361
            )

362
363
364
365
366
367
368
369
370
        self.dfa79 = self.DFA79(
            self, 79,
            eot = self.DFA79_eot,
            eof = self.DFA79_eof,
            min = self.DFA79_min,
            max = self.DFA79_max,
            accept = self.DFA79_accept,
            special = self.DFA79_special,
            transition = self.DFA79_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
371
372
            )

373
374
375
376
377
378
379
380
381
        self.dfa85 = self.DFA85(
            self, 85,
            eot = self.DFA85_eot,
            eof = self.DFA85_eof,
            min = self.DFA85_min,
            max = self.DFA85_max,
            accept = self.DFA85_accept,
            special = self.DFA85_special,
            transition = self.DFA85_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
382
383
            )

384
385
386
387
388
389
390
391
392
        self.dfa86 = self.DFA86(
            self, 86,
            eot = self.DFA86_eot,
            eof = self.DFA86_eof,
            min = self.DFA86_min,
            max = self.DFA86_max,
            accept = self.DFA86_accept,
            special = self.DFA86_special,
            transition = self.DFA86_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
393
394
            )

395
396
397
398
399
400
401
402
403
        self.dfa87 = self.DFA87(
            self, 87,
            eot = self.DFA87_eot,
            eof = self.DFA87_eof,
            min = self.DFA87_min,
            max = self.DFA87_max,
            accept = self.DFA87_accept,
            special = self.DFA87_special,
            transition = self.DFA87_transition
404
405
            )

406
407
408
409
410
411
412
413
414
        self.dfa91 = self.DFA91(
            self, 91,
            eot = self.DFA91_eot,
            eof = self.DFA91_eof,
            min = self.DFA91_min,
            max = self.DFA91_max,
            accept = self.DFA91_accept,
            special = self.DFA91_special,
            transition = self.DFA91_transition
415
416
            )

417
418
419
420
421
422
423
424
425
        self.dfa100 = self.DFA100(
            self, 100,
            eot = self.DFA100_eot,
            eof = self.DFA100_eof,
            min = self.DFA100_min,
            max = self.DFA100_max,
            accept = self.DFA100_accept,
            special = self.DFA100_special,
            transition = self.DFA100_transition
426
427
            )

428
429
430
431
432
433
434
435
436
        self.dfa105 = self.DFA105(
            self, 105,
            eot = self.DFA105_eot,
            eof = self.DFA105_eof,
            min = self.DFA105_min,
            max = self.DFA105_max,
            accept = self.DFA105_accept,
            special = self.DFA105_special,
            transition = self.DFA105_transition
437
438
            )

439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
        self.dfa106 = self.DFA106(
            self, 106,
            eot = self.DFA106_eot,
            eof = self.DFA106_eof,
            min = self.DFA106_min,
            max = self.DFA106_max,
            accept = self.DFA106_accept,
            special = self.DFA106_special,
            transition = self.DFA106_transition
            )

        self.dfa114 = self.DFA114(
            self, 114,
            eot = self.DFA114_eot,
            eof = self.DFA114_eof,
            min = self.DFA114_min,
            max = self.DFA114_max,
            accept = self.DFA114_accept,
            special = self.DFA114_special,
            transition = self.DFA114_transition
459
460
            )

461
462
463
464
465
466
467
468
469
        self.dfa111 = self.DFA111(
            self, 111,
            eot = self.DFA111_eot,
            eof = self.DFA111_eof,
            min = self.DFA111_min,
            max = self.DFA111_max,
            accept = self.DFA111_accept,
            special = self.DFA111_special,
            transition = self.DFA111_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
470
471
            )

472
473
474
475
476
477
478
479
480
481
482
        self.dfa112 = self.DFA112(
            self, 112,
            eot = self.DFA112_eot,
            eof = self.DFA112_eof,
            min = self.DFA112_min,
            max = self.DFA112_max,
            accept = self.DFA112_accept,
            special = self.DFA112_special,
            transition = self.DFA112_transition
            )

483
484
485
486
487
488
489
490
491
        self.dfa113 = self.DFA113(
            self, 113,
            eot = self.DFA113_eot,
            eof = self.DFA113_eof,
            min = self.DFA113_min,
            max = self.DFA113_max,
            accept = self.DFA113_accept,
            special = self.DFA113_special,
            transition = self.DFA113_transition
492
493
            )

494
495
496
497
498
499
500
501
502
        self.dfa115 = self.DFA115(
            self, 115,
            eot = self.DFA115_eot,
            eof = self.DFA115_eof,
            min = self.DFA115_min,
            max = self.DFA115_max,
            accept = self.DFA115_accept,
            special = self.DFA115_special,
            transition = self.DFA115_transition
503
504
            )

505
506
507
508
509
510
511
512
513
        self.dfa116 = self.DFA116(
            self, 116,
            eot = self.DFA116_eot,
            eof = self.DFA116_eof,
            min = self.DFA116_min,
            max = self.DFA116_max,
            accept = self.DFA116_accept,
            special = self.DFA116_special,
            transition = self.DFA116_transition
514
515
            )

516
517
518
519
520
521
522
523
524
        self.dfa127 = self.DFA127(
            self, 127,
            eot = self.DFA127_eot,
            eof = self.DFA127_eof,
            min = self.DFA127_min,
            max = self.DFA127_max,
            accept = self.DFA127_accept,
            special = self.DFA127_special,
            transition = self.DFA127_transition
525
526
            )

527
528
529
530
531
532
533
534
535
        self.dfa125 = self.DFA125(
            self, 125,
            eot = self.DFA125_eot,
            eof = self.DFA125_eof,
            min = self.DFA125_min,
            max = self.DFA125_max,
            accept = self.DFA125_accept,
            special = self.DFA125_special,
            transition = self.DFA125_transition
536
537
            )

538
539
540
541
542
543
544
545
546
        self.dfa135 = self.DFA135(
            self, 135,
            eot = self.DFA135_eot,
            eof = self.DFA135_eof,
            min = self.DFA135_min,
            max = self.DFA135_max,
            accept = self.DFA135_accept,
            special = self.DFA135_special,
            transition = self.DFA135_transition
547
548
            )

549
550
551
552
553
554
555
556
557
        self.dfa141 = self.DFA141(
            self, 141,
            eot = self.DFA141_eot,
            eof = self.DFA141_eof,
            min = self.DFA141_min,
            max = self.DFA141_max,
            accept = self.DFA141_accept,
            special = self.DFA141_special,
            transition = self.DFA141_transition
558
559
            )

560
561
562
563
564
565
566
567
568
        self.dfa174 = self.DFA174(
            self, 174,
            eot = self.DFA174_eot,
            eof = self.DFA174_eof,
            min = self.DFA174_min,
            max = self.DFA174_max,
            accept = self.DFA174_accept,
            special = self.DFA174_special,
            transition = self.DFA174_transition
569
570
            )

571
572
573
574
575
576
577
578
579
        self.dfa179 = self.DFA179(
            self, 179,
            eot = self.DFA179_eot,
            eof = self.DFA179_eof,
            min = self.DFA179_min,
            max = self.DFA179_max,
            accept = self.DFA179_accept,
            special = self.DFA179_special,
            transition = self.DFA179_transition
580
581
            )

582
583
584
585
586
587
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
        self.dfa180 = self.DFA180(
            self, 180,
            eot = self.DFA180_eot,
            eof = self.DFA180_eof,
            min = self.DFA180_min,
            max = self.DFA180_max,
            accept = self.DFA180_accept,
            special = self.DFA180_special,
            transition = self.DFA180_transition
            )

        self.dfa184 = self.DFA184(
            self, 184,
            eot = self.DFA184_eot,
            eof = self.DFA184_eof,
            min = self.DFA184_min,
            max = self.DFA184_max,
            accept = self.DFA184_accept,
            special = self.DFA184_special,
            transition = self.DFA184_transition
            )

        self.dfa193 = self.DFA193(
            self, 193,
            eot = self.DFA193_eot,
            eof = self.DFA193_eof,
            min = self.DFA193_min,
            max = self.DFA193_max,
            accept = self.DFA193_accept,
            special = self.DFA193_special,
            transition = self.DFA193_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
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
640
641
642
643
644
            )






        self._adaptor = None
        self.adaptor = CommonTreeAdaptor()
                


        
    def getTreeAdaptor(self):
        return self._adaptor

    def setTreeAdaptor(self, adaptor):
        self._adaptor = adaptor

    adaptor = property(getTreeAdaptor, setTreeAdaptor)


    class pr_file_return(ParserRuleReturnScope):
        def __init__(self):
            super(sdl92Parser.pr_file_return, self).__init__()

            self.tree = None




    # $ANTLR start "pr_file"
645
    # sdl92.g:146:1: pr_file : ( use_clause | system_definition | process_definition )+ ;
Maxime Perrotin's avatar
Maxime Perrotin committed
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
    def pr_file(self, ):

        retval = self.pr_file_return()
        retval.start = self.input.LT(1)

        root_0 = None

        use_clause1 = None

        system_definition2 = None

        process_definition3 = None



        try:
            try:
663
664
                # sdl92.g:147:9: ( ( use_clause | system_definition | process_definition )+ )
                # sdl92.g:147:17: ( use_clause | system_definition | process_definition )+
Maxime Perrotin's avatar
Maxime Perrotin committed
665
666
667
                pass 
                root_0 = self._adaptor.nil()

668
                # sdl92.g:147:17: ( use_clause | system_definition | process_definition )+
Maxime Perrotin's avatar
Maxime Perrotin committed
669
670
671
672
                cnt1 = 0
                while True: #loop1
                    alt1 = 4
                    LA1 = self.input.LA(1)
673
                    if LA1 == 229:
674
675
                        LA1_2 = self.input.LA(2)

676
                        if (LA1_2 == KEEP) :
677
                            alt1 = 1
678
679
                        elif (LA1_2 == ANSWER or LA1_2 == COMMENT or LA1_2 == CONNECT or LA1_2 == DECISION or LA1_2 == INPUT or (JOIN <= LA1_2 <= LABEL) or LA1_2 == NEXTSTATE or LA1_2 == OUTPUT or (PROCEDURE <= LA1_2 <= PROCEDURE_CALL) or (PROCESS <= LA1_2 <= PROVIDED) or LA1_2 == RETURN or LA1_2 == STATE or LA1_2 == STOP or LA1_2 == TASK or LA1_2 == TEXT or LA1_2 == START) :
                            alt1 = 3
680
681
682


                    elif LA1 == USE:
Maxime Perrotin's avatar
Maxime Perrotin committed
683
684
685
686
687
688
689
                        alt1 = 1
                    elif LA1 == SYSTEM:
                        alt1 = 2
                    elif LA1 == PROCESS:
                        alt1 = 3

                    if alt1 == 1:
690
                        # sdl92.g:147:18: use_clause
Maxime Perrotin's avatar
Maxime Perrotin committed
691
                        pass 
692
                        self._state.following.append(self.FOLLOW_use_clause_in_pr_file1375)
Maxime Perrotin's avatar
Maxime Perrotin committed
693
694
695
696
697
698
699
700
                        use_clause1 = self.use_clause()

                        self._state.following.pop()
                        if self._state.backtracking == 0:
                            self._adaptor.addChild(root_0, use_clause1.tree)


                    elif alt1 == 2:
701
                        # sdl92.g:148:19: system_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
702
                        pass 
703
                        self._state.following.append(self.FOLLOW_system_definition_in_pr_file1395)
Maxime Perrotin's avatar
Maxime Perrotin committed
704
705
706
707
708
709
710
711
                        system_definition2 = self.system_definition()

                        self._state.following.pop()
                        if self._state.backtracking == 0:
                            self._adaptor.addChild(root_0, system_definition2.tree)


                    elif alt1 == 3:
712
                        # sdl92.g:149:19: process_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
713
                        pass 
714
                        self._state.following.append(self.FOLLOW_process_definition_in_pr_file1415)
Maxime Perrotin's avatar
Maxime Perrotin committed
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
                        process_definition3 = self.process_definition()

                        self._state.following.pop()
                        if self._state.backtracking == 0:
                            self._adaptor.addChild(root_0, process_definition3.tree)


                    else:
                        if cnt1 >= 1:
                            break #loop1

                        if self._state.backtracking > 0:
                            raise BacktrackingFailed

                        eee = EarlyExitException(1, self.input)
                        raise eee

                    cnt1 += 1



                retval.stop = self.input.LT(-1)

                if self._state.backtracking == 0:

                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
                retval.tree = self._adaptor.errorNode(self.input, retval.start, self.input.LT(-1), re)
        finally:

            pass
        return retval

    # $ANTLR end "pr_file"

    class system_definition_return(ParserRuleReturnScope):
        def __init__(self):
            super(sdl92Parser.system_definition_return, self).__init__()

            self.tree = None




    # $ANTLR start "system_definition"
765
    # sdl92.g:153:1: system_definition : SYSTEM system_name end ( entity_in_system )* ENDSYSTEM ( system_name )? end -> ^( SYSTEM system_name ( entity_in_system )* ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
    def system_definition(self, ):

        retval = self.system_definition_return()
        retval.start = self.input.LT(1)

        root_0 = None

        SYSTEM4 = None
        ENDSYSTEM8 = None
        system_name5 = None

        end6 = None

        entity_in_system7 = None

        system_name9 = None

        end10 = None


        SYSTEM4_tree = None
        ENDSYSTEM8_tree = None
788
        stream_SYSTEM = RewriteRuleTokenStream(self._adaptor, "token SYSTEM")
789
        stream_ENDSYSTEM = RewriteRuleTokenStream(self._adaptor, "token ENDSYSTEM")
Maxime Perrotin's avatar
Maxime Perrotin committed
790
791
792
793
794
        stream_entity_in_system = RewriteRuleSubtreeStream(self._adaptor, "rule entity_in_system")
        stream_system_name = RewriteRuleSubtreeStream(self._adaptor, "rule system_name")
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
        try:
            try:
795
796
                # sdl92.g:154:9: ( SYSTEM system_name end ( entity_in_system )* ENDSYSTEM ( system_name )? end -> ^( SYSTEM system_name ( entity_in_system )* ) )
                # sdl92.g:154:17: SYSTEM system_name end ( entity_in_system )* ENDSYSTEM ( system_name )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
797
                pass 
798
                SYSTEM4=self.match(self.input, SYSTEM, self.FOLLOW_SYSTEM_in_system_definition1449) 
Maxime Perrotin's avatar
Maxime Perrotin committed
799
800
                if self._state.backtracking == 0:
                    stream_SYSTEM.add(SYSTEM4)
801
                self._state.following.append(self.FOLLOW_system_name_in_system_definition1451)
Maxime Perrotin's avatar
Maxime Perrotin committed
802
803
804
805
806
                system_name5 = self.system_name()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_system_name.add(system_name5.tree)
807
                self._state.following.append(self.FOLLOW_end_in_system_definition1453)
Maxime Perrotin's avatar
Maxime Perrotin committed
808
809
810
811
812
                end6 = self.end()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_end.add(end6.tree)
813
                # sdl92.g:155:17: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
814
815
816
817
                while True: #loop2
                    alt2 = 2
                    LA2_0 = self.input.LA(1)

818
                    if ((BLOCK <= LA2_0 <= CHANNEL) or LA2_0 == PROCEDURE or LA2_0 == SIGNAL or LA2_0 == 229) :
Maxime Perrotin's avatar
Maxime Perrotin committed
819
820
821
822
823
824
                        alt2 = 1


                    if alt2 == 1:
                        # sdl92.g:0:0: entity_in_system
                        pass 
825
                        self._state.following.append(self.FOLLOW_entity_in_system_in_system_definition1471)
Maxime Perrotin's avatar
Maxime Perrotin committed
826
827
828
829
830
831
832
833
834
                        entity_in_system7 = self.entity_in_system()

                        self._state.following.pop()
                        if self._state.backtracking == 0:
                            stream_entity_in_system.add(entity_in_system7.tree)


                    else:
                        break #loop2
835
                ENDSYSTEM8=self.match(self.input, ENDSYSTEM, self.FOLLOW_ENDSYSTEM_in_system_definition1490) 
Maxime Perrotin's avatar
Maxime Perrotin committed
836
837
                if self._state.backtracking == 0:
                    stream_ENDSYSTEM.add(ENDSYSTEM8)
838
                # sdl92.g:156:27: ( system_name )?
Maxime Perrotin's avatar
Maxime Perrotin committed
839
840
841
842
843
844
845
846
                alt3 = 2
                LA3_0 = self.input.LA(1)

                if (LA3_0 == ID) :
                    alt3 = 1
                if alt3 == 1:
                    # sdl92.g:0:0: system_name
                    pass 
847
                    self._state.following.append(self.FOLLOW_system_name_in_system_definition1492)
Maxime Perrotin's avatar
Maxime Perrotin committed
848
849
850
851
852
853
854
855
                    system_name9 = self.system_name()

                    self._state.following.pop()
                    if self._state.backtracking == 0:
                        stream_system_name.add(system_name9.tree)



856
                self._state.following.append(self.FOLLOW_end_in_system_definition1495)
Maxime Perrotin's avatar
Maxime Perrotin committed
857
858
859
860
861
862
863
                end10 = self.end()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_end.add(end10.tree)

                # AST Rewrite
864
                # elements: SYSTEM, system_name, entity_in_system
Maxime Perrotin's avatar
Maxime Perrotin committed
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
                # token labels: 
                # rule labels: retval
                # token list labels: 
                # rule list labels: 
                # wildcard labels: 
                if self._state.backtracking == 0:

                    retval.tree = root_0

                    if retval is not None:
                        stream_retval = RewriteRuleSubtreeStream(self._adaptor, "rule retval", retval.tree)
                    else:
                        stream_retval = RewriteRuleSubtreeStream(self._adaptor, "token retval", None)


                    root_0 = self._adaptor.nil()
881
882
                    # 157:9: -> ^( SYSTEM system_name ( entity_in_system )* )
                    # sdl92.g:157:17: ^( SYSTEM system_name ( entity_in_system )* )
Maxime Perrotin's avatar
Maxime Perrotin committed
883
884
885
886
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_SYSTEM.nextNode(), root_1)

                    self._adaptor.addChild(root_1, stream_system_name.nextTree())
887
                    # sdl92.g:157:38: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
                    while stream_entity_in_system.hasNext():
                        self._adaptor.addChild(root_1, stream_entity_in_system.nextTree())


                    stream_entity_in_system.reset();

                    self._adaptor.addChild(root_0, root_1)



                    retval.tree = root_0



                retval.stop = self.input.LT(-1)

                if self._state.backtracking == 0:

                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
                retval.tree = self._adaptor.errorNode(self.input, retval.start, self.input.LT(-1), re)
        finally:

            pass
        return retval

    # $ANTLR end "system_definition"

    class use_clause_return(ParserRuleReturnScope):
        def __init__(self):
            super(sdl92Parser.use_clause_return, self).__init__()

            self.tree = None




    # $ANTLR start "use_clause"
931
    # sdl92.g:161:1: use_clause : ( use_asn1 )? USE package_name ( '/' def_selection_list )? end -> ^( USE ( use_asn1 )? ( end )? package_name ( def_selection_list )? ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
932
933
934
935
936
937
938
939
    def use_clause(self, ):

        retval = self.use_clause_return()
        retval.start = self.input.LT(1)

        root_0 = None

        USE12 = None
940
        char_literal14 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
941
942
943
944
        use_asn111 = None

        package_name13 = None

945
946
947
        def_selection_list15 = None

        end16 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
948
949
950


        USE12_tree = None
951
        char_literal14_tree = None
952
        stream_DIV = RewriteRuleTokenStream(self._adaptor, "token DIV")
953
        stream_USE = RewriteRuleTokenStream(self._adaptor, "token USE")
Maxime Perrotin's avatar
Maxime Perrotin committed
954
955
        stream_use_asn1 = RewriteRuleSubtreeStream(self._adaptor, "rule use_asn1")
        stream_package_name = RewriteRuleSubtreeStream(self._adaptor, "rule package_name")
956
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
957
        stream_def_selection_list = RewriteRuleSubtreeStream(self._adaptor, "rule def_selection_list")
Maxime Perrotin's avatar
Maxime Perrotin committed
958
959
        try:
            try:
960
961
                # sdl92.g:162:9: ( ( use_asn1 )? USE package_name ( '/' def_selection_list )? end -> ^( USE ( use_asn1 )? ( end )? package_name ( def_selection_list )? ) )
                # sdl92.g:162:17: ( use_asn1 )? USE package_name ( '/' def_selection_list )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
962
                pass 
963
                # sdl92.g:162:17: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
964
965
966
                alt4 = 2
                LA4_0 = self.input.LA(1)

967
                if (LA4_0 == 229) :
Maxime Perrotin's avatar
Maxime Perrotin committed
968
969
970
971
                    alt4 = 1
                if alt4 == 1:
                    # sdl92.g:0:0: use_asn1
                    pass 
972
                    self._state.following.append(self.FOLLOW_use_asn1_in_use_clause1551)
Maxime Perrotin's avatar
Maxime Perrotin committed
973
974
975
976
977
978
979
980
                    use_asn111 = self.use_asn1()

                    self._state.following.pop()
                    if self._state.backtracking == 0:
                        stream_use_asn1.add(use_asn111.tree)



981
                USE12=self.match(self.input, USE, self.FOLLOW_USE_in_use_clause1570) 
Maxime Perrotin's avatar
Maxime Perrotin committed
982
983
                if self._state.backtracking == 0:
                    stream_USE.add(USE12)
984
                self._state.following.append(self.FOLLOW_package_name_in_use_clause1572)
Maxime Perrotin's avatar
Maxime Perrotin committed
985
986
987
988
989
                package_name13 = self.package_name()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_package_name.add(package_name13.tree)
990
                # sdl92.g:164:17: ( '/' def_selection_list )?
991
992
993
994
995
996
                alt5 = 2
                LA5_0 = self.input.LA(1)

                if (LA5_0 == DIV) :
                    alt5 = 1
                if alt5 == 1:
997
                    # sdl92.g:164:18: '/' def_selection_list
998
                    pass 
999
                    char_literal14=self.match(self.input, DIV, self.FOLLOW_DIV_in_use_clause1591) 
1000
1001
                    if self._state.backtracking == 0:
                        stream_DIV.add(char_literal14)
1002
                    self._state.following.append(self.FOLLOW_def_selection_list_in_use_clause1593)
1003
1004
1005
1006
1007
1008
1009
1010
                    def_selection_list15 = self.def_selection_list()

                    self._state.following.pop()
                    if self._state.backtracking == 0:
                        stream_def_selection_list.add(def_selection_list15.tree)



1011
                self._state.following.append(self.FOLLOW_end_in_use_clause1614)
1012
                end16 = self.end()
Maxime Perrotin's avatar
Maxime Perrotin committed
1013
1014
1015

                self._state.following.pop()
                if self._state.backtracking == 0:
1016
                    stream_end.add(end16.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1017
1018

                # AST Rewrite
1019
                # elements: package_name, def_selection_list, use_asn1, USE, end
Maxime Perrotin's avatar
Maxime Perrotin committed
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
                # token labels: 
                # rule labels: retval
                # token list labels: 
                # rule list labels: 
                # wildcard labels: 
                if self._state.backtracking == 0:

                    retval.tree = root_0

                    if retval is not None:
                        stream_retval = RewriteRuleSubtreeStream(self._adaptor, "rule retval", retval.tree)
                    else:
                        stream_retval = RewriteRuleSubtreeStream(self._adaptor, "token retval", None)


                    root_0 = self._adaptor.nil()
1036
1037
                    # 166:9: -> ^( USE ( use_asn1 )? ( end )? package_name ( def_selection_list )? )
                    # sdl92.g:166:17: ^( USE ( use_asn1 )? ( end )? package_name ( def_selection_list )? )
Maxime Perrotin's avatar
Maxime Perrotin committed
1038
1039
1040
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_USE.nextNode(), root_1)

1041
                    # sdl92.g:166:23: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1042
1043
1044
1045
1046
                    if stream_use_asn1.hasNext():
                        self._adaptor.addChild(root_1, stream_use_asn1.nextTree())


                    stream_use_asn1.reset();
1047
                    # sdl92.g:166:33: ( end )?
1048
1049
1050
1051
1052
                    if stream_end.hasNext():
                        self._adaptor.addChild(root_1, stream_end.nextTree())


                    stream_end.reset();
Maxime Perrotin's avatar
Maxime Perrotin committed
1053
                    self._adaptor.addChild(root_1, stream_package_name.nextTree())
1054
                    # sdl92.g:166:51: ( def_selection_list )?
1055
1056
1057
1058
1059
                    if stream_def_selection_list.hasNext():
                        self._adaptor.addChild(root_1, stream_def_selection_list.nextTree())


                    stream_def_selection_list.reset();
Maxime Perrotin's avatar
Maxime Perrotin committed
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087

                    self._adaptor.addChild(root_0, root_1)



                    retval.tree = root_0



                retval.stop = self.input.LT(-1)

                if self._state.backtracking == 0:

                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
                retval.tree = self._adaptor.errorNode(self.input, retval.start, self.input.LT(-1), re)
        finally:

            pass
        return retval

    # $ANTLR end "use_clause"

1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
    class def_selection_list_return(ParserRuleReturnScope):
        def __init__(self):
            super(sdl92Parser.def_selection_list_return, self).__init__()

            self.tree = None




    # $ANTLR start "def_selection_list"
1098
    # sdl92.g:173:1: def_selection_list : ID ( ',' ID )* ;
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
    def def_selection_list(self, ):

        retval = self.def_selection_list_return()
        retval.start = self.input.LT(1)

        root_0 = None

        ID17 = None
        char_literal18 = None
        ID19 = None

        ID17_tree = None
        char_literal18_tree = None
        ID19_tree = None

        try:
            try:
1116
1117
                # sdl92.g:174:9: ( ID ( ',' ID )* )
                # sdl92.g:174:17: ID ( ',' ID )*
1118
1119
1120
                pass 
                root_0 = self._adaptor.nil()

1121
                ID17=self.match(self.input, ID, self.FOLLOW_ID_in_def_selection_list1678)
1122
1123
1124
1125
1126
                if self._state.backtracking == 0:

                    ID17_tree = self._adaptor.createWithPayload(ID17)
                    self._adaptor.addChild(root_0, ID17_tree)

1127
                # sdl92.g:174:20: ( ',' ID )*
1128
1129
1130
1131
1132
1133
1134
1135
1136
                while True: #loop6
                    alt6 = 2
                    LA6_0 = self.input.LA(1)

                    if (LA6_0 == COMMA) :
                        alt6 = 1


                    if alt6 == 1:
1137
                        # sdl92.g:174:21: ',' ID
1138
                        pass 
1139
1140
                        char_literal18=self.match(self.input, COMMA, self.FOLLOW_COMMA_in_def_selection_list1681)
                        ID19=self.match(self.input, ID, self.FOLLOW_ID_in_def_selection_list1684)
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
                        if self._state.backtracking == 0:

                            ID19_tree = self._adaptor.createWithPayload(ID19)
                            self._adaptor.addChild(root_0, ID19_tree)



                    else:
                        break #loop6



                retval.stop = self.input.LT(-1)

                if self._state.backtracking == 0:

                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
                retval.tree = self._adaptor.errorNode(self.input, retval.start, self.input.LT(-1), re)
        finally:

            pass
        return retval

    # $ANTLR end "def_selection_list"

Maxime Perrotin's avatar
Maxime Perrotin committed
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
    class entity_in_system_return(ParserRuleReturnScope):
        def __init__(self):
            super(sdl92Parser.entity_in_system_return, self).__init__()

            self.tree = None




    # $ANTLR start "entity_in_system"
1182
    # sdl92.g:181:1: entity_in_system : ( signal_declaration | text_area | procedure | channel | block_definition );
Maxime Perrotin's avatar
Maxime Perrotin committed
1183
1184
1185
1186
1187
1188
1189
    def entity_in_system(self, ):

        retval = self.entity_in_system_return()
        retval.start = self.input.LT(1)

        root_0 = None

1190
        signal_declaration20 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1191

1192
        text_area21 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1193

1194
        procedure22 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1195

1196
        channel23 = None
1197

1198
        block_definition24 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1199
1200
1201
1202
1203



        try:
            try:
1204
                # sdl92.g:182:9: ( signal_declaration | text_area | procedure | channel | block_definition )
1205
1206
                alt7 = 5
                LA7 = self.input.LA(1)
1207
                if LA7 == 229:
1208
1209
1210
1211
1212
1213
1214
1215
                    LA7_1 = self.input.LA(2)

                    if (self.synpred9_sdl92()) :
                        alt7 = 1
                    elif (self.synpred10_sdl92()) :
                        alt7 = 2
                    elif (self.synpred11_sdl92()) :
                        alt7 = 3
Maxime Perrotin's avatar
Maxime Perrotin committed
1216
1217
1218
1219
                    else:
                        if self._state.backtracking > 0:
                            raise BacktrackingFailed

1220
                        nvae = NoViableAltException("", 7, 1, self.input)
Maxime Perrotin's avatar
Maxime Perrotin committed
1221
1222
1223

                        raise nvae

1224
1225
1226
1227
1228
1229
1230
1231
                elif LA7 == SIGNAL:
                    alt7 = 1
                elif LA7 == PROCEDURE:
                    alt7 = 3
                elif LA7 == CHANNEL:
                    alt7 = 4
                elif LA7 == BLOCK:
                    alt7 = 5
Maxime Perrotin's avatar
Maxime Perrotin committed
1232
1233
1234
1235
                else:
                    if self._state.backtracking > 0:
                        raise BacktrackingFailed

1236
                    nvae = NoViableAltException("", 7, 0, self.input)
Maxime Perrotin's avatar
Maxime Perrotin committed
1237
1238
1239

                    raise nvae

1240
                if alt7 == 1:
1241
                    # sdl92.g:182:17: signal_declaration
Maxime Perrotin's avatar
Maxime Perrotin committed
1242
1243
1244
                    pass 
                    root_0 = self._adaptor.nil()

1245
                    self._state.following.append(self.FOLLOW_signal_declaration_in_entity_in_system1720)
1246
                    signal_declaration20 = self.signal_declaration()
Maxime Perrotin's avatar
Maxime Perrotin committed
1247
1248
1249

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1250
                        self._adaptor.addChild(root_0, signal_declaration20.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1251
1252


1253
                elif alt7 == 2:
1254
                    # sdl92.g:183:19: text_area
Maxime Perrotin's avatar
Maxime Perrotin committed
1255
1256
1257
                    pass 
                    root_0 = self._adaptor.nil()

1258
                    self._state.following.append(self.FOLLOW_text_area_in_entity_in_system1740)
1259
                    text_area21 = self.text_area()
Maxime Perrotin's avatar
Maxime Perrotin committed
1260
1261
1262

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1263
                        self._adaptor.addChild(root_0, text_area21.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1264
1265


1266
                elif alt7 == 3:
1267
                    # sdl92.g:184:19: procedure
Maxime Perrotin's avatar
Maxime Perrotin committed
1268
1269
1270
                    pass 
                    root_0 = self._adaptor.nil()

1271
                    self._state.following.append(self.FOLLOW_procedure_in_entity_in_system1760)
1272
                    procedure22 = self.procedure()
Maxime Perrotin's avatar
Maxime Perrotin committed
1273
1274
1275

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1276
                        self._adaptor.addChild(root_0, procedure22.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1277
1278


1279
                elif alt7 == 4:
1280
                    # sdl92.g:185:19: channel
1281
1282
1283
                    pass 
                    root_0 = self._adaptor.nil()

1284
                    self._state.following.append(self.FOLLOW_channel_in_entity_in_system1780)
1285
                    channel23 = self.channel()
1286
1287
1288

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1289
                        self._adaptor.addChild(root_0, channel23.tree)
1290
1291


1292
                elif alt7 == 5:
1293
                    # sdl92.g:186:19: block_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
1294
1295
1296
                    pass 
                    root_0 = self._adaptor.nil()

1297
                    self._state.following.append(self.FOLLOW_block_definition_in_entity_in_system1800)
1298
                    block_definition24 = self.block_definition()
Maxime Perrotin's avatar
Maxime Perrotin committed
1299
1300
1301

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1302
                        self._adaptor.addChild(root_0, block_definition24.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333


                retval.stop = self.input.LT(-1)

                if self._state.backtracking == 0:

                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
                retval.tree = self._adaptor.errorNode(self.input, retval.start, self.input.LT(-1), re)
        finally:

            pass
        return retval

    # $ANTLR end "entity_in_system"

    class signal_declaration_return(ParserRuleReturnScope):
        def __init__(self):
            super(sdl92Parser.signal_declaration_return, self).__init__()

            self.tree = None




    # $ANTLR start "signal_declaration"
1334
    # sdl92.g:192:1: signal_declaration : ( paramnames )? SIGNAL signal_id ( input_params )? end -> ^( SIGNAL ( paramnames )? signal_id ( input_params )? ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
1335
1336
1337
1338
1339
1340
1341
    def signal_declaration(self, ):

        retval = self.signal_declaration_return()
        retval.start = self.input.LT(1)

        root_0 = None

1342
1343
        SIGNAL26 = None
        paramnames25 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1344

1345
        signal_id27 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1346

1347
        input_params28 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1348

1349
        end29 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1350
1351


1352
        SIGNAL26_tree = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1353
        stream_SIGNAL = RewriteRuleTokenStream(self._adaptor, "token SIGNAL")
1354
        stream_paramnames = RewriteRuleSubtreeStream(self._adaptor, "rule paramnames")
1355
        stream_input_params = RewriteRuleSubtreeStream(self._adaptor, "rule input_params")
1356
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
1357
        stream_signal_id = RewriteRuleSubtreeStream(self._adaptor, "rule signal_id")
Maxime Perrotin's avatar
Maxime Perrotin committed
1358
1359
        try:
            try:
1360
1361
                # sdl92.g:193:9: ( ( paramnames )? SIGNAL signal_id ( input_params )? end -> ^( SIGNAL ( paramnames )? signal_id ( input_params )? ) )
                # sdl92.g:193:17: ( paramnames )? SIGNAL signal_id ( input_params )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
1362
                pass 
1363
                # sdl92.g:193:17: ( paramnames )?
1364
1365
                alt8 = 2
                LA8_0 = self.input.LA(1)
Maxime Perrotin's avatar
Maxime Perrotin committed
1366

1367
                if (LA8_0 == 229) :
1368
1369
                    alt8 = 1
                if alt8 == 1:
Maxime Perrotin's avatar
Maxime Perrotin committed
1370
1371
                    # sdl92.g:0:0: paramnames
                    pass 
1372
                    self._state.following.append(self.FOLLOW_paramnames_in_signal_declaration1833)
1373
                    paramnames25 = self.paramnames()
Maxime Perrotin's avatar
Maxime Perrotin committed
1374
1375
1376

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1377
                        stream_paramnames.add(paramnames25.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1378
1379
1380



1381
                SIGNAL26=self.match(self.input, SIGNAL, self.FOLLOW_SIGNAL_in_signal_declaration1852) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1382
                if self._state.backtracking == 0:
1383
                    stream_SIGNAL.add(SIGNAL26)
1384
                self._state.following.append(self.FOLLOW_signal_id_in_signal_declaration1854)
1385
                signal_id27 = self.signal_id()
Maxime Perrotin's avatar
Maxime Perrotin committed
1386
1387
1388

                self._state.following.pop()
                if self._state.backtracking == 0:
1389
                    stream_signal_id.add(signal_id27.tree)
1390
                # sdl92.g:194:34: ( input_params )?
1391
1392
                alt9 = 2
                LA9_0 = self.input.LA(1)
Maxime Perrotin's avatar
Maxime Perrotin committed
1393

1394
1395
1396
                if (LA9_0 == L_PAREN) :
                    alt9 = 1
                if alt9 == 1:
Maxime Perrotin's avatar
Maxime Perrotin committed
1397
1398
                    # sdl92.g:0:0: input_params
                    pass 
1399
                    self._state.following.append(self.FOLLOW_input_params_in_signal_declaration1856)
1400
                    input_params28 = self.input_params()
Maxime Perrotin's avatar
Maxime Perrotin committed
1401
1402
1403

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1404
                        stream_input_params.add(input_params28.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1405
1406
1407



1408
                self._state.following.append(self.FOLLOW_end_in_signal_declaration1859)
1409
                end29 = self.end()
Maxime Perrotin's avatar
Maxime Perrotin committed
1410
1411
1412

                self._state.following.pop()
                if self._state.backtracking == 0:
1413
                    stream_end.add(end29.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1414
1415

                # AST Rewrite
1416
                # elements: input_params, SIGNAL, paramnames, signal_id
Maxime Perrotin's avatar
Maxime Perrotin committed
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
                # token labels: 
                # rule labels: retval
                # token list labels: 
                # rule list labels: 
                # wildcard labels: 
                if self._state.backtracking == 0:

                    retval.tree = root_0

                    if retval is not None:
                        stream_retval = RewriteRuleSubtreeStream(self._adaptor, "rule retval", retval.tree)
                    else:
                        stream_retval = RewriteRuleSubtreeStream(self._adaptor, "token retval", None)


                    root_0 = self._adaptor.nil()
1433
1434
                    # 195:9: -> ^( SIGNAL ( paramnames )? signal_id ( input_params )? )
                    # sdl92.g:195:17: ^( SIGNAL ( paramnames )? signal_id ( input_params )? )
Maxime Perrotin's avatar
Maxime Perrotin committed
1435
1436
1437
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_SIGNAL.nextNode(), root_1)

1438
                    # sdl92.g:195:26: ( paramnames )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1439
1440
1441
1442
1443
1444
                    if stream_paramnames.hasNext():
                        self._adaptor.addChild(root_1, stream_paramnames.nextTree())


                    stream_paramnames.reset();
                    self._adaptor.addChild(root_1, stream_signal_id.nextTree())
1445
                    # sdl92.g:195:48: ( input_params )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
                    if stream_input_params.hasNext():
                        self._adaptor.addChild(root_1, stream_input_params.nextTree())


                    stream_input_params.reset();

                    self._adaptor.addChild(root_0, root_1)



                    retval.tree = root_0



                retval.stop = self.input.LT(-1)

                if self._state.backtracking == 0:

                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
                retval.tree = self._adaptor.errorNode(self.input, retval.start, self.input.LT(-1), re)
        finally:

            pass
        return retval

    # $ANTLR end "signal_declaration"

    class channel_return(ParserRuleReturnScope):
        def __init__(self):
            super(sdl92Parser.channel_return, self).__init__()

            self.tree = None




    # $ANTLR start "channel"
1489
    # sdl92.g:199:1: channel : CHANNEL channel_id ( route )+ ENDCHANNEL end -> ^( CHANNEL channel_id ( route )+ ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
1490
1491
1492
1493
1494
1495
1496
    def channel(self, ):

        retval = self.channel_return()
        retval.start = self.input.LT(1)

        root_0 = None

1497
1498
1499
        CHANNEL30 = None
        ENDCHANNEL33 = None
        channel_id31 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1500

1501
        route32 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1502

1503
        end34 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1504
1505


1506
1507
        CHANNEL30_tree = None
        ENDCHANNEL33_tree = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1508
1509
1510
        stream_CHANNEL = RewriteRuleTokenStream(self._adaptor, "token CHANNEL")
        stream_ENDCHANNEL = RewriteRuleTokenStream(self._adaptor, "token ENDCHANNEL")
        stream_route = RewriteRuleSubtreeStream(self._adaptor, "rule route")
1511
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
1512
        stream_channel_id = RewriteRuleSubtreeStream(self._adaptor, "rule channel_id")
Maxime Perrotin's avatar
Maxime Perrotin committed
1513
1514
        try:
            try:
1515
1516
                # sdl92.g:200:9: ( CHANNEL channel_id ( route )+ ENDCHANNEL end -> ^( CHANNEL channel_id ( route )+ ) )
                # sdl92.g:200:17: CHANNEL channel_id ( route )+ ENDCHANNEL end
Maxime Perrotin's avatar
Maxime Perrotin committed
1517
                pass 
1518
                CHANNEL30=self.match(self.input, CHANNEL, self.FOLLOW_CHANNEL_in_channel1918) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1519
                if self._state.backtracking == 0:
1520
                    stream_CHANNEL.add(CHANNEL30)
1521
                self._state.following.append(self.FOLLOW_channel_id_in_channel1920)
1522
                channel_id31 = self.channel_id()
Maxime Perrotin's avatar
Maxime Perrotin committed
1523
1524
1525

                self._state.following.pop()
                if self._state.backtracking == 0:
1526
                    stream_channel_id.add(channel_id31.tree)
1527
                # sdl92.g:201:17: ( route )+
1528
1529
1530
1531
                cnt10 = 0
                while True: #loop10
                    alt10 = 2
                    LA10_0 = self.input.LA(1)
Maxime Perrotin's avatar
Maxime Perrotin committed
1532

1533
1534
                    if (LA10_0 == FROM) :
                        alt10 = 1
Maxime Perrotin's avatar
Maxime Perrotin committed
1535
1536


1537
                    if alt10 == 1:
Maxime Perrotin's avatar
Maxime Perrotin committed
1538
1539
                        # sdl92.g:0:0: route
                        pass 
1540
                        self._state.following.append(self.FOLLOW_route_in_channel1938)
1541
                        route32 = self.route()
Maxime Perrotin's avatar
Maxime Perrotin committed
1542
1543
1544

                        self._state.following.pop()
                        if self._state.backtracking == 0:
1545
                            stream_route.add(route32.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1546
1547
1548


                    else:
1549
1550
                        if cnt10 >= 1:
                            break #loop10
Maxime Perrotin's avatar
Maxime Perrotin committed
1551
1552
1553
1554

                        if self._state.backtracking > 0:
                            raise BacktrackingFailed

1555
                        eee = EarlyExitException(10, self.input)
Maxime Perrotin's avatar
Maxime Perrotin committed
1556
1557
                        raise eee

1558
                    cnt10 += 1
1559
                ENDCHANNEL33=self.match(self.input, ENDCHANNEL, self.FOLLOW_ENDCHANNEL_in_channel1957) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1560
                if self._state.backtracking == 0:
1561
                    stream_ENDCHANNEL.add(ENDCHANNEL33)
1562
                self._state.following.append(self.FOLLOW_end_in_channel1959)
1563
                end34 = self.end()
Maxime Perrotin's avatar
Maxime Perrotin committed
1564
1565
1566

                self._state.following.pop()
                if self._state.backtracking == 0:
1567
                    stream_end.add(end34.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1568
1569

                # AST Rewrite
1570
                # elements: CHANNEL, route, channel_id
Maxime Perrotin's avatar
Maxime Perrotin committed
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
                # token labels: 
                # rule labels: retval
                # token list labels: 
                # rule list labels: 
                # wildcard labels: 
                if self._state.backtracking == 0:

                    retval.tree = root_0

                    if retval is not None:
                        stream_retval = RewriteRuleSubtreeStream(self._adaptor, "rule retval", retval.tree)
                    else:
                        stream_retval = RewriteRuleSubtreeStream(self._adaptor, "token retval", None)


                    root_0 = self._adaptor.nil()
1587
1588
                    # 203:9: -> ^( CHANNEL channel_id ( route )+ )
                    # sdl92.g:203:17: ^( CHANNEL channel_id ( route )+ )
Maxime Perrotin's avatar
Maxime Perrotin committed
1589
1590
1591
1592
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_CHANNEL.nextNode(), root_1)

                    self._adaptor.addChild(root_1, stream_channel_id.nextTree())
1593
                    # sdl92.g:203:38: ( route )+
Maxime Perrotin's avatar
Maxime Perrotin committed
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
                    if not (stream_route.hasNext()):
                        raise RewriteEarlyExitException()

                    while stream_route.hasNext():
                        self._adaptor.addChild(root_1, stream_route.nextTree())


                    stream_route.reset()

                    self._adaptor.addChild(root_0, root_1)



                    retval.tree = root_0



                retval.stop = self.input.LT(-1)

                if self._state.backtracking == 0:

                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
                retval.tree = self._adaptor.errorNode(self.input, retval.start, self.input.LT(-1), re)
        finally:

            pass
        return retval

    # $ANTLR end "channel"

    class route_return(ParserRuleReturnScope):
        def __init__(self):
            super(sdl92Parser.route_return, self).__init__()

            self.tree = None




    # $ANTLR start "route"
1640
    # sdl92.g:207:1: route : FROM source_id TO dest_id WITH signal_id ( ',' signal_id )* end -> ^( ROUTE source_id dest_id ( signal_id )+ ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
1641
1642
1643
1644
1645
1646
1647
    def route(self, ):

        retval = self.route_return()
        retval.start = self.input.LT(1)

        root_0 = None

1648
1649
1650
1651
1652
        FROM35 = None
        TO37 = None
        WITH39 = None
        char_literal41 = None
        source_id36 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1653

1654
        dest_id38 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1655

1656
        signal_id40 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1657

1658
        signal_id42 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1659

1660
        end43 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1661
1662


1663
1664
1665
1666
        FROM35_tree = None
        TO37_tree = None
        WITH39_tree = None
        char_literal41_tree = None
1667
        stream_COMMA = RewriteRuleTokenStream(self._adaptor, "token COMMA")
Maxime Perrotin's avatar
Maxime Perrotin committed
1668
1669
1670
        stream_FROM = RewriteRuleTokenStream(self._adaptor, "token FROM")
        stream_TO = RewriteRuleTokenStream(self._adaptor, "token TO")
        stream_WITH = RewriteRuleTokenStream(self._adaptor, "token WITH")
1671
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
Maxime Perrotin's avatar
Maxime Perrotin committed
1672
1673
1674
1675
1676
        stream_source_id = RewriteRuleSubtreeStream(self._adaptor, "rule source_id")
        stream_dest_id = RewriteRuleSubtreeStream(self._adaptor, "rule dest_id")
        stream_signal_id = RewriteRuleSubtreeStream(self._adaptor, "rule signal_id")
        try:
            try:
1677
1678
                # sdl92.g:208:9: ( FROM source_id TO dest_id WITH signal_id ( ',' signal_id )* end -> ^( ROUTE source_id dest_id ( signal_id )+ ) )
                # sdl92.g:208:17: FROM source_id TO dest_id WITH signal_id ( ',' signal_id )* end
Maxime Perrotin's avatar
Maxime Perrotin committed
1679
                pass 
1680
                FROM35=self.match(self.input, FROM, self.FOLLOW_FROM_in_route2015) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1681
                if self._state.backtracking == 0:
1682
                    stream_FROM.add(FROM35)
1683
                self._state.following.append(self.FOLLOW_source_id_in_route2017)
1684
                source_id36 = self.source_id()
Maxime Perrotin's avatar
Maxime Perrotin committed
1685
1686
1687

                self._state.following.pop()
                if self._state.backtracking == 0:
1688
                    stream_source_id.add(source_id36.tree)
1689
                TO37=self.match(self.input, TO, self.FOLLOW_TO_in_route2019) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1690
                if self._state.backtracking == 0:
1691
                    stream_TO.add(TO37)
1692
                self._state.following.append(self.FOLLOW_dest_id_in_route2021)
1693
                dest_id38 = self.dest_id()
Maxime Perrotin's avatar
Maxime Perrotin committed
1694
1695
1696

                self._state.following.pop()
                if self._state.backtracking == 0:
1697
                    stream_dest_id.add(dest_id38.tree)
1698
                WITH39=self.match(self.input, WITH, self.FOLLOW_WITH_in_route2023)