sdl92Parser.py 878 KB
Newer Older
1
# $ANTLR 3.1.3 Mar 17, 2009 19:23:44 sdl92.g 2014-06-18 11:34:19
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
    "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)

274
275
276
277
278
279
280
281
282
        self.dfa19 = self.DFA19(
            self, 19,
            eot = self.DFA19_eot,
            eof = self.DFA19_eof,
            min = self.DFA19_min,
            max = self.DFA19_max,
            accept = self.DFA19_accept,
            special = self.DFA19_special,
            transition = self.DFA19_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
283
284
285
286
287
288
289
290
291
292
293
294
295
            )

        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
            )

296
297
298
299
300
301
302
303
304
        self.dfa36 = self.DFA36(
            self, 36,
            eot = self.DFA36_eot,
            eof = self.DFA36_eof,
            min = self.DFA36_min,
            max = self.DFA36_max,
            accept = self.DFA36_accept,
            special = self.DFA36_special,
            transition = self.DFA36_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
305
306
            )

307
308
309
310
311
312
313
314
315
        self.dfa40 = self.DFA40(
            self, 40,
            eot = self.DFA40_eot,
            eof = self.DFA40_eof,
            min = self.DFA40_min,
            max = self.DFA40_max,
            accept = self.DFA40_accept,
            special = self.DFA40_special,
            transition = self.DFA40_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
316
317
            )

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

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

340
341
342
343
344
345
346
347
348
        self.dfa60 = self.DFA60(
            self, 60,
            eot = self.DFA60_eot,
            eof = self.DFA60_eof,
            min = self.DFA60_min,
            max = self.DFA60_max,
            accept = self.DFA60_accept,
            special = self.DFA60_special,
            transition = self.DFA60_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
349
350
            )

351
352
353
354
355
356
357
358
359
        self.dfa64 = self.DFA64(
            self, 64,
            eot = self.DFA64_eot,
            eof = self.DFA64_eof,
            min = self.DFA64_min,
            max = self.DFA64_max,
            accept = self.DFA64_accept,
            special = self.DFA64_special,
            transition = self.DFA64_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
360
361
362
363
364
365
366
367
368
369
370
371
372
            )

        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
            )

373
374
375
376
377
378
379
380
381
        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
382
383
            )

384
385
386
387
388
389
390
391
392
        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
Maxime Perrotin's avatar
Maxime Perrotin committed
393
394
            )

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

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

417
418
419
420
421
422
423
424
425
        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
426
427
428
429
430
431
432
433
434
435
436
            )

        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
437
438
            )

439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
        self.dfa86 = self.DFA86(
            self, 86,
            eot = self.DFA86_eot,
            eof = self.DFA86_eof,
            min = self.DFA86_min,
            max = self.DFA86_max,
            accept = self.DFA86_accept,
            special = self.DFA86_special,
            transition = self.DFA86_transition
            )

        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
Maxime Perrotin's avatar
Maxime Perrotin committed
459
460
            )

461
462
463
464
465
466
467
468
469
        self.dfa95 = self.DFA95(
            self, 95,
            eot = self.DFA95_eot,
            eof = self.DFA95_eof,
            min = self.DFA95_min,
            max = self.DFA95_max,
            accept = self.DFA95_accept,
            special = self.DFA95_special,
            transition = self.DFA95_transition
470
471
            )

472
473
474
475
476
477
478
479
480
        self.dfa105 = self.DFA105(
            self, 105,
            eot = self.DFA105_eot,
            eof = self.DFA105_eof,
            min = self.DFA105_min,
            max = self.DFA105_max,
            accept = self.DFA105_accept,
            special = self.DFA105_special,
            transition = self.DFA105_transition
481
482
            )

483
484
485
486
487
488
489
490
491
        self.dfa141 = self.DFA141(
            self, 141,
            eot = self.DFA141_eot,
            eof = self.DFA141_eof,
            min = self.DFA141_min,
            max = self.DFA141_max,
            accept = self.DFA141_accept,
            special = self.DFA141_special,
            transition = self.DFA141_transition
492
493
            )

494
495
496
497
498
499
500
501
502
        self.dfa151 = self.DFA151(
            self, 151,
            eot = self.DFA151_eot,
            eof = self.DFA151_eof,
            min = self.DFA151_min,
            max = self.DFA151_max,
            accept = self.DFA151_accept,
            special = self.DFA151_special,
            transition = self.DFA151_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
503
504
            )

505
506
507
508
509
510
511
512
513
        self.dfa161 = self.DFA161(
            self, 161,
            eot = self.DFA161_eot,
            eof = self.DFA161_eof,
            min = self.DFA161_min,
            max = self.DFA161_max,
            accept = self.DFA161_accept,
            special = self.DFA161_special,
            transition = self.DFA161_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
575
576
577
578
579
580
581
582
583
                    if LA1 == 210:
                        LA1_2 = self.input.LA(2)

                        if (LA1_2 == KEEP) :
                            alt1 = 1
                        elif (LA1_2 == LABEL or LA1_2 == COMMENT or LA1_2 == PROCESS or LA1_2 == STATE or LA1_2 == PROVIDED or LA1_2 == INPUT or (PROCEDURE_CALL <= LA1_2 <= PROCEDURE) or LA1_2 == DECISION or LA1_2 == ANSWER or LA1_2 == OUTPUT or (TEXT <= LA1_2 <= JOIN) or LA1_2 == RETURN or LA1_2 == TASK or LA1_2 == STOP or LA1_2 == CONNECT or LA1_2 == START) :
                            alt1 = 3


                    elif LA1 == USE:
Maxime Perrotin's avatar
Maxime Perrotin committed
584
585
586
587
588
589
590
                        alt1 = 1
                    elif LA1 == SYSTEM:
                        alt1 = 2
                    elif LA1 == PROCESS:
                        alt1 = 3

                    if alt1 == 1:
591
                        # sdl92.g:125:18: use_clause
Maxime Perrotin's avatar
Maxime Perrotin committed
592
                        pass 
593
                        self._state.following.append(self.FOLLOW_use_clause_in_pr_file1134)
Maxime Perrotin's avatar
Maxime Perrotin committed
594
595
596
597
598
599
600
601
                        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:
602
                        # sdl92.g:126:19: system_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
603
                        pass 
604
                        self._state.following.append(self.FOLLOW_system_definition_in_pr_file1154)
Maxime Perrotin's avatar
Maxime Perrotin committed
605
606
607
608
609
610
611
612
                        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:
613
                        # sdl92.g:127:19: process_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
614
                        pass 
615
                        self._state.following.append(self.FOLLOW_process_definition_in_pr_file1174)
Maxime Perrotin's avatar
Maxime Perrotin committed
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
657
658
659
660
661
662
663
664
665
                        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"
666
    # 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
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
    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:
696
697
                # 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
698
                pass 
699
                SYSTEM4=self.match(self.input, SYSTEM, self.FOLLOW_SYSTEM_in_system_definition1199) 
Maxime Perrotin's avatar
Maxime Perrotin committed
700
701
                if self._state.backtracking == 0:
                    stream_SYSTEM.add(SYSTEM4)
702
                self._state.following.append(self.FOLLOW_system_name_in_system_definition1201)
Maxime Perrotin's avatar
Maxime Perrotin committed
703
704
705
706
707
                system_name5 = self.system_name()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_system_name.add(system_name5.tree)
708
                self._state.following.append(self.FOLLOW_end_in_system_definition1203)
Maxime Perrotin's avatar
Maxime Perrotin committed
709
710
711
712
713
                end6 = self.end()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_end.add(end6.tree)
714
                # sdl92.g:132:17: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
715
716
717
718
                while True: #loop2
                    alt2 = 2
                    LA2_0 = self.input.LA(1)

719
                    if (LA2_0 == PROCEDURE or (SIGNAL <= LA2_0 <= CHANNEL) or LA2_0 == BLOCK or LA2_0 == 210) :
Maxime Perrotin's avatar
Maxime Perrotin committed
720
721
722
723
724
725
                        alt2 = 1


                    if alt2 == 1:
                        # sdl92.g:0:0: entity_in_system
                        pass 
726
                        self._state.following.append(self.FOLLOW_entity_in_system_in_system_definition1221)
Maxime Perrotin's avatar
Maxime Perrotin committed
727
728
729
730
731
732
733
734
735
                        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
736
                ENDSYSTEM8=self.match(self.input, ENDSYSTEM, self.FOLLOW_ENDSYSTEM_in_system_definition1240) 
Maxime Perrotin's avatar
Maxime Perrotin committed
737
738
                if self._state.backtracking == 0:
                    stream_ENDSYSTEM.add(ENDSYSTEM8)
739
                # sdl92.g:133:27: ( system_name )?
Maxime Perrotin's avatar
Maxime Perrotin committed
740
741
742
743
744
745
746
747
                alt3 = 2
                LA3_0 = self.input.LA(1)

                if (LA3_0 == ID) :
                    alt3 = 1
                if alt3 == 1:
                    # sdl92.g:0:0: system_name
                    pass 
748
                    self._state.following.append(self.FOLLOW_system_name_in_system_definition1242)
Maxime Perrotin's avatar
Maxime Perrotin committed
749
750
751
752
753
754
755
756
                    system_name9 = self.system_name()

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



757
                self._state.following.append(self.FOLLOW_end_in_system_definition1245)
Maxime Perrotin's avatar
Maxime Perrotin committed
758
759
760
761
762
763
764
                end10 = self.end()

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

                # AST Rewrite
765
                # elements: entity_in_system, system_name, SYSTEM
Maxime Perrotin's avatar
Maxime Perrotin committed
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
                # 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()
782
783
                    # 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
784
785
786
787
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_SYSTEM.nextNode(), root_1)

                    self._adaptor.addChild(root_1, stream_system_name.nextTree())
788
                    # sdl92.g:134:38: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
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
823
824
825
826
827
828
829
830
831
                    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"
832
    # sdl92.g:137:1: use_clause : ( use_asn1 )? USE package_name end -> ^( USE ( use_asn1 )? package_name ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
    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:
855
856
                # 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
857
                pass 
858
                # sdl92.g:138:17: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
859
860
861
                alt4 = 2
                LA4_0 = self.input.LA(1)

862
                if (LA4_0 == 210) :
Maxime Perrotin's avatar
Maxime Perrotin committed
863
864
865
866
                    alt4 = 1
                if alt4 == 1:
                    # sdl92.g:0:0: use_asn1
                    pass 
867
                    self._state.following.append(self.FOLLOW_use_asn1_in_use_clause1292)
Maxime Perrotin's avatar
Maxime Perrotin committed
868
869
870
871
872
873
874
875
                    use_asn111 = self.use_asn1()

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



876
                USE12=self.match(self.input, USE, self.FOLLOW_USE_in_use_clause1311) 
Maxime Perrotin's avatar
Maxime Perrotin committed
877
878
                if self._state.backtracking == 0:
                    stream_USE.add(USE12)
879
                self._state.following.append(self.FOLLOW_package_name_in_use_clause1313)
Maxime Perrotin's avatar
Maxime Perrotin committed
880
881
882
883
884
                package_name13 = self.package_name()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_package_name.add(package_name13.tree)
885
                self._state.following.append(self.FOLLOW_end_in_use_clause1315)
Maxime Perrotin's avatar
Maxime Perrotin committed
886
887
888
889
890
891
892
                end14 = self.end()

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

                # AST Rewrite
893
                # elements: package_name, USE, use_asn1
Maxime Perrotin's avatar
Maxime Perrotin committed
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
                # 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()
910
911
                    # 140:9: -> ^( USE ( use_asn1 )? package_name )
                    # sdl92.g:140:17: ^( USE ( use_asn1 )? package_name )
Maxime Perrotin's avatar
Maxime Perrotin committed
912
913
914
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_USE.nextNode(), root_1)

915
                    # sdl92.g:140:23: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
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
953
954
955
956
957
958
959
                    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"
960
    # sdl92.g:146:1: entity_in_system : ( signal_declaration | procedure | channel | block_definition );
Maxime Perrotin's avatar
Maxime Perrotin committed
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
    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:
980
                # sdl92.g:147:9: ( signal_declaration | procedure | channel | block_definition )
Maxime Perrotin's avatar
Maxime Perrotin committed
981
982
                alt5 = 4
                LA5 = self.input.LA(1)
983
                if LA5 == 210:
Maxime Perrotin's avatar
Maxime Perrotin committed
984
985
                    LA5_1 = self.input.LA(2)

986
                    if (LA5_1 == LABEL or LA5_1 == COMMENT or LA5_1 == PROCESS 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) :
987
                        alt5 = 2
Maxime Perrotin's avatar
Maxime Perrotin committed
988
989
                    elif (LA5_1 == KEEP) :
                        alt5 = 1
Maxime Perrotin's avatar
Maxime Perrotin committed
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:
For faster browsing, not all history is shown. View entire blame