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

# token names
tokenNames = [
    "<invalid>", "<EOR>", "<DOWN>", "<UP>", 
dbarbera's avatar
dbarbera committed
239
240
    "ACTION", "ALL", "ALTERNATIVE", "ANSWER", "ARRAY", "ASN1", "ASSIGN", 
    "BITSTR", "BLOCK", "CHANNEL", "CHOICE", "CIF", "CLOSED_RANGE", "COMMENT", 
241
242
243
244
245
246
247
    "COMPOSITE_STATE", "CONDITIONAL", "CONNECT", "CONNECTION", "CONSTANT", 
    "CONSTANTS", "DCL", "DECISION", "DIGITS", "ELSE", "EMPTYSTR", "ENDNEWTYPE", 
    "ENDSYNTYPE", "ENDTEXT", "EXPORT", "EXPRESSION", "EXTERNAL", "FI", "FIELD", 
    "FIELD_NAME", "FIELDS", "FLOAT2", "FLOAT", "FLOATING_LABEL", "FOR", 
    "FPAR", "GROUND", "HYPERLINK", "IF", "IFTHENELSE", "IN", "INFORMAL_TEXT", 
    "INOUT", "INPUT", "INPUT_NONE", "INPUTLIST", "JOIN", "LABEL", "LITERAL", 
    "NEG", "NEWTYPE", "NEXTSTATE", "NUMBER_OF_INSTANCES", "OCTSTR", "OPEN_RANGE", 
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
    "OUTPUT", "OUTPUT_BODY", "PARAM", "PARAMNAMES", "PARAMS", "PAREN", "PFPAR", 
    "PRIMARY", "PROCEDURE", "PROCEDURE_CALL", "PROCEDURE_NAME", "PROCESS", 
    "PROVIDED", "QUESTION", "RANGE", "RESET", "RETURN", "ROUTE", "SAVE", 
    "SELECTOR", "SEQOF", "SEQUENCE", "SET", "SIGNAL", "SIGNAL_LIST", "SORT", 
    "STATE", "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", "INT", 
    "START", "ENDCONNECTION", "SEMI", "ENDSTATE", "ASTERISK", "SUBSTRUCTURE", 
    "ENDSUBSTRUCTURE", "OUT", "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
270
271
272
273
274
275
276
]




class sdl92Parser(Parser):
    grammarFileName = "sdl92.g"
Maxime Perrotin's avatar
Maxime Perrotin committed
277
278
    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
279
280
281
282
283
284
285
286
    tokenNames = tokenNames

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

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

287
288
289
290
291
292
293
294
295
        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
296
297
            )

298
299
300
301
302
303
304
305
306
        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
307
308
            )

309
310
311
312
313
314
315
316
317
        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
318
319
            )

320
321
322
323
324
325
326
327
328
        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
329
330
            )

331
332
333
334
335
336
337
338
339
        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
340
341
            )

342
343
344
345
346
347
348
349
350
        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
351
352
            )

353
354
355
356
357
358
359
360
361
        self.dfa74 = self.DFA74(
            self, 74,
            eot = self.DFA74_eot,
            eof = self.DFA74_eof,
            min = self.DFA74_min,
            max = self.DFA74_max,
            accept = self.DFA74_accept,
            special = self.DFA74_special,
            transition = self.DFA74_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
362
363
            )

364
365
366
367
368
369
370
371
372
        self.dfa75 = self.DFA75(
            self, 75,
            eot = self.DFA75_eot,
            eof = self.DFA75_eof,
            min = self.DFA75_min,
            max = self.DFA75_max,
            accept = self.DFA75_accept,
            special = self.DFA75_special,
            transition = self.DFA75_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
373
374
            )

375
376
377
378
379
380
381
382
383
        self.dfa76 = self.DFA76(
            self, 76,
            eot = self.DFA76_eot,
            eof = self.DFA76_eof,
            min = self.DFA76_min,
            max = self.DFA76_max,
            accept = self.DFA76_accept,
            special = self.DFA76_special,
            transition = self.DFA76_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
384
385
            )

386
387
388
389
390
391
392
393
394
        self.dfa80 = self.DFA80(
            self, 80,
            eot = self.DFA80_eot,
            eof = self.DFA80_eof,
            min = self.DFA80_min,
            max = self.DFA80_max,
            accept = self.DFA80_accept,
            special = self.DFA80_special,
            transition = self.DFA80_transition
395
396
            )

397
398
399
400
401
402
403
404
405
        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
406
407
            )

408
409
410
411
412
413
414
415
416
        self.dfa92 = self.DFA92(
            self, 92,
            eot = self.DFA92_eot,
            eof = self.DFA92_eof,
            min = self.DFA92_min,
            max = self.DFA92_max,
            accept = self.DFA92_accept,
            special = self.DFA92_special,
            transition = self.DFA92_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
417
418
            )

419
420
421
422
423
424
425
426
427
        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
Maxime Perrotin's avatar
Maxime Perrotin committed
428
429
            )

430
431
432
433
434
435
436
437
438
        self.dfa97 = self.DFA97(
            self, 97,
            eot = self.DFA97_eot,
            eof = self.DFA97_eof,
            min = self.DFA97_min,
            max = self.DFA97_max,
            accept = self.DFA97_accept,
            special = self.DFA97_special,
            transition = self.DFA97_transition
439
440
            )

441
442
443
444
445
446
447
448
449
        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
450
451
            )

452
453
454
455
456
457
458
459
460
        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
461
462
            )

463
464
465
466
467
468
469
470
471
        self.dfa101 = self.DFA101(
            self, 101,
            eot = self.DFA101_eot,
            eof = self.DFA101_eof,
            min = self.DFA101_min,
            max = self.DFA101_max,
            accept = self.DFA101_accept,
            special = self.DFA101_special,
            transition = self.DFA101_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
472
473
            )

474
475
476
477
478
479
480
481
482
        self.dfa102 = self.DFA102(
            self, 102,
            eot = self.DFA102_eot,
            eof = self.DFA102_eof,
            min = self.DFA102_min,
            max = self.DFA102_max,
            accept = self.DFA102_accept,
            special = self.DFA102_special,
            transition = self.DFA102_transition
483
484
            )

485
486
487
488
489
490
491
492
493
        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
494
495
            )

496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
        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
            )

        self.dfa121 = self.DFA121(
            self, 121,
            eot = self.DFA121_eot,
            eof = self.DFA121_eof,
            min = self.DFA121_min,
            max = self.DFA121_max,
            accept = self.DFA121_accept,
            special = self.DFA121_special,
            transition = self.DFA121_transition
516
517
            )

518
519
520
521
522
523
524
525
526
        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
527
528
            )

529
530
531
532
533
534
535
536
537
        self.dfa160 = self.DFA160(
            self, 160,
            eot = self.DFA160_eot,
            eof = self.DFA160_eof,
            min = self.DFA160_min,
            max = self.DFA160_max,
            accept = self.DFA160_accept,
            special = self.DFA160_special,
            transition = self.DFA160_transition
538
539
            )

540
541
542
543
544
545
546
547
548
        self.dfa165 = self.DFA165(
            self, 165,
            eot = self.DFA165_eot,
            eof = self.DFA165_eof,
            min = self.DFA165_min,
            max = self.DFA165_max,
            accept = self.DFA165_accept,
            special = self.DFA165_special,
            transition = self.DFA165_transition
549
550
            )

551
552
553
554
555
556
557
558
559
        self.dfa166 = self.DFA166(
            self, 166,
            eot = self.DFA166_eot,
            eof = self.DFA166_eof,
            min = self.DFA166_min,
            max = self.DFA166_max,
            accept = self.DFA166_accept,
            special = self.DFA166_special,
            transition = self.DFA166_transition
560
561
            )

562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
        self.dfa170 = self.DFA170(
            self, 170,
            eot = self.DFA170_eot,
            eof = self.DFA170_eof,
            min = self.DFA170_min,
            max = self.DFA170_max,
            accept = self.DFA170_accept,
            special = self.DFA170_special,
            transition = self.DFA170_transition
            )

        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
Maxime Perrotin's avatar
Maxime Perrotin committed
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
613
            )






        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"
614
    # sdl92.g:141:1: pr_file : ( use_clause | system_definition | process_definition )+ ;
Maxime Perrotin's avatar
Maxime Perrotin committed
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
    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:
632
633
                # sdl92.g:142:9: ( ( use_clause | system_definition | process_definition )+ )
                # sdl92.g:142:17: ( use_clause | system_definition | process_definition )+
Maxime Perrotin's avatar
Maxime Perrotin committed
634
635
636
                pass 
                root_0 = self._adaptor.nil()

637
                # sdl92.g:142:17: ( use_clause | system_definition | process_definition )+
Maxime Perrotin's avatar
Maxime Perrotin committed
638
639
640
641
                cnt1 = 0
                while True: #loop1
                    alt1 = 4
                    LA1 = self.input.LA(1)
642
                    if LA1 == 221:
643
644
                        LA1_2 = self.input.LA(2)

645
                        if (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) :
646
                            alt1 = 3
647
648
                        elif (LA1_2 == KEEP) :
                            alt1 = 1
649
650
651


                    elif LA1 == USE:
Maxime Perrotin's avatar
Maxime Perrotin committed
652
653
654
655
656
657
658
                        alt1 = 1
                    elif LA1 == SYSTEM:
                        alt1 = 2
                    elif LA1 == PROCESS:
                        alt1 = 3

                    if alt1 == 1:
659
                        # sdl92.g:142:18: use_clause
Maxime Perrotin's avatar
Maxime Perrotin committed
660
                        pass 
661
                        self._state.following.append(self.FOLLOW_use_clause_in_pr_file1321)
Maxime Perrotin's avatar
Maxime Perrotin committed
662
663
664
665
666
667
668
669
                        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:
670
                        # sdl92.g:143:19: system_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
671
                        pass 
672
                        self._state.following.append(self.FOLLOW_system_definition_in_pr_file1341)
Maxime Perrotin's avatar
Maxime Perrotin committed
673
674
675
676
677
678
679
680
                        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:
681
                        # sdl92.g:144:19: process_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
682
                        pass 
683
                        self._state.following.append(self.FOLLOW_process_definition_in_pr_file1361)
Maxime Perrotin's avatar
Maxime Perrotin committed
684
685
686
687
688
689
690
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
                        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"
734
    # sdl92.g:147: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
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
    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:
764
765
                # sdl92.g:148:9: ( SYSTEM system_name end ( entity_in_system )* ENDSYSTEM ( system_name )? end -> ^( SYSTEM system_name ( entity_in_system )* ) )
                # sdl92.g:148:17: SYSTEM system_name end ( entity_in_system )* ENDSYSTEM ( system_name )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
766
                pass 
767
                SYSTEM4=self.match(self.input, SYSTEM, self.FOLLOW_SYSTEM_in_system_definition1386) 
Maxime Perrotin's avatar
Maxime Perrotin committed
768
769
                if self._state.backtracking == 0:
                    stream_SYSTEM.add(SYSTEM4)
770
                self._state.following.append(self.FOLLOW_system_name_in_system_definition1388)
Maxime Perrotin's avatar
Maxime Perrotin committed
771
772
773
774
775
                system_name5 = self.system_name()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_system_name.add(system_name5.tree)
776
                self._state.following.append(self.FOLLOW_end_in_system_definition1390)
Maxime Perrotin's avatar
Maxime Perrotin committed
777
778
779
780
781
                end6 = self.end()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_end.add(end6.tree)
782
                # sdl92.g:149:17: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
783
784
785
786
                while True: #loop2
                    alt2 = 2
                    LA2_0 = self.input.LA(1)

787
                    if ((BLOCK <= LA2_0 <= CHANNEL) or LA2_0 == PROCEDURE or LA2_0 == SIGNAL or LA2_0 == 221) :
Maxime Perrotin's avatar
Maxime Perrotin committed
788
789
790
791
792
793
                        alt2 = 1


                    if alt2 == 1:
                        # sdl92.g:0:0: entity_in_system
                        pass 
794
                        self._state.following.append(self.FOLLOW_entity_in_system_in_system_definition1408)
Maxime Perrotin's avatar
Maxime Perrotin committed
795
796
797
798
799
800
801
802
803
                        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
804
                ENDSYSTEM8=self.match(self.input, ENDSYSTEM, self.FOLLOW_ENDSYSTEM_in_system_definition1427) 
Maxime Perrotin's avatar
Maxime Perrotin committed
805
806
                if self._state.backtracking == 0:
                    stream_ENDSYSTEM.add(ENDSYSTEM8)
807
                # sdl92.g:150:27: ( system_name )?
Maxime Perrotin's avatar
Maxime Perrotin committed
808
809
810
811
812
813
814
815
                alt3 = 2
                LA3_0 = self.input.LA(1)

                if (LA3_0 == ID) :
                    alt3 = 1
                if alt3 == 1:
                    # sdl92.g:0:0: system_name
                    pass 
816
                    self._state.following.append(self.FOLLOW_system_name_in_system_definition1429)
Maxime Perrotin's avatar
Maxime Perrotin committed
817
818
819
820
821
822
823
824
                    system_name9 = self.system_name()

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



825
                self._state.following.append(self.FOLLOW_end_in_system_definition1432)
Maxime Perrotin's avatar
Maxime Perrotin committed
826
827
828
829
830
831
832
                end10 = self.end()

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

                # AST Rewrite
833
                # elements: entity_in_system, SYSTEM, system_name
Maxime Perrotin's avatar
Maxime Perrotin committed
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
                # 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()
850
851
                    # 151:9: -> ^( SYSTEM system_name ( entity_in_system )* )
                    # sdl92.g:151:17: ^( SYSTEM system_name ( entity_in_system )* )
Maxime Perrotin's avatar
Maxime Perrotin committed
852
853
854
855
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_SYSTEM.nextNode(), root_1)

                    self._adaptor.addChild(root_1, stream_system_name.nextTree())
856
                    # sdl92.g:151:38: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
857
858
859
860
861
862
863
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
                    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"
900
    # sdl92.g:154: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
901
902
903
904
905
906
907
908
    def use_clause(self, ):

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

        root_0 = None

        USE12 = None
909
        char_literal14 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
910
911
912
913
        use_asn111 = None

        package_name13 = None

914
915
916
        def_selection_list15 = None

        end16 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
917
918
919


        USE12_tree = None
920
        char_literal14_tree = None
Maxime Perrotin's avatar
Maxime Perrotin committed
921
        stream_USE = RewriteRuleTokenStream(self._adaptor, "token USE")
922
        stream_DIV = RewriteRuleTokenStream(self._adaptor, "token DIV")
Maxime Perrotin's avatar
Maxime Perrotin committed
923
924
        stream_use_asn1 = RewriteRuleSubtreeStream(self._adaptor, "rule use_asn1")
        stream_package_name = RewriteRuleSubtreeStream(self._adaptor, "rule package_name")
925
        stream_def_selection_list = RewriteRuleSubtreeStream(self._adaptor, "rule def_selection_list")
Maxime Perrotin's avatar
Maxime Perrotin committed
926
927
928
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
        try:
            try:
929
930
                # sdl92.g:155:9: ( ( use_asn1 )? USE package_name ( '/' def_selection_list )? end -> ^( USE ( use_asn1 )? ( end )? package_name ( def_selection_list )? ) )
                # sdl92.g:155:17: ( use_asn1 )? USE package_name ( '/' def_selection_list )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
931
                pass 
932
                # sdl92.g:155:17: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
933
934
935
                alt4 = 2
                LA4_0 = self.input.LA(1)

936
                if (LA4_0 == 221) :
Maxime Perrotin's avatar
Maxime Perrotin committed
937
938
939
940
                    alt4 = 1
                if alt4 == 1:
                    # sdl92.g:0:0: use_asn1
                    pass 
941
                    self._state.following.append(self.FOLLOW_use_asn1_in_use_clause1479)
Maxime Perrotin's avatar
Maxime Perrotin committed
942
943
944
945
946
947
948
949
                    use_asn111 = self.use_asn1()

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



950
                USE12=self.match(self.input, USE, self.FOLLOW_USE_in_use_clause1498) 
Maxime Perrotin's avatar
Maxime Perrotin committed
951
952
                if self._state.backtracking == 0:
                    stream_USE.add(USE12)
953
                self._state.following.append(self.FOLLOW_package_name_in_use_clause1500)
Maxime Perrotin's avatar
Maxime Perrotin committed
954
955
956
957
958
                package_name13 = self.package_name()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_package_name.add(package_name13.tree)
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
                # sdl92.g:157:17: ( '/' def_selection_list )?
                alt5 = 2
                LA5_0 = self.input.LA(1)

                if (LA5_0 == DIV) :
                    alt5 = 1
                if alt5 == 1:
                    # sdl92.g:157:18: '/' def_selection_list
                    pass 
                    char_literal14=self.match(self.input, DIV, self.FOLLOW_DIV_in_use_clause1519) 
                    if self._state.backtracking == 0:
                        stream_DIV.add(char_literal14)
                    self._state.following.append(self.FOLLOW_def_selection_list_in_use_clause1521)
                    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)



                self._state.following.append(self.FOLLOW_end_in_use_clause1542)
                end16 = self.end()
Maxime Perrotin's avatar
Maxime Perrotin committed
982
983
984

                self._state.following.pop()
                if self._state.backtracking == 0:
985
                    stream_end.add(end16.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
986
987

                # AST Rewrite
988
                # elements: package_name, USE, use_asn1, def_selection_list, end
Maxime Perrotin's avatar
Maxime Perrotin committed
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
                # 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()
1005
1006
                    # 159:9: -> ^( USE ( use_asn1 )? ( end )? package_name ( def_selection_list )? )
                    # sdl92.g:159:17: ^( USE ( use_asn1 )? ( end )? package_name ( def_selection_list )? )
Maxime Perrotin's avatar
Maxime Perrotin committed
1007
1008
1009
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_USE.nextNode(), root_1)

1010
                    # sdl92.g:159:23: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1011
1012
1013
1014
1015
                    if stream_use_asn1.hasNext():
                        self._adaptor.addChild(root_1, stream_use_asn1.nextTree())


                    stream_use_asn1.reset();
1016
                    # sdl92.g:159:33: ( end )?
1017
1018
1019
1020
1021
                    if stream_end.hasNext():
                        self._adaptor.addChild(root_1, stream_end.nextTree())


                    stream_end.reset();
Maxime Perrotin's avatar
Maxime Perrotin committed
1022
                    self._adaptor.addChild(root_1, stream_package_name.nextTree())
1023
1024
1025
1026
1027
1028
                    # sdl92.g:159:51: ( def_selection_list )?
                    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
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056

                    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"

1057
1058
1059
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
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
    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"
    # sdl92.g:164:1: def_selection_list : ID ( ',' ID )* ;
    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:
                # sdl92.g:165:9: ( ID ( ',' ID )* )
                # sdl92.g:165:17: ID ( ',' ID )*
                pass 
                root_0 = self._adaptor.nil()

                ID17=self.match(self.input, ID, self.FOLLOW_ID_in_def_selection_list1596)
                if self._state.backtracking == 0:

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

                # sdl92.g:165:20: ( ',' ID )*
                while True: #loop6
                    alt6 = 2
                    LA6_0 = self.input.LA(1)

                    if (LA6_0 == COMMA) :
                        alt6 = 1


                    if alt6 == 1:
                        # sdl92.g:165:21: ',' ID
                        pass 
                        char_literal18=self.match(self.input, COMMA, self.FOLLOW_COMMA_in_def_selection_list1599)
                        ID19=self.match(self.input, ID, self.FOLLOW_ID_in_def_selection_list1602)
                        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
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
    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"
1151
    # sdl92.g:170:1: entity_in_system : ( signal_declaration | text_area | procedure | channel | block_definition );
Maxime Perrotin's avatar
Maxime Perrotin committed
1152
1153
1154
1155
1156
1157
1158
    def entity_in_system(self, ):

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

        root_0 = None

1159
        signal_declaration20 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1160

1161
        text_area21 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1162

1163
        procedure22 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1164

1165
        channel23 = None
1166

1167
        block_definition24 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1168
1169
1170
1171
1172



        try:
            try:
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
                # sdl92.g:171:9: ( signal_declaration | text_area | procedure | channel | block_definition )
                alt7 = 5
                LA7 = self.input.LA(1)
                if LA7 == 221:
                    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
1185
1186
1187
1188
                    else:
                        if self._state.backtracking > 0:
                            raise BacktrackingFailed

1189
                        nvae = NoViableAltException("", 7, 1, self.input)
Maxime Perrotin's avatar
Maxime Perrotin committed
1190
1191
1192

                        raise nvae

1193
1194
1195
1196
1197
1198
1199
1200
                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
1201
1202
1203
1204
                else:
                    if self._state.backtracking > 0:
                        raise BacktrackingFailed

1205
                    nvae = NoViableAltException("", 7, 0, self.input)
Maxime Perrotin's avatar
Maxime Perrotin committed
1206
1207
1208

                    raise nvae

1209
1210
                if alt7 == 1:
                    # sdl92.g:171:17: signal_declaration
Maxime Perrotin's avatar
Maxime Perrotin committed
1211
1212
1213
                    pass 
                    root_0 = self._adaptor.nil()

1214
1215
                    self._state.following.append(self.FOLLOW_signal_declaration_in_entity_in_system1628)
                    signal_declaration20 = self.signal_declaration()
Maxime Perrotin's avatar
Maxime Perrotin committed
1216
1217
1218

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


1222
1223
                elif alt7 == 2:
                    # sdl92.g:172:19: text_area
Maxime Perrotin's avatar
Maxime Perrotin committed
1224
1225
1226
                    pass 
                    root_0 = self._adaptor.nil()

1227
1228
                    self._state.following.append(self.FOLLOW_text_area_in_entity_in_system1648)
                    text_area21 = self.text_area()
Maxime Perrotin's avatar
Maxime Perrotin committed
1229
1230
1231

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


1235
1236
                elif alt7 == 3:
                    # sdl92.g:173:19: procedure
Maxime Perrotin's avatar
Maxime Perrotin committed
1237
1238
1239
                    pass 
                    root_0 = self._adaptor.nil()

1240
1241
                    self._state.following.append(self.FOLLOW_procedure_in_entity_in_system1668)
                    procedure22 = self.procedure()
Maxime Perrotin's avatar
Maxime Perrotin committed
1242
1243
1244

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


1248
1249
                elif alt7 == 4:
                    # sdl92.g:174:19: channel
1250
1251
1252
                    pass 
                    root_0 = self._adaptor.nil()

1253
1254
                    self._state.following.append(self.FOLLOW_channel_in_entity_in_system1688)
                    channel23 = self.channel()
1255
1256
1257

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1258
                        self._adaptor.addChild(root_0, channel23.tree)
1259
1260


1261
1262
                elif alt7 == 5:
                    # sdl92.g:175:19: block_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
1263
1264
1265
                    pass 
                    root_0 = self._adaptor.nil()

1266
1267
                    self._state.following.append(self.FOLLOW_block_definition_in_entity_in_system1708)
                    block_definition24 = self.block_definition()
Maxime Perrotin's avatar
Maxime Perrotin committed
1268
1269
1270

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1271
                        self._adaptor.addChild(root_0, block_definition24.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302


                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"
1303
    # sdl92.g:180:1: signal_declaration : ( paramnames )? SIGNAL signal_id ( input_params )? end -> ^( SIGNAL ( paramnames )? signal_id ( input_params )? ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
1304
1305
1306
1307
1308
1309
1310
    def signal_declaration(self, ):

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

        root_0 = None

1311
1312
        SIGNAL26 = None
        paramnames25 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1313

1314
        signal_id27 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1315

1316
        input_params28 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1317

1318
        end29 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1319
1320


1321
        SIGNAL26_tree = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1322
1323
1324
1325
1326
1327
1328
        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:
1329
1330
                # sdl92.g:181:9: ( ( paramnames )? SIGNAL signal_id ( input_params )? end -> ^( SIGNAL ( paramnames )? signal_id ( input_params )? ) )
                # sdl92.g:181:17: ( paramnames )? SIGNAL signal_id ( input_params )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
1331
                pass 
1332
1333
1334
                # sdl92.g:181:17: ( paramnames )?
                alt8 = 2
                LA8_0 = self.input.LA(1)
Maxime Perrotin's avatar
Maxime Perrotin committed
1335

1336
1337
1338
                if (LA8_0 == 221) :
                    alt8 = 1
                if alt8 == 1:
Maxime Perrotin's avatar
Maxime Perrotin committed
1339
1340
                    # sdl92.g:0:0: paramnames
                    pass 
1341
1342
                    self._state.following.append(self.FOLLOW_paramnames_in_signal_declaration1732)
                    paramnames25 = self.paramnames()
Maxime Perrotin's avatar
Maxime Perrotin committed
1343
1344
1345

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1346
                        stream_paramnames.add(paramnames25.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1347
1348
1349



1350
                SIGNAL26=self.match(self.input, SIGNAL, self.FOLLOW_SIGNAL_in_signal_declaration1751) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1351
                if self._state.backtracking == 0:
1352
1353
1354
                    stream_SIGNAL.add(SIGNAL26)
                self._state.following.append(self.FOLLOW_signal_id_in_signal_declaration1753)
                signal_id27 = self.signal_id()
Maxime Perrotin's avatar
Maxime Perrotin committed
1355
1356
1357

                self._state.following.pop()
                if self._state.backtracking == 0:
1358
1359
1360
1361
                    stream_signal_id.add(signal_id27.tree)
                # sdl92.g:182:34: ( input_params )?
                alt9 = 2
                LA9_0 = self.input.LA(1)
Maxime Perrotin's avatar
Maxime Perrotin committed
1362

1363
1364
1365
                if (LA9_0 == L_PAREN) :
                    alt9 = 1
                if alt9 == 1:
Maxime Perrotin's avatar
Maxime Perrotin committed
1366
1367
                    # sdl92.g:0:0: input_params
                    pass 
1368
1369
                    self._state.following.append(self.FOLLOW_input_params_in_signal_declaration1755)
                    input_params28 = self.input_params()
Maxime Perrotin's avatar
Maxime Perrotin committed
1370
1371
1372

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1373
                        stream_input_params.add(input_params28.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1374
1375
1376



1377
1378
                self._state.following.append(self.FOLLOW_end_in_signal_declaration1758)
                end29 = self.end()
Maxime Perrotin's avatar
Maxime Perrotin committed
1379
1380
1381

                self._state.following.pop()
                if self._state.backtracking == 0:
1382
                    stream_end.add(end29.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1383
1384

                # AST Rewrite
1385
                # elements: paramnames, signal_id, input_params, SIGNAL
Maxime Perrotin's avatar
Maxime Perrotin committed
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
                # 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()
1402
1403
                    # 183:9: -> ^( SIGNAL ( paramnames )? signal_id ( input_params )? )
                    # sdl92.g:183:17: ^( SIGNAL ( paramnames )? signal_id ( input_params )? )
Maxime Perrotin's avatar
Maxime Perrotin committed
1404
1405
1406
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_SIGNAL.nextNode(), root_1)

1407
                    # sdl92.g:183:26: ( paramnames )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1408
1409
1410
1411
1412
1413
                    if stream_paramnames.hasNext():
                        self._adaptor.addChild(root_1, stream_paramnames.nextTree())


                    stream_paramnames.reset();
                    self._adaptor.addChild(root_1, stream_signal_id.nextTree())
1414
                    # sdl92.g:183:48: ( input_params )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1415
1416
1417
1418
1419
1420
1421
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
                    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"
1458
    # sdl92.g:186:1: channel : CHANNEL channel_id ( route )+ ENDCHANNEL end -> ^( CHANNEL channel_id ( route )+ ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
1459
1460
1461
1462
1463
1464
1465
    def channel(self, ):

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

        root_0 = None

1466
1467
1468
        CHANNEL30 = None
        ENDCHANNEL33 = None
        channel_id31 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1469

1470
        route32 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1471

1472
        end34 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1473
1474


1475
1476
        CHANNEL30_tree = None
        ENDCHANNEL33_tree = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1477
1478
1479
1480
1481
1482
1483
        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:
1484
1485
                # sdl92.g:187:9: ( CHANNEL channel_id ( route )+ ENDCHANNEL end -> ^( CHANNEL channel_id ( route )+ ) )
                # sdl92.g:187:17: CHANNEL channel_id ( route )+ ENDCHANNEL end
Maxime Perrotin's avatar
Maxime Perrotin committed
1486
                pass 
1487
                CHANNEL30=self.match(self.input, CHANNEL, self.FOLLOW_CHANNEL_in_channel1808) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1488
                if self._state.backtracking == 0:
1489
1490
1491
                    stream_CHANNEL.add(CHANNEL30)
                self._state.following.append(self.FOLLOW_channel_id_in_channel1810)
                channel_id31 = self.channel_id()
Maxime Perrotin's avatar
Maxime Perrotin committed
1492
1493
1494

                self._state.following.pop()
                if self._state.backtracking == 0:
1495
1496
1497
1498
1499
1500
                    stream_channel_id.add(channel_id31.tree)
                # sdl92.g:188:17: ( route )+
                cnt10 = 0
                while True: #loop10
                    alt10 = 2
                    LA10_0 = self.input.LA(1)
Maxime Perrotin's avatar
Maxime Perrotin committed
1501

1502
1503
                    if (LA10_0 == FROM) :
                        alt10 = 1
Maxime Perrotin's avatar
Maxime Perrotin committed
1504
1505


1506
                    if alt10 == 1:
Maxime Perrotin's avatar
Maxime Perrotin committed
1507
1508
                        # sdl92.g:0:0: route
                        pass 
1509
1510
                        self._state.following.append(self.FOLLOW_route_in_channel1828)
                        route32 = self.route()
Maxime Perrotin's avatar
Maxime Perrotin committed
1511
1512
1513

                        self._state.following.pop()
                        if self._state.backtracking == 0:
1514
                            stream_route.add(route32.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1515
1516
1517


                    else:
1518
1519
                        if cnt10 >= 1:
                            break #loop10
Maxime Perrotin's avatar
Maxime Perrotin committed
1520
1521
1522
1523

                        if self._state.backtracking > 0:
                            raise BacktrackingFailed

1524
                        eee = EarlyExitException(10, self.input)
Maxime Perrotin's avatar
Maxime Perrotin committed
1525
1526
                        raise eee

1527
1528
                    cnt10 += 1
                ENDCHANNEL33=self.match(self.input, ENDCHANNEL, self.FOLLOW_ENDCHANNEL_in_channel1847) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1529
                if self._state.backtracking == 0:
1530
1531
1532
                    stream_ENDCHANNEL.add(ENDCHANNEL33)
                self._state.following.append(self.FOLLOW_end_in_channel1849)
                end34 = self.end()
Maxime Perrotin's avatar
Maxime Perrotin committed
1533
1534
1535

                self._state.following.pop()
                if self._state.backtracking == 0:
1536
                    stream_end.add(end34.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1537
1538

                # AST Rewrite
1539
                # elements: route, channel_id, CHANNEL
Maxime Perrotin's avatar
Maxime Perrotin committed
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
                # 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()
1556
1557
                    # 190:9: -> ^( CHANNEL channel_id ( route )+ )
                    # sdl92.g:190:17: ^( CHANNEL channel_id ( route )+ )
Maxime Perrotin's avatar
Maxime Perrotin committed
1558
1559
1560
1561
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_CHANNEL.nextNode(), root_1)

                    self._adaptor.addChild(root_1, stream_channel_id.nextTree())
1562
                    # sdl92.g:190:38: ( route )+
Maxime Perrotin's avatar
Maxime Perrotin committed
1563
1564
1565
1566
1567
1568
1569
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
                    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"
1609
    # sdl92.g:193: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
1610
1611
1612
1613
1614
1615
1616
    def route(self, ):

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

        root_0 = None

1617
1618
1619
1620
1621
        FROM35 = None
        TO37 = None
        WITH39 = None
        char_literal41 = None
        source_id36 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1622

1623
        dest_id38 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1624

1625
        signal_id40 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1626

1627
        signal_id42 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1628

1629
        end43 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1630
1631


1632
1633
1634
1635
        FROM35_tree = None
        TO37_tree = None
        WITH39_tree = None
        char_literal41_tree = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
        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:
1646
1647
                # sdl92.g:194:9: ( FROM source_id TO dest_id WITH signal_id ( ',' signal_id )* end -> ^( ROUTE source_id dest_id ( signal_id )+ ) )
                # sdl92.g:194:17: FROM source_id TO dest_id WITH signal_id ( ',' signal_id )* end
Maxime Perrotin's avatar
Maxime Perrotin committed
1648
                pass 
1649
                FROM35=self.match(self.input, FROM, self.FOLLOW_FROM_in_route1896) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1650
                if self._state.backtracking == 0:
1651
1652
1653
                    stream_FROM.add(FROM35)
                self._state.following.append(self.FOLLOW_source_id_in_route1898)
                source_id36 = self.source_id()
Maxime Perrotin's avatar
Maxime Perrotin committed
1654
1655
1656

                self._state.following.pop()
                if self._state.backtracking == 0:
1657
1658
                    stream_source_id.add(source_id36.tree)
                TO37=self.match(self.input, TO, self.FOLLOW_TO_in_route1900) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1659
                if self._state.backtracking == 0:
1660
1661
1662
                    stream_TO.add(TO37)
                self._state.following.append(self.FOLLOW_dest_id_in_route1902)
                dest_id38 = self.dest_id()
Maxime Perrotin's avatar
Maxime Perrotin committed
1663
1664
1665

                self._state.following.pop()
                if self._state.backtracking == 0:
1666
1667
                    stream_dest_id.add(dest_id38.tree)
                WITH39=self.match(self.input, WITH, self.FOLLOW_WITH_in_route1904) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1668
                if self._state.backtracking == 0:
1669
1670
1671
                    stream_WITH.add(WITH39)
                self._state.following.append(self.FOLLOW_signal_id_in_route1906)
                signal_id40 = self.signal_id()
Maxime Perrotin's avatar
Maxime Perrotin committed
1672
1673
1674

                self._state.following.pop()
                if self._state.backtracking == 0:
1675
1676
1677
1678
1679
                    stream_signal_id.add(signal_id40.tree)
                # sdl92.g:194:58: ( ',' signal_id )*
                while True: #loop11
                    alt11 = 2
                    LA11_0 = self.input.LA(1)
Maxime Perrotin's avatar
Maxime Perrotin committed
1680

1681
1682
                    if (LA11_0 == COMMA) :
                        alt11 = 1
Maxime Perrotin's avatar
Maxime Perrotin committed
1683
1684


1685
1686
                    if alt11 == 1:
                        # sdl92.g:194:59: ',' signal_id
Maxime Perrotin's avatar
Maxime Perrotin committed
1687
                        pass