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

# token names
tokenNames = [
    "<invalid>", "<EOR>", "<DOWN>", "<UP>", 
dbarbera's avatar
dbarbera committed
245
246
    "ACTION", "ALL", "ALTERNATIVE", "ANSWER", "ARRAY", "ASN1", "ASSIGN", 
    "BITSTR", "BLOCK", "CHANNEL", "CHOICE", "CIF", "CLOSED_RANGE", "COMMENT", 
247
248
    "COMPOSITE_STATE", "CONDITIONAL", "CONNECT", "CONNECTION", "CONSTANT", 
    "CONSTANTS", "DCL", "DECISION", "DIGITS", "ELSE", "EMPTYSTR", "ENDNEWTYPE", 
249
250
251
    "ENDSYNTYPE", "ENDTEXT", "ENTRY_POINT", "EXPORT", "EXPRESSION", "EXTERNAL", 
    "FI", "FIELD", "FIELD_NAME", "FIELDS", "FLOAT2", "FLOAT", "FLOATING_LABEL", 
    "FOR", "FPAR", "GROUND", "HYPERLINK", "IF", "IFTHENELSE", "IN", "INFORMAL_TEXT", 
252
253
    "INOUT", "INPUT", "INPUT_NONE", "INPUTLIST", "JOIN", "LABEL", "LITERAL", 
    "NEG", "NEWTYPE", "NEXTSTATE", "NUMBER_OF_INSTANCES", "OCTSTR", "OPEN_RANGE", 
254
    "OUTPUT", "OUTPUT_BODY", "PARAM", "PARAMNAMES", "PARAMS", "PAREN", "PFPAR", 
255
    "POINT", "PRIMARY", "PROCEDURE", "PROCEDURE_CALL", "PROCEDURE_NAME", 
256
257
    "PROCESS", "PROVIDED", "QUESTION", "RANGE", "RESET", "RETURN", "RETURNS", 
    "ROUTE", "SAVE", "SELECTOR", "SEQOF", "SEQUENCE", "SET", "SIGNAL", "SIGNAL_LIST", 
258
259
260
261
262
263
    "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", 
264
265
    "AND", "REFERENCED", "ENDPROCESS", "SEMI", "ENDPROCEDURE", "OUT", "INT", 
    "START", "ENDCONNECTION", "ENDSTATE", "ASTERISK", "AGGREGATION", "SUBSTRUCTURE", 
266
    "ENDSUBSTRUCTURE", "DEFAULT", "NONE", "PRIORITY", "L_PAREN", "R_PAREN", 
267
    "COMMA", "CALL", "ENDALTERNATIVE", "ENDDECISION", "ANY", "EQ", "NEQ", 
268
269
    "GT", "LT", "LE", "GE", "CREATE", "THIS", "ENDFOR", "DOT", "IMPLIES", 
    "OR", "XOR", "PLUS", "DASH", "APPEND", "DIV", "MOD", "REM", "NOT", "TRUE", 
270
271
272
    "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", 
273
274
275
    "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
276
277
278
279
280
281
282
]




class sdl92Parser(Parser):
    grammarFileName = "sdl92.g"
Maxime Perrotin's avatar
Maxime Perrotin committed
283
284
    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
285
286
287
288
289
290
291
292
    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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
        self.dfa20 = self.DFA20(
            self, 20,
            eot = self.DFA20_eot,
            eof = self.DFA20_eof,
            min = self.DFA20_min,
            max = self.DFA20_max,
            accept = self.DFA20_accept,
            special = self.DFA20_special,
            transition = self.DFA20_transition
            )

        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
            )

        self.dfa24 = self.DFA24(
            self, 24,
            eot = self.DFA24_eot,
            eof = self.DFA24_eof,
            min = self.DFA24_min,
            max = self.DFA24_max,
            accept = self.DFA24_accept,
            special = self.DFA24_special,
            transition = self.DFA24_transition
            )

        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
335
336
            )

337
338
339
340
341
342
343
344
345
        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
Maxime Perrotin's avatar
Maxime Perrotin committed
346
347
            )

348
349
350
351
352
353
354
355
356
        self.dfa43 = self.DFA43(
            self, 43,
            eot = self.DFA43_eot,
            eof = self.DFA43_eof,
            min = self.DFA43_min,
            max = self.DFA43_max,
            accept = self.DFA43_accept,
            special = self.DFA43_special,
            transition = self.DFA43_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
357
358
            )

359
360
361
362
363
364
365
366
367
        self.dfa50 = self.DFA50(
            self, 50,
            eot = self.DFA50_eot,
            eof = self.DFA50_eof,
            min = self.DFA50_min,
            max = self.DFA50_max,
            accept = self.DFA50_accept,
            special = self.DFA50_special,
            transition = self.DFA50_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
368
369
            )

370
371
372
373
374
375
376
377
378
        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
379
380
            )

381
382
383
384
385
386
387
388
389
        self.dfa57 = self.DFA57(
            self, 57,
            eot = self.DFA57_eot,
            eof = self.DFA57_eof,
            min = self.DFA57_min,
            max = self.DFA57_max,
            accept = self.DFA57_accept,
            special = self.DFA57_special,
            transition = self.DFA57_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
390
391
            )

392
393
394
395
396
397
398
399
400
        self.dfa61 = self.DFA61(
            self, 61,
            eot = self.DFA61_eot,
            eof = self.DFA61_eof,
            min = self.DFA61_min,
            max = self.DFA61_max,
            accept = self.DFA61_accept,
            special = self.DFA61_special,
            transition = self.DFA61_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
401
402
            )

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

414
415
416
417
418
419
420
421
422
        self.dfa83 = self.DFA83(
            self, 83,
            eot = self.DFA83_eot,
            eof = self.DFA83_eof,
            min = self.DFA83_min,
            max = self.DFA83_max,
            accept = self.DFA83_accept,
            special = self.DFA83_special,
            transition = self.DFA83_transition
423
424
            )

425
426
427
428
429
430
431
432
433
        self.dfa88 = self.DFA88(
            self, 88,
            eot = self.DFA88_eot,
            eof = self.DFA88_eof,
            min = self.DFA88_min,
            max = self.DFA88_max,
            accept = self.DFA88_accept,
            special = self.DFA88_special,
            transition = self.DFA88_transition
434
435
            )

436
437
438
439
440
441
442
443
444
        self.dfa89 = self.DFA89(
            self, 89,
            eot = self.DFA89_eot,
            eof = self.DFA89_eof,
            min = self.DFA89_min,
            max = self.DFA89_max,
            accept = self.DFA89_accept,
            special = self.DFA89_special,
            transition = self.DFA89_transition
445
446
            )

447
448
449
450
451
452
453
454
455
        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
456
457
            )

458
459
460
461
462
463
464
465
466
        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
467
468
            )

469
470
471
472
473
474
475
476
477
        self.dfa96 = self.DFA96(
            self, 96,
            eot = self.DFA96_eot,
            eof = self.DFA96_eof,
            min = self.DFA96_min,
            max = self.DFA96_max,
            accept = self.DFA96_accept,
            special = self.DFA96_special,
            transition = self.DFA96_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
478
479
            )

480
481
482
483
484
485
486
487
488
        self.dfa105 = self.DFA105(
            self, 105,
            eot = self.DFA105_eot,
            eof = self.DFA105_eof,
            min = self.DFA105_min,
            max = self.DFA105_max,
            accept = self.DFA105_accept,
            special = self.DFA105_special,
            transition = self.DFA105_transition
489
490
            )

491
492
493
494
495
496
497
498
499
        self.dfa110 = self.DFA110(
            self, 110,
            eot = self.DFA110_eot,
            eof = self.DFA110_eof,
            min = self.DFA110_min,
            max = self.DFA110_max,
            accept = self.DFA110_accept,
            special = self.DFA110_special,
            transition = self.DFA110_transition
500
501
            )

502
503
504
505
506
507
508
509
510
        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
511
512
            )

513
514
515
516
517
518
519
520
521
        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
522
523
            )

524
525
526
527
528
529
530
531
532
533
534
        self.dfa116 = self.DFA116(
            self, 116,
            eot = self.DFA116_eot,
            eof = self.DFA116_eof,
            min = self.DFA116_min,
            max = self.DFA116_max,
            accept = self.DFA116_accept,
            special = self.DFA116_special,
            transition = self.DFA116_transition
            )

535
536
537
538
539
540
541
542
543
544
545
        self.dfa117 = self.DFA117(
            self, 117,
            eot = self.DFA117_eot,
            eof = self.DFA117_eof,
            min = self.DFA117_min,
            max = self.DFA117_max,
            accept = self.DFA117_accept,
            special = self.DFA117_special,
            transition = self.DFA117_transition
            )

546
547
548
549
550
551
552
553
554
        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
555
556
557
558
559
560
561
562
563
564
565
566
567
            )

        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
            )

568
569
570
571
572
573
574
575
576
        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
577
578
            )

579
580
581
582
583
584
585
586
587
        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
588
589
            )

590
591
592
593
594
595
596
597
598
        self.dfa130 = self.DFA130(
            self, 130,
            eot = self.DFA130_eot,
            eof = self.DFA130_eof,
            min = self.DFA130_min,
            max = self.DFA130_max,
            accept = self.DFA130_accept,
            special = self.DFA130_special,
            transition = self.DFA130_transition
599
600
            )

601
602
603
604
605
606
607
608
609
        self.dfa140 = self.DFA140(
            self, 140,
            eot = self.DFA140_eot,
            eof = self.DFA140_eof,
            min = self.DFA140_min,
            max = self.DFA140_max,
            accept = self.DFA140_accept,
            special = self.DFA140_special,
            transition = self.DFA140_transition
610
611
            )

612
613
614
615
616
617
618
619
620
        self.dfa146 = self.DFA146(
            self, 146,
            eot = self.DFA146_eot,
            eof = self.DFA146_eof,
            min = self.DFA146_min,
            max = self.DFA146_max,
            accept = self.DFA146_accept,
            special = self.DFA146_special,
            transition = self.DFA146_transition
621
622
            )

623
624
625
626
627
628
629
630
631
        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
632
633
            )

634
635
636
637
638
639
640
641
642
        self.dfa184 = self.DFA184(
            self, 184,
            eot = self.DFA184_eot,
            eof = self.DFA184_eof,
            min = self.DFA184_min,
            max = self.DFA184_max,
            accept = self.DFA184_accept,
            special = self.DFA184_special,
            transition = self.DFA184_transition
643
644
            )

645
646
647
648
649
650
651
652
653
        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
654
655
            )

656
657
658
659
660
661
662
663
664
        self.dfa190 = self.DFA190(
            self, 190,
            eot = self.DFA190_eot,
            eof = self.DFA190_eof,
            min = self.DFA190_min,
            max = self.DFA190_max,
            accept = self.DFA190_accept,
            special = self.DFA190_special,
            transition = self.DFA190_transition
665
666
            )

667
668
669
670
671
672
673
674
675
        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
Maxime Perrotin's avatar
Maxime Perrotin committed
676
677
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
            )






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

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

739
                        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
740
                            alt1 = 3
741
742
                        elif (LA1_2 == KEEP) :
                            alt1 = 1
743
744
745


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

                    if alt1 == 1:
753
                        # sdl92.g:147:18: use_clause
Maxime Perrotin's avatar
Maxime Perrotin committed
754
                        pass 
755
                        self._state.following.append(self.FOLLOW_use_clause_in_pr_file1375)
Maxime Perrotin's avatar
Maxime Perrotin committed
756
757
758
759
760
761
762
763
                        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:
764
                        # sdl92.g:148:19: system_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
765
                        pass 
766
                        self._state.following.append(self.FOLLOW_system_definition_in_pr_file1395)
Maxime Perrotin's avatar
Maxime Perrotin committed
767
768
769
770
771
772
773
774
                        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:
775
                        # sdl92.g:149:19: process_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
776
                        pass 
777
                        self._state.following.append(self.FOLLOW_process_definition_in_pr_file1415)
Maxime Perrotin's avatar
Maxime Perrotin committed
778
779
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
                        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"
828
    # 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
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
    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
851
        stream_SYSTEM = RewriteRuleTokenStream(self._adaptor, "token SYSTEM")
852
        stream_ENDSYSTEM = RewriteRuleTokenStream(self._adaptor, "token ENDSYSTEM")
Maxime Perrotin's avatar
Maxime Perrotin committed
853
854
855
856
857
        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:
858
859
                # 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
860
                pass 
861
                SYSTEM4=self.match(self.input, SYSTEM, self.FOLLOW_SYSTEM_in_system_definition1449) 
Maxime Perrotin's avatar
Maxime Perrotin committed
862
863
                if self._state.backtracking == 0:
                    stream_SYSTEM.add(SYSTEM4)
864
                self._state.following.append(self.FOLLOW_system_name_in_system_definition1451)
Maxime Perrotin's avatar
Maxime Perrotin committed
865
866
867
868
869
                system_name5 = self.system_name()

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

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

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


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

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

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



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

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

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

                    self._adaptor.addChild(root_1, stream_system_name.nextTree())
950
                    # sdl92.g:157:38: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
951
952
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
                    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"
994
    # 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
995
996
997
998
999
1000
1001
1002
    def use_clause(self, ):

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

        root_0 = None

        USE12 = None
1003
        char_literal14 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1004
1005
1006
1007
        use_asn111 = None

        package_name13 = None

1008
1009
1010
        def_selection_list15 = None

        end16 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1011
1012
1013


        USE12_tree = None
1014
        char_literal14_tree = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1015
        stream_DIV = RewriteRuleTokenStream(self._adaptor, "token DIV")
1016
        stream_USE = RewriteRuleTokenStream(self._adaptor, "token USE")
Maxime Perrotin's avatar
Maxime Perrotin committed
1017
1018
        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
1019
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
1020
        stream_def_selection_list = RewriteRuleSubtreeStream(self._adaptor, "rule def_selection_list")
Maxime Perrotin's avatar
Maxime Perrotin committed
1021
1022
        try:
            try:
1023
1024
                # 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
1025
                pass 
1026
                # sdl92.g:162:17: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1027
1028
1029
                alt4 = 2
                LA4_0 = self.input.LA(1)

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

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



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

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

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



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

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

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

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


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


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

                    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"

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

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

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

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

                    if (LA6_0 == COMMA) :
                        alt6 = 1


                    if alt6 == 1:
1200
                        # sdl92.g:174:21: ',' ID
1201
                        pass 
1202
1203
                        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)
1204
1205
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
                        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
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
    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"
1245
    # sdl92.g:181:1: entity_in_system : ( signal_declaration | text_area | procedure | channel | block_definition );
Maxime Perrotin's avatar
Maxime Perrotin committed
1246
1247
1248
1249
1250
1251
1252
    def entity_in_system(self, ):

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

        root_0 = None

1253
        signal_declaration20 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1254

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

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

1259
        channel23 = None
1260

1261
        block_definition24 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1262
1263
1264
1265
1266



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

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

                        raise nvae

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

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

                    raise nvae

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

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

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


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

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

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


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

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

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


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

1347
                    self._state.following.append(self.FOLLOW_channel_in_entity_in_system1780)
1348
                    channel23 = self.channel()
1349
1350
1351

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


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

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

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1365
                        self._adaptor.addChild(root_0, block_definition24.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1366
1367
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


                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"
1397
    # 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
1398
1399
1400
1401
1402
1403
1404
    def signal_declaration(self, ):

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

        root_0 = None

1405
1406
        SIGNAL26 = None
        paramnames25 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1407

1408
        signal_id27 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1409

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

1412
        end29 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1413
1414


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

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

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



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

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

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

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



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

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

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

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


                    stream_paramnames.reset();
                    self._adaptor.addChild(root_1, stream_signal_id.nextTree())
1508
                    # sdl92.g:195:48: ( input_params )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1509
1510
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
                    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"
1552
    # sdl92.g:199:1: channel : CHANNEL channel_id ( route )+ ENDCHANNEL end -> ^( CHANNEL channel_id ( route )+ ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
1553
1554
1555