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

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

from antlr3.tree import *



# for convenience in actions
HIDDEN = BaseRecognizer.HIDDEN

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

# token names
tokenNames = [
    "<invalid>", "<EOR>", "<DOWN>", "<UP>", 
dbarbera's avatar
dbarbera committed
246
247
    "ACTION", "ALL", "ALTERNATIVE", "ANSWER", "ARRAY", "ASN1", "ASSIGN", 
    "BITSTR", "BLOCK", "CHANNEL", "CHOICE", "CIF", "CLOSED_RANGE", "COMMENT", 
248
249
    "COMPOSITE_STATE", "CONDITIONAL", "CONNECT", "CONNECTION", "CONSTANT", 
    "CONSTANTS", "DCL", "DECISION", "DIGITS", "ELSE", "EMPTYSTR", "ENDNEWTYPE", 
250
251
252
    "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", 
253
254
    "INOUT", "INPUT", "INPUT_NONE", "INPUTLIST", "JOIN", "LABEL", "LITERAL", 
    "NEG", "NEWTYPE", "NEXTSTATE", "NUMBER_OF_INSTANCES", "OCTSTR", "OPEN_RANGE", 
255
    "OUTPUT", "OUTPUT_BODY", "PARAM", "PARAMNAMES", "PARAMS", "PAREN", "PFPAR", 
256
    "POINT", "PRIMARY", "PROCEDURE", "PROCEDURE_CALL", "PROCEDURE_NAME", 
257
258
    "PROCESS", "PROVIDED", "QUESTION", "RANGE", "RESET", "RETURN", "RETURNS", 
    "ROUTE", "SAVE", "SELECTOR", "SEQOF", "SEQUENCE", "SET", "SIGNAL", "SIGNAL_LIST", 
259
260
261
262
263
264
    "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", 
265
266
267
268
269
270
271
272
273
274
275
276
277
    "AND", "TYPE", "REFERENCED", "ENDPROCESS", "SEMI", "ENDPROCEDURE", "OUT", 
    "INT", "START", "ENDCONNECTION", "ENDSTATE", "ASTERISK", "AGGREGATION", 
    "SUBSTRUCTURE", "ENDSUBSTRUCTURE", "DEFAULT", "NONE", "PRIORITY", "L_PAREN", 
    "R_PAREN", "COMMA", "CALL", "ENDALTERNATIVE", "ENDDECISION", "ANY", 
    "EQ", "NEQ", "GT", "LT", "LE", "GE", "CREATE", "THIS", "ENDFOR", "DOT", 
    "IMPLIES", "OR", "XOR", "PLUS", "DASH", "APPEND", "DIV", "MOD", "REM", 
    "NOT", "TRUE", "FALSE", "PLUS_INFINITY", "MINUS_INFINITY", "MANTISSA", 
    "BASE", "EXPONENT", "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", "IMPORT", "VIEW", "ACTIVE", "STR", "ALPHA", "Exponent", 
    "WS", "COMMENT2", "Q", "Z", "':'", "'->'", "'!'", "'(.'", "'.)'", "'/* CIF'", 
    "'*/'"
Maxime Perrotin's avatar
Maxime Perrotin committed
278
279
280
281
282
283
284
]




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

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

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

Maxime Perrotin's avatar
Maxime Perrotin committed
295
296
297
298
299
300
301
302
303
304
305
        self.dfa21 = self.DFA21(
            self, 21,
            eot = self.DFA21_eot,
            eof = self.DFA21_eof,
            min = self.DFA21_min,
            max = self.DFA21_max,
            accept = self.DFA21_accept,
            special = self.DFA21_special,
            transition = self.DFA21_transition
            )

306
307
308
309
310
311
312
313
314
        self.dfa22 = self.DFA22(
            self, 22,
            eot = self.DFA22_eot,
            eof = self.DFA22_eof,
            min = self.DFA22_min,
            max = self.DFA22_max,
            accept = self.DFA22_accept,
            special = self.DFA22_special,
            transition = self.DFA22_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
315
316
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
317
318
319
320
321
322
323
324
325
        self.dfa26 = self.DFA26(
            self, 26,
            eot = self.DFA26_eot,
            eof = self.DFA26_eof,
            min = self.DFA26_min,
            max = self.DFA26_max,
            accept = self.DFA26_accept,
            special = self.DFA26_special,
            transition = self.DFA26_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
326
327
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
328
329
330
331
332
333
334
335
336
        self.dfa28 = self.DFA28(
            self, 28,
            eot = self.DFA28_eot,
            eof = self.DFA28_eof,
            min = self.DFA28_min,
            max = self.DFA28_max,
            accept = self.DFA28_accept,
            special = self.DFA28_special,
            transition = self.DFA28_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
337
338
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
339
340
341
342
343
344
345
346
347
        self.dfa40 = self.DFA40(
            self, 40,
            eot = self.DFA40_eot,
            eof = self.DFA40_eof,
            min = self.DFA40_min,
            max = self.DFA40_max,
            accept = self.DFA40_accept,
            special = self.DFA40_special,
            transition = self.DFA40_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
348
349
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
350
351
352
353
354
355
356
357
358
        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
359
360
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
361
362
363
364
365
366
367
368
369
        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
370
371
            )

372
373
374
375
376
377
378
379
380
        self.dfa58 = self.DFA58(
            self, 58,
            eot = self.DFA58_eot,
            eof = self.DFA58_eof,
            min = self.DFA58_min,
            max = self.DFA58_max,
            accept = self.DFA58_accept,
            special = self.DFA58_special,
            transition = self.DFA58_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
381
382
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
383
384
385
386
387
388
389
390
391
        self.dfa59 = self.DFA59(
            self, 59,
            eot = self.DFA59_eot,
            eof = self.DFA59_eof,
            min = self.DFA59_min,
            max = self.DFA59_max,
            accept = self.DFA59_accept,
            special = self.DFA59_special,
            transition = self.DFA59_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
392
393
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
394
395
396
397
398
399
400
401
402
        self.dfa63 = self.DFA63(
            self, 63,
            eot = self.DFA63_eot,
            eof = self.DFA63_eof,
            min = self.DFA63_min,
            max = self.DFA63_max,
            accept = self.DFA63_accept,
            special = self.DFA63_special,
            transition = self.DFA63_transition
403
404
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
405
406
407
408
409
410
411
412
413
        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
414
415
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
416
417
418
419
420
421
422
423
424
        self.dfa85 = self.DFA85(
            self, 85,
            eot = self.DFA85_eot,
            eof = self.DFA85_eof,
            min = self.DFA85_min,
            max = self.DFA85_max,
            accept = self.DFA85_accept,
            special = self.DFA85_special,
            transition = self.DFA85_transition
425
426
            )

427
428
429
430
431
432
433
434
435
        self.dfa90 = self.DFA90(
            self, 90,
            eot = self.DFA90_eot,
            eof = self.DFA90_eof,
            min = self.DFA90_min,
            max = self.DFA90_max,
            accept = self.DFA90_accept,
            special = self.DFA90_special,
            transition = self.DFA90_transition
436
437
            )

438
439
440
441
442
443
444
445
446
        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
447
448
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
449
450
451
452
453
454
455
456
457
        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
458
459
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
460
461
462
463
464
465
466
467
468
        self.dfa94 = self.DFA94(
            self, 94,
            eot = self.DFA94_eot,
            eof = self.DFA94_eof,
            min = self.DFA94_min,
            max = self.DFA94_max,
            accept = self.DFA94_accept,
            special = self.DFA94_special,
            transition = self.DFA94_transition
469
470
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
471
472
473
474
475
476
477
478
479
        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
480
481
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
482
483
484
485
486
487
488
489
490
        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
491
492
            )

493
494
495
496
497
498
499
500
501
        self.dfa112 = self.DFA112(
            self, 112,
            eot = self.DFA112_eot,
            eof = self.DFA112_eof,
            min = self.DFA112_min,
            max = self.DFA112_max,
            accept = self.DFA112_accept,
            special = self.DFA112_special,
            transition = self.DFA112_transition
502
503
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
504
505
506
507
508
509
510
511
512
        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
513
514
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
515
516
517
518
519
520
521
522
523
        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
524
525
            )

526
527
528
529
530
531
532
533
534
        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
535
536
            )

537
538
539
540
541
542
543
544
545
        self.dfa119 = self.DFA119(
            self, 119,
            eot = self.DFA119_eot,
            eof = self.DFA119_eof,
            min = self.DFA119_min,
            max = self.DFA119_max,
            accept = self.DFA119_accept,
            special = self.DFA119_special,
            transition = self.DFA119_transition
546
547
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
548
549
550
551
552
553
554
555
556
        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
557
558
            )

559
560
561
562
563
564
565
566
567
568
569
        self.dfa122 = self.DFA122(
            self, 122,
            eot = self.DFA122_eot,
            eof = self.DFA122_eof,
            min = self.DFA122_min,
            max = self.DFA122_max,
            accept = self.DFA122_accept,
            special = self.DFA122_special,
            transition = self.DFA122_transition
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
        self.dfa123 = self.DFA123(
            self, 123,
            eot = self.DFA123_eot,
            eof = self.DFA123_eof,
            min = self.DFA123_min,
            max = self.DFA123_max,
            accept = self.DFA123_accept,
            special = self.DFA123_special,
            transition = self.DFA123_transition
            )

        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
590
591
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
592
593
594
595
596
597
598
599
600
        self.dfa132 = self.DFA132(
            self, 132,
            eot = self.DFA132_eot,
            eof = self.DFA132_eof,
            min = self.DFA132_min,
            max = self.DFA132_max,
            accept = self.DFA132_accept,
            special = self.DFA132_special,
            transition = self.DFA132_transition
601
602
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
603
604
605
606
607
608
609
610
611
        self.dfa142 = self.DFA142(
            self, 142,
            eot = self.DFA142_eot,
            eof = self.DFA142_eof,
            min = self.DFA142_min,
            max = self.DFA142_max,
            accept = self.DFA142_accept,
            special = self.DFA142_special,
            transition = self.DFA142_transition
612
613
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
614
615
616
617
618
619
620
621
622
        self.dfa148 = self.DFA148(
            self, 148,
            eot = self.DFA148_eot,
            eof = self.DFA148_eof,
            min = self.DFA148_min,
            max = self.DFA148_max,
            accept = self.DFA148_accept,
            special = self.DFA148_special,
            transition = self.DFA148_transition
623
624
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
625
626
627
628
629
630
631
632
633
        self.dfa181 = self.DFA181(
            self, 181,
            eot = self.DFA181_eot,
            eof = self.DFA181_eof,
            min = self.DFA181_min,
            max = self.DFA181_max,
            accept = self.DFA181_accept,
            special = self.DFA181_special,
            transition = self.DFA181_transition
634
635
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
636
637
638
639
640
641
642
643
644
        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
645
646
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
647
648
649
650
651
652
653
654
655
        self.dfa188 = self.DFA188(
            self, 188,
            eot = self.DFA188_eot,
            eof = self.DFA188_eof,
            min = self.DFA188_min,
            max = self.DFA188_max,
            accept = self.DFA188_accept,
            special = self.DFA188_special,
            transition = self.DFA188_transition
656
657
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
658
659
660
661
662
663
664
665
666
        self.dfa192 = self.DFA192(
            self, 192,
            eot = self.DFA192_eot,
            eof = self.DFA192_eof,
            min = self.DFA192_min,
            max = self.DFA192_max,
            accept = self.DFA192_accept,
            special = self.DFA192_special,
            transition = self.DFA192_transition
667
668
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
669
670
671
672
673
674
675
676
677
        self.dfa194 = self.DFA194(
            self, 194,
            eot = self.DFA194_eot,
            eof = self.DFA194_eof,
            min = self.DFA194_min,
            max = self.DFA194_max,
            accept = self.DFA194_accept,
            special = self.DFA194_special,
            transition = self.DFA194_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
678
679
680
681
682
683
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
            )






        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"
710
    # sdl92.g:146:1: pr_file : ( use_clause | system_definition | process_definition )+ ;
Maxime Perrotin's avatar
Maxime Perrotin committed
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
    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:
728
729
                # sdl92.g:147:9: ( ( use_clause | system_definition | process_definition )+ )
                # sdl92.g:147:17: ( use_clause | system_definition | process_definition )+
Maxime Perrotin's avatar
Maxime Perrotin committed
730
731
732
                pass 
                root_0 = self._adaptor.nil()

733
                # sdl92.g:147:17: ( use_clause | system_definition | process_definition )+
Maxime Perrotin's avatar
Maxime Perrotin committed
734
735
736
737
                cnt1 = 0
                while True: #loop1
                    alt1 = 4
                    LA1 = self.input.LA(1)
738
                    if LA1 == 228:
739
740
                        LA1_2 = self.input.LA(2)

741
                        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) :
Maxime Perrotin's avatar
Maxime Perrotin committed
742
                            alt1 = 3
743
744
                        elif (LA1_2 == KEEP) :
                            alt1 = 1
745
746
747


                    elif LA1 == USE:
Maxime Perrotin's avatar
Maxime Perrotin committed
748
749
750
751
752
753
754
                        alt1 = 1
                    elif LA1 == SYSTEM:
                        alt1 = 2
                    elif LA1 == PROCESS:
                        alt1 = 3

                    if alt1 == 1:
755
                        # sdl92.g:147:18: use_clause
Maxime Perrotin's avatar
Maxime Perrotin committed
756
                        pass 
757
                        self._state.following.append(self.FOLLOW_use_clause_in_pr_file1375)
Maxime Perrotin's avatar
Maxime Perrotin committed
758
759
760
761
762
763
764
765
                        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:
766
                        # sdl92.g:148:19: system_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
767
                        pass 
768
                        self._state.following.append(self.FOLLOW_system_definition_in_pr_file1395)
Maxime Perrotin's avatar
Maxime Perrotin committed
769
770
771
772
773
774
775
776
                        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:
777
                        # sdl92.g:149:19: process_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
778
                        pass 
779
                        self._state.following.append(self.FOLLOW_process_definition_in_pr_file1415)
Maxime Perrotin's avatar
Maxime Perrotin committed
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
                        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"
830
    # sdl92.g:153:1: system_definition : SYSTEM system_name end ( entity_in_system )* ENDSYSTEM ( system_name )? end -> ^( SYSTEM system_name ( entity_in_system )* ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
    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
Maxime Perrotin's avatar
Maxime Perrotin committed
853
        stream_SYSTEM = RewriteRuleTokenStream(self._adaptor, "token SYSTEM")
854
        stream_ENDSYSTEM = RewriteRuleTokenStream(self._adaptor, "token ENDSYSTEM")
Maxime Perrotin's avatar
Maxime Perrotin committed
855
856
857
858
859
        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:
860
861
                # sdl92.g:154:9: ( SYSTEM system_name end ( entity_in_system )* ENDSYSTEM ( system_name )? end -> ^( SYSTEM system_name ( entity_in_system )* ) )
                # sdl92.g:154:17: SYSTEM system_name end ( entity_in_system )* ENDSYSTEM ( system_name )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
862
                pass 
863
                SYSTEM4=self.match(self.input, SYSTEM, self.FOLLOW_SYSTEM_in_system_definition1449) 
Maxime Perrotin's avatar
Maxime Perrotin committed
864
865
                if self._state.backtracking == 0:
                    stream_SYSTEM.add(SYSTEM4)
866
                self._state.following.append(self.FOLLOW_system_name_in_system_definition1451)
Maxime Perrotin's avatar
Maxime Perrotin committed
867
868
869
870
871
                system_name5 = self.system_name()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_system_name.add(system_name5.tree)
872
                self._state.following.append(self.FOLLOW_end_in_system_definition1453)
Maxime Perrotin's avatar
Maxime Perrotin committed
873
874
875
876
877
                end6 = self.end()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_end.add(end6.tree)
878
                # sdl92.g:155:17: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
879
880
881
882
                while True: #loop2
                    alt2 = 2
                    LA2_0 = self.input.LA(1)

883
                    if ((BLOCK <= LA2_0 <= CHANNEL) or LA2_0 == PROCEDURE or LA2_0 == SIGNAL or LA2_0 == 228) :
Maxime Perrotin's avatar
Maxime Perrotin committed
884
885
886
887
888
889
                        alt2 = 1


                    if alt2 == 1:
                        # sdl92.g:0:0: entity_in_system
                        pass 
890
                        self._state.following.append(self.FOLLOW_entity_in_system_in_system_definition1471)
Maxime Perrotin's avatar
Maxime Perrotin committed
891
892
893
894
895
896
897
898
899
                        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
900
                ENDSYSTEM8=self.match(self.input, ENDSYSTEM, self.FOLLOW_ENDSYSTEM_in_system_definition1490) 
Maxime Perrotin's avatar
Maxime Perrotin committed
901
902
                if self._state.backtracking == 0:
                    stream_ENDSYSTEM.add(ENDSYSTEM8)
903
                # sdl92.g:156:27: ( system_name )?
Maxime Perrotin's avatar
Maxime Perrotin committed
904
905
906
907
908
909
910
911
                alt3 = 2
                LA3_0 = self.input.LA(1)

                if (LA3_0 == ID) :
                    alt3 = 1
                if alt3 == 1:
                    # sdl92.g:0:0: system_name
                    pass 
912
                    self._state.following.append(self.FOLLOW_system_name_in_system_definition1492)
Maxime Perrotin's avatar
Maxime Perrotin committed
913
914
915
916
917
918
919
920
                    system_name9 = self.system_name()

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



921
                self._state.following.append(self.FOLLOW_end_in_system_definition1495)
Maxime Perrotin's avatar
Maxime Perrotin committed
922
923
924
925
926
927
928
                end10 = self.end()

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

                # AST Rewrite
Maxime Perrotin's avatar
Maxime Perrotin committed
929
                # elements: entity_in_system, system_name, SYSTEM
Maxime Perrotin's avatar
Maxime Perrotin committed
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
                # 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()
946
947
                    # 157:9: -> ^( SYSTEM system_name ( entity_in_system )* )
                    # sdl92.g:157:17: ^( SYSTEM system_name ( entity_in_system )* )
Maxime Perrotin's avatar
Maxime Perrotin committed
948
949
950
951
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_SYSTEM.nextNode(), root_1)

                    self._adaptor.addChild(root_1, stream_system_name.nextTree())
952
                    # sdl92.g:157:38: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
                    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"
996
    # sdl92.g:161:1: use_clause : ( use_asn1 )? USE package_name ( '/' def_selection_list )? end -> ^( USE ( use_asn1 )? ( end )? package_name ( def_selection_list )? ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
997
998
999
1000
1001
1002
1003
1004
    def use_clause(self, ):

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

        root_0 = None

        USE12 = None
1005
        char_literal14 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1006
1007
1008
1009
        use_asn111 = None

        package_name13 = None

1010
1011
1012
        def_selection_list15 = None

        end16 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1013
1014
1015


        USE12_tree = None
1016
        char_literal14_tree = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1017
        stream_DIV = RewriteRuleTokenStream(self._adaptor, "token DIV")
1018
        stream_USE = RewriteRuleTokenStream(self._adaptor, "token USE")
Maxime Perrotin's avatar
Maxime Perrotin committed
1019
1020
        stream_use_asn1 = RewriteRuleSubtreeStream(self._adaptor, "rule use_asn1")
        stream_package_name = RewriteRuleSubtreeStream(self._adaptor, "rule package_name")
Maxime Perrotin's avatar
Maxime Perrotin committed
1021
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
1022
        stream_def_selection_list = RewriteRuleSubtreeStream(self._adaptor, "rule def_selection_list")
Maxime Perrotin's avatar
Maxime Perrotin committed
1023
1024
        try:
            try:
1025
1026
                # sdl92.g:162:9: ( ( use_asn1 )? USE package_name ( '/' def_selection_list )? end -> ^( USE ( use_asn1 )? ( end )? package_name ( def_selection_list )? ) )
                # sdl92.g:162:17: ( use_asn1 )? USE package_name ( '/' def_selection_list )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
1027
                pass 
1028
                # sdl92.g:162:17: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1029
1030
1031
                alt4 = 2
                LA4_0 = self.input.LA(1)

1032
                if (LA4_0 == 228) :
Maxime Perrotin's avatar
Maxime Perrotin committed
1033
1034
1035
1036
                    alt4 = 1
                if alt4 == 1:
                    # sdl92.g:0:0: use_asn1
                    pass 
1037
                    self._state.following.append(self.FOLLOW_use_asn1_in_use_clause1551)
Maxime Perrotin's avatar
Maxime Perrotin committed
1038
1039
1040
1041
1042
1043
1044
1045
                    use_asn111 = self.use_asn1()

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



1046
                USE12=self.match(self.input, USE, self.FOLLOW_USE_in_use_clause1570) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1047
1048
                if self._state.backtracking == 0:
                    stream_USE.add(USE12)
1049
                self._state.following.append(self.FOLLOW_package_name_in_use_clause1572)
Maxime Perrotin's avatar
Maxime Perrotin committed
1050
1051
1052
1053
1054
                package_name13 = self.package_name()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_package_name.add(package_name13.tree)
1055
                # sdl92.g:164:17: ( '/' def_selection_list )?
1056
1057
1058
1059
1060
1061
                alt5 = 2
                LA5_0 = self.input.LA(1)

                if (LA5_0 == DIV) :
                    alt5 = 1
                if alt5 == 1:
1062
                    # sdl92.g:164:18: '/' def_selection_list
1063
                    pass 
1064
                    char_literal14=self.match(self.input, DIV, self.FOLLOW_DIV_in_use_clause1591) 
1065
1066
                    if self._state.backtracking == 0:
                        stream_DIV.add(char_literal14)
1067
                    self._state.following.append(self.FOLLOW_def_selection_list_in_use_clause1593)
1068
1069
1070
1071
1072
1073
1074
1075
                    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)



1076
                self._state.following.append(self.FOLLOW_end_in_use_clause1614)
1077
                end16 = self.end()
Maxime Perrotin's avatar
Maxime Perrotin committed
1078
1079
1080

                self._state.following.pop()
                if self._state.backtracking == 0:
1081
                    stream_end.add(end16.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1082
1083

                # AST Rewrite
Maxime Perrotin's avatar
Maxime Perrotin committed
1084
                # elements: USE, package_name, end, def_selection_list, use_asn1
Maxime Perrotin's avatar
Maxime Perrotin committed
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
                # 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()
1101
1102
                    # 166:9: -> ^( USE ( use_asn1 )? ( end )? package_name ( def_selection_list )? )
                    # sdl92.g:166:17: ^( USE ( use_asn1 )? ( end )? package_name ( def_selection_list )? )
Maxime Perrotin's avatar
Maxime Perrotin committed
1103
1104
1105
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_USE.nextNode(), root_1)

1106
                    # sdl92.g:166:23: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1107
1108
1109
1110
1111
                    if stream_use_asn1.hasNext():
                        self._adaptor.addChild(root_1, stream_use_asn1.nextTree())


                    stream_use_asn1.reset();
1112
                    # sdl92.g:166:33: ( end )?
1113
1114
1115
1116
1117
                    if stream_end.hasNext():
                        self._adaptor.addChild(root_1, stream_end.nextTree())


                    stream_end.reset();
Maxime Perrotin's avatar
Maxime Perrotin committed
1118
                    self._adaptor.addChild(root_1, stream_package_name.nextTree())
1119
                    # sdl92.g:166:51: ( def_selection_list )?
1120
1121
1122
1123
1124
                    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
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152

                    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"

1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
    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"
1163
    # sdl92.g:173:1: def_selection_list : ID ( ',' ID )* ;
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
    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:
1181
1182
                # sdl92.g:174:9: ( ID ( ',' ID )* )
                # sdl92.g:174:17: ID ( ',' ID )*
1183
1184
1185
                pass 
                root_0 = self._adaptor.nil()

1186
                ID17=self.match(self.input, ID, self.FOLLOW_ID_in_def_selection_list1678)
1187
1188
1189
1190
1191
                if self._state.backtracking == 0:

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

1192
                # sdl92.g:174:20: ( ',' ID )*
1193
1194
1195
1196
1197
1198
1199
1200
1201
                while True: #loop6
                    alt6 = 2
                    LA6_0 = self.input.LA(1)

                    if (LA6_0 == COMMA) :
                        alt6 = 1


                    if alt6 == 1:
1202
                        # sdl92.g:174:21: ',' ID
1203
                        pass 
1204
1205
                        char_literal18=self.match(self.input, COMMA, self.FOLLOW_COMMA_in_def_selection_list1681)
                        ID19=self.match(self.input, ID, self.FOLLOW_ID_in_def_selection_list1684)
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
                        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
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
    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"
1247
    # sdl92.g:181:1: entity_in_system : ( signal_declaration | text_area | procedure | channel | block_definition );
Maxime Perrotin's avatar
Maxime Perrotin committed
1248
1249
1250
1251
1252
1253
1254
    def entity_in_system(self, ):

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

        root_0 = None

1255
        signal_declaration20 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1256

1257
        text_area21 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1258

1259
        procedure22 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1260

1261
        channel23 = None
1262

1263
        block_definition24 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1264
1265
1266
1267
1268



        try:
            try:
1269
                # sdl92.g:182:9: ( signal_declaration | text_area | procedure | channel | block_definition )
1270
1271
                alt7 = 5
                LA7 = self.input.LA(1)
1272
                if LA7 == 228:
1273
1274
1275
1276
1277
1278
1279
1280
                    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
1281
1282
1283
1284
                    else:
                        if self._state.backtracking > 0:
                            raise BacktrackingFailed

1285
                        nvae = NoViableAltException("", 7, 1, self.input)
Maxime Perrotin's avatar
Maxime Perrotin committed
1286
1287
1288

                        raise nvae

1289
1290
1291
1292
1293
1294
1295
1296
                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
1297
1298
1299
1300
                else:
                    if self._state.backtracking > 0:
                        raise BacktrackingFailed

1301
                    nvae = NoViableAltException("", 7, 0, self.input)
Maxime Perrotin's avatar
Maxime Perrotin committed
1302
1303
1304

                    raise nvae

1305
                if alt7 == 1:
1306
                    # sdl92.g:182:17: signal_declaration
Maxime Perrotin's avatar
Maxime Perrotin committed
1307
1308
1309
                    pass 
                    root_0 = self._adaptor.nil()

1310
                    self._state.following.append(self.FOLLOW_signal_declaration_in_entity_in_system1720)
1311
                    signal_declaration20 = self.signal_declaration()
Maxime Perrotin's avatar
Maxime Perrotin committed
1312
1313
1314

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


1318
                elif alt7 == 2:
1319
                    # sdl92.g:183:19: text_area
Maxime Perrotin's avatar
Maxime Perrotin committed
1320
1321
1322
                    pass 
                    root_0 = self._adaptor.nil()

1323
                    self._state.following.append(self.FOLLOW_text_area_in_entity_in_system1740)
1324
                    text_area21 = self.text_area()
Maxime Perrotin's avatar
Maxime Perrotin committed
1325
1326
1327

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


1331
                elif alt7 == 3:
1332
                    # sdl92.g:184:19: procedure
Maxime Perrotin's avatar
Maxime Perrotin committed
1333
1334
1335
                    pass 
                    root_0 = self._adaptor.nil()

1336
                    self._state.following.append(self.FOLLOW_procedure_in_entity_in_system1760)
1337
                    procedure22 = self.procedure()
Maxime Perrotin's avatar
Maxime Perrotin committed
1338
1339
1340

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


1344
                elif alt7 == 4:
1345
                    # sdl92.g:185:19: channel
1346
1347
1348
                    pass 
                    root_0 = self._adaptor.nil()

1349
                    self._state.following.append(self.FOLLOW_channel_in_entity_in_system1780)
1350
                    channel23 = self.channel()
1351
1352
1353

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1354
                        self._adaptor.addChild(root_0, channel23.tree)
1355
1356


1357
                elif alt7 == 5:
1358
                    # sdl92.g:186:19: block_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
1359
1360
1361
                    pass 
                    root_0 = self._adaptor.nil()

1362
                    self._state.following.append(self.FOLLOW_block_definition_in_entity_in_system1800)
1363
                    block_definition24 = self.block_definition()
Maxime Perrotin's avatar
Maxime Perrotin committed
1364
1365
1366

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1367
                        self._adaptor.addChild(root_0, block_definition24.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398


                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"
1399
    # sdl92.g:192:1: signal_declaration : ( paramnames )? SIGNAL signal_id ( input_params )? end -> ^( SIGNAL ( paramnames )? signal_id ( input_params )? ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
1400
1401
1402
1403
1404
1405
1406
    def signal_declaration(self, ):

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

        root_0 = None

1407
1408
        SIGNAL26 = None
        paramnames25 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1409

1410
        signal_id27 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1411

1412
        input_params28 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1413

1414
        end29 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1415
1416


1417
        SIGNAL26_tree = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1418
        stream_SIGNAL = RewriteRuleTokenStream(self._adaptor, "token SIGNAL")
Maxime Perrotin's avatar
Maxime Perrotin committed
1419
        stream_paramnames = RewriteRuleSubtreeStream(self._adaptor, "rule paramnames")
1420
        stream_input_params = RewriteRuleSubtreeStream(self._adaptor, "rule input_params")
Maxime Perrotin's avatar
Maxime Perrotin committed
1421
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
1422
        stream_signal_id = RewriteRuleSubtreeStream(self._adaptor, "rule signal_id")
Maxime Perrotin's avatar
Maxime Perrotin committed
1423
1424
        try:
            try:
1425
1426
                # sdl92.g:193:9: ( ( paramnames )? SIGNAL signal_id ( input_params )? end -> ^( SIGNAL ( paramnames )? signal_id ( input_params )? ) )
                # sdl92.g:193:17: ( paramnames )? SIGNAL signal_id ( input_params )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
1427
                pass 
1428
                # sdl92.g:193:17: ( paramnames )?
1429
1430
                alt8 = 2
                LA8_0 = self.input.LA(1)
Maxime Perrotin's avatar
Maxime Perrotin committed
1431

1432
                if (LA8_0 == 228) :
1433
1434
                    alt8 = 1
                if alt8 == 1:
Maxime Perrotin's avatar
Maxime Perrotin committed
1435
1436
                    # sdl92.g:0:0: paramnames
                    pass 
1437
                    self._state.following.append(self.FOLLOW_paramnames_in_signal_declaration1833)
1438
                    paramnames25 = self.paramnames()
Maxime Perrotin's avatar
Maxime Perrotin committed
1439
1440
1441

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1442
                        stream_paramnames.add(paramnames25.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1443
1444
1445



1446
                SIGNAL26=self.match(self.input, SIGNAL, self.FOLLOW_SIGNAL_in_signal_declaration1852) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1447
                if self._state.backtracking == 0:
1448
                    stream_SIGNAL.add(SIGNAL26)
1449
                self._state.following.append(self.FOLLOW_signal_id_in_signal_declaration1854)
1450
                signal_id27 = self.signal_id()
Maxime Perrotin's avatar
Maxime Perrotin committed
1451
1452
1453

                self._state.following.pop()
                if self._state.backtracking == 0:
1454
                    stream_signal_id.add(signal_id27.tree)
1455
                # sdl92.g:194:34: ( input_params )?
1456
1457
                alt9 = 2
                LA9_0 = self.input.LA(1)
Maxime Perrotin's avatar
Maxime Perrotin committed
1458

1459
1460
1461
                if (LA9_0 == L_PAREN) :
                    alt9 = 1
                if alt9 == 1:
Maxime Perrotin's avatar
Maxime Perrotin committed
1462
1463
                    # sdl92.g:0:0: input_params
                    pass 
1464
                    self._state.following.append(self.FOLLOW_input_params_in_signal_declaration1856)
1465
                    input_params28 = self.input_params()
Maxime Perrotin's avatar
Maxime Perrotin committed
1466
1467
1468

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1469
                        stream_input_params.add(input_params28.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1470
1471
1472



1473
                self._state.following.append(self.FOLLOW_end_in_signal_declaration1859)
1474
                end29 = self.end()
Maxime Perrotin's avatar
Maxime Perrotin committed
1475
1476
1477

                self._state.following.pop()
                if self._state.backtracking == 0:
1478
                    stream_end.add(end29.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1479
1480

                # AST Rewrite
Maxime Perrotin's avatar
Maxime Perrotin committed
1481
                # elements: SIGNAL, paramnames, input_params, signal_id
Maxime Perrotin's avatar
Maxime Perrotin committed
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
                # 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()
1498
1499
                    # 195:9: -> ^( SIGNAL ( paramnames )? signal_id ( input_params )? )
                    # sdl92.g:195:17: ^( SIGNAL ( paramnames )? signal_id ( input_params )? )
Maxime Perrotin's avatar
Maxime Perrotin committed
1500
1501
1502
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_SIGNAL.nextNode(), root_1)

1503
                    # sdl92.g:195:26: ( paramnames )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1504
1505
1506
1507
1508
1509
                    if stream_paramnames.hasNext():
                        self._adaptor.addChild(root_1, stream_paramnames.nextTree())


                    stream_paramnames.reset();
                    self._adaptor.addChild(root_1, stream_signal_id.nextTree())
1510
                    # sdl92.g:195:48: ( input_params )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
                    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"
1554
    # sdl92.g:199:1: channel : CHANNEL channel_id ( route )+ ENDCHANNEL end -> ^( CHANNEL channel_id ( route )+ ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
1555
1556