sdl92Parser.py 875 KB
Newer Older
Maxime Perrotin's avatar
Maxime Perrotin committed
1
# $ANTLR 3.1.3 Mar 17, 2009 19:23:44 sdl92.g 2014-04-22 15:38:12
Maxime Perrotin's avatar
Maxime Perrotin committed
2
3
4
5
6
7
8
9
10
11
12
13
14
15

import sys
from antlr3 import *
from antlr3.compat import set, frozenset

from antlr3.tree import *



# for convenience in actions
HIDDEN = BaseRecognizer.HIDDEN

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

# token names
tokenNames = [
    "<invalid>", "<EOR>", "<DOWN>", "<UP>", 
    "FOR", "RANGE", "TIMER", "LABEL", "IFTHENELSE", "COMMENT", "VALUE", 
    "CHOICE", "SEQUENCE", "SEQOF", "EMPTYSTR", "FLOAT", "FLOAT2", "BITSTR", 
    "OCTSTR", "STRING", "EXPRESSION", "DIGITS", "ENDTEXT", "PROCESS", "NUMBER_OF_INSTANCES", 
    "TRANSITION", "STATE", "INPUT_NONE", "SAVE", "PROVIDED", "SIGNAL_LIST", 
    "INPUT", "STIMULUS", "ACTION", "PROCEDURE_CALL", "PROCEDURE", "SET", 
    "RESET", "EXPORT", "DECISION", "ALTERNATIVE", "ANSWER", "CLOSED_RANGE", 
    "OPEN_RANGE", "CONSTANT", "ELSE", "ALL", "TO", "VIA", "VIAPATH", "OUTPUT", 
    "OUTPUT_BODY", "ASSIGN", "TEXT", "NEXTSTATE", "JOIN", "TERMINATOR", 
    "RETURN", "PROCEDURE_NAME", "PARAMS", "FIELD_NAME", "PRIMARY", "PRIMARY_ID", 
    "IF", "THEN", "FI", "CIF", "HYPERLINK", "STATELIST", "INPUTLIST", "INFORMAL_TEXT", 
    "VARIABLE", "VARIABLES", "SORT", "DCL", "MINUS", "GROUND", "TEXTAREA", 
    "TEXTAREA_CONTENT", "TASK", "TASK_BODY", "QUESTION", "FPAR", "PARAM", 
    "INOUT", "EXTERNAL", "IN", "STOP", "SYSTEM", "USE", "SIGNAL", "CHANNEL", 
    "CONNECTION", "ROUTE", "BLOCK", "PARAMNAMES", "ASN1", "FLOATING_LABEL", 
242
243
    "COMPOSITE_STATE", "CONNECT", "ENDSYSTEM", "ENDCHANNEL", "FROM", "WITH", 
    "ENDBLOCK", "SIGNALROUTE", "AND", "REFERENCED", "ENDPROCESS", "ENDPROCEDURE", 
244
245
246
247
248
249
250
251
252
253
254
    "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", "BitStringLiteral", 
    "OctetStringLiteral", "TRUE", "FALSE", "StringLiteral", "NULL", "PLUS_INFINITY", 
    "MINUS_INFINITY", "FloatingPointLiteral", "L_BRACKET", "R_BRACKET", 
    "MANTISSA", "BASE", "EXPONENT", "NOT", "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", 
Maxime Perrotin's avatar
Maxime Perrotin committed
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
    "Q", "Z", "':'", "'ALL'", "'!'", "'(.'", "'.)'", "'ERROR'", "'ACTIVE'", 
    "'ANY'", "'IMPORT'", "'VIEW'", "'/* CIF'", "'*/'"
]




class sdl92Parser(Parser):
    grammarFileName = "sdl92.g"
    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"
    tokenNames = tokenNames

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

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

        self.dfa18 = self.DFA18(
            self, 18,
            eot = self.DFA18_eot,
            eof = self.DFA18_eof,
            min = self.DFA18_min,
            max = self.DFA18_max,
            accept = self.DFA18_accept,
            special = self.DFA18_special,
            transition = self.DFA18_transition
            )

        self.dfa34 = self.DFA34(
            self, 34,
            eot = self.DFA34_eot,
            eof = self.DFA34_eof,
            min = self.DFA34_min,
            max = self.DFA34_max,
            accept = self.DFA34_accept,
            special = self.DFA34_special,
            transition = self.DFA34_transition
            )

        self.dfa35 = self.DFA35(
            self, 35,
            eot = self.DFA35_eot,
            eof = self.DFA35_eof,
            min = self.DFA35_min,
            max = self.DFA35_max,
            accept = self.DFA35_accept,
            special = self.DFA35_special,
            transition = self.DFA35_transition
            )

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

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

329
330
331
332
333
334
335
336
337
        self.dfa58 = self.DFA58(
            self, 58,
            eot = self.DFA58_eot,
            eof = self.DFA58_eof,
            min = self.DFA58_min,
            max = self.DFA58_max,
            accept = self.DFA58_accept,
            special = self.DFA58_special,
            transition = self.DFA58_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
338
339
            )

340
341
342
343
344
345
346
347
348
349
350
        self.dfa59 = self.DFA59(
            self, 59,
            eot = self.DFA59_eot,
            eof = self.DFA59_eof,
            min = self.DFA59_min,
            max = self.DFA59_max,
            accept = self.DFA59_accept,
            special = self.DFA59_special,
            transition = self.DFA59_transition
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
351
352
353
354
355
356
357
358
359
        self.dfa63 = self.DFA63(
            self, 63,
            eot = self.DFA63_eot,
            eof = self.DFA63_eof,
            min = self.DFA63_min,
            max = self.DFA63_max,
            accept = self.DFA63_accept,
            special = self.DFA63_special,
            transition = self.DFA63_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
360
361
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
        self.dfa74 = self.DFA74(
            self, 74,
            eot = self.DFA74_eot,
            eof = self.DFA74_eof,
            min = self.DFA74_min,
            max = self.DFA74_max,
            accept = self.DFA74_accept,
            special = self.DFA74_special,
            transition = self.DFA74_transition
            )

        self.dfa75 = self.DFA75(
            self, 75,
            eot = self.DFA75_eot,
            eof = self.DFA75_eof,
            min = self.DFA75_min,
            max = self.DFA75_max,
            accept = self.DFA75_accept,
            special = self.DFA75_special,
            transition = self.DFA75_transition
            )

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

        self.dfa80 = self.DFA80(
            self, 80,
            eot = self.DFA80_eot,
            eof = self.DFA80_eof,
            min = self.DFA80_min,
            max = self.DFA80_max,
            accept = self.DFA80_accept,
            special = self.DFA80_special,
            transition = self.DFA80_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
404
405
            )

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

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

Maxime Perrotin's avatar
Maxime Perrotin committed
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
        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
            )

        self.dfa85 = self.DFA85(
            self, 85,
            eot = self.DFA85_eot,
            eof = self.DFA85_eof,
            min = self.DFA85_min,
            max = self.DFA85_max,
            accept = self.DFA85_accept,
            special = self.DFA85_special,
            transition = self.DFA85_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
448
449
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
450
451
452
453
454
455
456
457
458
        self.dfa96 = self.DFA96(
            self, 96,
            eot = self.DFA96_eot,
            eof = self.DFA96_eof,
            min = self.DFA96_min,
            max = self.DFA96_max,
            accept = self.DFA96_accept,
            special = self.DFA96_special,
            transition = self.DFA96_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
459
460
            )

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

Maxime Perrotin's avatar
Maxime Perrotin committed
472
473
474
475
476
477
478
479
480
        self.dfa104 = self.DFA104(
            self, 104,
            eot = self.DFA104_eot,
            eof = self.DFA104_eof,
            min = self.DFA104_min,
            max = self.DFA104_max,
            accept = self.DFA104_accept,
            special = self.DFA104_special,
            transition = self.DFA104_transition
481
482
            )

483
484
485
486
487
488
489
490
491
        self.dfa140 = self.DFA140(
            self, 140,
            eot = self.DFA140_eot,
            eof = self.DFA140_eof,
            min = self.DFA140_min,
            max = self.DFA140_max,
            accept = self.DFA140_accept,
            special = self.DFA140_special,
            transition = self.DFA140_transition
492
493
            )

494
495
496
497
498
499
500
501
502
        self.dfa150 = self.DFA150(
            self, 150,
            eot = self.DFA150_eot,
            eof = self.DFA150_eof,
            min = self.DFA150_min,
            max = self.DFA150_max,
            accept = self.DFA150_accept,
            special = self.DFA150_special,
            transition = self.DFA150_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
503
504
            )

505
506
507
508
509
510
511
512
513
        self.dfa160 = self.DFA160(
            self, 160,
            eot = self.DFA160_eot,
            eof = self.DFA160_eof,
            min = self.DFA160_min,
            max = self.DFA160_max,
            accept = self.DFA160_accept,
            special = self.DFA160_special,
            transition = self.DFA160_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
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
            )






        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"
546
    # sdl92.g:124:1: pr_file : ( use_clause | system_definition | process_definition )+ ;
Maxime Perrotin's avatar
Maxime Perrotin committed
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
    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:
564
565
                # sdl92.g:125:9: ( ( use_clause | system_definition | process_definition )+ )
                # sdl92.g:125:17: ( use_clause | system_definition | process_definition )+
Maxime Perrotin's avatar
Maxime Perrotin committed
566
567
568
                pass 
                root_0 = self._adaptor.nil()

569
                # sdl92.g:125:17: ( use_clause | system_definition | process_definition )+
Maxime Perrotin's avatar
Maxime Perrotin committed
570
571
572
573
                cnt1 = 0
                while True: #loop1
                    alt1 = 4
                    LA1 = self.input.LA(1)
574
                    if LA1 == USE or LA1 == 210:
Maxime Perrotin's avatar
Maxime Perrotin committed
575
576
577
578
579
580
581
                        alt1 = 1
                    elif LA1 == SYSTEM:
                        alt1 = 2
                    elif LA1 == PROCESS:
                        alt1 = 3

                    if alt1 == 1:
582
                        # sdl92.g:125:18: use_clause
Maxime Perrotin's avatar
Maxime Perrotin committed
583
                        pass 
584
                        self._state.following.append(self.FOLLOW_use_clause_in_pr_file1134)
Maxime Perrotin's avatar
Maxime Perrotin committed
585
586
587
588
589
590
591
592
                        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:
593
                        # sdl92.g:126:19: system_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
594
                        pass 
595
                        self._state.following.append(self.FOLLOW_system_definition_in_pr_file1154)
Maxime Perrotin's avatar
Maxime Perrotin committed
596
597
598
599
600
601
602
603
                        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:
604
                        # sdl92.g:127:19: process_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
605
                        pass 
606
                        self._state.following.append(self.FOLLOW_process_definition_in_pr_file1174)
Maxime Perrotin's avatar
Maxime Perrotin committed
607
608
609
610
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
643
644
645
646
647
648
649
650
651
652
653
654
655
656
                        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"
657
    # sdl92.g:130: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
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
    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:
687
688
                # sdl92.g:131:9: ( SYSTEM system_name end ( entity_in_system )* ENDSYSTEM ( system_name )? end -> ^( SYSTEM system_name ( entity_in_system )* ) )
                # sdl92.g:131:17: SYSTEM system_name end ( entity_in_system )* ENDSYSTEM ( system_name )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
689
                pass 
690
                SYSTEM4=self.match(self.input, SYSTEM, self.FOLLOW_SYSTEM_in_system_definition1199) 
Maxime Perrotin's avatar
Maxime Perrotin committed
691
692
                if self._state.backtracking == 0:
                    stream_SYSTEM.add(SYSTEM4)
693
                self._state.following.append(self.FOLLOW_system_name_in_system_definition1201)
Maxime Perrotin's avatar
Maxime Perrotin committed
694
695
696
697
698
                system_name5 = self.system_name()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_system_name.add(system_name5.tree)
699
                self._state.following.append(self.FOLLOW_end_in_system_definition1203)
Maxime Perrotin's avatar
Maxime Perrotin committed
700
701
702
703
704
                end6 = self.end()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_end.add(end6.tree)
705
                # sdl92.g:132:17: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
706
707
708
709
                while True: #loop2
                    alt2 = 2
                    LA2_0 = self.input.LA(1)

710
                    if (LA2_0 == PROCEDURE or (SIGNAL <= LA2_0 <= CHANNEL) or LA2_0 == BLOCK or LA2_0 == 210) :
Maxime Perrotin's avatar
Maxime Perrotin committed
711
712
713
714
715
716
                        alt2 = 1


                    if alt2 == 1:
                        # sdl92.g:0:0: entity_in_system
                        pass 
717
                        self._state.following.append(self.FOLLOW_entity_in_system_in_system_definition1221)
Maxime Perrotin's avatar
Maxime Perrotin committed
718
719
720
721
722
723
724
725
726
                        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
727
                ENDSYSTEM8=self.match(self.input, ENDSYSTEM, self.FOLLOW_ENDSYSTEM_in_system_definition1240) 
Maxime Perrotin's avatar
Maxime Perrotin committed
728
729
                if self._state.backtracking == 0:
                    stream_ENDSYSTEM.add(ENDSYSTEM8)
730
                # sdl92.g:133:27: ( system_name )?
Maxime Perrotin's avatar
Maxime Perrotin committed
731
732
733
734
735
736
737
738
                alt3 = 2
                LA3_0 = self.input.LA(1)

                if (LA3_0 == ID) :
                    alt3 = 1
                if alt3 == 1:
                    # sdl92.g:0:0: system_name
                    pass 
739
                    self._state.following.append(self.FOLLOW_system_name_in_system_definition1242)
Maxime Perrotin's avatar
Maxime Perrotin committed
740
741
742
743
744
745
746
747
                    system_name9 = self.system_name()

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



748
                self._state.following.append(self.FOLLOW_end_in_system_definition1245)
Maxime Perrotin's avatar
Maxime Perrotin committed
749
750
751
752
753
754
755
                end10 = self.end()

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

                # AST Rewrite
756
                # elements: SYSTEM, entity_in_system, system_name
Maxime Perrotin's avatar
Maxime Perrotin committed
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
                # 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()
773
774
                    # 134:9: -> ^( SYSTEM system_name ( entity_in_system )* )
                    # sdl92.g:134:17: ^( SYSTEM system_name ( entity_in_system )* )
Maxime Perrotin's avatar
Maxime Perrotin committed
775
776
777
778
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_SYSTEM.nextNode(), root_1)

                    self._adaptor.addChild(root_1, stream_system_name.nextTree())
779
                    # sdl92.g:134:38: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
                    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"
823
    # sdl92.g:137:1: use_clause : ( use_asn1 )? USE package_name end -> ^( USE ( use_asn1 )? package_name ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
    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:
846
847
                # sdl92.g:138:9: ( ( use_asn1 )? USE package_name end -> ^( USE ( use_asn1 )? package_name ) )
                # sdl92.g:138:17: ( use_asn1 )? USE package_name end
Maxime Perrotin's avatar
Maxime Perrotin committed
848
                pass 
849
                # sdl92.g:138:17: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
850
851
852
                alt4 = 2
                LA4_0 = self.input.LA(1)

853
                if (LA4_0 == 210) :
Maxime Perrotin's avatar
Maxime Perrotin committed
854
855
856
857
                    alt4 = 1
                if alt4 == 1:
                    # sdl92.g:0:0: use_asn1
                    pass 
858
                    self._state.following.append(self.FOLLOW_use_asn1_in_use_clause1292)
Maxime Perrotin's avatar
Maxime Perrotin committed
859
860
861
862
863
864
865
866
                    use_asn111 = self.use_asn1()

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



867
                USE12=self.match(self.input, USE, self.FOLLOW_USE_in_use_clause1311) 
Maxime Perrotin's avatar
Maxime Perrotin committed
868
869
                if self._state.backtracking == 0:
                    stream_USE.add(USE12)
870
                self._state.following.append(self.FOLLOW_package_name_in_use_clause1313)
Maxime Perrotin's avatar
Maxime Perrotin committed
871
872
873
874
875
                package_name13 = self.package_name()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_package_name.add(package_name13.tree)
876
                self._state.following.append(self.FOLLOW_end_in_use_clause1315)
Maxime Perrotin's avatar
Maxime Perrotin committed
877
878
879
880
881
882
883
                end14 = self.end()

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

                # AST Rewrite
884
                # elements: USE, package_name, use_asn1
Maxime Perrotin's avatar
Maxime Perrotin committed
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
                # 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()
901
902
                    # 140:9: -> ^( USE ( use_asn1 )? package_name )
                    # sdl92.g:140:17: ^( USE ( use_asn1 )? package_name )
Maxime Perrotin's avatar
Maxime Perrotin committed
903
904
905
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_USE.nextNode(), root_1)

906
                    # sdl92.g:140:23: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
907
908
909
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
                    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"
951
    # sdl92.g:146:1: entity_in_system : ( signal_declaration | procedure | channel | block_definition );
Maxime Perrotin's avatar
Maxime Perrotin committed
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
    def entity_in_system(self, ):

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

        root_0 = None

        signal_declaration15 = None

        procedure16 = None

        channel17 = None

        block_definition18 = None



        try:
            try:
971
                # sdl92.g:147:9: ( signal_declaration | procedure | channel | block_definition )
Maxime Perrotin's avatar
Maxime Perrotin committed
972
973
                alt5 = 4
                LA5 = self.input.LA(1)
974
                if LA5 == 210:
Maxime Perrotin's avatar
Maxime Perrotin committed
975
976
                    LA5_1 = self.input.LA(2)

Maxime Perrotin's avatar
Maxime Perrotin committed
977
                    if (LA5_1 == LABEL or LA5_1 == COMMENT or LA5_1 == STATE or LA5_1 == PROVIDED or LA5_1 == INPUT or (PROCEDURE_CALL <= LA5_1 <= PROCEDURE) or LA5_1 == DECISION or LA5_1 == ANSWER or LA5_1 == OUTPUT or (TEXT <= LA5_1 <= JOIN) or LA5_1 == RETURN or LA5_1 == TASK or LA5_1 == STOP or LA5_1 == CONNECT or LA5_1 == START) :
978
                        alt5 = 2
Maxime Perrotin's avatar
Maxime Perrotin committed
979
980
                    elif (LA5_1 == KEEP) :
                        alt5 = 1
Maxime Perrotin's avatar
Maxime Perrotin committed
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
                    else:
                        if self._state.backtracking > 0:
                            raise BacktrackingFailed

                        nvae = NoViableAltException("", 5, 1, self.input)

                        raise nvae

                elif LA5 == SIGNAL:
                    alt5 = 1
                elif LA5 == PROCEDURE:
                    alt5 = 2
                elif LA5 == CHANNEL:
                    alt5 = 3
                elif LA5 == BLOCK:
                    alt5 = 4
                else:
                    if self._state.backtracking > 0:
                        raise BacktrackingFailed

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