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

296
297
298
299
300
301
302
303
304
        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
305
306
            )

307
308
309
310
311
312
313
314
315
        self.dfa27 = self.DFA27(
            self, 27,
            eot = self.DFA27_eot,
            eof = self.DFA27_eof,
            min = self.DFA27_min,
            max = self.DFA27_max,
            accept = self.DFA27_accept,
            special = self.DFA27_special,
            transition = self.DFA27_transition
316
317
            )

318
319
320
321
322
323
324
325
326
        self.dfa39 = self.DFA39(
            self, 39,
            eot = self.DFA39_eot,
            eof = self.DFA39_eof,
            min = self.DFA39_min,
            max = self.DFA39_max,
            accept = self.DFA39_accept,
            special = self.DFA39_special,
            transition = self.DFA39_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
327
328
            )

329
330
331
332
333
334
335
336
337
        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
338
339
            )

340
341
342
343
344
345
346
347
348
        self.dfa50 = self.DFA50(
            self, 50,
            eot = self.DFA50_eot,
            eof = self.DFA50_eof,
            min = self.DFA50_min,
            max = self.DFA50_max,
            accept = self.DFA50_accept,
            special = self.DFA50_special,
            transition = self.DFA50_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
349
350
            )

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

362
363
364
365
366
367
368
369
370
        self.dfa57 = self.DFA57(
            self, 57,
            eot = self.DFA57_eot,
            eof = self.DFA57_eof,
            min = self.DFA57_min,
            max = self.DFA57_max,
            accept = self.DFA57_accept,
            special = self.DFA57_special,
            transition = self.DFA57_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
371
372
            )

373
374
375
376
377
378
379
380
381
        self.dfa61 = self.DFA61(
            self, 61,
            eot = self.DFA61_eot,
            eof = self.DFA61_eof,
            min = self.DFA61_min,
            max = self.DFA61_max,
            accept = self.DFA61_accept,
            special = self.DFA61_special,
            transition = self.DFA61_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
382
383
            )

384
385
386
387
388
389
390
391
392
        self.dfa81 = self.DFA81(
            self, 81,
            eot = self.DFA81_eot,
            eof = self.DFA81_eof,
            min = self.DFA81_min,
            max = self.DFA81_max,
            accept = self.DFA81_accept,
            special = self.DFA81_special,
            transition = self.DFA81_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
393
394
            )

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

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

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

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

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

450
451
452
453
454
455
456
457
458
        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
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
Maxime Perrotin's avatar
Maxime Perrotin committed
470
471
            )

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

483
484
485
486
487
488
489
490
491
        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
492
493
            )

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

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
514
515
            )

516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
        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
            )

        self.dfa118 = self.DFA118(
            self, 118,
            eot = self.DFA118_eot,
            eof = self.DFA118_eof,
            min = self.DFA118_min,
            max = self.DFA118_max,
            accept = self.DFA118_accept,
            special = self.DFA118_special,
            transition = self.DFA118_transition
            )

        self.dfa129 = self.DFA129(
            self, 129,
            eot = self.DFA129_eot,
            eof = self.DFA129_eof,
            min = self.DFA129_min,
            max = self.DFA129_max,
            accept = self.DFA129_accept,
            special = self.DFA129_special,
            transition = self.DFA129_transition
547
548
            )

549
550
551
552
553
554
555
556
557
        self.dfa127 = self.DFA127(
            self, 127,
            eot = self.DFA127_eot,
            eof = self.DFA127_eof,
            min = self.DFA127_min,
            max = self.DFA127_max,
            accept = self.DFA127_accept,
            special = self.DFA127_special,
            transition = self.DFA127_transition
558
559
            )

560
561
562
563
564
565
566
567
568
        self.dfa137 = self.DFA137(
            self, 137,
            eot = self.DFA137_eot,
            eof = self.DFA137_eof,
            min = self.DFA137_min,
            max = self.DFA137_max,
            accept = self.DFA137_accept,
            special = self.DFA137_special,
            transition = self.DFA137_transition
569
570
            )

571
572
573
574
575
576
577
578
579
        self.dfa143 = self.DFA143(
            self, 143,
            eot = self.DFA143_eot,
            eof = self.DFA143_eof,
            min = self.DFA143_min,
            max = self.DFA143_max,
            accept = self.DFA143_accept,
            special = self.DFA143_special,
            transition = self.DFA143_transition
580
581
            )

582
583
584
585
586
587
588
589
590
        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
591
592
            )

593
594
595
596
597
598
599
600
601
        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
602
603
            )

604
605
606
607
608
609
610
611
612
        self.dfa182 = self.DFA182(
            self, 182,
            eot = self.DFA182_eot,
            eof = self.DFA182_eof,
            min = self.DFA182_min,
            max = self.DFA182_max,
            accept = self.DFA182_accept,
            special = self.DFA182_special,
            transition = self.DFA182_transition
613
614
            )

615
616
617
618
619
620
621
622
623
        self.dfa186 = self.DFA186(
            self, 186,
            eot = self.DFA186_eot,
            eof = self.DFA186_eof,
            min = self.DFA186_min,
            max = self.DFA186_max,
            accept = self.DFA186_accept,
            special = self.DFA186_special,
            transition = self.DFA186_transition
624
625
            )

626
627
628
629
630
631
632
633
634
        self.dfa195 = self.DFA195(
            self, 195,
            eot = self.DFA195_eot,
            eof = self.DFA195_eof,
            min = self.DFA195_min,
            max = self.DFA195_max,
            accept = self.DFA195_accept,
            special = self.DFA195_special,
            transition = self.DFA195_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
            )






        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"
667
    # sdl92.g:146:1: pr_file : ( use_clause | system_definition | process_definition )+ ;
Maxime Perrotin's avatar
Maxime Perrotin committed
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
    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:
685
686
                # 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
687
688
689
                pass 
                root_0 = self._adaptor.nil()

690
                # sdl92.g:147:17: ( use_clause | system_definition | process_definition )+
Maxime Perrotin's avatar
Maxime Perrotin committed
691
692
693
694
                cnt1 = 0
                while True: #loop1
                    alt1 = 4
                    LA1 = self.input.LA(1)
695
                    if LA1 == 229:
696
697
                        LA1_2 = self.input.LA(2)

698
                        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) :
699
                            alt1 = 3
700
701
                        elif (LA1_2 == KEEP) :
                            alt1 = 1
702
703
704


                    elif LA1 == USE:
Maxime Perrotin's avatar
Maxime Perrotin committed
705
706
707
708
709
710
711
                        alt1 = 1
                    elif LA1 == SYSTEM:
                        alt1 = 2
                    elif LA1 == PROCESS:
                        alt1 = 3

                    if alt1 == 1:
712
                        # sdl92.g:147:18: use_clause
Maxime Perrotin's avatar
Maxime Perrotin committed
713
                        pass 
714
                        self._state.following.append(self.FOLLOW_use_clause_in_pr_file1375)
Maxime Perrotin's avatar
Maxime Perrotin committed
715
716
717
718
719
720
721
722
                        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:
723
                        # sdl92.g:148:19: system_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
724
                        pass 
725
                        self._state.following.append(self.FOLLOW_system_definition_in_pr_file1395)
Maxime Perrotin's avatar
Maxime Perrotin committed
726
727
728
729
730
731
732
733
                        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:
734
                        # sdl92.g:149:19: process_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
735
                        pass 
736
                        self._state.following.append(self.FOLLOW_process_definition_in_pr_file1415)
Maxime Perrotin's avatar
Maxime Perrotin committed
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
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
                        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"
787
    # 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
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
    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
810
        stream_SYSTEM = RewriteRuleTokenStream(self._adaptor, "token SYSTEM")
811
        stream_ENDSYSTEM = RewriteRuleTokenStream(self._adaptor, "token ENDSYSTEM")
Maxime Perrotin's avatar
Maxime Perrotin committed
812
813
814
815
816
        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:
817
818
                # 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
819
                pass 
820
                SYSTEM4=self.match(self.input, SYSTEM, self.FOLLOW_SYSTEM_in_system_definition1449) 
Maxime Perrotin's avatar
Maxime Perrotin committed
821
822
                if self._state.backtracking == 0:
                    stream_SYSTEM.add(SYSTEM4)
823
                self._state.following.append(self.FOLLOW_system_name_in_system_definition1451)
Maxime Perrotin's avatar
Maxime Perrotin committed
824
825
826
827
828
                system_name5 = self.system_name()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_system_name.add(system_name5.tree)
829
                self._state.following.append(self.FOLLOW_end_in_system_definition1453)
Maxime Perrotin's avatar
Maxime Perrotin committed
830
831
832
833
834
                end6 = self.end()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_end.add(end6.tree)
835
                # sdl92.g:155:17: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
836
837
838
839
                while True: #loop2
                    alt2 = 2
                    LA2_0 = self.input.LA(1)

840
                    if ((BLOCK <= LA2_0 <= CHANNEL) or LA2_0 == PROCEDURE or LA2_0 == SIGNAL or LA2_0 == 229) :
Maxime Perrotin's avatar
Maxime Perrotin committed
841
842
843
844
845
846
                        alt2 = 1


                    if alt2 == 1:
                        # sdl92.g:0:0: entity_in_system
                        pass 
847
                        self._state.following.append(self.FOLLOW_entity_in_system_in_system_definition1471)
Maxime Perrotin's avatar
Maxime Perrotin committed
848
849
850
851
852
853
854
855
856
                        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
857
                ENDSYSTEM8=self.match(self.input, ENDSYSTEM, self.FOLLOW_ENDSYSTEM_in_system_definition1490) 
Maxime Perrotin's avatar
Maxime Perrotin committed
858
859
                if self._state.backtracking == 0:
                    stream_ENDSYSTEM.add(ENDSYSTEM8)
860
                # sdl92.g:156:27: ( system_name )?
Maxime Perrotin's avatar
Maxime Perrotin committed
861
862
863
864
865
866
867
868
                alt3 = 2
                LA3_0 = self.input.LA(1)

                if (LA3_0 == ID) :
                    alt3 = 1
                if alt3 == 1:
                    # sdl92.g:0:0: system_name
                    pass 
869
                    self._state.following.append(self.FOLLOW_system_name_in_system_definition1492)
Maxime Perrotin's avatar
Maxime Perrotin committed
870
871
872
873
874
875
876
877
                    system_name9 = self.system_name()

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



878
                self._state.following.append(self.FOLLOW_end_in_system_definition1495)
Maxime Perrotin's avatar
Maxime Perrotin committed
879
880
881
882
883
884
885
                end10 = self.end()

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

                # AST Rewrite
886
                # elements: system_name, entity_in_system, SYSTEM
Maxime Perrotin's avatar
Maxime Perrotin committed
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
                # 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()
903
904
                    # 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
905
906
907
908
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_SYSTEM.nextNode(), root_1)

                    self._adaptor.addChild(root_1, stream_system_name.nextTree())
909
                    # sdl92.g:157:38: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
                    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"
953
    # 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
954
955
956
957
958
959
960
961
    def use_clause(self, ):

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

        root_0 = None

        USE12 = None
962
        char_literal14 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
963
964
965
966
        use_asn111 = None

        package_name13 = None

967
968
969
        def_selection_list15 = None

        end16 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
970
971
972


        USE12_tree = None
973
        char_literal14_tree = None
974
        stream_DIV = RewriteRuleTokenStream(self._adaptor, "token DIV")
975
        stream_USE = RewriteRuleTokenStream(self._adaptor, "token USE")
Maxime Perrotin's avatar
Maxime Perrotin committed
976
977
        stream_use_asn1 = RewriteRuleSubtreeStream(self._adaptor, "rule use_asn1")
        stream_package_name = RewriteRuleSubtreeStream(self._adaptor, "rule package_name")
978
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
979
        stream_def_selection_list = RewriteRuleSubtreeStream(self._adaptor, "rule def_selection_list")
Maxime Perrotin's avatar
Maxime Perrotin committed
980
981
        try:
            try:
982
983
                # sdl92.g:162:9: ( ( use_asn1 )? USE package_name ( '/' def_selection_list )? end -> ^( USE ( use_asn1 )? ( end )? package_name ( def_selection_list )? ) )
                # sdl92.g:162:17: ( use_asn1 )? USE package_name ( '/' def_selection_list )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
984
                pass 
985
                # sdl92.g:162:17: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
986
987
988
                alt4 = 2
                LA4_0 = self.input.LA(1)

989
                if (LA4_0 == 229) :
Maxime Perrotin's avatar
Maxime Perrotin committed
990
991
992
993
                    alt4 = 1
                if alt4 == 1:
                    # sdl92.g:0:0: use_asn1
                    pass 
994
                    self._state.following.append(self.FOLLOW_use_asn1_in_use_clause1551)
Maxime Perrotin's avatar
Maxime Perrotin committed
995
996
997
998
999
1000
                    use_asn111 = self.use_asn1()

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

For faster browsing, not all history is shown. View entire blame