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

# token names
tokenNames = [
    "<invalid>", "<EOR>", "<DOWN>", "<UP>", 
dbarbera's avatar
dbarbera committed
245
246
    "ACTION", "ALL", "ALTERNATIVE", "ANSWER", "ARRAY", "ASN1", "ASSIGN", 
    "BITSTR", "BLOCK", "CHANNEL", "CHOICE", "CIF", "CLOSED_RANGE", "COMMENT", 
247
248
    "COMPOSITE_STATE", "CONDITIONAL", "CONNECT", "CONNECTION", "CONSTANT", 
    "CONSTANTS", "DCL", "DECISION", "DIGITS", "ELSE", "EMPTYSTR", "ENDNEWTYPE", 
249
250
251
    "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", 
252
253
    "INOUT", "INPUT", "INPUT_NONE", "INPUTLIST", "JOIN", "LABEL", "LITERAL", 
    "NEG", "NEWTYPE", "NEXTSTATE", "NUMBER_OF_INSTANCES", "OCTSTR", "OPEN_RANGE", 
254
    "OUTPUT", "OUTPUT_BODY", "PARAM", "PARAMNAMES", "PARAMS", "PAREN", "PFPAR", 
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
    "POINT", "PRIMARY", "PROCEDURE", "PROCEDURE_CALL", "PROCEDURE_NAME", 
    "PROCESS", "PROVIDED", "QUESTION", "RANGE", "RESET", "RETURN", "ROUTE", 
    "SAVE", "SELECTOR", "SEQOF", "SEQUENCE", "SET", "SIGNAL", "SIGNAL_LIST", 
    "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", 
    "WS", "COMMENT2", "Q", "Z", "':'", "'!'", "'(.'", "'.)'", "'ERROR'", 
    "'/* CIF'", "'*/'"
Maxime Perrotin's avatar
Maxime Perrotin committed
277
278
279
280
281
282
283
]




class sdl92Parser(Parser):
    grammarFileName = "sdl92.g"
Maxime Perrotin's avatar
Maxime Perrotin committed
284
285
    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
286
287
288
289
290
291
292
293
    tokenNames = tokenNames

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

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

294
295
296
297
298
299
300
301
302
        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
303
304
            )

305
306
307
308
309
310
311
312
313
        self.dfa38 = self.DFA38(
            self, 38,
            eot = self.DFA38_eot,
            eof = self.DFA38_eof,
            min = self.DFA38_min,
            max = self.DFA38_max,
            accept = self.DFA38_accept,
            special = self.DFA38_special,
            transition = self.DFA38_transition
314
315
            )

316
317
318
319
320
321
322
323
324
        self.dfa45 = self.DFA45(
            self, 45,
            eot = self.DFA45_eot,
            eof = self.DFA45_eof,
            min = self.DFA45_min,
            max = self.DFA45_max,
            accept = self.DFA45_accept,
            special = self.DFA45_special,
            transition = self.DFA45_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
325
326
            )

327
328
329
330
331
332
333
334
335
        self.dfa51 = self.DFA51(
            self, 51,
            eot = self.DFA51_eot,
            eof = self.DFA51_eof,
            min = self.DFA51_min,
            max = self.DFA51_max,
            accept = self.DFA51_accept,
            special = self.DFA51_special,
            transition = self.DFA51_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
336
337
            )

338
339
340
341
342
343
344
345
346
        self.dfa52 = self.DFA52(
            self, 52,
            eot = self.DFA52_eot,
            eof = self.DFA52_eof,
            min = self.DFA52_min,
            max = self.DFA52_max,
            accept = self.DFA52_accept,
            special = self.DFA52_special,
            transition = self.DFA52_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
347
348
            )

349
350
351
352
353
354
355
356
357
        self.dfa56 = self.DFA56(
            self, 56,
            eot = self.DFA56_eot,
            eof = self.DFA56_eof,
            min = self.DFA56_min,
            max = self.DFA56_max,
            accept = self.DFA56_accept,
            special = self.DFA56_special,
            transition = self.DFA56_transition
358
359
            )

360
361
362
363
364
365
366
367
368
        self.dfa81 = self.DFA81(
            self, 81,
            eot = self.DFA81_eot,
            eof = self.DFA81_eof,
            min = self.DFA81_min,
            max = self.DFA81_max,
            accept = self.DFA81_accept,
            special = self.DFA81_special,
            transition = self.DFA81_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
369
370
            )

371
372
373
374
375
376
377
378
379
        self.dfa82 = self.DFA82(
            self, 82,
            eot = self.DFA82_eot,
            eof = self.DFA82_eof,
            min = self.DFA82_min,
            max = self.DFA82_max,
            accept = self.DFA82_accept,
            special = self.DFA82_special,
            transition = self.DFA82_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
380
381
            )

382
383
384
385
386
387
388
389
390
        self.dfa83 = self.DFA83(
            self, 83,
            eot = self.DFA83_eot,
            eof = self.DFA83_eof,
            min = self.DFA83_min,
            max = self.DFA83_max,
            accept = self.DFA83_accept,
            special = self.DFA83_special,
            transition = self.DFA83_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
391
392
            )

393
394
395
396
397
398
399
400
401
        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
402
403
            )

404
405
406
407
408
409
410
411
412
        self.dfa98 = self.DFA98(
            self, 98,
            eot = self.DFA98_eot,
            eof = self.DFA98_eof,
            min = self.DFA98_min,
            max = self.DFA98_max,
            accept = self.DFA98_accept,
            special = self.DFA98_special,
            transition = self.DFA98_transition
413
414
            )

415
416
417
418
419
420
421
422
423
        self.dfa99 = self.DFA99(
            self, 99,
            eot = self.DFA99_eot,
            eof = self.DFA99_eof,
            min = self.DFA99_min,
            max = self.DFA99_max,
            accept = self.DFA99_accept,
            special = self.DFA99_special,
            transition = self.DFA99_transition
424
425
            )

426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
        self.dfa107 = self.DFA107(
            self, 107,
            eot = self.DFA107_eot,
            eof = self.DFA107_eof,
            min = self.DFA107_min,
            max = self.DFA107_max,
            accept = self.DFA107_accept,
            special = self.DFA107_special,
            transition = self.DFA107_transition
            )

        self.dfa104 = self.DFA104(
            self, 104,
            eot = self.DFA104_eot,
            eof = self.DFA104_eof,
            min = self.DFA104_min,
            max = self.DFA104_max,
            accept = self.DFA104_accept,
            special = self.DFA104_special,
            transition = self.DFA104_transition
            )

        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
            )

        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.dfa108 = self.DFA108(
            self, 108,
            eot = self.DFA108_eot,
            eof = self.DFA108_eof,
            min = self.DFA108_min,
            max = self.DFA108_max,
            accept = self.DFA108_accept,
            special = self.DFA108_special,
            transition = self.DFA108_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
479
480
            )

481
482
483
484
485
486
487
488
489
        self.dfa109 = self.DFA109(
            self, 109,
            eot = self.DFA109_eot,
            eof = self.DFA109_eof,
            min = self.DFA109_min,
            max = self.DFA109_max,
            accept = self.DFA109_accept,
            special = self.DFA109_special,
            transition = self.DFA109_transition
490
491
            )

492
493
494
495
496
497
498
499
500
        self.dfa120 = self.DFA120(
            self, 120,
            eot = self.DFA120_eot,
            eof = self.DFA120_eof,
            min = self.DFA120_min,
            max = self.DFA120_max,
            accept = self.DFA120_accept,
            special = self.DFA120_special,
            transition = self.DFA120_transition
501
502
            )

503
504
505
506
507
508
509
510
511
        self.dfa118 = self.DFA118(
            self, 118,
            eot = self.DFA118_eot,
            eof = self.DFA118_eof,
            min = self.DFA118_min,
            max = self.DFA118_max,
            accept = self.DFA118_accept,
            special = self.DFA118_special,
            transition = self.DFA118_transition
512
513
            )

514
515
516
517
518
519
520
521
522
        self.dfa128 = self.DFA128(
            self, 128,
            eot = self.DFA128_eot,
            eof = self.DFA128_eof,
            min = self.DFA128_min,
            max = self.DFA128_max,
            accept = self.DFA128_accept,
            special = self.DFA128_special,
            transition = self.DFA128_transition
523
524
            )

525
526
527
528
529
530
531
532
533
        self.dfa134 = self.DFA134(
            self, 134,
            eot = self.DFA134_eot,
            eof = self.DFA134_eof,
            min = self.DFA134_min,
            max = self.DFA134_max,
            accept = self.DFA134_accept,
            special = self.DFA134_special,
            transition = self.DFA134_transition
534
535
            )

536
537
538
539
540
541
542
543
544
        self.dfa167 = self.DFA167(
            self, 167,
            eot = self.DFA167_eot,
            eof = self.DFA167_eof,
            min = self.DFA167_min,
            max = self.DFA167_max,
            accept = self.DFA167_accept,
            special = self.DFA167_special,
            transition = self.DFA167_transition
545
546
            )

547
548
549
550
551
552
553
554
555
        self.dfa172 = self.DFA172(
            self, 172,
            eot = self.DFA172_eot,
            eof = self.DFA172_eof,
            min = self.DFA172_min,
            max = self.DFA172_max,
            accept = self.DFA172_accept,
            special = self.DFA172_special,
            transition = self.DFA172_transition
556
557
            )

558
559
560
561
562
563
564
565
566
        self.dfa173 = self.DFA173(
            self, 173,
            eot = self.DFA173_eot,
            eof = self.DFA173_eof,
            min = self.DFA173_min,
            max = self.DFA173_max,
            accept = self.DFA173_accept,
            special = self.DFA173_special,
            transition = self.DFA173_transition
567
568
            )

569
570
571
572
573
574
575
576
577
        self.dfa177 = self.DFA177(
            self, 177,
            eot = self.DFA177_eot,
            eof = self.DFA177_eof,
            min = self.DFA177_min,
            max = self.DFA177_max,
            accept = self.DFA177_accept,
            special = self.DFA177_special,
            transition = self.DFA177_transition
578
579
            )

580
581
582
583
584
585
586
587
588
        self.dfa186 = self.DFA186(
            self, 186,
            eot = self.DFA186_eot,
            eof = self.DFA186_eof,
            min = self.DFA186_min,
            max = self.DFA186_max,
            accept = self.DFA186_accept,
            special = self.DFA186_special,
            transition = self.DFA186_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
            )






        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"
621
    # sdl92.g:145:1: pr_file : ( use_clause | system_definition | process_definition )+ ;
Maxime Perrotin's avatar
Maxime Perrotin committed
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
    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:
639
640
                # sdl92.g:146:9: ( ( use_clause | system_definition | process_definition )+ )
                # sdl92.g:146:17: ( use_clause | system_definition | process_definition )+
Maxime Perrotin's avatar
Maxime Perrotin committed
641
642
643
                pass 
                root_0 = self._adaptor.nil()

644
                # sdl92.g:146:17: ( use_clause | system_definition | process_definition )+
Maxime Perrotin's avatar
Maxime Perrotin committed
645
646
647
648
                cnt1 = 0
                while True: #loop1
                    alt1 = 4
                    LA1 = self.input.LA(1)
649
                    if LA1 == 227:
650
651
                        LA1_2 = self.input.LA(2)

652
                        if (LA1_2 == KEEP) :
653
                            alt1 = 1
654
655
                        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
656
657
658


                    elif LA1 == USE:
Maxime Perrotin's avatar
Maxime Perrotin committed
659
660
661
662
663
664
665
                        alt1 = 1
                    elif LA1 == SYSTEM:
                        alt1 = 2
                    elif LA1 == PROCESS:
                        alt1 = 3

                    if alt1 == 1:
666
                        # sdl92.g:146:18: use_clause
Maxime Perrotin's avatar
Maxime Perrotin committed
667
                        pass 
668
                        self._state.following.append(self.FOLLOW_use_clause_in_pr_file1364)
Maxime Perrotin's avatar
Maxime Perrotin committed
669
670
671
672
673
674
675
676
                        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:
677
                        # sdl92.g:147:19: system_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
678
                        pass 
679
                        self._state.following.append(self.FOLLOW_system_definition_in_pr_file1384)
Maxime Perrotin's avatar
Maxime Perrotin committed
680
681
682
683
684
685
686
687
                        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:
688
                        # sdl92.g:148:19: process_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
689
                        pass 
690
                        self._state.following.append(self.FOLLOW_process_definition_in_pr_file1404)
Maxime Perrotin's avatar
Maxime Perrotin committed
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
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
                        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"
741
    # sdl92.g:152: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
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
    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
        stream_ENDSYSTEM = RewriteRuleTokenStream(self._adaptor, "token ENDSYSTEM")
        stream_SYSTEM = RewriteRuleTokenStream(self._adaptor, "token SYSTEM")
        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:
771
772
                # sdl92.g:153:9: ( SYSTEM system_name end ( entity_in_system )* ENDSYSTEM ( system_name )? end -> ^( SYSTEM system_name ( entity_in_system )* ) )
                # sdl92.g:153:17: SYSTEM system_name end ( entity_in_system )* ENDSYSTEM ( system_name )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
773
                pass 
774
                SYSTEM4=self.match(self.input, SYSTEM, self.FOLLOW_SYSTEM_in_system_definition1438) 
Maxime Perrotin's avatar
Maxime Perrotin committed
775
776
                if self._state.backtracking == 0:
                    stream_SYSTEM.add(SYSTEM4)
777
                self._state.following.append(self.FOLLOW_system_name_in_system_definition1440)
Maxime Perrotin's avatar
Maxime Perrotin committed
778
779
780
781
782
                system_name5 = self.system_name()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_system_name.add(system_name5.tree)
783
                self._state.following.append(self.FOLLOW_end_in_system_definition1442)
Maxime Perrotin's avatar
Maxime Perrotin committed
784
785
786
787
788
                end6 = self.end()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_end.add(end6.tree)
789
                # sdl92.g:154:17: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
790
791
792
793
                while True: #loop2
                    alt2 = 2
                    LA2_0 = self.input.LA(1)

794
                    if ((BLOCK <= LA2_0 <= CHANNEL) or LA2_0 == PROCEDURE or LA2_0 == SIGNAL or LA2_0 == 227) :
Maxime Perrotin's avatar
Maxime Perrotin committed
795
796
797
798
799
800
                        alt2 = 1


                    if alt2 == 1:
                        # sdl92.g:0:0: entity_in_system
                        pass 
801
                        self._state.following.append(self.FOLLOW_entity_in_system_in_system_definition1460)
Maxime Perrotin's avatar
Maxime Perrotin committed
802
803
804
805
806
807
808
809
810
                        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
811
                ENDSYSTEM8=self.match(self.input, ENDSYSTEM, self.FOLLOW_ENDSYSTEM_in_system_definition1479) 
Maxime Perrotin's avatar
Maxime Perrotin committed
812
813
                if self._state.backtracking == 0:
                    stream_ENDSYSTEM.add(ENDSYSTEM8)
814
                # sdl92.g:155:27: ( system_name )?
Maxime Perrotin's avatar
Maxime Perrotin committed
815
816
817
818
819
820
821
822
                alt3 = 2
                LA3_0 = self.input.LA(1)

                if (LA3_0 == ID) :
                    alt3 = 1
                if alt3 == 1:
                    # sdl92.g:0:0: system_name
                    pass 
823
                    self._state.following.append(self.FOLLOW_system_name_in_system_definition1481)
Maxime Perrotin's avatar
Maxime Perrotin committed
824
825
826
827
828
829
830
831
                    system_name9 = self.system_name()

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



832
                self._state.following.append(self.FOLLOW_end_in_system_definition1484)
Maxime Perrotin's avatar
Maxime Perrotin committed
833
834
835
836
837
838
839
                end10 = self.end()

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

                # AST Rewrite
840
                # elements: system_name, entity_in_system, SYSTEM
Maxime Perrotin's avatar
Maxime Perrotin committed
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
                # 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()
857
858
                    # 156:9: -> ^( SYSTEM system_name ( entity_in_system )* )
                    # sdl92.g:156:17: ^( SYSTEM system_name ( entity_in_system )* )
Maxime Perrotin's avatar
Maxime Perrotin committed
859
860
861
862
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_SYSTEM.nextNode(), root_1)

                    self._adaptor.addChild(root_1, stream_system_name.nextTree())
863
                    # sdl92.g:156:38: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
                    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"
907
    # sdl92.g:160: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
908
909
910
911
912
913
914
915
    def use_clause(self, ):

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

        root_0 = None

        USE12 = None
916
        char_literal14 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
917
918
919
920
        use_asn111 = None

        package_name13 = None

921
922
923
        def_selection_list15 = None

        end16 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
924
925
926


        USE12_tree = None
927
        char_literal14_tree = None
Maxime Perrotin's avatar
Maxime Perrotin committed
928
        stream_USE = RewriteRuleTokenStream(self._adaptor, "token USE")
929
        stream_DIV = RewriteRuleTokenStream(self._adaptor, "token DIV")
Maxime Perrotin's avatar
Maxime Perrotin committed
930
931
        stream_use_asn1 = RewriteRuleSubtreeStream(self._adaptor, "rule use_asn1")
        stream_package_name = RewriteRuleSubtreeStream(self._adaptor, "rule package_name")
932
        stream_def_selection_list = RewriteRuleSubtreeStream(self._adaptor, "rule def_selection_list")
Maxime Perrotin's avatar
Maxime Perrotin committed
933
934
935
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
        try:
            try:
936
937
                # sdl92.g:161:9: ( ( use_asn1 )? USE package_name ( '/' def_selection_list )? end -> ^( USE ( use_asn1 )? ( end )? package_name ( def_selection_list )? ) )
                # sdl92.g:161:17: ( use_asn1 )? USE package_name ( '/' def_selection_list )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
938
                pass 
939
                # sdl92.g:161:17: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
940
941
942
                alt4 = 2
                LA4_0 = self.input.LA(1)

943
                if (LA4_0 == 227) :
Maxime Perrotin's avatar
Maxime Perrotin committed
944
945
946
947
                    alt4 = 1
                if alt4 == 1:
                    # sdl92.g:0:0: use_asn1
                    pass 
948
                    self._state.following.append(self.FOLLOW_use_asn1_in_use_clause1540)
Maxime Perrotin's avatar
Maxime Perrotin committed
949
950
951
952
953
954
955
956
                    use_asn111 = self.use_asn1()

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



957
                USE12=self.match(self.input, USE, self.FOLLOW_USE_in_use_clause1559) 
Maxime Perrotin's avatar
Maxime Perrotin committed
958
959
                if self._state.backtracking == 0:
                    stream_USE.add(USE12)
960
                self._state.following.append(self.FOLLOW_package_name_in_use_clause1561)
Maxime Perrotin's avatar
Maxime Perrotin committed
961
962
963
964
965
                package_name13 = self.package_name()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_package_name.add(package_name13.tree)
966
                # sdl92.g:163:17: ( '/' def_selection_list )?
967
968
969
970
971
972
                alt5 = 2
                LA5_0 = self.input.LA(1)

                if (LA5_0 == DIV) :
                    alt5 = 1
                if alt5 == 1:
973
                    # sdl92.g:163:18: '/' def_selection_list
974
                    pass 
975
                    char_literal14=self.match(self.input, DIV, self.FOLLOW_DIV_in_use_clause1580) 
976
977
                    if self._state.backtracking == 0:
                        stream_DIV.add(char_literal14)
978
                    self._state.following.append(self.FOLLOW_def_selection_list_in_use_clause1582)
979
980
981
982
983
984
985
986
                    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)



987
                self._state.following.append(self.FOLLOW_end_in_use_clause1603)
988
                end16 = self.end()
Maxime Perrotin's avatar
Maxime Perrotin committed
989
990
991

                self._state.following.pop()
                if self._state.backtracking == 0:
992
                    stream_end.add(end16.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
993
994

                # AST Rewrite
995
                # elements: use_asn1, USE, package_name, end, def_selection_list
Maxime Perrotin's avatar
Maxime Perrotin committed
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
                # 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()
1012
1013
                    # 165:9: -> ^( USE ( use_asn1 )? ( end )? package_name ( def_selection_list )? )
                    # sdl92.g:165:17: ^( USE ( use_asn1 )? ( end )? package_name ( def_selection_list )? )
Maxime Perrotin's avatar
Maxime Perrotin committed
1014
1015
1016
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_USE.nextNode(), root_1)

1017
                    # sdl92.g:165:23: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1018
1019
1020
1021
1022
                    if stream_use_asn1.hasNext():
                        self._adaptor.addChild(root_1, stream_use_asn1.nextTree())


                    stream_use_asn1.reset();
1023
                    # sdl92.g:165:33: ( end )?
1024
1025
1026
1027
1028
                    if stream_end.hasNext():
                        self._adaptor.addChild(root_1, stream_end.nextTree())


                    stream_end.reset();
Maxime Perrotin's avatar
Maxime Perrotin committed
1029
                    self._adaptor.addChild(root_1, stream_package_name.nextTree())
1030
                    # sdl92.g:165:51: ( def_selection_list )?
1031
1032
1033
1034
1035
                    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
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063

                    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"

1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
    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"
1074
    # sdl92.g:172:1: def_selection_list : ID ( ',' ID )* ;
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
    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:
1092
1093
                # sdl92.g:173:9: ( ID ( ',' ID )* )
                # sdl92.g:173:17: ID ( ',' ID )*
1094
1095
1096
                pass 
                root_0 = self._adaptor.nil()

1097
                ID17=self.match(self.input, ID, self.FOLLOW_ID_in_def_selection_list1667)
1098
1099
1100
1101
1102
                if self._state.backtracking == 0:

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

1103
                # sdl92.g:173:20: ( ',' ID )*
1104
1105
1106
1107
1108
1109
1110
1111
1112
                while True: #loop6
                    alt6 = 2
                    LA6_0 = self.input.LA(1)

                    if (LA6_0 == COMMA) :
                        alt6 = 1


                    if alt6 == 1:
1113
                        # sdl92.g:173:21: ',' ID
1114
                        pass 
1115
1116
                        char_literal18=self.match(self.input, COMMA, self.FOLLOW_COMMA_in_def_selection_list1670)
                        ID19=self.match(self.input, ID, self.FOLLOW_ID_in_def_selection_list1673)
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
                        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
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
    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"
1158
    # sdl92.g:180:1: entity_in_system : ( signal_declaration | text_area | procedure | channel | block_definition );
Maxime Perrotin's avatar
Maxime Perrotin committed
1159
1160
1161
1162
1163
1164
1165
    def entity_in_system(self, ):

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

        root_0 = None

1166
        signal_declaration20 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1167

1168
        text_area21 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1169

1170
        procedure22 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1171

1172
        channel23 = None
1173

1174
        block_definition24 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1175
1176
1177
1178
1179



        try:
            try:
1180
                # sdl92.g:181:9: ( signal_declaration | text_area | procedure | channel | block_definition )
1181
1182
                alt7 = 5
                LA7 = self.input.LA(1)
1183
                if LA7 == 227:
1184
1185
1186
1187
1188
1189
1190
1191
                    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
1192
1193
1194
1195
                    else:
                        if self._state.backtracking > 0:
                            raise BacktrackingFailed

1196
                        nvae = NoViableAltException("", 7, 1, self.input)
Maxime Perrotin's avatar
Maxime Perrotin committed
1197
1198
1199

                        raise nvae

1200
1201
1202
1203
1204
1205
1206
1207
                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
1208
1209
1210
1211
                else:
                    if self._state.backtracking > 0:
                        raise BacktrackingFailed

1212
                    nvae = NoViableAltException("", 7, 0, self.input)
Maxime Perrotin's avatar
Maxime Perrotin committed
1213
1214
1215

                    raise nvae

1216
                if alt7 == 1:
1217
                    # sdl92.g:181:17: signal_declaration
Maxime Perrotin's avatar
Maxime Perrotin committed
1218
1219
1220
                    pass 
                    root_0 = self._adaptor.nil()

1221
                    self._state.following.append(self.FOLLOW_signal_declaration_in_entity_in_system1709)
1222
                    signal_declaration20 = self.signal_declaration()
Maxime Perrotin's avatar
Maxime Perrotin committed
1223
1224
1225

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


1229
                elif alt7 == 2:
1230
                    # sdl92.g:182:19: text_area
Maxime Perrotin's avatar
Maxime Perrotin committed
1231
1232
1233
                    pass 
                    root_0 = self._adaptor.nil()

1234
                    self._state.following.append(self.FOLLOW_text_area_in_entity_in_system1729)
1235
                    text_area21 = self.text_area()
Maxime Perrotin's avatar
Maxime Perrotin committed
1236
1237
1238

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


1242
                elif alt7 == 3:
1243
                    # sdl92.g:183:19: procedure
Maxime Perrotin's avatar
Maxime Perrotin committed
1244
1245
1246
                    pass 
                    root_0 = self._adaptor.nil()

1247
                    self._state.following.append(self.FOLLOW_procedure_in_entity_in_system1749)
1248
                    procedure22 = self.procedure()
Maxime Perrotin's avatar
Maxime Perrotin committed
1249
1250
1251

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


1255
                elif alt7 == 4:
1256
                    # sdl92.g:184:19: channel
1257
1258
1259
                    pass 
                    root_0 = self._adaptor.nil()

1260
                    self._state.following.append(self.FOLLOW_channel_in_entity_in_system1769)
1261
                    channel23 = self.channel()
1262
1263
1264

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1265
                        self._adaptor.addChild(root_0, channel23.tree)
1266
1267


1268
                elif alt7 == 5:
1269
                    # sdl92.g:185:19: block_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
1270
1271
1272
                    pass 
                    root_0 = self._adaptor.nil()

1273
                    self._state.following.append(self.FOLLOW_block_definition_in_entity_in_system1789)
1274
                    block_definition24 = self.block_definition()
Maxime Perrotin's avatar
Maxime Perrotin committed
1275
1276
1277

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1278
                        self._adaptor.addChild(root_0, block_definition24.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309


                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"
1310
    # sdl92.g:191:1: signal_declaration : ( paramnames )? SIGNAL signal_id ( input_params )? end -> ^( SIGNAL ( paramnames )? signal_id ( input_params )? ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
1311
1312
1313
1314
1315
1316
1317
    def signal_declaration(self, ):

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

        root_0 = None

1318
1319
        SIGNAL26 = None
        paramnames25 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1320

1321
        signal_id27 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1322

1323
        input_params28 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1324

1325
        end29 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1326
1327


1328
        SIGNAL26_tree = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1329
1330
1331
1332
1333
1334
1335
        stream_SIGNAL = RewriteRuleTokenStream(self._adaptor, "token SIGNAL")
        stream_input_params = RewriteRuleSubtreeStream(self._adaptor, "rule input_params")
        stream_paramnames = RewriteRuleSubtreeStream(self._adaptor, "rule paramnames")
        stream_signal_id = RewriteRuleSubtreeStream(self._adaptor, "rule signal_id")
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
        try:
            try:
1336
1337
                # sdl92.g:192:9: ( ( paramnames )? SIGNAL signal_id ( input_params )? end -> ^( SIGNAL ( paramnames )? signal_id ( input_params )? ) )
                # sdl92.g:192:17: ( paramnames )? SIGNAL signal_id ( input_params )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
1338
                pass 
1339
                # sdl92.g:192:17: ( paramnames )?
1340
1341
                alt8 = 2
                LA8_0 = self.input.LA(1)
Maxime Perrotin's avatar
Maxime Perrotin committed
1342

1343
                if (LA8_0 == 227) :
1344
1345
                    alt8 = 1
                if alt8 == 1:
Maxime Perrotin's avatar
Maxime Perrotin committed
1346
1347
                    # sdl92.g:0:0: paramnames
                    pass 
1348
                    self._state.following.append(self.FOLLOW_paramnames_in_signal_declaration1822)
1349
                    paramnames25 = self.paramnames()
Maxime Perrotin's avatar
Maxime Perrotin committed
1350
1351
1352

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1353
                        stream_paramnames.add(paramnames25.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1354
1355
1356



1357
                SIGNAL26=self.match(self.input, SIGNAL, self.FOLLOW_SIGNAL_in_signal_declaration1841) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1358
                if self._state.backtracking == 0:
1359
                    stream_SIGNAL.add(SIGNAL26)
1360
                self._state.following.append(self.FOLLOW_signal_id_in_signal_declaration1843)
1361
                signal_id27 = self.signal_id()
Maxime Perrotin's avatar
Maxime Perrotin committed
1362
1363
1364

                self._state.following.pop()
                if self._state.backtracking == 0:
1365
                    stream_signal_id.add(signal_id27.tree)
1366
                # sdl92.g:193:34: ( input_params )?
1367
1368
                alt9 = 2
                LA9_0 = self.input.LA(1)
Maxime Perrotin's avatar
Maxime Perrotin committed
1369

1370
1371
1372
                if (LA9_0 == L_PAREN) :
                    alt9 = 1
                if alt9 == 1:
Maxime Perrotin's avatar
Maxime Perrotin committed
1373
1374
                    # sdl92.g:0:0: input_params
                    pass 
1375
                    self._state.following.append(self.FOLLOW_input_params_in_signal_declaration1845)
1376
                    input_params28 = self.input_params()
Maxime Perrotin's avatar
Maxime Perrotin committed
1377
1378
1379

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1380
                        stream_input_params.add(input_params28.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1381
1382
1383



1384
                self._state.following.append(self.FOLLOW_end_in_signal_declaration1848)
1385
                end29 = self.end()
Maxime Perrotin's avatar
Maxime Perrotin committed
1386
1387
1388

                self._state.following.pop()
                if self._state.backtracking == 0:
1389
                    stream_end.add(end29.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1390
1391

                # AST Rewrite
1392
                # elements: SIGNAL, paramnames, input_params, signal_id
Maxime Perrotin's avatar
Maxime Perrotin committed
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
                # 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()
1409
1410
                    # 194:9: -> ^( SIGNAL ( paramnames )? signal_id ( input_params )? )
                    # sdl92.g:194:17: ^( SIGNAL ( paramnames )? signal_id ( input_params )? )
Maxime Perrotin's avatar
Maxime Perrotin committed
1411
1412
1413
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_SIGNAL.nextNode(), root_1)

1414
                    # sdl92.g:194:26: ( paramnames )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1415
1416
1417
1418
1419
1420
                    if stream_paramnames.hasNext():
                        self._adaptor.addChild(root_1, stream_paramnames.nextTree())


                    stream_paramnames.reset();
                    self._adaptor.addChild(root_1, stream_signal_id.nextTree())
1421
                    # sdl92.g:194:48: ( input_params )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
                    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"
1465
    # sdl92.g:198:1: channel : CHANNEL channel_id ( route )+ ENDCHANNEL end -> ^( CHANNEL channel_id ( route )+ ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
1466
1467
1468
1469
1470
1471
1472
    def channel(self, ):

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

        root_0 = None

1473
1474
1475
        CHANNEL30 = None
        ENDCHANNEL33 = None
        channel_id31 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1476

1477
        route32 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1478

1479
        end34 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1480
1481


1482
1483
        CHANNEL30_tree = None
        ENDCHANNEL33_tree = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1484
1485
1486
1487
1488
1489
1490
        stream_CHANNEL = RewriteRuleTokenStream(self._adaptor, "token CHANNEL")
        stream_ENDCHANNEL = RewriteRuleTokenStream(self._adaptor, "token ENDCHANNEL")
        stream_route = RewriteRuleSubtreeStream(self._adaptor, "rule route")
        stream_channel_id = RewriteRuleSubtreeStream(self._adaptor, "rule channel_id")
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
        try:
            try:
1491
1492
                # sdl92.g:199:9: ( CHANNEL channel_id ( route )+ ENDCHANNEL end -> ^( CHANNEL channel_id ( route )+ ) )
                # sdl92.g:199:17: CHANNEL channel_id ( route )+ ENDCHANNEL end
Maxime Perrotin's avatar
Maxime Perrotin committed
1493
                pass 
1494
                CHANNEL30=self.match(self.input, CHANNEL, self.FOLLOW_CHANNEL_in_channel1907) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1495
                if self._state.backtracking == 0:
1496
                    stream_CHANNEL.add(CHANNEL30)
1497
                self._state.following.append(self.FOLLOW_channel_id_in_channel1909)
1498
                channel_id31 = self.channel_id()
Maxime Perrotin's avatar
Maxime Perrotin committed
1499
1500
1501

                self._state.following.pop()
                if self._state.backtracking == 0:
1502
                    stream_channel_id.add(channel_id31.tree)
1503
                # sdl92.g:200:17: ( route )+
1504
1505
1506
1507
                cnt10 = 0
                while True: #loop10
                    alt10 = 2
                    LA10_0 = self.input.LA(1)
Maxime Perrotin's avatar
Maxime Perrotin committed
1508

1509
1510
                    if (LA10_0 == FROM) :
                        alt10 = 1
Maxime Perrotin's avatar
Maxime Perrotin committed
1511
1512


1513
                    if alt10 == 1:
Maxime Perrotin's avatar
Maxime Perrotin committed
1514
1515
                        # sdl92.g:0:0: route
                        pass 
1516
                        self._state.following.append(self.FOLLOW_route_in_channel1927)
1517
                        route32 = self.route()
Maxime Perrotin's avatar
Maxime Perrotin committed
1518
1519
1520

                        self._state.following.pop()
                        if self._state.backtracking == 0:
1521
                            stream_route.add(route32.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1522
1523
1524


                    else:
1525
1526
                        if cnt10 >= 1:
                            break #loop10
Maxime Perrotin's avatar
Maxime Perrotin committed
1527
1528
1529
1530

                        if self._state.backtracking > 0:
                            raise BacktrackingFailed

1531
                        eee = EarlyExitException(10, self.input)
Maxime Perrotin's avatar
Maxime Perrotin committed
1532
1533
                        raise eee

1534
                    cnt10 += 1
1535
                ENDCHANNEL33=self.match(self.input, ENDCHANNEL, self.FOLLOW_ENDCHANNEL_in_channel1946) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1536
                if self._state.backtracking == 0:
1537
                    stream_ENDCHANNEL.add(ENDCHANNEL33)
1538
                self._state.following.append(self.FOLLOW_end_in_channel1948)
1539
                end34 = self.end()
Maxime Perrotin's avatar
Maxime Perrotin committed
1540
1541
1542

                self._state.following.pop()
                if self._state.backtracking == 0:
1543
                    stream_end.add(end34.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1544
1545

                # AST Rewrite
1546
                # elements: channel_id, route, CHANNEL
Maxime Perrotin's avatar
Maxime Perrotin committed
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
                # 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()
1563
1564
                    # 202:9: -> ^( CHANNEL channel_id ( route )+ )
                    # sdl92.g:202:17: ^( CHANNEL channel_id ( route )+ )
Maxime Perrotin's avatar
Maxime Perrotin committed
1565
1566
1567
1568
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_CHANNEL.nextNode(), root_1)

                    self._adaptor.addChild(root_1, stream_channel_id.nextTree())
1569
                    # sdl92.g:202:38: ( route )+
Maxime Perrotin's avatar
Maxime Perrotin committed
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
                    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"
1616
    # sdl92.g:206: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
1617
1618
1619
1620
1621
1622
1623
    def route(self, ):

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

        root_0 = None

1624
1625
1626
1627
1628
        FROM35 = None
        TO37 = None
        WITH39 = None
        char_literal41 = None
        source_id36 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1629

1630
        dest_id38 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1631

1632
        signal_id40 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1633

1634
        signal_id42 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1635

1636
        end43 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1637
1638


1639
1640
1641
1642
        FROM35_tree = None
        TO37_tree = None
        WITH39_tree = None
        char_literal41_tree = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
        stream_FROM = RewriteRuleTokenStream(self._adaptor, "token FROM")
        stream_TO = RewriteRuleTokenStream(self._adaptor, "token TO")
        stream_COMMA = RewriteRuleTokenStream(self._adaptor, "token COMMA")
        stream_WITH = RewriteRuleTokenStream(self._adaptor, "token WITH")
        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")
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
        try:
            try:
1653
1654
                # sdl92.g:207:9: ( FROM source_id TO dest_id WITH signal_id ( ',' signal_id )* end -> ^( ROUTE source_id dest_id ( signal_id )+ ) )
                # sdl92.g:207:17: FROM source_id TO dest_id WITH signal_id ( ',' signal_id )* end
Maxime Perrotin's avatar
Maxime Perrotin committed
1655
                pass 
1656
                FROM35=self.match(self.input, FROM, self.FOLLOW_FROM_in_route2004) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1657
                if self._state.backtracking == 0:
1658
                    stream_FROM.add(FROM35)
1659
                self._state.following.append(self.FOLLOW_source_id_in_route2006)
1660
                source_id36 = self.source_id()
Maxime Perrotin's avatar
Maxime Perrotin committed
1661
1662
1663

                self._state.following.pop()
                if self._state.backtracking == 0:
1664
                    stream_source_id.add(source_id36.tree)
1665
                TO37=self.match(self.input, TO, self.FOLLOW_TO_in_route2008) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1666
                if self._state.backtracking == 0:
1667
                    stream_TO.add(TO37)
1668
                self._state.following.append(self.FOLLOW_dest_id_in_route2010)
1669
                dest_id38 = self.dest_id()
Maxime Perrotin's avatar
Maxime Perrotin committed
1670
1671
1672

                self._state.following.pop()
                if self._state.backtracking == 0:
1673
                    stream_dest_id.add(dest_id38.tree)
1674
                WITH39=self.match(self.input, WITH, self.FOLLOW_WITH_in_route2012) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1675
                if self._state.backtracking == 0:
1676
                    stream_WITH.add(WITH39)