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

# token names
tokenNames = [
    "<invalid>", "<EOR>", "<DOWN>", "<UP>", 
dbarbera's avatar
dbarbera committed
238
239
240
241
242
243
244
245
246
    "ACTION", "ALL", "ALTERNATIVE", "ANSWER", "ARRAY", "ASN1", "ASSIGN", 
    "BITSTR", "BLOCK", "CHANNEL", "CHOICE", "CIF", "CLOSED_RANGE", "COMMENT", 
    "COMPOSITE_STATE", "CONNECT", "CONNECTION", "CONSTANT", "CONSTANTS", 
    "DCL", "DECISION", "DIGITS", "ELSE", "EMPTYSTR", "ENDNEWTYPE", "ENDSYNTYPE", 
    "ENDTEXT", "EXPORT", "EXPRESSION", "EXTERNAL", "FI", "FIELD", "FIELD_NAME", 
    "FIELDS", "FLOAT2", "FLOAT", "FLOATING_LABEL", "FOR", "FPAR", "GROUND", 
    "HYPERLINK", "IF", "IFTHENELSE", "IN", "INFORMAL_TEXT", "INOUT", "INPUT", 
    "INPUT_NONE", "INPUTLIST", "JOIN", "LABEL", "NEG", "NEWTYPE", "NEXTSTATE", 
    "NUMBER_OF_INSTANCES", "OCTSTR", "OPEN_RANGE", "OUTPUT", "OUTPUT_BODY", 
247
    "PARAM", "PARAMNAMES", "PARAMS", "PAREN", "PRIMARY", "PRIMARY_ID", "PROCEDURE", 
dbarbera's avatar
dbarbera committed
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
    "PROCEDURE_CALL", "PROCEDURE_NAME", "PROCESS", "PROVIDED", "QUESTION", 
    "RANGE", "RESET", "RETURN", "ROUTE", "SAVE", "SEQOF", "SEQUENCE", "SET", 
    "SIGNAL", "SIGNAL_LIST", "SORT", "STATE", "STATELIST", "STIMULUS", "STOP", 
    "STRING", "STRUCT", "SYNONYM", "SYNONYM_LIST", "SYNTYPE", "SYSTEM", 
    "TASK", "TASK_BODY", "TERMINATOR", "TEXT", "TEXTAREA", "TEXTAREA_CONTENT", 
    "THEN", "TIMER", "TO", "TRANSITION", "USE", "VALUE", "VARIABLE", "VARIABLES", 
    "VIA", "VIAPATH", "ENDSYSTEM", "ENDCHANNEL", "FROM", "WITH", "ENDBLOCK", 
    "SIGNALROUTE", "AND", "REFERENCED", "ENDPROCESS", "ENDPROCEDURE", "INT", 
    "START", "ENDCONNECTION", "SEMI", "ENDSTATE", "ASTERISK", "SUBSTRUCTURE", 
    "ENDSUBSTRUCTURE", "OUT", "NONE", "PRIORITY", "L_PAREN", "R_PAREN", 
    "COMMA", "CALL", "ENDALTERNATIVE", "ENDDECISION", "ANY", "EQ", "NEQ", 
    "GT", "LT", "LE", "GE", "CREATE", "THIS", "ID", "ENDFOR", "IMPLIES", 
    "OR", "XOR", "PLUS", "DASH", "APPEND", "DIV", "MOD", "REM", "NOT", "BitStringLiteral", 
    "OctetStringLiteral", "TRUE", "FALSE", "StringLiteral", "NULL", "PLUS_INFINITY", 
    "MINUS_INFINITY", "FloatingPointLiteral", "L_BRACKET", "R_BRACKET", 
    "MANTISSA", "BASE", "EXPONENT", "ACTIVE", "IMPORT", "VIEW", "KEEP", 
    "SPECIFIC", "GEODE", "ASNFILENAME", "END", "ASSIG_OP", "A", "N", "Y", 
    "D", "C", "L", "E", "K", "P", "R", "M", "S", "I", "F", "G", "O", "H", 
    "T", "X", "U", "V", "W", "B", "J", "DOT", "STR", "ALPHA", "Exponent", 
    "WS", "COMMENT2", "Q", "Z", "':'", "'!'", "'(.'", "'.)'", "'ERROR'", 
    "'/* CIF'", "'*/'"
Maxime Perrotin's avatar
Maxime Perrotin committed
269
270
271
272
273
274
275
]




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

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

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

286
287
288
289
290
291
292
293
294
        self.dfa19 = self.DFA19(
            self, 19,
            eot = self.DFA19_eot,
            eof = self.DFA19_eof,
            min = self.DFA19_min,
            max = self.DFA19_max,
            accept = self.DFA19_accept,
            special = self.DFA19_special,
            transition = self.DFA19_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
295
296
            )

297
298
299
300
301
302
303
304
305
306
307
        self.dfa30 = self.DFA30(
            self, 30,
            eot = self.DFA30_eot,
            eof = self.DFA30_eof,
            min = self.DFA30_min,
            max = self.DFA30_max,
            accept = self.DFA30_accept,
            special = self.DFA30_special,
            transition = self.DFA30_transition
            )

308
309
310
311
312
313
314
315
316
        self.dfa37 = self.DFA37(
            self, 37,
            eot = self.DFA37_eot,
            eof = self.DFA37_eof,
            min = self.DFA37_min,
            max = self.DFA37_max,
            accept = self.DFA37_accept,
            special = self.DFA37_special,
            transition = self.DFA37_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
317
318
            )

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

330
331
332
333
334
335
336
337
338
        self.dfa44 = self.DFA44(
            self, 44,
            eot = self.DFA44_eot,
            eof = self.DFA44_eof,
            min = self.DFA44_min,
            max = self.DFA44_max,
            accept = self.DFA44_accept,
            special = self.DFA44_special,
            transition = self.DFA44_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
339
340
            )

341
342
343
344
345
346
347
348
349
        self.dfa48 = self.DFA48(
            self, 48,
            eot = self.DFA48_eot,
            eof = self.DFA48_eof,
            min = self.DFA48_min,
            max = self.DFA48_max,
            accept = self.DFA48_accept,
            special = self.DFA48_special,
            transition = self.DFA48_transition
350
351
            )

352
353
354
355
356
357
358
359
360
        self.dfa66 = self.DFA66(
            self, 66,
            eot = self.DFA66_eot,
            eof = self.DFA66_eof,
            min = self.DFA66_min,
            max = self.DFA66_max,
            accept = self.DFA66_accept,
            special = self.DFA66_special,
            transition = self.DFA66_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
361
362
            )

363
364
365
366
367
368
369
370
371
        self.dfa67 = self.DFA67(
            self, 67,
            eot = self.DFA67_eot,
            eof = self.DFA67_eof,
            min = self.DFA67_min,
            max = self.DFA67_max,
            accept = self.DFA67_accept,
            special = self.DFA67_special,
            transition = self.DFA67_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
372
373
            )

374
375
376
377
378
379
380
381
382
        self.dfa68 = self.DFA68(
            self, 68,
            eot = self.DFA68_eot,
            eof = self.DFA68_eof,
            min = self.DFA68_min,
            max = self.DFA68_max,
            accept = self.DFA68_accept,
            special = self.DFA68_special,
            transition = self.DFA68_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
383
384
            )

385
386
387
388
389
390
391
392
393
        self.dfa72 = self.DFA72(
            self, 72,
            eot = self.DFA72_eot,
            eof = self.DFA72_eof,
            min = self.DFA72_min,
            max = self.DFA72_max,
            accept = self.DFA72_accept,
            special = self.DFA72_special,
            transition = self.DFA72_transition
394
395
            )

396
397
398
399
400
401
402
403
404
        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
Maxime Perrotin's avatar
Maxime Perrotin committed
405
406
            )

407
408
409
410
411
412
413
414
415
        self.dfa84 = self.DFA84(
            self, 84,
            eot = self.DFA84_eot,
            eof = self.DFA84_eof,
            min = self.DFA84_min,
            max = self.DFA84_max,
            accept = self.DFA84_accept,
            special = self.DFA84_special,
            transition = self.DFA84_transition
416
417
            )

418
419
420
421
422
423
424
425
426
        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
427
428
            )

429
430
431
432
433
434
435
436
437
        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
438
439
            )

440
441
442
443
444
445
446
447
448
        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
Maxime Perrotin's avatar
Maxime Perrotin committed
449
450
            )

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

462
463
464
465
466
467
468
469
470
        self.dfa93 = self.DFA93(
            self, 93,
            eot = self.DFA93_eot,
            eof = self.DFA93_eof,
            min = self.DFA93_min,
            max = self.DFA93_max,
            accept = self.DFA93_accept,
            special = self.DFA93_special,
            transition = self.DFA93_transition
471
472
            )

473
474
475
476
477
478
479
480
481
        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
482
483
            )

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

495
496
497
498
499
500
501
502
503
        self.dfa103 = self.DFA103(
            self, 103,
            eot = self.DFA103_eot,
            eof = self.DFA103_eof,
            min = self.DFA103_min,
            max = self.DFA103_max,
            accept = self.DFA103_accept,
            special = self.DFA103_special,
            transition = self.DFA103_transition
504
505
            )

506
507
508
509
510
511
512
513
514
        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
515
516
            )

517
518
519
520
521
522
523
524
525
        self.dfa152 = self.DFA152(
            self, 152,
            eot = self.DFA152_eot,
            eof = self.DFA152_eof,
            min = self.DFA152_min,
            max = self.DFA152_max,
            accept = self.DFA152_accept,
            special = self.DFA152_special,
            transition = self.DFA152_transition
526
527
            )

528
529
530
531
532
533
534
535
536
        self.dfa162 = self.DFA162(
            self, 162,
            eot = self.DFA162_eot,
            eof = self.DFA162_eof,
            min = self.DFA162_min,
            max = self.DFA162_max,
            accept = self.DFA162_accept,
            special = self.DFA162_special,
            transition = self.DFA162_transition
537
538
            )

dbarbera's avatar
dbarbera committed
539
540
541
542
543
544
545
546
547
        self.dfa171 = self.DFA171(
            self, 171,
            eot = self.DFA171_eot,
            eof = self.DFA171_eof,
            min = self.DFA171_min,
            max = self.DFA171_max,
            accept = self.DFA171_accept,
            special = self.DFA171_special,
            transition = self.DFA171_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
            )






        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"
580
    # sdl92.g:136:1: pr_file : ( use_clause | system_definition | process_definition )+ ;
Maxime Perrotin's avatar
Maxime Perrotin committed
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
    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:
598
599
                # sdl92.g:137:9: ( ( use_clause | system_definition | process_definition )+ )
                # sdl92.g:137:17: ( use_clause | system_definition | process_definition )+
Maxime Perrotin's avatar
Maxime Perrotin committed
600
601
602
                pass 
                root_0 = self._adaptor.nil()

603
                # sdl92.g:137:17: ( use_clause | system_definition | process_definition )+
Maxime Perrotin's avatar
Maxime Perrotin committed
604
605
606
607
                cnt1 = 0
                while True: #loop1
                    alt1 = 4
                    LA1 = self.input.LA(1)
608
                    if LA1 == 220:
609
610
                        LA1_2 = self.input.LA(2)

dbarbera's avatar
dbarbera committed
611
                        if (LA1_2 == KEEP) :
612
                            alt1 = 1
dbarbera's avatar
dbarbera committed
613
                        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) :
dbarbera's avatar
dbarbera committed
614
                            alt1 = 3
615
616
617


                    elif LA1 == USE:
Maxime Perrotin's avatar
Maxime Perrotin committed
618
619
620
621
622
623
624
                        alt1 = 1
                    elif LA1 == SYSTEM:
                        alt1 = 2
                    elif LA1 == PROCESS:
                        alt1 = 3

                    if alt1 == 1:
625
                        # sdl92.g:137:18: use_clause
Maxime Perrotin's avatar
Maxime Perrotin committed
626
                        pass 
627
                        self._state.following.append(self.FOLLOW_use_clause_in_pr_file1266)
Maxime Perrotin's avatar
Maxime Perrotin committed
628
629
630
631
632
633
634
635
                        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:
636
                        # sdl92.g:138:19: system_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
637
                        pass 
638
                        self._state.following.append(self.FOLLOW_system_definition_in_pr_file1286)
Maxime Perrotin's avatar
Maxime Perrotin committed
639
640
641
642
643
644
645
646
                        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:
647
                        # sdl92.g:139:19: process_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
648
                        pass 
649
                        self._state.following.append(self.FOLLOW_process_definition_in_pr_file1306)
Maxime Perrotin's avatar
Maxime Perrotin committed
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
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
                        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"
700
    # sdl92.g:142: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
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
    def system_definition(self, ):

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

        root_0 = None

        SYSTEM4 = None
        ENDSYSTEM8 = None
        system_name5 = None

        end6 = None

        entity_in_system7 = None

        system_name9 = None

        end10 = None


        SYSTEM4_tree = None
        ENDSYSTEM8_tree = None
        stream_ENDSYSTEM = RewriteRuleTokenStream(self._adaptor, "token ENDSYSTEM")
        stream_SYSTEM = RewriteRuleTokenStream(self._adaptor, "token SYSTEM")
        stream_entity_in_system = RewriteRuleSubtreeStream(self._adaptor, "rule entity_in_system")
        stream_system_name = RewriteRuleSubtreeStream(self._adaptor, "rule system_name")
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
        try:
            try:
730
731
                # sdl92.g:143:9: ( SYSTEM system_name end ( entity_in_system )* ENDSYSTEM ( system_name )? end -> ^( SYSTEM system_name ( entity_in_system )* ) )
                # sdl92.g:143:17: SYSTEM system_name end ( entity_in_system )* ENDSYSTEM ( system_name )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
732
                pass 
733
                SYSTEM4=self.match(self.input, SYSTEM, self.FOLLOW_SYSTEM_in_system_definition1331) 
Maxime Perrotin's avatar
Maxime Perrotin committed
734
735
                if self._state.backtracking == 0:
                    stream_SYSTEM.add(SYSTEM4)
736
                self._state.following.append(self.FOLLOW_system_name_in_system_definition1333)
Maxime Perrotin's avatar
Maxime Perrotin committed
737
738
739
740
741
                system_name5 = self.system_name()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_system_name.add(system_name5.tree)
742
                self._state.following.append(self.FOLLOW_end_in_system_definition1335)
Maxime Perrotin's avatar
Maxime Perrotin committed
743
744
745
746
747
                end6 = self.end()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_end.add(end6.tree)
748
                # sdl92.g:144:17: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
749
750
751
752
                while True: #loop2
                    alt2 = 2
                    LA2_0 = self.input.LA(1)

753
                    if ((BLOCK <= LA2_0 <= CHANNEL) or LA2_0 == PROCEDURE or LA2_0 == SIGNAL or LA2_0 == 220) :
Maxime Perrotin's avatar
Maxime Perrotin committed
754
755
756
757
758
759
                        alt2 = 1


                    if alt2 == 1:
                        # sdl92.g:0:0: entity_in_system
                        pass 
760
                        self._state.following.append(self.FOLLOW_entity_in_system_in_system_definition1353)
Maxime Perrotin's avatar
Maxime Perrotin committed
761
762
763
764
765
766
767
768
769
                        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
770
                ENDSYSTEM8=self.match(self.input, ENDSYSTEM, self.FOLLOW_ENDSYSTEM_in_system_definition1372) 
Maxime Perrotin's avatar
Maxime Perrotin committed
771
772
                if self._state.backtracking == 0:
                    stream_ENDSYSTEM.add(ENDSYSTEM8)
773
                # sdl92.g:145:27: ( system_name )?
Maxime Perrotin's avatar
Maxime Perrotin committed
774
775
776
777
778
779
780
781
                alt3 = 2
                LA3_0 = self.input.LA(1)

                if (LA3_0 == ID) :
                    alt3 = 1
                if alt3 == 1:
                    # sdl92.g:0:0: system_name
                    pass 
782
                    self._state.following.append(self.FOLLOW_system_name_in_system_definition1374)
Maxime Perrotin's avatar
Maxime Perrotin committed
783
784
785
786
787
788
789
790
                    system_name9 = self.system_name()

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



791
                self._state.following.append(self.FOLLOW_end_in_system_definition1377)
Maxime Perrotin's avatar
Maxime Perrotin committed
792
793
794
795
796
797
798
                end10 = self.end()

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

                # AST Rewrite
799
                # elements: system_name, entity_in_system, SYSTEM
Maxime Perrotin's avatar
Maxime Perrotin committed
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
                # 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()
816
817
                    # 146:9: -> ^( SYSTEM system_name ( entity_in_system )* )
                    # sdl92.g:146:17: ^( SYSTEM system_name ( entity_in_system )* )
Maxime Perrotin's avatar
Maxime Perrotin committed
818
819
820
821
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_SYSTEM.nextNode(), root_1)

                    self._adaptor.addChild(root_1, stream_system_name.nextTree())
822
                    # sdl92.g:146:38: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
                    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"
866
    # sdl92.g:149:1: use_clause : ( use_asn1 )? USE package_name end -> ^( USE ( use_asn1 )? package_name ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
    def use_clause(self, ):

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

        root_0 = None

        USE12 = None
        use_asn111 = None

        package_name13 = None

        end14 = None


        USE12_tree = None
        stream_USE = RewriteRuleTokenStream(self._adaptor, "token USE")
        stream_use_asn1 = RewriteRuleSubtreeStream(self._adaptor, "rule use_asn1")
        stream_package_name = RewriteRuleSubtreeStream(self._adaptor, "rule package_name")
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
        try:
            try:
889
890
                # sdl92.g:150:9: ( ( use_asn1 )? USE package_name end -> ^( USE ( use_asn1 )? package_name ) )
                # sdl92.g:150:17: ( use_asn1 )? USE package_name end
Maxime Perrotin's avatar
Maxime Perrotin committed
891
                pass 
892
                # sdl92.g:150:17: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
893
894
895
                alt4 = 2
                LA4_0 = self.input.LA(1)

896
                if (LA4_0 == 220) :
Maxime Perrotin's avatar
Maxime Perrotin committed
897
898
899
900
                    alt4 = 1
                if alt4 == 1:
                    # sdl92.g:0:0: use_asn1
                    pass 
901
                    self._state.following.append(self.FOLLOW_use_asn1_in_use_clause1424)
Maxime Perrotin's avatar
Maxime Perrotin committed
902
903
904
905
906
907
908
909
                    use_asn111 = self.use_asn1()

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



910
                USE12=self.match(self.input, USE, self.FOLLOW_USE_in_use_clause1443) 
Maxime Perrotin's avatar
Maxime Perrotin committed
911
912
                if self._state.backtracking == 0:
                    stream_USE.add(USE12)
913
                self._state.following.append(self.FOLLOW_package_name_in_use_clause1445)
Maxime Perrotin's avatar
Maxime Perrotin committed
914
915
916
917
918
                package_name13 = self.package_name()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_package_name.add(package_name13.tree)
919
                self._state.following.append(self.FOLLOW_end_in_use_clause1447)
Maxime Perrotin's avatar
Maxime Perrotin committed
920
921
922
923
924
925
926
                end14 = self.end()

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

                # AST Rewrite
927
                # elements: USE, package_name, use_asn1
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
                    # 152:9: -> ^( USE ( use_asn1 )? package_name )
                    # sdl92.g:152:17: ^( USE ( use_asn1 )? package_name )
Maxime Perrotin's avatar
Maxime Perrotin committed
946
947
948
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_USE.nextNode(), root_1)

949
                    # sdl92.g:152:23: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
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
986
987
988
989
990
991
992
993
                    if stream_use_asn1.hasNext():
                        self._adaptor.addChild(root_1, stream_use_asn1.nextTree())


                    stream_use_asn1.reset();
                    self._adaptor.addChild(root_1, stream_package_name.nextTree())

                    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"

    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"
994
    # sdl92.g:158:1: entity_in_system : ( signal_declaration | procedure | channel | block_definition );
Maxime Perrotin's avatar
Maxime Perrotin committed
995
996
997
998
999
1000
    def entity_in_system(self, ):

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

        root_0 = None