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

# token names
tokenNames = [
    "<invalid>", "<EOR>", "<DOWN>", "<UP>", 
dbarbera's avatar
dbarbera committed
245
246
    "ACTION", "ALL", "ALTERNATIVE", "ANSWER", "ARRAY", "ASN1", "ASSIGN", 
    "BITSTR", "BLOCK", "CHANNEL", "CHOICE", "CIF", "CLOSED_RANGE", "COMMENT", 
247
248
    "COMPOSITE_STATE", "CONDITIONAL", "CONNECT", "CONNECTION", "CONSTANT", 
    "CONSTANTS", "DCL", "DECISION", "DIGITS", "ELSE", "EMPTYSTR", "ENDNEWTYPE", 
249
250
251
    "ENDSYNTYPE", "ENDTEXT", "ENTRY_POINT", "EXPORT", "EXPRESSION", "EXTERNAL", 
    "FI", "FIELD", "FIELD_NAME", "FIELDS", "FLOAT2", "FLOAT", "FLOATING_LABEL", 
    "FOR", "FPAR", "GROUND", "HYPERLINK", "IF", "IFTHENELSE", "IN", "INFORMAL_TEXT", 
252
253
    "INOUT", "INPUT", "INPUT_NONE", "INPUTLIST", "JOIN", "LABEL", "LITERAL", 
    "NEG", "NEWTYPE", "NEXTSTATE", "NUMBER_OF_INSTANCES", "OCTSTR", "OPEN_RANGE", 
254
    "OUTPUT", "OUTPUT_BODY", "PARAM", "PARAMNAMES", "PARAMS", "PAREN", "PFPAR", 
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
    "POINT", "PRIMARY", "PROCEDURE", "PROCEDURE_CALL", "PROCEDURE_NAME", 
    "PROCESS", "PROVIDED", "QUESTION", "RANGE", "RESET", "RETURN", "ROUTE", 
    "SAVE", "SELECTOR", "SEQOF", "SEQUENCE", "SET", "SIGNAL", "SIGNAL_LIST", 
    "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", 
    "WS", "COMMENT2", "Q", "Z", "':'", "'!'", "'(.'", "'.)'", "'ERROR'", 
    "'/* CIF'", "'*/'"
Maxime Perrotin's avatar
Maxime Perrotin committed
277
278
279
280
281
282
283
]




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

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

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

294
295
296
297
298
299
300
301
302
        self.dfa25 = self.DFA25(
            self, 25,
            eot = self.DFA25_eot,
            eof = self.DFA25_eof,
            min = self.DFA25_min,
            max = self.DFA25_max,
            accept = self.DFA25_accept,
            special = self.DFA25_special,
            transition = self.DFA25_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
303
304
            )

305
306
307
308
309
310
311
312
313
        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
314
315
            )

316
317
318
319
320
321
322
323
324
        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
325
326
            )

327
328
329
330
331
332
333
334
335
        self.dfa51 = self.DFA51(
            self, 51,
            eot = self.DFA51_eot,
            eof = self.DFA51_eof,
            min = self.DFA51_min,
            max = self.DFA51_max,
            accept = self.DFA51_accept,
            special = self.DFA51_special,
            transition = self.DFA51_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
336
337
            )

338
339
340
341
342
343
344
345
346
        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
347
348
            )

349
350
351
352
353
354
355
356
357
        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
358
359
            )

360
361
362
363
364
365
366
367
368
        self.dfa76 = self.DFA76(
            self, 76,
            eot = self.DFA76_eot,
            eof = self.DFA76_eof,
            min = self.DFA76_min,
            max = self.DFA76_max,
            accept = self.DFA76_accept,
            special = self.DFA76_special,
            transition = self.DFA76_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
369
370
            )

371
372
373
374
375
376
377
378
379
        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
Maxime Perrotin's avatar
Maxime Perrotin committed
380
381
            )

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

393
394
395
396
397
398
399
400
401
        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
402
403
            )

404
405
406
407
408
409
410
411
412
        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
413
414
            )

415
416
417
418
419
420
421
422
423
        self.dfa97 = self.DFA97(
            self, 97,
            eot = self.DFA97_eot,
            eof = self.DFA97_eof,
            min = self.DFA97_min,
            max = self.DFA97_max,
            accept = self.DFA97_accept,
            special = self.DFA97_special,
            transition = self.DFA97_transition
424
425
            )

426
427
428
429
430
431
432
433
434
        self.dfa102 = self.DFA102(
            self, 102,
            eot = self.DFA102_eot,
            eof = self.DFA102_eof,
            min = self.DFA102_min,
            max = self.DFA102_max,
            accept = self.DFA102_accept,
            special = self.DFA102_special,
            transition = self.DFA102_transition
435
436
            )

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

448
449
450
451
452
453
454
455
456
        self.dfa111 = self.DFA111(
            self, 111,
            eot = self.DFA111_eot,
            eof = self.DFA111_eof,
            min = self.DFA111_min,
            max = self.DFA111_max,
            accept = self.DFA111_accept,
            special = self.DFA111_special,
            transition = self.DFA111_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
457
458
            )

459
460
461
462
463
464
465
466
467
468
469
        self.dfa108 = self.DFA108(
            self, 108,
            eot = self.DFA108_eot,
            eof = self.DFA108_eof,
            min = self.DFA108_min,
            max = self.DFA108_max,
            accept = self.DFA108_accept,
            special = self.DFA108_special,
            transition = self.DFA108_transition
            )

470
471
472
473
474
475
476
477
478
        self.dfa109 = self.DFA109(
            self, 109,
            eot = self.DFA109_eot,
            eof = self.DFA109_eof,
            min = self.DFA109_min,
            max = self.DFA109_max,
            accept = self.DFA109_accept,
            special = self.DFA109_special,
            transition = self.DFA109_transition
479
480
            )

481
482
483
484
485
486
487
488
489
        self.dfa110 = self.DFA110(
            self, 110,
            eot = self.DFA110_eot,
            eof = self.DFA110_eof,
            min = self.DFA110_min,
            max = self.DFA110_max,
            accept = self.DFA110_accept,
            special = self.DFA110_special,
            transition = self.DFA110_transition
490
491
492
493
494
495
496
497
498
499
500
501
502
            )

        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
            )

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

514
515
516
517
518
519
520
521
522
        self.dfa124 = self.DFA124(
            self, 124,
            eot = self.DFA124_eot,
            eof = self.DFA124_eof,
            min = self.DFA124_min,
            max = self.DFA124_max,
            accept = self.DFA124_accept,
            special = self.DFA124_special,
            transition = self.DFA124_transition
523
524
            )

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

536
537
538
539
540
541
542
543
544
        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
545
546
            )

547
548
549
550
551
552
553
554
555
        self.dfa138 = self.DFA138(
            self, 138,
            eot = self.DFA138_eot,
            eof = self.DFA138_eof,
            min = self.DFA138_min,
            max = self.DFA138_max,
            accept = self.DFA138_accept,
            special = self.DFA138_special,
            transition = self.DFA138_transition
556
557
            )

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

569
570
571
572
573
574
575
576
577
        self.dfa176 = self.DFA176(
            self, 176,
            eot = self.DFA176_eot,
            eof = self.DFA176_eof,
            min = self.DFA176_min,
            max = self.DFA176_max,
            accept = self.DFA176_accept,
            special = self.DFA176_special,
            transition = self.DFA176_transition
578
579
            )

580
581
582
583
584
585
586
587
588
        self.dfa177 = self.DFA177(
            self, 177,
            eot = self.DFA177_eot,
            eof = self.DFA177_eof,
            min = self.DFA177_min,
            max = self.DFA177_max,
            accept = self.DFA177_accept,
            special = self.DFA177_special,
            transition = self.DFA177_transition
589
590
            )

591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
        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
            )

        self.dfa190 = self.DFA190(
            self, 190,
            eot = self.DFA190_eot,
            eof = self.DFA190_eof,
            min = self.DFA190_min,
            max = self.DFA190_max,
            accept = self.DFA190_accept,
            special = self.DFA190_special,
            transition = self.DFA190_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
            )






        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"
643
    # sdl92.g:145:1: pr_file : ( use_clause | system_definition | process_definition )+ ;
Maxime Perrotin's avatar
Maxime Perrotin committed
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
    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:
661
662
                # sdl92.g:146:9: ( ( use_clause | system_definition | process_definition )+ )
                # sdl92.g:146:17: ( use_clause | system_definition | process_definition )+
Maxime Perrotin's avatar
Maxime Perrotin committed
663
664
665
                pass 
                root_0 = self._adaptor.nil()

666
                # sdl92.g:146:17: ( use_clause | system_definition | process_definition )+
Maxime Perrotin's avatar
Maxime Perrotin committed
667
668
669
670
                cnt1 = 0
                while True: #loop1
                    alt1 = 4
                    LA1 = self.input.LA(1)
671
                    if LA1 == 227:
672
673
                        LA1_2 = self.input.LA(2)

674
                        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) :
675
                            alt1 = 3
676
677
                        elif (LA1_2 == KEEP) :
                            alt1 = 1
678
679
680


                    elif LA1 == USE:
Maxime Perrotin's avatar
Maxime Perrotin committed
681
682
683
684
685
686
687
                        alt1 = 1
                    elif LA1 == SYSTEM:
                        alt1 = 2
                    elif LA1 == PROCESS:
                        alt1 = 3

                    if alt1 == 1:
688
                        # sdl92.g:146:18: use_clause
Maxime Perrotin's avatar
Maxime Perrotin committed
689
                        pass 
690
                        self._state.following.append(self.FOLLOW_use_clause_in_pr_file1364)
Maxime Perrotin's avatar
Maxime Perrotin committed
691
692
693
694
695
696
697
698
                        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:
699
                        # sdl92.g:147:19: system_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
700
                        pass 
701
                        self._state.following.append(self.FOLLOW_system_definition_in_pr_file1384)
Maxime Perrotin's avatar
Maxime Perrotin committed
702
703
704
705
706
707
708
709
                        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:
710
                        # sdl92.g:148:19: process_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
711
                        pass 
712
                        self._state.following.append(self.FOLLOW_process_definition_in_pr_file1404)
Maxime Perrotin's avatar
Maxime Perrotin committed
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
                        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"
763
    # sdl92.g:152: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
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
    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
786
        stream_ENDSYSTEM = RewriteRuleTokenStream(self._adaptor, "token ENDSYSTEM")
787
        stream_SYSTEM = RewriteRuleTokenStream(self._adaptor, "token SYSTEM")
Maxime Perrotin's avatar
Maxime Perrotin committed
788
789
790
791
792
        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:
793
794
                # sdl92.g:153:9: ( SYSTEM system_name end ( entity_in_system )* ENDSYSTEM ( system_name )? end -> ^( SYSTEM system_name ( entity_in_system )* ) )
                # sdl92.g:153:17: SYSTEM system_name end ( entity_in_system )* ENDSYSTEM ( system_name )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
795
                pass 
796
                SYSTEM4=self.match(self.input, SYSTEM, self.FOLLOW_SYSTEM_in_system_definition1438) 
Maxime Perrotin's avatar
Maxime Perrotin committed
797
798
                if self._state.backtracking == 0:
                    stream_SYSTEM.add(SYSTEM4)
799
                self._state.following.append(self.FOLLOW_system_name_in_system_definition1440)
Maxime Perrotin's avatar
Maxime Perrotin committed
800
801
802
803
804
                system_name5 = self.system_name()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_system_name.add(system_name5.tree)
805
                self._state.following.append(self.FOLLOW_end_in_system_definition1442)
Maxime Perrotin's avatar
Maxime Perrotin committed
806
807
808
809
810
                end6 = self.end()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_end.add(end6.tree)
811
                # sdl92.g:154:17: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
812
813
814
815
                while True: #loop2
                    alt2 = 2
                    LA2_0 = self.input.LA(1)

816
                    if ((BLOCK <= LA2_0 <= CHANNEL) or LA2_0 == PROCEDURE or LA2_0 == SIGNAL or LA2_0 == 227) :
Maxime Perrotin's avatar
Maxime Perrotin committed
817
818
819
820
821
822
                        alt2 = 1


                    if alt2 == 1:
                        # sdl92.g:0:0: entity_in_system
                        pass 
823
                        self._state.following.append(self.FOLLOW_entity_in_system_in_system_definition1460)
Maxime Perrotin's avatar
Maxime Perrotin committed
824
825
826
827
828
829
830
831
832
                        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
833
                ENDSYSTEM8=self.match(self.input, ENDSYSTEM, self.FOLLOW_ENDSYSTEM_in_system_definition1479) 
Maxime Perrotin's avatar
Maxime Perrotin committed
834
835
                if self._state.backtracking == 0:
                    stream_ENDSYSTEM.add(ENDSYSTEM8)
836
                # sdl92.g:155:27: ( system_name )?
Maxime Perrotin's avatar
Maxime Perrotin committed
837
838
839
840
841
842
843
844
                alt3 = 2
                LA3_0 = self.input.LA(1)

                if (LA3_0 == ID) :
                    alt3 = 1
                if alt3 == 1:
                    # sdl92.g:0:0: system_name
                    pass 
845
                    self._state.following.append(self.FOLLOW_system_name_in_system_definition1481)
Maxime Perrotin's avatar
Maxime Perrotin committed
846
847
848
849
850
851
852
853
                    system_name9 = self.system_name()

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



854
                self._state.following.append(self.FOLLOW_end_in_system_definition1484)
Maxime Perrotin's avatar
Maxime Perrotin committed
855
856
857
858
859
860
861
                end10 = self.end()

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

                # AST Rewrite
862
                # elements: SYSTEM, system_name, entity_in_system
Maxime Perrotin's avatar
Maxime Perrotin committed
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
                # 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()
879
880
                    # 156:9: -> ^( SYSTEM system_name ( entity_in_system )* )
                    # sdl92.g:156:17: ^( SYSTEM system_name ( entity_in_system )* )
Maxime Perrotin's avatar
Maxime Perrotin committed
881
882
883
884
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_SYSTEM.nextNode(), root_1)

                    self._adaptor.addChild(root_1, stream_system_name.nextTree())
885
                    # sdl92.g:156:38: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
                    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"
929
    # sdl92.g:160: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
930
931
932
933
934
935
936
937
    def use_clause(self, ):

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

        root_0 = None

        USE12 = None
938
        char_literal14 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
939
940
941
942
        use_asn111 = None

        package_name13 = None

943
944
945
        def_selection_list15 = None

        end16 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
946
947
948


        USE12_tree = None
949
        char_literal14_tree = None
950
        stream_USE = RewriteRuleTokenStream(self._adaptor, "token USE")
951
        stream_DIV = RewriteRuleTokenStream(self._adaptor, "token DIV")
Maxime Perrotin's avatar
Maxime Perrotin committed
952
953
        stream_use_asn1 = RewriteRuleSubtreeStream(self._adaptor, "rule use_asn1")
        stream_package_name = RewriteRuleSubtreeStream(self._adaptor, "rule package_name")
954
        stream_def_selection_list = RewriteRuleSubtreeStream(self._adaptor, "rule def_selection_list")
955
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
Maxime Perrotin's avatar
Maxime Perrotin committed
956
957
        try:
            try:
958
959
                # sdl92.g:161:9: ( ( use_asn1 )? USE package_name ( '/' def_selection_list )? end -> ^( USE ( use_asn1 )? ( end )? package_name ( def_selection_list )? ) )
                # sdl92.g:161:17: ( use_asn1 )? USE package_name ( '/' def_selection_list )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
960
                pass 
961
                # sdl92.g:161:17: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
962
963
964
                alt4 = 2
                LA4_0 = self.input.LA(1)

965
                if (LA4_0 == 227) :
Maxime Perrotin's avatar
Maxime Perrotin committed
966
967
968
969
                    alt4 = 1
                if alt4 == 1:
                    # sdl92.g:0:0: use_asn1
                    pass 
970
                    self._state.following.append(self.FOLLOW_use_asn1_in_use_clause1540)
Maxime Perrotin's avatar
Maxime Perrotin committed
971
972
973
974
975
976
977
978
                    use_asn111 = self.use_asn1()

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



979
                USE12=self.match(self.input, USE, self.FOLLOW_USE_in_use_clause1559) 
Maxime Perrotin's avatar
Maxime Perrotin committed
980
981
                if self._state.backtracking == 0:
                    stream_USE.add(USE12)
982
                self._state.following.append(self.FOLLOW_package_name_in_use_clause1561)
Maxime Perrotin's avatar
Maxime Perrotin committed
983
984
985
986
987
                package_name13 = self.package_name()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_package_name.add(package_name13.tree)
988
                # sdl92.g:163:17: ( '/' def_selection_list )?
989
990
991
992
993
994
                alt5 = 2
                LA5_0 = self.input.LA(1)

                if (LA5_0 == DIV) :
                    alt5 = 1
                if alt5 == 1:
995
                    # sdl92.g:163:18: '/' def_selection_list
996
                    pass 
997
                    char_literal14=self.match(self.input, DIV, self.FOLLOW_DIV_in_use_clause1580) 
998
999
                    if self._state.backtracking == 0:
                        stream_DIV.add(char_literal14)
1000
                    self._state.following.append(self.FOLLOW_def_selection_list_in_use_clause1582)
For faster browsing, not all history is shown. View entire blame