sdl92Parser.py 2.06 MB
Newer Older
1
# $ANTLR 3.5.2 sdl92.g 2020-01-16 12:43:34
Maxime Perrotin's avatar
Maxime Perrotin committed
2
3
4
5
6
7
8
9

import sys
from antlr3 import *

from antlr3.tree import *



Maxime Perrotin's avatar
Maxime Perrotin committed
10

Maxime Perrotin's avatar
Maxime Perrotin committed
11
12
13
14
# for convenience in actions
HIDDEN = BaseRecognizer.HIDDEN

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

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

# token names
tokenNames = [
Maxime Perrotin's avatar
Maxime Perrotin committed
296
297
298
299
300
    "<invalid>", "<EOR>", "<DOWN>", "<UP>",
    "A", "ACTION", "ACTIVE", "AGGREGATION", "ALL", "ALPHA", "ALTERNATIVE", 
    "AND", "ANSWER", "ANY", "APPEND", "ARRAY", "ASN1", "ASNFILENAME", "ASSIGN", 
    "ASSIG_OP", "ASTERISK", "B", "BASE", "BITSTR", "BLOCK", "C", "CALL", 
    "CHANNEL", "CHOICE", "CIF", "CLOSED_RANGE", "COMMA", "COMMENT", "COMMENT2", 
301
    "COMPOSITE_STATE", "CONDITIONAL", "CONNECT", "CONNECTION", "CONSTANT", 
Maxime Perrotin's avatar
Maxime Perrotin committed
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
    "CONSTANTS", "CREATE", "D", "DASH", "DCL", "DECISION", "DEFAULT", "DIGITS", 
    "DIV", "DOT", "E", "ELSE", "EMPTYSTR", "END", "ENDALTERNATIVE", "ENDBLOCK", 
    "ENDCHANNEL", "ENDCONNECTION", "ENDDECISION", "ENDFOR", "ENDNEWTYPE", 
    "ENDPROCEDURE", "ENDPROCESS", "ENDSTATE", "ENDSUBSTRUCTURE", "ENDSYNTYPE", 
    "ENDSYSTEM", "ENDTEXT", "ENTRY_POINT", "EQ", "EXPONENT", "EXPORT", "EXPRESSION", 
    "EXTERNAL", "Exponent", "F", "FALSE", "FI", "FIELD", "FIELDS", "FIELD_NAME", 
    "FLOAT", "FLOAT2", "FLOATING_LABEL", "FOR", "FPAR", "FROM", "G", "GE", 
    "GEODE", "GROUND", "GT", "H", "HYPERLINK", "I", "ID", "IF", "IFTHENELSE", 
    "IMPLIES", "IMPORT", "IN", "INFORMAL_TEXT", "INOUT", "INPUT", "INPUTLIST", 
    "INPUT_NONE", "INT", "J", "JOIN", "K", "KEEP", "L", "LABEL", "LE", "LITERAL", 
    "LT", "L_BRACKET", "L_PAREN", "M", "MANTISSA", "MINUS_INFINITY", "MOD", 
    "N", "NEG", "NEQ", "NEWTYPE", "NEXTSTATE", "NONE", "NOT", "NUMBER_OF_INSTANCES", 
    "O", "OCTSTR", "OPEN_RANGE", "OR", "OUT", "OUTPUT", "OUTPUT_BODY", "P", 
    "PARAM", "PARAMNAMES", "PARAMS", "PAREN", "PFPAR", "PLUS", "PLUS_INFINITY", 
    "POINT", "PRIMARY", "PRIORITY", "PROCEDURE", "PROCEDURE_CALL", "PROCEDURE_NAME", 
    "PROCESS", "PROVIDED", "Q", "QUESTION", "R", "RANGE", "REFERENCED", 
    "REM", "RESET", "RETURN", "RETURNS", "ROUTE", "R_BRACKET", "R_PAREN", 
    "S", "SAVE", "SELECTOR", "SEMI", "SEQOF", "SEQUENCE", "SET", "SIGNAL", 
    "SIGNALROUTE", "SIGNAL_LIST", "SORT", "SPECIFIC", "START", "STATE", 
    "STATELIST", "STATE_AGGREGATION", "STATE_PARTITION_CONNECTION", "STIMULUS", 
    "STOP", "STOPIF", "STR", "STRING", "STRUCT", "SUBSTRUCTURE", "SYNONYM", 
    "SYNONYM_LIST", "SYNTYPE", "SYSTEM", "T", "TASK", "TASK_BODY", "TERMINATOR", 
    "TEXT", "TEXTAREA", "TEXTAREA_CONTENT", "THEN", "THIS", "TIMER", "TO", 
    "TRANSITION", "TRUE", "TYPE", "TYPE_INSTANCE", "U", "USE", "V", "VALUE", 
    "VARIABLE", "VARIABLES", "VIA", "VIAPATH", "VIEW", "W", "WITH", "WS", 
    "X", "XOR", "Y", "Z", "'!'", "'(.'", "'*/'", "'->'", "'.)'", "'/* CIF'", 
    "':'"
Maxime Perrotin's avatar
Maxime Perrotin committed
329
330
331
332
333
334
]



class sdl92Parser(Parser):
    grammarFileName = "sdl92.g"
Maxime Perrotin's avatar
Maxime Perrotin committed
335
    api_version = 1
Maxime Perrotin's avatar
Maxime Perrotin committed
336
337
338
339
340
341
    tokenNames = tokenNames

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

Maxime Perrotin's avatar
Maxime Perrotin committed
342
        super().__init__(input, state, *args, **kwargs)
Maxime Perrotin's avatar
Maxime Perrotin committed
343

Maxime Perrotin's avatar
Maxime Perrotin committed
344
345
346
347
348
349
350
351
352
        self.dfa52 = self.DFA52(
            self, 52,
            eot = self.DFA52_eot,
            eof = self.DFA52_eof,
            min = self.DFA52_min,
            max = self.DFA52_max,
            accept = self.DFA52_accept,
            special = self.DFA52_special,
            transition = self.DFA52_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
353
354
            )

355
356
357
358
359
360
361
362
363
        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
364
365
            )

366
367
368
369
370
371
372
373
374
        self.dfa189 = self.DFA189(
            self, 189,
            eot = self.DFA189_eot,
            eof = self.DFA189_eof,
            min = self.DFA189_min,
            max = self.DFA189_max,
            accept = self.DFA189_accept,
            special = self.DFA189_special,
            transition = self.DFA189_transition
375
376
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
377
378
379



Maxime Perrotin's avatar
Maxime Perrotin committed
380
        self.delegates = []
Maxime Perrotin's avatar
Maxime Perrotin committed
381
382
383
384
385

        self._adaptor = None
        self.adaptor = CommonTreeAdaptor()


Maxime Perrotin's avatar
Maxime Perrotin committed
386

Maxime Perrotin's avatar
Maxime Perrotin committed
387
388
389
390
391
392
393
394
395
396
397
    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):
Maxime Perrotin's avatar
Maxime Perrotin committed
398
            super().__init__()
Maxime Perrotin's avatar
Maxime Perrotin committed
399
400
401
402
403
404

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
405

Maxime Perrotin's avatar
Maxime Perrotin committed
406
    # $ANTLR start "pr_file"
407
    # sdl92.g:146:1: pr_file : ( use_clause | system_definition | process_definition )+ ;
Maxime Perrotin's avatar
Maxime Perrotin committed
408
409
410
411
    def pr_file(self, ):
        retval = self.pr_file_return()
        retval.start = self.input.LT(1)

Maxime Perrotin's avatar
Maxime Perrotin committed
412

Maxime Perrotin's avatar
Maxime Perrotin committed
413
414
415
416
417
418
419
420
421
        root_0 = None

        use_clause1 = None
        system_definition2 = None
        process_definition3 = None


        try:
            try:
422
423
                # sdl92.g:147:9: ( ( use_clause | system_definition | process_definition )+ )
                # sdl92.g:147:17: ( use_clause | system_definition | process_definition )+
Maxime Perrotin's avatar
Maxime Perrotin committed
424
425
426
                pass 
                root_0 = self._adaptor.nil()

Maxime Perrotin's avatar
Maxime Perrotin committed
427

428
                # sdl92.g:147:17: ( use_clause | system_definition | process_definition )+
Maxime Perrotin's avatar
Maxime Perrotin committed
429
430
431
432
                cnt1 = 0
                while True: #loop1
                    alt1 = 4
                    LA1 = self.input.LA(1)
Maxime Perrotin's avatar
Maxime Perrotin committed
433
                    if LA1 in {228}:
434
435
                        LA1_2 = self.input.LA(2)

Maxime Perrotin's avatar
Maxime Perrotin committed
436
                        if (LA1_2 == KEEP) :
437
                            alt1 = 1
Maxime Perrotin's avatar
Maxime Perrotin committed
438
439
                        elif (LA1_2 in {ANSWER, COMMENT, CONNECT, DECISION, INPUT, JOIN, LABEL, NEXTSTATE, OUTPUT, PROCEDURE, PROCEDURE_CALL, PROCESS, PROVIDED, RETURN, START, STATE, STOP, TASK, TEXT}) :
                            alt1 = 3
440
441


Maxime Perrotin's avatar
Maxime Perrotin committed
442
                    elif LA1 in {USE}:
Maxime Perrotin's avatar
Maxime Perrotin committed
443
                        alt1 = 1
Maxime Perrotin's avatar
Maxime Perrotin committed
444
                    elif LA1 in {SYSTEM}:
Maxime Perrotin's avatar
Maxime Perrotin committed
445
                        alt1 = 2
Maxime Perrotin's avatar
Maxime Perrotin committed
446
                    elif LA1 in {PROCESS}:
Maxime Perrotin's avatar
Maxime Perrotin committed
447
448
449
                        alt1 = 3

                    if alt1 == 1:
450
                        # sdl92.g:147:18: use_clause
Maxime Perrotin's avatar
Maxime Perrotin committed
451
                        pass 
452
                        self._state.following.append(self.FOLLOW_use_clause_in_pr_file1375)
Maxime Perrotin's avatar
Maxime Perrotin committed
453
454
455
456
457
458
459
                        use_clause1 = self.use_clause()

                        self._state.following.pop()
                        if self._state.backtracking == 0:
                            self._adaptor.addChild(root_0, use_clause1.tree)


Maxime Perrotin's avatar
Maxime Perrotin committed
460

Maxime Perrotin's avatar
Maxime Perrotin committed
461
                    elif alt1 == 2:
462
                        # sdl92.g:148:19: system_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
463
                        pass 
464
                        self._state.following.append(self.FOLLOW_system_definition_in_pr_file1395)
Maxime Perrotin's avatar
Maxime Perrotin committed
465
466
467
468
469
470
471
                        system_definition2 = self.system_definition()

                        self._state.following.pop()
                        if self._state.backtracking == 0:
                            self._adaptor.addChild(root_0, system_definition2.tree)


Maxime Perrotin's avatar
Maxime Perrotin committed
472

Maxime Perrotin's avatar
Maxime Perrotin committed
473
                    elif alt1 == 3:
474
                        # sdl92.g:149:19: process_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
475
                        pass 
476
                        self._state.following.append(self.FOLLOW_process_definition_in_pr_file1415)
Maxime Perrotin's avatar
Maxime Perrotin committed
477
478
479
480
481
482
483
                        process_definition3 = self.process_definition()

                        self._state.following.pop()
                        if self._state.backtracking == 0:
                            self._adaptor.addChild(root_0, process_definition3.tree)


Maxime Perrotin's avatar
Maxime Perrotin committed
484

Maxime Perrotin's avatar
Maxime Perrotin committed
485
486
487
488
489
490
491
                    else:
                        if cnt1 >= 1:
                            break #loop1

                        if self._state.backtracking > 0:
                            raise BacktrackingFailed

Maxime Perrotin's avatar
Maxime Perrotin committed
492

Maxime Perrotin's avatar
Maxime Perrotin committed
493
494
495
496
497
498
499
                        eee = EarlyExitException(1, self.input)
                        raise eee

                    cnt1 += 1



Maxime Perrotin's avatar
Maxime Perrotin committed
500

Maxime Perrotin's avatar
Maxime Perrotin committed
501
502
503
                retval.stop = self.input.LT(-1)


Maxime Perrotin's avatar
Maxime Perrotin committed
504
                if self._state.backtracking == 0:
Maxime Perrotin's avatar
Maxime Perrotin committed
505
506
507
508
                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


Maxime Perrotin's avatar
Maxime Perrotin committed
509
510

            except RecognitionException as re:
Maxime Perrotin's avatar
Maxime Perrotin committed
511
512
513
514
                self.reportError(re)
                self.recover(self.input, re)
                retval.tree = self._adaptor.errorNode(self.input, retval.start, self.input.LT(-1), re)

Maxime Perrotin's avatar
Maxime Perrotin committed
515
        finally:
Maxime Perrotin's avatar
Maxime Perrotin committed
516
517
518
519
520
            pass
        return retval

    # $ANTLR end "pr_file"

Maxime Perrotin's avatar
Maxime Perrotin committed
521

Maxime Perrotin's avatar
Maxime Perrotin committed
522
523
    class system_definition_return(ParserRuleReturnScope):
        def __init__(self):
Maxime Perrotin's avatar
Maxime Perrotin committed
524
            super().__init__()
Maxime Perrotin's avatar
Maxime Perrotin committed
525
526
527
528
529
530

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
531

Maxime Perrotin's avatar
Maxime Perrotin committed
532
    # $ANTLR start "system_definition"
533
    # sdl92.g:153:1: system_definition : SYSTEM system_name end ( entity_in_system )* ENDSYSTEM ( system_name )? end -> ^( SYSTEM system_name ( entity_in_system )* ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
534
535
536
537
    def system_definition(self, ):
        retval = self.system_definition_return()
        retval.start = self.input.LT(1)

Maxime Perrotin's avatar
Maxime Perrotin committed
538

Maxime Perrotin's avatar
Maxime Perrotin committed
539
540
541
542
543
544
545
546
547
548
549
550
        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
Maxime Perrotin's avatar
Maxime Perrotin committed
551
        stream_SYSTEM = RewriteRuleTokenStream(self._adaptor, "token SYSTEM")
552
        stream_ENDSYSTEM = RewriteRuleTokenStream(self._adaptor, "token ENDSYSTEM")
Maxime Perrotin's avatar
Maxime Perrotin committed
553
554
555
556
557
        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:
558
559
                # sdl92.g:154:9: ( SYSTEM system_name end ( entity_in_system )* ENDSYSTEM ( system_name )? end -> ^( SYSTEM system_name ( entity_in_system )* ) )
                # sdl92.g:154:17: SYSTEM system_name end ( entity_in_system )* ENDSYSTEM ( system_name )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
560
                pass 
Maxime Perrotin's avatar
Maxime Perrotin committed
561
                SYSTEM4 = self.match(self.input, SYSTEM, self.FOLLOW_SYSTEM_in_system_definition1449) 
Maxime Perrotin's avatar
Maxime Perrotin committed
562
563
                if self._state.backtracking == 0:
                    stream_SYSTEM.add(SYSTEM4)
Maxime Perrotin's avatar
Maxime Perrotin committed
564
565


566
                self._state.following.append(self.FOLLOW_system_name_in_system_definition1451)
Maxime Perrotin's avatar
Maxime Perrotin committed
567
568
569
570
571
                system_name5 = self.system_name()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_system_name.add(system_name5.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
572
573


574
                self._state.following.append(self.FOLLOW_end_in_system_definition1453)
Maxime Perrotin's avatar
Maxime Perrotin committed
575
576
577
578
579
                end6 = self.end()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_end.add(end6.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
580
581


582
                # sdl92.g:155:17: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
583
584
585
586
                while True: #loop2
                    alt2 = 2
                    LA2_0 = self.input.LA(1)

Maxime Perrotin's avatar
Maxime Perrotin committed
587
                    if (LA2_0 in {BLOCK, CHANNEL, PROCEDURE, SIGNAL, 228}) :
Maxime Perrotin's avatar
Maxime Perrotin committed
588
589
590
591
                        alt2 = 1


                    if alt2 == 1:
Maxime Perrotin's avatar
Maxime Perrotin committed
592
                        # sdl92.g:155:17: entity_in_system
Maxime Perrotin's avatar
Maxime Perrotin committed
593
                        pass 
594
                        self._state.following.append(self.FOLLOW_entity_in_system_in_system_definition1471)
Maxime Perrotin's avatar
Maxime Perrotin committed
595
596
597
598
599
600
601
                        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)


Maxime Perrotin's avatar
Maxime Perrotin committed
602

Maxime Perrotin's avatar
Maxime Perrotin committed
603
604
                    else:
                        break #loop2
Maxime Perrotin's avatar
Maxime Perrotin committed
605
606
607


                ENDSYSTEM8 = self.match(self.input, ENDSYSTEM, self.FOLLOW_ENDSYSTEM_in_system_definition1490) 
Maxime Perrotin's avatar
Maxime Perrotin committed
608
609
                if self._state.backtracking == 0:
                    stream_ENDSYSTEM.add(ENDSYSTEM8)
Maxime Perrotin's avatar
Maxime Perrotin committed
610
611


612
                # sdl92.g:156:27: ( system_name )?
Maxime Perrotin's avatar
Maxime Perrotin committed
613
614
615
616
617
618
                alt3 = 2
                LA3_0 = self.input.LA(1)

                if (LA3_0 == ID) :
                    alt3 = 1
                if alt3 == 1:
Maxime Perrotin's avatar
Maxime Perrotin committed
619
                    # sdl92.g:156:27: system_name
Maxime Perrotin's avatar
Maxime Perrotin committed
620
                    pass 
621
                    self._state.following.append(self.FOLLOW_system_name_in_system_definition1492)
Maxime Perrotin's avatar
Maxime Perrotin committed
622
623
624
625
626
627
628
629
                    system_name9 = self.system_name()

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



Maxime Perrotin's avatar
Maxime Perrotin committed
630
631


632
                self._state.following.append(self.FOLLOW_end_in_system_definition1495)
Maxime Perrotin's avatar
Maxime Perrotin committed
633
634
635
636
637
638
                end10 = self.end()

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

Maxime Perrotin's avatar
Maxime Perrotin committed
639

Maxime Perrotin's avatar
Maxime Perrotin committed
640
                # AST Rewrite
Maxime Perrotin's avatar
Maxime Perrotin committed
641
                # elements: SYSTEM, system_name, entity_in_system
Maxime Perrotin's avatar
Maxime Perrotin committed
642
643
644
645
646
647
648
649
650
651
652
653
654
655
                # 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()
656
657
                    # 157:9: -> ^( SYSTEM system_name ( entity_in_system )* )
                    # sdl92.g:157:17: ^( SYSTEM system_name ( entity_in_system )* )
Maxime Perrotin's avatar
Maxime Perrotin committed
658
                    root_1 = self._adaptor.nil()
Maxime Perrotin's avatar
Maxime Perrotin committed
659
660
661
                    root_1 = self._adaptor.becomeRoot(
                    stream_SYSTEM.nextNode()
                    , root_1)
Maxime Perrotin's avatar
Maxime Perrotin committed
662
663

                    self._adaptor.addChild(root_1, stream_system_name.nextTree())
Maxime Perrotin's avatar
Maxime Perrotin committed
664

665
                    # sdl92.g:157:38: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
666
667
668
669
670
671
672
673
674
675
                    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)



Maxime Perrotin's avatar
Maxime Perrotin committed
676

Maxime Perrotin's avatar
Maxime Perrotin committed
677
678
679
680
                    retval.tree = root_0



Maxime Perrotin's avatar
Maxime Perrotin committed
681
682


Maxime Perrotin's avatar
Maxime Perrotin committed
683
684
685
                retval.stop = self.input.LT(-1)


Maxime Perrotin's avatar
Maxime Perrotin committed
686
                if self._state.backtracking == 0:
Maxime Perrotin's avatar
Maxime Perrotin committed
687
688
689
690
                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


Maxime Perrotin's avatar
Maxime Perrotin committed
691
692

            except RecognitionException as re:
Maxime Perrotin's avatar
Maxime Perrotin committed
693
694
695
696
                self.reportError(re)
                self.recover(self.input, re)
                retval.tree = self._adaptor.errorNode(self.input, retval.start, self.input.LT(-1), re)

Maxime Perrotin's avatar
Maxime Perrotin committed
697
        finally:
Maxime Perrotin's avatar
Maxime Perrotin committed
698
699
700
701
702
            pass
        return retval

    # $ANTLR end "system_definition"

Maxime Perrotin's avatar
Maxime Perrotin committed
703

Maxime Perrotin's avatar
Maxime Perrotin committed
704
705
    class use_clause_return(ParserRuleReturnScope):
        def __init__(self):
Maxime Perrotin's avatar
Maxime Perrotin committed
706
            super().__init__()
Maxime Perrotin's avatar
Maxime Perrotin committed
707
708
709
710
711
712

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
713

Maxime Perrotin's avatar
Maxime Perrotin committed
714
    # $ANTLR start "use_clause"
715
    # sdl92.g:161:1: use_clause : ( use_asn1 )? USE package_name ( '/' def_selection_list )? end -> ^( USE ( use_asn1 )? ( end )? package_name ( def_selection_list )? ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
716
717
718
719
    def use_clause(self, ):
        retval = self.use_clause_return()
        retval.start = self.input.LT(1)

Maxime Perrotin's avatar
Maxime Perrotin committed
720

Maxime Perrotin's avatar
Maxime Perrotin committed
721
722
723
        root_0 = None

        USE12 = None
724
        char_literal14 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
725
726
        use_asn111 = None
        package_name13 = None
727
728
        def_selection_list15 = None
        end16 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
729
730

        USE12_tree = None
731
        char_literal14_tree = None
Maxime Perrotin's avatar
Maxime Perrotin committed
732
        stream_DIV = RewriteRuleTokenStream(self._adaptor, "token DIV")
733
        stream_USE = RewriteRuleTokenStream(self._adaptor, "token USE")
Maxime Perrotin's avatar
Maxime Perrotin committed
734
735
        stream_use_asn1 = RewriteRuleSubtreeStream(self._adaptor, "rule use_asn1")
        stream_package_name = RewriteRuleSubtreeStream(self._adaptor, "rule package_name")
Maxime Perrotin's avatar
Maxime Perrotin committed
736
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
737
        stream_def_selection_list = RewriteRuleSubtreeStream(self._adaptor, "rule def_selection_list")
Maxime Perrotin's avatar
Maxime Perrotin committed
738
739
        try:
            try:
740
741
                # sdl92.g:162:9: ( ( use_asn1 )? USE package_name ( '/' def_selection_list )? end -> ^( USE ( use_asn1 )? ( end )? package_name ( def_selection_list )? ) )
                # sdl92.g:162:17: ( use_asn1 )? USE package_name ( '/' def_selection_list )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
742
                pass 
743
                # sdl92.g:162:17: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
744
745
746
                alt4 = 2
                LA4_0 = self.input.LA(1)

747
                if (LA4_0 == 228) :
Maxime Perrotin's avatar
Maxime Perrotin committed
748
749
                    alt4 = 1
                if alt4 == 1:
Maxime Perrotin's avatar
Maxime Perrotin committed
750
                    # sdl92.g:162:17: use_asn1
Maxime Perrotin's avatar
Maxime Perrotin committed
751
                    pass 
752
                    self._state.following.append(self.FOLLOW_use_asn1_in_use_clause1551)
Maxime Perrotin's avatar
Maxime Perrotin committed
753
754
755
756
757
758
759
760
                    use_asn111 = self.use_asn1()

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



Maxime Perrotin's avatar
Maxime Perrotin committed
761
762
763


                USE12 = self.match(self.input, USE, self.FOLLOW_USE_in_use_clause1570) 
Maxime Perrotin's avatar
Maxime Perrotin committed
764
765
                if self._state.backtracking == 0:
                    stream_USE.add(USE12)
Maxime Perrotin's avatar
Maxime Perrotin committed
766
767


768
                self._state.following.append(self.FOLLOW_package_name_in_use_clause1572)
Maxime Perrotin's avatar
Maxime Perrotin committed
769
770
771
772
773
                package_name13 = self.package_name()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_package_name.add(package_name13.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
774
775


776
                # sdl92.g:164:17: ( '/' def_selection_list )?
777
778
779
780
781
782
                alt5 = 2
                LA5_0 = self.input.LA(1)

                if (LA5_0 == DIV) :
                    alt5 = 1
                if alt5 == 1:
783
                    # sdl92.g:164:18: '/' def_selection_list
784
                    pass 
Maxime Perrotin's avatar
Maxime Perrotin committed
785
                    char_literal14 = self.match(self.input, DIV, self.FOLLOW_DIV_in_use_clause1591) 
786
787
                    if self._state.backtracking == 0:
                        stream_DIV.add(char_literal14)
Maxime Perrotin's avatar
Maxime Perrotin committed
788
789


790
                    self._state.following.append(self.FOLLOW_def_selection_list_in_use_clause1593)
791
792
793
794
795
796
797
798
                    def_selection_list15 = self.def_selection_list()

                    self._state.following.pop()
                    if self._state.backtracking == 0:
                        stream_def_selection_list.add(def_selection_list15.tree)



Maxime Perrotin's avatar
Maxime Perrotin committed
799
800


801
                self._state.following.append(self.FOLLOW_end_in_use_clause1614)
802
                end16 = self.end()
Maxime Perrotin's avatar
Maxime Perrotin committed
803
804
805

                self._state.following.pop()
                if self._state.backtracking == 0:
806
                    stream_end.add(end16.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
807

Maxime Perrotin's avatar
Maxime Perrotin committed
808

Maxime Perrotin's avatar
Maxime Perrotin committed
809
                # AST Rewrite
Maxime Perrotin's avatar
Maxime Perrotin committed
810
                # elements: USE, use_asn1, end, package_name, def_selection_list
Maxime Perrotin's avatar
Maxime Perrotin committed
811
812
813
814
815
816
817
818
819
820
821
822
823
824
                # 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()
825
826
                    # 166:9: -> ^( USE ( use_asn1 )? ( end )? package_name ( def_selection_list )? )
                    # sdl92.g:166:17: ^( USE ( use_asn1 )? ( end )? package_name ( def_selection_list )? )
Maxime Perrotin's avatar
Maxime Perrotin committed
827
                    root_1 = self._adaptor.nil()
Maxime Perrotin's avatar
Maxime Perrotin committed
828
829
830
                    root_1 = self._adaptor.becomeRoot(
                    stream_USE.nextNode()
                    , root_1)
Maxime Perrotin's avatar
Maxime Perrotin committed
831

832
                    # sdl92.g:166:23: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
833
834
835
836
837
                    if stream_use_asn1.hasNext():
                        self._adaptor.addChild(root_1, stream_use_asn1.nextTree())


                    stream_use_asn1.reset();
Maxime Perrotin's avatar
Maxime Perrotin committed
838

839
                    # sdl92.g:166:33: ( end )?
840
841
842
843
844
                    if stream_end.hasNext():
                        self._adaptor.addChild(root_1, stream_end.nextTree())


                    stream_end.reset();
Maxime Perrotin's avatar
Maxime Perrotin committed
845

Maxime Perrotin's avatar
Maxime Perrotin committed
846
                    self._adaptor.addChild(root_1, stream_package_name.nextTree())
Maxime Perrotin's avatar
Maxime Perrotin committed
847

848
                    # sdl92.g:166:51: ( def_selection_list )?
849
850
851
852
853
                    if stream_def_selection_list.hasNext():
                        self._adaptor.addChild(root_1, stream_def_selection_list.nextTree())


                    stream_def_selection_list.reset();
Maxime Perrotin's avatar
Maxime Perrotin committed
854
855
856
857
858

                    self._adaptor.addChild(root_0, root_1)



Maxime Perrotin's avatar
Maxime Perrotin committed
859

Maxime Perrotin's avatar
Maxime Perrotin committed
860
861
862
863
                    retval.tree = root_0



Maxime Perrotin's avatar
Maxime Perrotin committed
864
865


Maxime Perrotin's avatar
Maxime Perrotin committed
866
867
868
                retval.stop = self.input.LT(-1)


Maxime Perrotin's avatar
Maxime Perrotin committed
869
                if self._state.backtracking == 0:
Maxime Perrotin's avatar
Maxime Perrotin committed
870
871
872
873
                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


Maxime Perrotin's avatar
Maxime Perrotin committed
874
875

            except RecognitionException as re:
Maxime Perrotin's avatar
Maxime Perrotin committed
876
877
878
879
                self.reportError(re)
                self.recover(self.input, re)
                retval.tree = self._adaptor.errorNode(self.input, retval.start, self.input.LT(-1), re)

Maxime Perrotin's avatar
Maxime Perrotin committed
880
        finally:
Maxime Perrotin's avatar
Maxime Perrotin committed
881
882
883
884
885
            pass
        return retval

    # $ANTLR end "use_clause"

Maxime Perrotin's avatar
Maxime Perrotin committed
886

887
888
    class def_selection_list_return(ParserRuleReturnScope):
        def __init__(self):
Maxime Perrotin's avatar
Maxime Perrotin committed
889
            super().__init__()
890
891
892
893
894
895

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
896

897
    # $ANTLR start "def_selection_list"
Maxime Perrotin's avatar
Maxime Perrotin committed
898
    # sdl92.g:173:1: def_selection_list : ID ( ',' ! ID )* ;
899
900
901
902
    def def_selection_list(self, ):
        retval = self.def_selection_list_return()
        retval.start = self.input.LT(1)

Maxime Perrotin's avatar
Maxime Perrotin committed
903

904
905
906
907
908
909
910
911
912
913
914
915
        root_0 = None

        ID17 = None
        char_literal18 = None
        ID19 = None

        ID17_tree = None
        char_literal18_tree = None
        ID19_tree = None

        try:
            try:
Maxime Perrotin's avatar
Maxime Perrotin committed
916
917
                # sdl92.g:174:9: ( ID ( ',' ! ID )* )
                # sdl92.g:174:17: ID ( ',' ! ID )*
918
919
920
921
                pass 
                root_0 = self._adaptor.nil()


Maxime Perrotin's avatar
Maxime Perrotin committed
922
923
                ID17 = self.match(self.input, ID, self.FOLLOW_ID_in_def_selection_list1678)
                if self._state.backtracking == 0:
924
925
926
                    ID17_tree = self._adaptor.createWithPayload(ID17)
                    self._adaptor.addChild(root_0, ID17_tree)

Maxime Perrotin's avatar
Maxime Perrotin committed
927
928
929


                # sdl92.g:174:20: ( ',' ! ID )*
930
931
932
933
934
935
936
937
938
                while True: #loop6
                    alt6 = 2
                    LA6_0 = self.input.LA(1)

                    if (LA6_0 == COMMA) :
                        alt6 = 1


                    if alt6 == 1:
Maxime Perrotin's avatar
Maxime Perrotin committed
939
                        # sdl92.g:174:21: ',' ! ID
940
                        pass 
Maxime Perrotin's avatar
Maxime Perrotin committed
941
                        char_literal18 = self.match(self.input, COMMA, self.FOLLOW_COMMA_in_def_selection_list1681)
942

Maxime Perrotin's avatar
Maxime Perrotin committed
943
944
                        ID19 = self.match(self.input, ID, self.FOLLOW_ID_in_def_selection_list1684)
                        if self._state.backtracking == 0:
945
946
947
948
949
                            ID19_tree = self._adaptor.createWithPayload(ID19)
                            self._adaptor.addChild(root_0, ID19_tree)



Maxime Perrotin's avatar
Maxime Perrotin committed
950

951
952
953
954
955
                    else:
                        break #loop6



Maxime Perrotin's avatar
Maxime Perrotin committed
956

957
958
959
                retval.stop = self.input.LT(-1)


Maxime Perrotin's avatar
Maxime Perrotin committed
960
                if self._state.backtracking == 0:
961
962
963
964
                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


Maxime Perrotin's avatar
Maxime Perrotin committed
965
966

            except RecognitionException as re:
967
968
969
970
                self.reportError(re)
                self.recover(self.input, re)
                retval.tree = self._adaptor.errorNode(self.input, retval.start, self.input.LT(-1), re)

Maxime Perrotin's avatar
Maxime Perrotin committed
971
        finally:
972
973
974
975
976
            pass
        return retval

    # $ANTLR end "def_selection_list"

Maxime Perrotin's avatar
Maxime Perrotin committed
977

Maxime Perrotin's avatar
Maxime Perrotin committed
978
979
    class entity_in_system_return(ParserRuleReturnScope):
        def __init__(self):
Maxime Perrotin's avatar
Maxime Perrotin committed
980
            super().__init__()
Maxime Perrotin's avatar
Maxime Perrotin committed
981
982
983
984
985
986

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
987

Maxime Perrotin's avatar
Maxime Perrotin committed
988
    # $ANTLR start "entity_in_system"
989
    # sdl92.g:181:1: entity_in_system : ( signal_declaration | text_area | procedure | channel | block_definition );
Maxime Perrotin's avatar
Maxime Perrotin committed
990
991
992
993
    def entity_in_system(self, ):
        retval = self.entity_in_system_return()
        retval.start = self.input.LT(1)

Maxime Perrotin's avatar
Maxime Perrotin committed
994

Maxime Perrotin's avatar
Maxime Perrotin committed
995
996
        root_0 = None

997
998
999
1000
1001
        signal_declaration20 = None
        text_area21 = None
        procedure22 = None
        channel23 = None
        block_definition24 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1002
1003
1004
1005


        try:
            try:
1006
                # sdl92.g:182:9: ( signal_declaration | text_area | procedure | channel | block_definition )
1007
1008
                alt7 = 5
                LA7 = self.input.LA(1)
Maxime Perrotin's avatar
Maxime Perrotin committed
1009
                if LA7 in {228}:
1010
1011
1012
1013
1014
1015
1016
1017
                    LA7_1 = self.input.LA(2)

                    if (self.synpred9_sdl92()) :
                        alt7 = 1
                    elif (self.synpred10_sdl92()) :
                        alt7 = 2
                    elif (self.synpred11_sdl92()) :
                        alt7 = 3
Maxime Perrotin's avatar
Maxime Perrotin committed
1018
1019
1020
1021
                    else:
                        if self._state.backtracking > 0:
                            raise BacktrackingFailed

Maxime Perrotin's avatar
Maxime Perrotin committed
1022

1023
                        nvae = NoViableAltException("", 7, 1, self.input)
Maxime Perrotin's avatar
Maxime Perrotin committed
1024
1025
1026

                        raise nvae

Maxime Perrotin's avatar
Maxime Perrotin committed
1027
1028

                elif LA7 in {SIGNAL}:
1029
                    alt7 = 1
Maxime Perrotin's avatar
Maxime Perrotin committed
1030
                elif LA7 in {PROCEDURE}:
1031
                    alt7 = 3
Maxime Perrotin's avatar
Maxime Perrotin committed
1032
                elif LA7 in {CHANNEL}:
1033
                    alt7 = 4
Maxime Perrotin's avatar
Maxime Perrotin committed
1034
                elif LA7 in {BLOCK}:
1035
                    alt7 = 5
Maxime Perrotin's avatar
Maxime Perrotin committed
1036
1037
1038
1039
                else:
                    if self._state.backtracking > 0:
                        raise BacktrackingFailed

Maxime Perrotin's avatar
Maxime Perrotin committed
1040

1041
                    nvae = NoViableAltException("", 7, 0, self.input)
Maxime Perrotin's avatar
Maxime Perrotin committed
1042
1043
1044

                    raise nvae

Maxime Perrotin's avatar
Maxime Perrotin committed
1045

1046
                if alt7 == 1:
1047
                    # sdl92.g:182:17: signal_declaration
Maxime Perrotin's avatar
Maxime Perrotin committed
1048
1049
1050
                    pass 
                    root_0 = self._adaptor.nil()

Maxime Perrotin's avatar
Maxime Perrotin committed
1051

1052
                    self._state.following.append(self.FOLLOW_signal_declaration_in_entity_in_system1720)
1053
                    signal_declaration20 = self.signal_declaration()
Maxime Perrotin's avatar
Maxime Perrotin committed
1054
1055
1056

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1057
                        self._adaptor.addChild(root_0, signal_declaration20.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1058
1059


Maxime Perrotin's avatar
Maxime Perrotin committed
1060

1061
                elif alt7 == 2:
1062
                    # sdl92.g:183:19: text_area
Maxime Perrotin's avatar
Maxime Perrotin committed
1063
1064
1065
                    pass 
                    root_0 = self._adaptor.nil()

Maxime Perrotin's avatar
Maxime Perrotin committed
1066

1067
                    self._state.following.append(self.FOLLOW_text_area_in_entity_in_system1740)
1068
                    text_area21 = self.text_area()
Maxime Perrotin's avatar
Maxime Perrotin committed
1069
1070
1071

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1072
                        self._adaptor.addChild(root_0, text_area21.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1073
1074


Maxime Perrotin's avatar
Maxime Perrotin committed
1075

1076
                elif alt7 == 3:
1077
                    # sdl92.g:184:19: procedure
Maxime Perrotin's avatar
Maxime Perrotin committed
1078
1079
1080
                    pass 
                    root_0 = self._adaptor.nil()

Maxime Perrotin's avatar
Maxime Perrotin committed
1081

1082
                    self._state.following.append(self.FOLLOW_procedure_in_entity_in_system1760)
1083
                    procedure22 = self.procedure()
Maxime Perrotin's avatar
Maxime Perrotin committed
1084
1085
1086

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1087
                        self._adaptor.addChild(root_0, procedure22.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1088
1089


Maxime Perrotin's avatar
Maxime Perrotin committed
1090

1091
                elif alt7 == 4:
1092
                    # sdl92.g:185:19: channel
1093
1094
1095
                    pass 
                    root_0 = self._adaptor.nil()

Maxime Perrotin's avatar
Maxime Perrotin committed
1096

1097
                    self._state.following.append(self.FOLLOW_channel_in_entity_in_system1780)
1098
                    channel23 = self.channel()
1099
1100
1101

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1102
                        self._adaptor.addChild(root_0, channel23.tree)
1103
1104


Maxime Perrotin's avatar
Maxime Perrotin committed
1105

1106
                elif alt7 == 5:
1107
                    # sdl92.g:186:19: block_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
1108
1109
1110
                    pass 
                    root_0 = self._adaptor.nil()

Maxime Perrotin's avatar
Maxime Perrotin committed
1111

1112
                    self._state.following.append(self.FOLLOW_block_definition_in_entity_in_system1800)
1113
                    block_definition24 = self.block_definition()
Maxime Perrotin's avatar
Maxime Perrotin committed
1114
1115
1116

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1117
                        self._adaptor.addChild(root_0, block_definition24.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1118
1119


Maxime Perrotin's avatar
Maxime Perrotin committed
1120

Maxime Perrotin's avatar
Maxime Perrotin committed
1121
1122
1123
                retval.stop = self.input.LT(-1)


Maxime Perrotin's avatar
Maxime Perrotin committed
1124
                if self._state.backtracking == 0:
Maxime Perrotin's avatar
Maxime Perrotin committed
1125
1126
1127
1128
                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


Maxime Perrotin's avatar
Maxime Perrotin committed
1129
1130

            except RecognitionException as re:
Maxime Perrotin's avatar
Maxime Perrotin committed
1131
1132
1133
1134
                self.reportError(re)
                self.recover(self.input, re)
                retval.tree = self._adaptor.errorNode(self.input, retval.start, self.input.LT(-1), re)

Maxime Perrotin's avatar
Maxime Perrotin committed
1135
        finally:
Maxime Perrotin's avatar
Maxime Perrotin committed
1136
1137
1138
1139
1140
            pass
        return retval

    # $ANTLR end "entity_in_system"

Maxime Perrotin's avatar
Maxime Perrotin committed
1141

Maxime Perrotin's avatar
Maxime Perrotin committed
1142
1143
    class signal_declaration_return(ParserRuleReturnScope):
        def __init__(self):
Maxime Perrotin's avatar
Maxime Perrotin committed
1144
            super().__init__()
Maxime Perrotin's avatar
Maxime Perrotin committed
1145
1146
1147
1148
1149
1150

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
1151

Maxime Perrotin's avatar
Maxime Perrotin committed
1152
    # $ANTLR start "signal_declaration"
1153
    # sdl92.g:192:1: signal_declaration : ( paramnames )? SIGNAL signal_id ( input_params )? end -> ^( SIGNAL ( paramnames )? signal_id ( input_params )? ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
1154
1155
1156
1157
    def signal_declaration(self, ):
        retval = self.signal_declaration_return()
        retval.start = self.input.LT(1)

Maxime Perrotin's avatar
Maxime Perrotin committed
1158

Maxime Perrotin's avatar
Maxime Perrotin committed
1159
1160
        root_0 = None

1161
1162
1163
1164
1165
        SIGNAL26 = None
        paramnames25 = None
        signal_id27 = None
        input_params28 = None
        end29 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1166

1167
        SIGNAL26_tree = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1168
        stream_SIGNAL = RewriteRuleTokenStream(self._adaptor, "token SIGNAL")
Maxime Perrotin's avatar
Maxime Perrotin committed
1169
        stream_paramnames = RewriteRuleSubtreeStream(self._adaptor, "rule paramnames")
1170
        stream_input_params = RewriteRuleSubtreeStream(self._adaptor, "rule input_params")
Maxime Perrotin's avatar
Maxime Perrotin committed
1171
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
1172
        stream_signal_id = RewriteRuleSubtreeStream(self._adaptor, "rule signal_id")
Maxime Perrotin's avatar
Maxime Perrotin committed
1173
1174
        try:
            try:
1175
1176
                # sdl92.g:193:9: ( ( paramnames )? SIGNAL signal_id ( input_params )? end -> ^( SIGNAL ( paramnames )? signal_id ( input_params )? ) )
                # sdl92.g:193:17: ( paramnames )? SIGNAL signal_id ( input_params )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
1177
                pass 
1178
                # sdl92.g:193:17: ( paramnames )?
1179
1180
                alt8 = 2
                LA8_0 = self.input.LA(1)
Maxime Perrotin's avatar
Maxime Perrotin committed
1181

1182
                if (LA8_0 == 228) :
1183
1184
                    alt8 = 1
                if alt8 == 1:
Maxime Perrotin's avatar
Maxime Perrotin committed
1185
                    # sdl92.g:193:17: paramnames
Maxime Perrotin's avatar
Maxime Perrotin committed
1186
                    pass 
1187
                    self._state.following.append(self.FOLLOW_paramnames_in_signal_declaration1833)
1188
                    paramnames25 = self.paramnames()
Maxime Perrotin's avatar
Maxime Perrotin committed
1189
1190
1191

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1192
                        stream_paramnames.add(paramnames25.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1193
1194
1195



Maxime Perrotin's avatar
Maxime Perrotin committed
1196
1197
1198


                SIGNAL26 = self.match(self.input, SIGNAL, self.FOLLOW_SIGNAL_in_signal_declaration1852) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1199
                if self._state.backtracking == 0:
1200
                    stream_SIGNAL.add(SIGNAL26)
Maxime Perrotin's avatar
Maxime Perrotin committed
1201
1202


1203
                self._state.following.append(self.FOLLOW_signal_id_in_signal_declaration1854)
1204
                signal_id27 = self.signal_id()
Maxime Perrotin's avatar
Maxime Perrotin committed
1205
1206
1207

                self._state.following.pop()
                if self._state.backtracking == 0:
1208
                    stream_signal_id.add(signal_id27.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1209
1210


1211
                # sdl92.g:194:34: ( input_params )?
1212
1213
                alt9 = 2
                LA9_0 = self.input.LA(1)
Maxime Perrotin's avatar
Maxime Perrotin committed
1214

1215
1216
1217
                if (LA9_0 == L_PAREN) :
                    alt9 = 1
                if alt9 == 1:
Maxime Perrotin's avatar
Maxime Perrotin committed
1218
                    # sdl92.g:194:34: input_params
Maxime Perrotin's avatar
Maxime Perrotin committed
1219
                    pass 
1220
                    self._state.following.append(self.FOLLOW_input_params_in_signal_declaration1856)
1221
                    input_params28 = self.input_params()
Maxime Perrotin's avatar
Maxime Perrotin committed
1222
1223
1224

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1225
                        stream_input_params.add(input_params28.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1226
1227
1228



Maxime Perrotin's avatar
Maxime Perrotin committed
1229
1230


1231
                self._state.following.append(self.FOLLOW_end_in_signal_declaration1859)
1232
                end29 = self.end()
Maxime Perrotin's avatar
Maxime Perrotin committed
1233
1234
1235

                self._state.following.pop()
                if self._state.backtracking == 0:
1236
                    stream_end.add(end29.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1237

Maxime Perrotin's avatar
Maxime Perrotin committed
1238

Maxime Perrotin's avatar
Maxime Perrotin committed
1239
                # AST Rewrite
Maxime Perrotin's avatar
Maxime Perrotin committed
1240
                # elements: SIGNAL, paramnames, signal_id, input_params
Maxime Perrotin's avatar
Maxime Perrotin committed
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
                # 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()
1255
1256
                    # 195:9: -> ^( SIGNAL ( paramnames )? signal_id ( input_params )? )
                    # sdl92.g:195:17: ^( SIGNAL ( paramnames )? signal_id ( input_params )? )
Maxime Perrotin's avatar
Maxime Perrotin committed
1257
                    root_1 = self._adaptor.nil()
Maxime Perrotin's avatar
Maxime Perrotin committed
1258
1259
1260
                    root_1 = self._adaptor.becomeRoot(
                    stream_SIGNAL.nextNode()
                    , root_1)
Maxime Perrotin's avatar
Maxime Perrotin committed
1261

1262
                    # sdl92.g:195:26: ( paramnames )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1263
1264
1265
1266
1267
                    if stream_paramnames.hasNext():
                        self._adaptor.addChild(root_1, stream_paramnames.nextTree())


                    stream_paramnames.reset();
Maxime Perrotin's avatar
Maxime Perrotin committed
1268

Maxime Perrotin's avatar
Maxime Perrotin committed
1269
                    self._adaptor.addChild(root_1, stream_signal_id.nextTree())
Maxime Perrotin's avatar
Maxime Perrotin committed
1270

1271
                    # sdl92.g:195:48: ( input_params )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
                    if stream_input_params.hasNext():
                        self._adaptor.addChild(root_1, stream_input_params.nextTree())


                    stream_input_params.reset();

                    self._adaptor.addChild(root_0, root_1)



Maxime Perrotin's avatar
Maxime Perrotin committed
1282

Maxime Perrotin's avatar
Maxime Perrotin committed
1283
1284
1285
1286
                    retval.tree = root_0



Maxime Perrotin's avatar
Maxime Perrotin committed
1287
1288


Maxime Perrotin's avatar
Maxime Perrotin committed
1289
1290
1291
                retval.stop = self.input.LT(-1)


Maxime Perrotin's avatar
Maxime Perrotin committed
1292
                if self._state.backtracking == 0:
Maxime Perrotin's avatar
Maxime Perrotin committed
1293
1294
1295
1296
                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


Maxime Perrotin's avatar
Maxime Perrotin committed
1297
1298

            except RecognitionException as re:
Maxime Perrotin's avatar
Maxime Perrotin committed
1299
1300
1301
1302
                self.reportError(re)
                self.recover(self.input, re)
                retval.tree = self._adaptor.errorNode(self.input, retval.start, self.input.LT(-1), re)

Maxime Perrotin's avatar
Maxime Perrotin committed
1303
        finally:
Maxime Perrotin's avatar
Maxime Perrotin committed
1304
1305
1306
1307
1308
            pass
        return retval

    # $ANTLR end "signal_declaration"

Maxime Perrotin's avatar
Maxime Perrotin committed
1309

Maxime Perrotin's avatar
Maxime Perrotin committed
1310
1311
    class channel_return(ParserRuleReturnScope):
        def __init__(self):
Maxime Perrotin's avatar
Maxime Perrotin committed
1312
            super().__init__()
Maxime Perrotin's avatar
Maxime Perrotin committed
1313
1314
1315
1316
1317
1318

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
1319

Maxime Perrotin's avatar
Maxime Perrotin committed
1320
    # $ANTLR start "channel"
1321
    # sdl92.g:199:1: channel : CHANNEL channel_id ( route )+ ENDCHANNEL end -> ^( CHANNEL channel_id ( route )+ ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
1322
1323
1324
1325
    def channel(self, ):
        retval = self.channel_return()
        retval.start = self.input.LT(1)

Maxime Perrotin's avatar
Maxime Perrotin committed
1326

Maxime Perrotin's avatar
Maxime Perrotin committed
1327
1328
        root_0 = None

1329
1330
1331
1332
1333
        CHANNEL30 = None
        ENDCHANNEL33 = None
        channel_id31 = None
        route32 = None
        end34 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1334

1335
1336
        CHANNEL30_tree = None
        ENDCHANNEL33_tree = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1337
1338
1339
        stream_CHANNEL = RewriteRuleTokenStream(self._adaptor, "token CHANNEL")
        stream_ENDCHANNEL = RewriteRuleTokenStream(self._adaptor, "token ENDCHANNEL")
        stream_route = RewriteRuleSubtreeStream(self._adaptor, "rule route")
Maxime Perrotin's avatar
Maxime Perrotin committed
1340
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
1341
        stream_channel_id = RewriteRuleSubtreeStream(self._adaptor, "rule channel_id")
Maxime Perrotin's avatar
Maxime Perrotin committed
1342
1343
        try:
            try:
1344
1345
                # sdl92.g:200:9: ( CHANNEL channel_id ( route )+ ENDCHANNEL end -> ^( CHANNEL channel_id ( route )+ ) )
                # sdl92.g:200:17: CHANNEL channel_id ( route )+ ENDCHANNEL end
Maxime Perrotin's avatar
Maxime Perrotin committed
1346
                pass 
Maxime Perrotin's avatar
Maxime Perrotin committed
1347
                CHANNEL30 = self.match(self.input, CHANNEL, self.FOLLOW_CHANNEL_in_channel1918) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1348
                if self._state.backtracking == 0:
1349
                    stream_CHANNEL.add(CHANNEL30)
Maxime Perrotin's avatar
Maxime Perrotin committed
1350
1351


1352
                self._state.following.append(self.FOLLOW_channel_id_in_channel1920)
1353
                channel_id31 = self.channel_id()
Maxime Perrotin's avatar
Maxime Perrotin committed
1354
1355
1356

                self._state.following.pop()
                if self._state.backtracking == 0:
1357
                    stream_channel_id.add(channel_id31.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1358
1359


1360
                # sdl92.g:201:17: ( route )+
1361
1362
1363
1364
                cnt10 = 0
                while True: #loop10
                    alt10 = 2
                    LA10_0 = self.input.LA(1)
Maxime Perrotin's avatar
Maxime Perrotin committed
1365

1366
1367
                    if (LA10_0 == FROM) :
                        alt10 = 1
Maxime Perrotin's avatar
Maxime Perrotin committed
1368
1369


1370
                    if alt10 == 1:
Maxime Perrotin's avatar
Maxime Perrotin committed
1371
                        # sdl92.g:201:17: route
Maxime Perrotin's avatar
Maxime Perrotin committed
1372
                        pass 
1373
                        self._state.following.append(self.FOLLOW_route_in_channel1938)
1374
                        route32 = self.route()
Maxime Perrotin's avatar
Maxime Perrotin committed
1375
1376
1377

                        self._state.following.pop()
                        if self._state.backtracking == 0:
1378
                            stream_route.add(route32.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1379
1380


Maxime Perrotin's avatar
Maxime Perrotin committed
1381

Maxime Perrotin's avatar
Maxime Perrotin committed
1382
                    else:
1383
1384
                        if cnt10 >= 1:
                            break #loop10
Maxime Perrotin's avatar
Maxime Perrotin committed
1385
1386
1387
1388

                        if self._state.backtracking > 0:
                            raise BacktrackingFailed

Maxime Perrotin's avatar
Maxime Perrotin committed
1389

1390
                        eee = EarlyExitException(10, self.input)
Maxime Perrotin's avatar
Maxime Perrotin committed
1391
1392
                        raise eee

1393
                    cnt10 += 1
Maxime Perrotin's avatar
Maxime Perrotin committed
1394
1395
1396


                ENDCHANNEL33 = self.match(self.input, ENDCHANNEL, self.FOLLOW_ENDCHANNEL_in_channel1957) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1397
                if self._state.backtracking == 0: