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 14:35:42
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
    def use_clause(self, ):

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