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

# token names
tokenNames = [
    "<invalid>", "<EOR>", "<DOWN>", "<UP>", 
dbarbera's avatar
dbarbera committed
247
248
    "ACTION", "ALL", "ALTERNATIVE", "ANSWER", "ARRAY", "ASN1", "ASSIGN", 
    "BITSTR", "BLOCK", "CHANNEL", "CHOICE", "CIF", "CLOSED_RANGE", "COMMENT", 
249
250
    "COMPOSITE_STATE", "CONDITIONAL", "CONNECT", "CONNECTION", "CONSTANT", 
    "CONSTANTS", "DCL", "DECISION", "DIGITS", "ELSE", "EMPTYSTR", "ENDNEWTYPE", 
251
252
253
    "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", 
254
255
    "INOUT", "INPUT", "INPUT_NONE", "INPUTLIST", "JOIN", "LABEL", "LITERAL", 
    "NEG", "NEWTYPE", "NEXTSTATE", "NUMBER_OF_INSTANCES", "OCTSTR", "OPEN_RANGE", 
256
    "OUTPUT", "OUTPUT_BODY", "PARAM", "PARAMNAMES", "PARAMS", "PAREN", "PFPAR", 
257
    "POINT", "PRIMARY", "PROCEDURE", "PROCEDURE_CALL", "PROCEDURE_NAME", 
258
259
    "PROCESS", "PROVIDED", "QUESTION", "RANGE", "RESET", "RETURN", "RETURNS", 
    "ROUTE", "SAVE", "SELECTOR", "SEQOF", "SEQUENCE", "SET", "SIGNAL", "SIGNAL_LIST", 
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
    "SORT", "STATE", "STATE_AGGREGATION", "STATE_PARTITION_CONNECTION", 
    "STATELIST", "STIMULUS", "STOP", "STOPIF", "STRING", "STRUCT", "SYNONYM", 
    "SYNONYM_LIST", "SYNTYPE", "SYSTEM", "TASK", "TASK_BODY", "TERMINATOR", 
    "TEXT", "TEXTAREA", "TEXTAREA_CONTENT", "THEN", "TIMER", "TO", "TRANSITION", 
    "TYPE_INSTANCE", "USE", "VALUE", "VARIABLE", "VARIABLES", "VIA", "VIAPATH", 
    "ENDSYSTEM", "ID", "ENDCHANNEL", "FROM", "WITH", "ENDBLOCK", "SIGNALROUTE", 
    "AND", "REFERENCED", "ENDPROCESS", "ENDPROCEDURE", "OUT", "INT", "START", 
    "ENDCONNECTION", "SEMI", "ENDSTATE", "ASTERISK", "SUBSTRUCTURE", "ENDSUBSTRUCTURE", 
    "AGGREGATION", "DEFAULT", "NONE", "PRIORITY", "L_PAREN", "R_PAREN", 
    "COMMA", "CALL", "ENDALTERNATIVE", "ENDDECISION", "ANY", "EQ", "NEQ", 
    "GT", "LT", "LE", "GE", "CREATE", "THIS", "ENDFOR", "IMPLIES", "OR", 
    "XOR", "PLUS", "DASH", "APPEND", "DIV", "MOD", "REM", "NOT", "TRUE", 
    "FALSE", "NULL", "PLUS_INFINITY", "MINUS_INFINITY", "MANTISSA", "BASE", 
    "EXPONENT", "ACTIVE", "IMPORT", "VIEW", "KEEP", "SPECIFIC", "GEODE", 
    "ASNFILENAME", "END", "ASSIG_OP", "L_BRACKET", "R_BRACKET", "A", "N", 
    "Y", "D", "C", "L", "E", "K", "P", "R", "M", "S", "I", "F", "G", "O", 
    "H", "T", "X", "U", "V", "W", "B", "J", "DOT", "STR", "ALPHA", "Exponent", 
277
    "WS", "COMMENT2", "Q", "Z", "':'", "'->'", "'!'", "'(.'", "'.)'", "'ERROR'", 
278
    "'/* CIF'", "'*/'"
Maxime Perrotin's avatar
Maxime Perrotin committed
279
280
281
282
283
284
285
]




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

Maxime Perrotin's avatar
Maxime Perrotin committed
340
341
342
343
344
345
346
347
348
        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
349
350
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
351
352
353
354
355
356
357
358
359
        self.dfa42 = self.DFA42(
            self, 42,
            eot = self.DFA42_eot,
            eof = self.DFA42_eof,
            min = self.DFA42_min,
            max = self.DFA42_max,
            accept = self.DFA42_accept,
            special = self.DFA42_special,
            transition = self.DFA42_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
360
361
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
362
363
364
365
366
367
368
369
370
        self.dfa49 = self.DFA49(
            self, 49,
            eot = self.DFA49_eot,
            eof = self.DFA49_eof,
            min = self.DFA49_min,
            max = self.DFA49_max,
            accept = self.DFA49_accept,
            special = self.DFA49_special,
            transition = self.DFA49_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
371
372
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
373
374
375
376
377
378
379
380
381
        self.dfa55 = self.DFA55(
            self, 55,
            eot = self.DFA55_eot,
            eof = self.DFA55_eof,
            min = self.DFA55_min,
            max = self.DFA55_max,
            accept = self.DFA55_accept,
            special = self.DFA55_special,
            transition = self.DFA55_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
382
383
            )

384
385
386
387
388
389
390
391
392
        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
393
394
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
        self.dfa60 = self.DFA60(
            self, 60,
            eot = self.DFA60_eot,
            eof = self.DFA60_eof,
            min = self.DFA60_min,
            max = self.DFA60_max,
            accept = self.DFA60_accept,
            special = self.DFA60_special,
            transition = self.DFA60_transition
            )

        self.dfa77 = self.DFA77(
            self, 77,
            eot = self.DFA77_eot,
            eof = self.DFA77_eof,
            min = self.DFA77_min,
            max = self.DFA77_max,
            accept = self.DFA77_accept,
            special = self.DFA77_special,
            transition = self.DFA77_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
415
416
            )

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

Maxime Perrotin's avatar
Maxime Perrotin committed
428
429
430
431
432
433
434
435
436
        self.dfa86 = self.DFA86(
            self, 86,
            eot = self.DFA86_eot,
            eof = self.DFA86_eof,
            min = self.DFA86_min,
            max = self.DFA86_max,
            accept = self.DFA86_accept,
            special = self.DFA86_special,
            transition = self.DFA86_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
437
438
            )

439
440
441
442
443
444
445
446
447
        self.dfa87 = self.DFA87(
            self, 87,
            eot = self.DFA87_eot,
            eof = self.DFA87_eof,
            min = self.DFA87_min,
            max = self.DFA87_max,
            accept = self.DFA87_accept,
            special = self.DFA87_special,
            transition = self.DFA87_transition
448
449
            )

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

Maxime Perrotin's avatar
Maxime Perrotin committed
461
462
463
464
465
466
467
468
469
        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
470
471
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
472
473
474
475
476
477
478
479
480
        self.dfa101 = self.DFA101(
            self, 101,
            eot = self.DFA101_eot,
            eof = self.DFA101_eof,
            min = self.DFA101_min,
            max = self.DFA101_max,
            accept = self.DFA101_accept,
            special = self.DFA101_special,
            transition = self.DFA101_transition
481
482
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
483
484
485
486
487
488
489
490
491
        self.dfa106 = self.DFA106(
            self, 106,
            eot = self.DFA106_eot,
            eof = self.DFA106_eof,
            min = self.DFA106_min,
            max = self.DFA106_max,
            accept = self.DFA106_accept,
            special = self.DFA106_special,
            transition = self.DFA106_transition
492
493
            )

494
495
496
497
498
499
500
501
502
        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
503
504
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
505
506
507
508
509
510
511
512
513
        self.dfa115 = self.DFA115(
            self, 115,
            eot = self.DFA115_eot,
            eof = self.DFA115_eof,
            min = self.DFA115_min,
            max = self.DFA115_max,
            accept = self.DFA115_accept,
            special = self.DFA115_special,
            transition = self.DFA115_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
514
515
            )

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

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

538
539
540
541
542
543
544
545
546
547
548
        self.dfa114 = self.DFA114(
            self, 114,
            eot = self.DFA114_eot,
            eof = self.DFA114_eof,
            min = self.DFA114_min,
            max = self.DFA114_max,
            accept = self.DFA114_accept,
            special = self.DFA114_special,
            transition = self.DFA114_transition
            )

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

560
561
562
563
564
565
566
567
568
569
570
        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
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
571
572
573
574
575
576
577
578
579
        self.dfa128 = self.DFA128(
            self, 128,
            eot = self.DFA128_eot,
            eof = self.DFA128_eof,
            min = self.DFA128_min,
            max = self.DFA128_max,
            accept = self.DFA128_accept,
            special = self.DFA128_special,
            transition = self.DFA128_transition
580
581
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
582
583
584
585
586
587
588
589
590
        self.dfa126 = self.DFA126(
            self, 126,
            eot = self.DFA126_eot,
            eof = self.DFA126_eof,
            min = self.DFA126_min,
            max = self.DFA126_max,
            accept = self.DFA126_accept,
            special = self.DFA126_special,
            transition = self.DFA126_transition
591
592
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
593
594
595
596
597
598
599
600
601
        self.dfa136 = self.DFA136(
            self, 136,
            eot = self.DFA136_eot,
            eof = self.DFA136_eof,
            min = self.DFA136_min,
            max = self.DFA136_max,
            accept = self.DFA136_accept,
            special = self.DFA136_special,
            transition = self.DFA136_transition
602
603
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
604
605
606
607
608
609
610
611
612
        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
613
614
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
615
616
617
618
619
620
621
622
623
        self.dfa175 = self.DFA175(
            self, 175,
            eot = self.DFA175_eot,
            eof = self.DFA175_eof,
            min = self.DFA175_min,
            max = self.DFA175_max,
            accept = self.DFA175_accept,
            special = self.DFA175_special,
            transition = self.DFA175_transition
624
625
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
626
627
628
629
630
631
632
633
634
        self.dfa180 = self.DFA180(
            self, 180,
            eot = self.DFA180_eot,
            eof = self.DFA180_eof,
            min = self.DFA180_min,
            max = self.DFA180_max,
            accept = self.DFA180_accept,
            special = self.DFA180_special,
            transition = self.DFA180_transition
635
636
            )

637
638
639
640
641
642
643
644
645
        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
646
647
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
648
649
650
651
652
653
654
655
656
        self.dfa185 = self.DFA185(
            self, 185,
            eot = self.DFA185_eot,
            eof = self.DFA185_eof,
            min = self.DFA185_min,
            max = self.DFA185_max,
            accept = self.DFA185_accept,
            special = self.DFA185_special,
            transition = self.DFA185_transition
657
658
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
659
660
661
662
663
664
665
666
667
        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
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
            )






        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"
700
    # sdl92.g:146:1: pr_file : ( use_clause | system_definition | process_definition )+ ;
Maxime Perrotin's avatar
Maxime Perrotin committed
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
    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:
718
719
                # 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
720
721
722
                pass 
                root_0 = self._adaptor.nil()

723
                # sdl92.g:147:17: ( use_clause | system_definition | process_definition )+
Maxime Perrotin's avatar
Maxime Perrotin committed
724
725
726
727
                cnt1 = 0
                while True: #loop1
                    alt1 = 4
                    LA1 = self.input.LA(1)
728
                    if LA1 == 229:
729
730
                        LA1_2 = self.input.LA(2)

Maxime Perrotin's avatar
Maxime Perrotin committed
731
                        if (LA1_2 == KEEP) :
732
                            alt1 = 1
Maxime Perrotin's avatar
Maxime Perrotin committed
733
734
                        elif (LA1_2 == ANSWER or LA1_2 == COMMENT or LA1_2 == CONNECT or LA1_2 == DECISION or LA1_2 == INPUT or (JOIN <= LA1_2 <= LABEL) or LA1_2 == NEXTSTATE or LA1_2 == OUTPUT or (PROCEDURE <= LA1_2 <= PROCEDURE_CALL) or (PROCESS <= LA1_2 <= PROVIDED) or LA1_2 == RETURN or LA1_2 == STATE or LA1_2 == STOP or LA1_2 == TASK or LA1_2 == TEXT or LA1_2 == START) :
                            alt1 = 3
735
736
737


                    elif LA1 == USE:
Maxime Perrotin's avatar
Maxime Perrotin committed
738
739
740
741
742
743
744
                        alt1 = 1
                    elif LA1 == SYSTEM:
                        alt1 = 2
                    elif LA1 == PROCESS:
                        alt1 = 3

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

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_system_name.add(system_name5.tree)
862
                self._state.following.append(self.FOLLOW_end_in_system_definition1453)
Maxime Perrotin's avatar
Maxime Perrotin committed
863
864
865
866
867
                end6 = self.end()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_end.add(end6.tree)
868
                # sdl92.g:155:17: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
869
870
871
872
                while True: #loop2
                    alt2 = 2
                    LA2_0 = self.input.LA(1)

873
                    if ((BLOCK <= LA2_0 <= CHANNEL) or LA2_0 == PROCEDURE or LA2_0 == SIGNAL or LA2_0 == 229) :
Maxime Perrotin's avatar
Maxime Perrotin committed
874
875
876
877
878
879
                        alt2 = 1


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

                if (LA3_0 == ID) :
                    alt3 = 1
                if alt3 == 1:
                    # sdl92.g:0:0: system_name
                    pass 
902
                    self._state.following.append(self.FOLLOW_system_name_in_system_definition1492)
Maxime Perrotin's avatar
Maxime Perrotin committed
903
904
905
906
907
908
909
910
                    system_name9 = self.system_name()

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



911
                self._state.following.append(self.FOLLOW_end_in_system_definition1495)
Maxime Perrotin's avatar
Maxime Perrotin committed
912
913
914
915
916
917
918
                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
919
                # elements: system_name, SYSTEM, entity_in_system
Maxime Perrotin's avatar
Maxime Perrotin committed
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
                # 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()
936
937
                    # 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
938
939
940
941
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_SYSTEM.nextNode(), root_1)

                    self._adaptor.addChild(root_1, stream_system_name.nextTree())
942
                    # sdl92.g:157:38: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
943
944
945
946
947
948
949
950
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
                    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"
986
    # 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
987
988
989
990
991
992
993
994
    def use_clause(self, ):

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

        root_0 = None

        USE12 = None
995
        char_literal14 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
996
997
998
999
        use_asn111 = None

        package_name13 = None

1000
        def_selection_list15 = None
For faster browsing, not all history is shown. View entire blame