sdl92Parser.py 855 KB
Newer Older
1
# $ANTLR 3.1.3 Mar 17, 2009 19:23:44 sdl92.g 2014-03-19 16:48:06
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
106
107
ENDSYSTEM=99
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
117
ASSIG_OP=167
SIGNALROUTE=104
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=103
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
145
CONNECT=105
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
155
ENDCHANNEL=100
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
172
173
FROM=101
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=102
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
244
245
246
247
248
249
250
251
252
253
254
    "COMPOSITE_STATE", "ENDSYSTEM", "ENDCHANNEL", "FROM", "WITH", "ENDBLOCK", 
    "SIGNALROUTE", "CONNECT", "AND", "REFERENCED", "ENDPROCESS", "ENDPROCEDURE", 
    "INT", "START", "ENDCONNECTION", "SEMI", "ENDSTATE", "ASTERISK", "SUBSTRUCTURE", 
    "ENDSUBSTRUCTURE", "OUT", "NONE", "PRIORITY", "L_PAREN", "R_PAREN", 
    "COMMA", "CALL", "ENDALTERNATIVE", "ENDDECISION", "ANY", "EQ", "NEQ", 
    "GT", "LT", "LE", "GE", "CREATE", "THIS", "ID", "ENDFOR", "IMPLIES", 
    "OR", "XOR", "PLUS", "DASH", "APPEND", "DIV", "MOD", "REM", "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
351
352
353
354
355
356
357
358
359
        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
            )

        self.dfa68 = self.DFA68(
            self, 68,
            eot = self.DFA68_eot,
            eof = self.DFA68_eof,
            min = self.DFA68_min,
            max = self.DFA68_max,
            accept = self.DFA68_accept,
            special = self.DFA68_special,
            transition = self.DFA68_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
360
361
362
363
364
365
366
367
368
369
370
371
372
            )

        self.dfa69 = self.DFA69(
            self, 69,
            eot = self.DFA69_eot,
            eof = self.DFA69_eof,
            min = self.DFA69_min,
            max = self.DFA69_max,
            accept = self.DFA69_accept,
            special = self.DFA69_special,
            transition = self.DFA69_transition
            )

373
374
375
376
377
378
379
380
381
        self.dfa77 = self.DFA77(
            self, 77,
            eot = self.DFA77_eot,
            eof = self.DFA77_eof,
            min = self.DFA77_min,
            max = self.DFA77_max,
            accept = self.DFA77_accept,
            special = self.DFA77_special,
            transition = self.DFA77_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
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
Maxime Perrotin's avatar
Maxime Perrotin committed
393
394
            )

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

406
407
408
409
410
411
412
413
414
        self.dfa76 = self.DFA76(
            self, 76,
            eot = self.DFA76_eot,
            eof = self.DFA76_eof,
            min = self.DFA76_min,
            max = self.DFA76_max,
            accept = self.DFA76_accept,
            special = self.DFA76_special,
            transition = self.DFA76_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
415
416
            )

417
418
419
420
421
422
423
424
425
        self.dfa78 = self.DFA78(
            self, 78,
            eot = self.DFA78_eot,
            eof = self.DFA78_eof,
            min = self.DFA78_min,
            max = self.DFA78_max,
            accept = self.DFA78_accept,
            special = self.DFA78_special,
            transition = self.DFA78_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
426
427
            )

428
429
430
431
432
433
434
435
436
        self.dfa79 = self.DFA79(
            self, 79,
            eot = self.DFA79_eot,
            eof = self.DFA79_eof,
            min = self.DFA79_min,
            max = self.DFA79_max,
            accept = self.DFA79_accept,
            special = self.DFA79_special,
            transition = self.DFA79_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
437
438
439
440
441
442
443
444
445
446
447
448
449
            )

        self.dfa90 = self.DFA90(
            self, 90,
            eot = self.DFA90_eot,
            eof = self.DFA90_eof,
            min = self.DFA90_min,
            max = self.DFA90_max,
            accept = self.DFA90_accept,
            special = self.DFA90_special,
            transition = self.DFA90_transition
            )

450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
        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
            )

        self.dfa98 = self.DFA98(
            self, 98,
            eot = self.DFA98_eot,
            eof = self.DFA98_eof,
            min = self.DFA98_min,
            max = self.DFA98_max,
            accept = self.DFA98_accept,
            special = self.DFA98_special,
            transition = self.DFA98_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
470
471
            )

472
473
474
475
476
477
478
479
480
        self.dfa133 = self.DFA133(
            self, 133,
            eot = self.DFA133_eot,
            eof = self.DFA133_eof,
            min = self.DFA133_min,
            max = self.DFA133_max,
            accept = self.DFA133_accept,
            special = self.DFA133_special,
            transition = self.DFA133_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
481
482
            )

483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
        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
            )

        self.dfa153 = self.DFA153(
            self, 153,
            eot = self.DFA153_eot,
            eof = self.DFA153_eof,
            min = self.DFA153_min,
            max = self.DFA153_max,
            accept = self.DFA153_accept,
            special = self.DFA153_special,
            transition = self.DFA153_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
            )






        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"
535
    # sdl92.g:123:1: pr_file : ( use_clause | system_definition | process_definition )+ ;
Maxime Perrotin's avatar
Maxime Perrotin committed
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
    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:
553
554
                # sdl92.g:124:9: ( ( use_clause | system_definition | process_definition )+ )
                # sdl92.g:124:17: ( use_clause | system_definition | process_definition )+
Maxime Perrotin's avatar
Maxime Perrotin committed
555
556
557
                pass 
                root_0 = self._adaptor.nil()

558
                # sdl92.g:124:17: ( use_clause | system_definition | process_definition )+
Maxime Perrotin's avatar
Maxime Perrotin committed
559
560
561
562
                cnt1 = 0
                while True: #loop1
                    alt1 = 4
                    LA1 = self.input.LA(1)
563
                    if LA1 == USE or LA1 == 210:
Maxime Perrotin's avatar
Maxime Perrotin committed
564
565
566
567
568
569
570
                        alt1 = 1
                    elif LA1 == SYSTEM:
                        alt1 = 2
                    elif LA1 == PROCESS:
                        alt1 = 3

                    if alt1 == 1:
571
                        # sdl92.g:124:18: use_clause
Maxime Perrotin's avatar
Maxime Perrotin committed
572
                        pass 
573
                        self._state.following.append(self.FOLLOW_use_clause_in_pr_file1124)
Maxime Perrotin's avatar
Maxime Perrotin committed
574
575
576
577
578
579
580
581
                        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:
582
                        # sdl92.g:125:19: system_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
583
                        pass 
584
                        self._state.following.append(self.FOLLOW_system_definition_in_pr_file1144)
Maxime Perrotin's avatar
Maxime Perrotin committed
585
586
587
588
589
590
591
592
                        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:
593
                        # sdl92.g:126:19: process_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
594
                        pass 
595
                        self._state.following.append(self.FOLLOW_process_definition_in_pr_file1164)
Maxime Perrotin's avatar
Maxime Perrotin committed
596
597
598
599
600
601
602
603
604
605
606
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
                        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"
646
    # sdl92.g:129: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
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
    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:
676
677
                # sdl92.g:130:9: ( SYSTEM system_name end ( entity_in_system )* ENDSYSTEM ( system_name )? end -> ^( SYSTEM system_name ( entity_in_system )* ) )
                # sdl92.g:130:17: SYSTEM system_name end ( entity_in_system )* ENDSYSTEM ( system_name )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
678
                pass 
679
                SYSTEM4=self.match(self.input, SYSTEM, self.FOLLOW_SYSTEM_in_system_definition1189) 
Maxime Perrotin's avatar
Maxime Perrotin committed
680
681
                if self._state.backtracking == 0:
                    stream_SYSTEM.add(SYSTEM4)
682
                self._state.following.append(self.FOLLOW_system_name_in_system_definition1191)
Maxime Perrotin's avatar
Maxime Perrotin committed
683
684
685
686
687
                system_name5 = self.system_name()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_system_name.add(system_name5.tree)
688
                self._state.following.append(self.FOLLOW_end_in_system_definition1193)
Maxime Perrotin's avatar
Maxime Perrotin committed
689
690
691
692
693
                end6 = self.end()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_end.add(end6.tree)
694
                # sdl92.g:131:17: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
695
696
697
698
                while True: #loop2
                    alt2 = 2
                    LA2_0 = self.input.LA(1)

699
                    if (LA2_0 == PROCEDURE or (SIGNAL <= LA2_0 <= CHANNEL) or LA2_0 == BLOCK or LA2_0 == 210) :
Maxime Perrotin's avatar
Maxime Perrotin committed
700
701
702
703
704
705
                        alt2 = 1


                    if alt2 == 1:
                        # sdl92.g:0:0: entity_in_system
                        pass 
706
                        self._state.following.append(self.FOLLOW_entity_in_system_in_system_definition1211)
Maxime Perrotin's avatar
Maxime Perrotin committed
707
708
709
710
711
712
713
714
715
                        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
716
                ENDSYSTEM8=self.match(self.input, ENDSYSTEM, self.FOLLOW_ENDSYSTEM_in_system_definition1230) 
Maxime Perrotin's avatar
Maxime Perrotin committed
717
718
                if self._state.backtracking == 0:
                    stream_ENDSYSTEM.add(ENDSYSTEM8)
719
                # sdl92.g:132:27: ( system_name )?
Maxime Perrotin's avatar
Maxime Perrotin committed
720
721
722
723
724
725
726
727
                alt3 = 2
                LA3_0 = self.input.LA(1)

                if (LA3_0 == ID) :
                    alt3 = 1
                if alt3 == 1:
                    # sdl92.g:0:0: system_name
                    pass 
728
                    self._state.following.append(self.FOLLOW_system_name_in_system_definition1232)
Maxime Perrotin's avatar
Maxime Perrotin committed
729
730
731
732
733
734
735
736
                    system_name9 = self.system_name()

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



737
                self._state.following.append(self.FOLLOW_end_in_system_definition1235)
Maxime Perrotin's avatar
Maxime Perrotin committed
738
739
740
741
742
743
744
                end10 = self.end()

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

                # AST Rewrite
745
                # elements: SYSTEM, entity_in_system, system_name
Maxime Perrotin's avatar
Maxime Perrotin committed
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
                # 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()
762
763
                    # 133:9: -> ^( SYSTEM system_name ( entity_in_system )* )
                    # sdl92.g:133:17: ^( SYSTEM system_name ( entity_in_system )* )
Maxime Perrotin's avatar
Maxime Perrotin committed
764
765
766
767
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_SYSTEM.nextNode(), root_1)

                    self._adaptor.addChild(root_1, stream_system_name.nextTree())
768
                    # sdl92.g:133:38: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
769
770
771
772
773
774
775
776
777
778
779
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
                    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"
812
    # sdl92.g:136:1: use_clause : ( use_asn1 )? USE package_name end -> ^( USE ( use_asn1 )? package_name ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
    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:
835
836
                # sdl92.g:137:9: ( ( use_asn1 )? USE package_name end -> ^( USE ( use_asn1 )? package_name ) )
                # sdl92.g:137:17: ( use_asn1 )? USE package_name end
Maxime Perrotin's avatar
Maxime Perrotin committed
837
                pass 
838
                # sdl92.g:137:17: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
839
840
841
                alt4 = 2
                LA4_0 = self.input.LA(1)

842
                if (LA4_0 == 210) :
Maxime Perrotin's avatar
Maxime Perrotin committed
843
844
845
846
                    alt4 = 1
                if alt4 == 1:
                    # sdl92.g:0:0: use_asn1
                    pass 
847
                    self._state.following.append(self.FOLLOW_use_asn1_in_use_clause1282)
Maxime Perrotin's avatar
Maxime Perrotin committed
848
849
850
851
852
853
854
855
                    use_asn111 = self.use_asn1()

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



856
                USE12=self.match(self.input, USE, self.FOLLOW_USE_in_use_clause1301) 
Maxime Perrotin's avatar
Maxime Perrotin committed
857
858
                if self._state.backtracking == 0:
                    stream_USE.add(USE12)
859
                self._state.following.append(self.FOLLOW_package_name_in_use_clause1303)
Maxime Perrotin's avatar
Maxime Perrotin committed
860
861
862
863
864
                package_name13 = self.package_name()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_package_name.add(package_name13.tree)
865
                self._state.following.append(self.FOLLOW_end_in_use_clause1305)
Maxime Perrotin's avatar
Maxime Perrotin committed
866
867
868
869
870
871
872
                end14 = self.end()

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

                # AST Rewrite
873
                # elements: package_name, use_asn1, USE
Maxime Perrotin's avatar
Maxime Perrotin committed
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
                # 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()
890
891
                    # 139:9: -> ^( USE ( use_asn1 )? package_name )
                    # sdl92.g:139:17: ^( USE ( use_asn1 )? package_name )
Maxime Perrotin's avatar
Maxime Perrotin committed
892
893
894
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_USE.nextNode(), root_1)

895
                    # sdl92.g:139:23: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
                    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"
940
    # sdl92.g:145:1: entity_in_system : ( signal_declaration | procedure | channel | block_definition );
Maxime Perrotin's avatar
Maxime Perrotin committed
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
    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:
960
                # sdl92.g:146:9: ( signal_declaration | procedure | channel | block_definition )
Maxime Perrotin's avatar
Maxime Perrotin committed
961
962
                alt5 = 4
                LA5 = self.input.LA(1)
963
                if LA5 == 210:
Maxime Perrotin's avatar
Maxime Perrotin committed
964
965
                    LA5_1 = self.input.LA(2)

966
                    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 == START) :
Maxime Perrotin's avatar
Maxime Perrotin committed
967
                        alt5 = 2
968
969
                    elif (LA5_1 == KEEP) :
                        alt5 = 1
Maxime Perrotin's avatar
Maxime Perrotin committed
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
                    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

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

                    raise nvae

                if alt5 == 1:
995
                    # sdl92.g:146:17: signal_declaration
Maxime Perrotin's avatar
Maxime Perrotin committed
996
997
998
                    pass 
                    root_0 = self._adaptor.nil()

999
                    self._state.following.append(self.FOLLOW_signal_declaration_in_entity_in_system1354)
Maxime Perrotin's avatar
Maxime Perrotin committed
1000
                    signal_declaration15 = self.signal_declaration()
For faster browsing, not all history is shown. View entire blame