sdl92Parser.py 2.07 MB
Newer Older
1
# $ANTLR 3.5.2 sdl92.g 2020-06-20 15:59:32
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
375
376
        self.dfa128 = self.DFA128(
            self, 128,
            eot = self.DFA128_eot,
            eof = self.DFA128_eof,
            min = self.DFA128_min,
            max = self.DFA128_max,
            accept = self.DFA128_accept,
            special = self.DFA128_special,
            transition = self.DFA128_transition
            )

377
378
379
380
381
382
383
384
385
        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
386
387
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
388
389
390



Maxime Perrotin's avatar
Maxime Perrotin committed
391
        self.delegates = []
Maxime Perrotin's avatar
Maxime Perrotin committed
392
393
394
395
396

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


Maxime Perrotin's avatar
Maxime Perrotin committed
397

Maxime Perrotin's avatar
Maxime Perrotin committed
398
399
400
401
402
403
404
405
406
407
408
    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
409
            super().__init__()
Maxime Perrotin's avatar
Maxime Perrotin committed
410
411
412
413
414
415

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
416

Maxime Perrotin's avatar
Maxime Perrotin committed
417
    # $ANTLR start "pr_file"
418
    # sdl92.g:146:1: pr_file : ( use_clause | system_definition | process_definition )+ ;
Maxime Perrotin's avatar
Maxime Perrotin committed
419
420
421
422
    def pr_file(self, ):
        retval = self.pr_file_return()
        retval.start = self.input.LT(1)

Maxime Perrotin's avatar
Maxime Perrotin committed
423

Maxime Perrotin's avatar
Maxime Perrotin committed
424
425
426
427
428
429
430
431
432
        root_0 = None

        use_clause1 = None
        system_definition2 = None
        process_definition3 = None


        try:
            try:
433
434
                # 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
435
436
437
                pass 
                root_0 = self._adaptor.nil()

Maxime Perrotin's avatar
Maxime Perrotin committed
438

439
                # sdl92.g:147:17: ( use_clause | system_definition | process_definition )+
Maxime Perrotin's avatar
Maxime Perrotin committed
440
441
442
443
                cnt1 = 0
                while True: #loop1
                    alt1 = 4
                    LA1 = self.input.LA(1)
Maxime Perrotin's avatar
Maxime Perrotin committed
444
                    if LA1 in {228}:
445
446
                        LA1_2 = self.input.LA(2)

Maxime Perrotin's avatar
Maxime Perrotin committed
447
                        if (LA1_2 == KEEP) :
448
                            alt1 = 1
Maxime Perrotin's avatar
Maxime Perrotin committed
449
450
                        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
451
452


Maxime Perrotin's avatar
Maxime Perrotin committed
453
                    elif LA1 in {USE}:
Maxime Perrotin's avatar
Maxime Perrotin committed
454
                        alt1 = 1
Maxime Perrotin's avatar
Maxime Perrotin committed
455
                    elif LA1 in {SYSTEM}:
Maxime Perrotin's avatar
Maxime Perrotin committed
456
                        alt1 = 2
Maxime Perrotin's avatar
Maxime Perrotin committed
457
                    elif LA1 in {PROCESS}:
Maxime Perrotin's avatar
Maxime Perrotin committed
458
459
460
                        alt1 = 3

                    if alt1 == 1:
461
                        # sdl92.g:147:18: use_clause
Maxime Perrotin's avatar
Maxime Perrotin committed
462
                        pass 
463
                        self._state.following.append(self.FOLLOW_use_clause_in_pr_file1375)
Maxime Perrotin's avatar
Maxime Perrotin committed
464
465
466
467
468
469
470
                        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
471

Maxime Perrotin's avatar
Maxime Perrotin committed
472
                    elif alt1 == 2:
473
                        # sdl92.g:148:19: system_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
474
                        pass 
475
                        self._state.following.append(self.FOLLOW_system_definition_in_pr_file1395)
Maxime Perrotin's avatar
Maxime Perrotin committed
476
477
478
479
480
481
482
                        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
483

Maxime Perrotin's avatar
Maxime Perrotin committed
484
                    elif alt1 == 3:
485
                        # sdl92.g:149:19: process_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
486
                        pass 
487
                        self._state.following.append(self.FOLLOW_process_definition_in_pr_file1415)
Maxime Perrotin's avatar
Maxime Perrotin committed
488
489
490
491
492
493
494
                        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
495

Maxime Perrotin's avatar
Maxime Perrotin committed
496
497
498
499
500
501
502
                    else:
                        if cnt1 >= 1:
                            break #loop1

                        if self._state.backtracking > 0:
                            raise BacktrackingFailed

Maxime Perrotin's avatar
Maxime Perrotin committed
503

Maxime Perrotin's avatar
Maxime Perrotin committed
504
505
506
507
508
509
510
                        eee = EarlyExitException(1, self.input)
                        raise eee

                    cnt1 += 1



Maxime Perrotin's avatar
Maxime Perrotin committed
511

Maxime Perrotin's avatar
Maxime Perrotin committed
512
513
514
                retval.stop = self.input.LT(-1)


Maxime Perrotin's avatar
Maxime Perrotin committed
515
                if self._state.backtracking == 0:
Maxime Perrotin's avatar
Maxime Perrotin committed
516
517
518
519
                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


Maxime Perrotin's avatar
Maxime Perrotin committed
520
521

            except RecognitionException as re:
Maxime Perrotin's avatar
Maxime Perrotin committed
522
523
524
525
                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
526
        finally:
Maxime Perrotin's avatar
Maxime Perrotin committed
527
528
529
530
531
            pass
        return retval

    # $ANTLR end "pr_file"

Maxime Perrotin's avatar
Maxime Perrotin committed
532

Maxime Perrotin's avatar
Maxime Perrotin committed
533
534
    class system_definition_return(ParserRuleReturnScope):
        def __init__(self):
Maxime Perrotin's avatar
Maxime Perrotin committed
535
            super().__init__()
Maxime Perrotin's avatar
Maxime Perrotin committed
536
537
538
539
540
541

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
542

Maxime Perrotin's avatar
Maxime Perrotin committed
543
    # $ANTLR start "system_definition"
544
    # 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
545
546
547
548
    def system_definition(self, ):
        retval = self.system_definition_return()
        retval.start = self.input.LT(1)

Maxime Perrotin's avatar
Maxime Perrotin committed
549

Maxime Perrotin's avatar
Maxime Perrotin committed
550
551
552
553
554
555
556
557
558
559
560
561
        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
562
        stream_SYSTEM = RewriteRuleTokenStream(self._adaptor, "token SYSTEM")
563
        stream_ENDSYSTEM = RewriteRuleTokenStream(self._adaptor, "token ENDSYSTEM")
Maxime Perrotin's avatar
Maxime Perrotin committed
564
565
566
567
568
        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:
569
570
                # 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
571
                pass 
Maxime Perrotin's avatar
Maxime Perrotin committed
572
                SYSTEM4 = self.match(self.input, SYSTEM, self.FOLLOW_SYSTEM_in_system_definition1449) 
Maxime Perrotin's avatar
Maxime Perrotin committed
573
574
                if self._state.backtracking == 0:
                    stream_SYSTEM.add(SYSTEM4)
Maxime Perrotin's avatar
Maxime Perrotin committed
575
576


577
                self._state.following.append(self.FOLLOW_system_name_in_system_definition1451)
Maxime Perrotin's avatar
Maxime Perrotin committed
578
579
580
581
582
                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
583
584


585
                self._state.following.append(self.FOLLOW_end_in_system_definition1453)
Maxime Perrotin's avatar
Maxime Perrotin committed
586
587
588
589
590
                end6 = self.end()

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


593
                # sdl92.g:155:17: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
594
595
596
597
                while True: #loop2
                    alt2 = 2
                    LA2_0 = self.input.LA(1)

Maxime Perrotin's avatar
Maxime Perrotin committed
598
                    if (LA2_0 in {BLOCK, CHANNEL, PROCEDURE, SIGNAL, 228}) :
Maxime Perrotin's avatar
Maxime Perrotin committed
599
600
601
602
                        alt2 = 1


                    if alt2 == 1:
Maxime Perrotin's avatar
Maxime Perrotin committed
603
                        # sdl92.g:155:17: entity_in_system
Maxime Perrotin's avatar
Maxime Perrotin committed
604
                        pass 
605
                        self._state.following.append(self.FOLLOW_entity_in_system_in_system_definition1471)
Maxime Perrotin's avatar
Maxime Perrotin committed
606
607
608
609
610
611
612
                        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
613

Maxime Perrotin's avatar
Maxime Perrotin committed
614
615
                    else:
                        break #loop2
Maxime Perrotin's avatar
Maxime Perrotin committed
616
617
618


                ENDSYSTEM8 = self.match(self.input, ENDSYSTEM, self.FOLLOW_ENDSYSTEM_in_system_definition1490) 
Maxime Perrotin's avatar
Maxime Perrotin committed
619
620
                if self._state.backtracking == 0:
                    stream_ENDSYSTEM.add(ENDSYSTEM8)
Maxime Perrotin's avatar
Maxime Perrotin committed
621
622


623
                # sdl92.g:156:27: ( system_name )?
Maxime Perrotin's avatar
Maxime Perrotin committed
624
625
626
627
628
629
                alt3 = 2
                LA3_0 = self.input.LA(1)

                if (LA3_0 == ID) :
                    alt3 = 1
                if alt3 == 1:
Maxime Perrotin's avatar
Maxime Perrotin committed
630
                    # sdl92.g:156:27: system_name
Maxime Perrotin's avatar
Maxime Perrotin committed
631
                    pass 
632
                    self._state.following.append(self.FOLLOW_system_name_in_system_definition1492)
Maxime Perrotin's avatar
Maxime Perrotin committed
633
634
635
636
637
638
639
640
                    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
641
642


643
                self._state.following.append(self.FOLLOW_end_in_system_definition1495)
Maxime Perrotin's avatar
Maxime Perrotin committed
644
645
646
647
648
649
                end10 = self.end()

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

Maxime Perrotin's avatar
Maxime Perrotin committed
650

Maxime Perrotin's avatar
Maxime Perrotin committed
651
                # AST Rewrite
Maxime Perrotin's avatar
Maxime Perrotin committed
652
                # elements: SYSTEM, system_name, entity_in_system
Maxime Perrotin's avatar
Maxime Perrotin committed
653
654
655
656
657
658
659
660
661
662
663
664
665
666
                # 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()
667
668
                    # 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
669
                    root_1 = self._adaptor.nil()
Maxime Perrotin's avatar
Maxime Perrotin committed
670
671
672
                    root_1 = self._adaptor.becomeRoot(
                    stream_SYSTEM.nextNode()
                    , root_1)
Maxime Perrotin's avatar
Maxime Perrotin committed
673
674

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

676
                    # sdl92.g:157:38: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
677
678
679
680
681
682
683
684
685
686
                    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
687

Maxime Perrotin's avatar
Maxime Perrotin committed
688
689
690
691
                    retval.tree = root_0



Maxime Perrotin's avatar
Maxime Perrotin committed
692
693


Maxime Perrotin's avatar
Maxime Perrotin committed
694
695
696
                retval.stop = self.input.LT(-1)


Maxime Perrotin's avatar
Maxime Perrotin committed
697
                if self._state.backtracking == 0:
Maxime Perrotin's avatar
Maxime Perrotin committed
698
699
700
701
                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


Maxime Perrotin's avatar
Maxime Perrotin committed
702
703

            except RecognitionException as re:
Maxime Perrotin's avatar
Maxime Perrotin committed
704
705
706
707
                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
708
        finally:
Maxime Perrotin's avatar
Maxime Perrotin committed
709
710
711
712
713
            pass
        return retval

    # $ANTLR end "system_definition"

Maxime Perrotin's avatar
Maxime Perrotin committed
714

Maxime Perrotin's avatar
Maxime Perrotin committed
715
716
    class use_clause_return(ParserRuleReturnScope):
        def __init__(self):
Maxime Perrotin's avatar
Maxime Perrotin committed
717
            super().__init__()
Maxime Perrotin's avatar
Maxime Perrotin committed
718
719
720
721
722
723

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
724

Maxime Perrotin's avatar
Maxime Perrotin committed
725
    # $ANTLR start "use_clause"
726
    # 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
727
728
729
730
    def use_clause(self, ):
        retval = self.use_clause_return()
        retval.start = self.input.LT(1)

Maxime Perrotin's avatar
Maxime Perrotin committed
731

Maxime Perrotin's avatar
Maxime Perrotin committed
732
733
734
        root_0 = None

        USE12 = None
735
        char_literal14 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
736
737
        use_asn111 = None
        package_name13 = None
738
739
        def_selection_list15 = None
        end16 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
740
741

        USE12_tree = None
742
        char_literal14_tree = None
Maxime Perrotin's avatar
Maxime Perrotin committed
743
        stream_DIV = RewriteRuleTokenStream(self._adaptor, "token DIV")
744
        stream_USE = RewriteRuleTokenStream(self._adaptor, "token USE")
Maxime Perrotin's avatar
Maxime Perrotin committed
745
746
        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
747
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
748
        stream_def_selection_list = RewriteRuleSubtreeStream(self._adaptor, "rule def_selection_list")
Maxime Perrotin's avatar
Maxime Perrotin committed
749
750
        try:
            try:
751
752
                # 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
753
                pass 
754
                # sdl92.g:162:17: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
755
756
757
                alt4 = 2
                LA4_0 = self.input.LA(1)

758
                if (LA4_0 == 228) :
Maxime Perrotin's avatar
Maxime Perrotin committed
759
760
                    alt4 = 1
                if alt4 == 1:
Maxime Perrotin's avatar
Maxime Perrotin committed
761
                    # sdl92.g:162:17: use_asn1
Maxime Perrotin's avatar
Maxime Perrotin committed
762
                    pass 
763
                    self._state.following.append(self.FOLLOW_use_asn1_in_use_clause1551)
Maxime Perrotin's avatar
Maxime Perrotin committed
764
765
766
767
768
769
770
771
                    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
772
773
774


                USE12 = self.match(self.input, USE, self.FOLLOW_USE_in_use_clause1570) 
Maxime Perrotin's avatar
Maxime Perrotin committed
775
776
                if self._state.backtracking == 0:
                    stream_USE.add(USE12)
Maxime Perrotin's avatar
Maxime Perrotin committed
777
778


779
                self._state.following.append(self.FOLLOW_package_name_in_use_clause1572)
Maxime Perrotin's avatar
Maxime Perrotin committed
780
781
782
783
784
                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
785
786


787
                # sdl92.g:164:17: ( '/' def_selection_list )?
788
789
790
791
792
793
                alt5 = 2
                LA5_0 = self.input.LA(1)

                if (LA5_0 == DIV) :
                    alt5 = 1
                if alt5 == 1:
794
                    # sdl92.g:164:18: '/' def_selection_list
795
                    pass 
Maxime Perrotin's avatar
Maxime Perrotin committed
796
                    char_literal14 = self.match(self.input, DIV, self.FOLLOW_DIV_in_use_clause1591) 
797
798
                    if self._state.backtracking == 0:
                        stream_DIV.add(char_literal14)
Maxime Perrotin's avatar
Maxime Perrotin committed
799
800


801
                    self._state.following.append(self.FOLLOW_def_selection_list_in_use_clause1593)
802
803
804
805
806
807
808
809
                    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
810
811


812
                self._state.following.append(self.FOLLOW_end_in_use_clause1614)
813
                end16 = self.end()
Maxime Perrotin's avatar
Maxime Perrotin committed
814
815
816

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

Maxime Perrotin's avatar
Maxime Perrotin committed
819

Maxime Perrotin's avatar
Maxime Perrotin committed
820
                # AST Rewrite
Maxime Perrotin's avatar
Maxime Perrotin committed
821
                # elements: USE, use_asn1, end, package_name, def_selection_list
Maxime Perrotin's avatar
Maxime Perrotin committed
822
823
824
825
826
827
828
829
830
831
832
833
834
835
                # 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()
836
837
                    # 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
838
                    root_1 = self._adaptor.nil()
Maxime Perrotin's avatar
Maxime Perrotin committed
839
840
841
                    root_1 = self._adaptor.becomeRoot(
                    stream_USE.nextNode()
                    , root_1)
Maxime Perrotin's avatar
Maxime Perrotin committed
842

843
                    # sdl92.g:166:23: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
844
845
846
847
848
                    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
849

850
                    # sdl92.g:166:33: ( end )?
851
852
853
854
855
                    if stream_end.hasNext():
                        self._adaptor.addChild(root_1, stream_end.nextTree())


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

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

859
                    # sdl92.g:166:51: ( def_selection_list )?
860
861
862
863
864
                    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
865
866
867
868
869

                    self._adaptor.addChild(root_0, root_1)



Maxime Perrotin's avatar
Maxime Perrotin committed
870

Maxime Perrotin's avatar
Maxime Perrotin committed
871
872
873
874
                    retval.tree = root_0



Maxime Perrotin's avatar
Maxime Perrotin committed
875
876


Maxime Perrotin's avatar
Maxime Perrotin committed
877
878
879
                retval.stop = self.input.LT(-1)


Maxime Perrotin's avatar
Maxime Perrotin committed
880
                if self._state.backtracking == 0:
Maxime Perrotin's avatar
Maxime Perrotin committed
881
882
883
884
                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


Maxime Perrotin's avatar
Maxime Perrotin committed
885
886

            except RecognitionException as re:
Maxime Perrotin's avatar
Maxime Perrotin committed
887
888
889
890
                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
891
        finally:
Maxime Perrotin's avatar
Maxime Perrotin committed
892
893
894
895
896
            pass
        return retval

    # $ANTLR end "use_clause"

Maxime Perrotin's avatar
Maxime Perrotin committed
897

898
899
    class def_selection_list_return(ParserRuleReturnScope):
        def __init__(self):
Maxime Perrotin's avatar
Maxime Perrotin committed
900
            super().__init__()
901
902
903
904
905
906

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
907

908
    # $ANTLR start "def_selection_list"
Maxime Perrotin's avatar
Maxime Perrotin committed
909
    # sdl92.g:173:1: def_selection_list : ID ( ',' ! ID )* ;
910
911
912
913
    def def_selection_list(self, ):
        retval = self.def_selection_list_return()
        retval.start = self.input.LT(1)

Maxime Perrotin's avatar
Maxime Perrotin committed
914

915
916
917
918
919
920
921
922
923
924
925
926
        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
927
928
                # sdl92.g:174:9: ( ID ( ',' ! ID )* )
                # sdl92.g:174:17: ID ( ',' ! ID )*
929
930
931
932
                pass 
                root_0 = self._adaptor.nil()


Maxime Perrotin's avatar
Maxime Perrotin committed
933
934
                ID17 = self.match(self.input, ID, self.FOLLOW_ID_in_def_selection_list1678)
                if self._state.backtracking == 0:
935
936
937
                    ID17_tree = self._adaptor.createWithPayload(ID17)
                    self._adaptor.addChild(root_0, ID17_tree)

Maxime Perrotin's avatar
Maxime Perrotin committed
938
939
940


                # sdl92.g:174:20: ( ',' ! ID )*
941
942
943
944
945
946
947
948
949
                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
950
                        # sdl92.g:174:21: ',' ! ID
951
                        pass 
Maxime Perrotin's avatar
Maxime Perrotin committed
952
                        char_literal18 = self.match(self.input, COMMA, self.FOLLOW_COMMA_in_def_selection_list1681)
953

Maxime Perrotin's avatar
Maxime Perrotin committed
954
955
                        ID19 = self.match(self.input, ID, self.FOLLOW_ID_in_def_selection_list1684)
                        if self._state.backtracking == 0:
956
957
958
959
960
                            ID19_tree = self._adaptor.createWithPayload(ID19)
                            self._adaptor.addChild(root_0, ID19_tree)



Maxime Perrotin's avatar
Maxime Perrotin committed
961

962
963
964
965
966
                    else:
                        break #loop6



Maxime Perrotin's avatar
Maxime Perrotin committed
967

968
969
970
                retval.stop = self.input.LT(-1)


Maxime Perrotin's avatar
Maxime Perrotin committed
971
                if self._state.backtracking == 0:
972
973
974
975
                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


Maxime Perrotin's avatar
Maxime Perrotin committed
976
977

            except RecognitionException as re:
978
979
980
981
                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
982
        finally:
983
984
985
986
987
            pass
        return retval

    # $ANTLR end "def_selection_list"

Maxime Perrotin's avatar
Maxime Perrotin committed
988

Maxime Perrotin's avatar
Maxime Perrotin committed
989
990
    class entity_in_system_return(ParserRuleReturnScope):
        def __init__(self):
Maxime Perrotin's avatar
Maxime Perrotin committed
991
            super().__init__()
Maxime Perrotin's avatar
Maxime Perrotin committed
992
993
994
995
996
997

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
998

Maxime Perrotin's avatar
Maxime Perrotin committed
999
    # $ANTLR start "entity_in_system"
1000
    # sdl92.g:181:1: entity_in_system : ( signal_declaration | text_area | procedure | channel | block_definition );
Maxime Perrotin's avatar
Maxime Perrotin committed
1001
1002
1003
1004
    def entity_in_system(self, ):
        retval = self.entity_in_system_return()
        retval.start = self.input.LT(1)

Maxime Perrotin's avatar
Maxime Perrotin committed
1005

Maxime Perrotin's avatar
Maxime Perrotin committed
1006
1007
        root_0 = None

1008
1009
1010
1011
1012
        signal_declaration20 = None
        text_area21 = None
        procedure22 = None
        channel23 = None
        block_definition24 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1013
1014
1015
1016


        try:
            try:
1017
                # sdl92.g:182:9: ( signal_declaration | text_area | procedure | channel | block_definition )
1018
1019
                alt7 = 5
                LA7 = self.input.LA(1)
Maxime Perrotin's avatar
Maxime Perrotin committed
1020
                if LA7 in {228}:
1021
1022
1023
1024
1025
1026
1027
1028
                    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
1029
1030
1031
1032
                    else:
                        if self._state.backtracking > 0:
                            raise BacktrackingFailed

Maxime Perrotin's avatar
Maxime Perrotin committed
1033

1034
                        nvae = NoViableAltException("", 7, 1, self.input)
Maxime Perrotin's avatar
Maxime Perrotin committed
1035
1036
1037

                        raise nvae

Maxime Perrotin's avatar
Maxime Perrotin committed
1038
1039

                elif LA7 in {SIGNAL}:
1040
                    alt7 = 1
Maxime Perrotin's avatar
Maxime Perrotin committed
1041
                elif LA7 in {PROCEDURE}:
1042
                    alt7 = 3
Maxime Perrotin's avatar
Maxime Perrotin committed
1043
                elif LA7 in {CHANNEL}:
1044
                    alt7 = 4
Maxime Perrotin's avatar
Maxime Perrotin committed
1045
                elif LA7 in {BLOCK}:
1046
                    alt7 = 5
Maxime Perrotin's avatar
Maxime Perrotin committed
1047
1048
1049
1050
                else:
                    if self._state.backtracking > 0:
                        raise BacktrackingFailed

Maxime Perrotin's avatar
Maxime Perrotin committed
1051

1052
                    nvae = NoViableAltException("", 7, 0, self.input)
Maxime Perrotin's avatar
Maxime Perrotin committed
1053
1054
1055

                    raise nvae

Maxime Perrotin's avatar
Maxime Perrotin committed
1056

1057
                if alt7 == 1:
1058
                    # sdl92.g:182:17: signal_declaration
Maxime Perrotin's avatar
Maxime Perrotin committed
1059
1060
1061
                    pass 
                    root_0 = self._adaptor.nil()

Maxime Perrotin's avatar
Maxime Perrotin committed
1062

1063
                    self._state.following.append(self.FOLLOW_signal_declaration_in_entity_in_system1720)
1064
                    signal_declaration20 = self.signal_declaration()
Maxime Perrotin's avatar
Maxime Perrotin committed
1065
1066
1067

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


Maxime Perrotin's avatar
Maxime Perrotin committed
1071

1072
                elif alt7 == 2:
1073
                    # sdl92.g:183:19: text_area
Maxime Perrotin's avatar
Maxime Perrotin committed
1074
1075
1076
                    pass 
                    root_0 = self._adaptor.nil()

Maxime Perrotin's avatar
Maxime Perrotin committed
1077

1078
                    self._state.following.append(self.FOLLOW_text_area_in_entity_in_system1740)
1079
                    text_area21 = self.text_area()
Maxime Perrotin's avatar
Maxime Perrotin committed
1080
1081
1082

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


Maxime Perrotin's avatar
Maxime Perrotin committed
1086

1087
                elif alt7 == 3:
1088
                    # sdl92.g:184:19: procedure
Maxime Perrotin's avatar
Maxime Perrotin committed
1089
1090
1091
                    pass 
                    root_0 = self._adaptor.nil()

Maxime Perrotin's avatar
Maxime Perrotin committed
1092

1093
                    self._state.following.append(self.FOLLOW_procedure_in_entity_in_system1760)
1094
                    procedure22 = self.procedure()
Maxime Perrotin's avatar
Maxime Perrotin committed
1095
1096
1097

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


Maxime Perrotin's avatar
Maxime Perrotin committed
1101

1102
                elif alt7 == 4:
1103
                    # sdl92.g:185:19: channel
1104
1105
1106
                    pass 
                    root_0 = self._adaptor.nil()

Maxime Perrotin's avatar
Maxime Perrotin committed
1107

1108
                    self._state.following.append(self.FOLLOW_channel_in_entity_in_system1780)
1109
                    channel23 = self.channel()
1110
1111
1112

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1113
                        self._adaptor.addChild(root_0, channel23.tree)
1114
1115


Maxime Perrotin's avatar
Maxime Perrotin committed
1116

1117
                elif alt7 == 5:
1118
                    # sdl92.g:186:19: block_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
1119
1120
1121
                    pass 
                    root_0 = self._adaptor.nil()

Maxime Perrotin's avatar
Maxime Perrotin committed
1122

1123
                    self._state.following.append(self.FOLLOW_block_definition_in_entity_in_system1800)
1124
                    block_definition24 = self.block_definition()
Maxime Perrotin's avatar
Maxime Perrotin committed
1125
1126
1127

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


Maxime Perrotin's avatar
Maxime Perrotin committed
1131

Maxime Perrotin's avatar
Maxime Perrotin committed
1132
1133
1134
                retval.stop = self.input.LT(-1)


Maxime Perrotin's avatar
Maxime Perrotin committed
1135
                if self._state.backtracking == 0:
Maxime Perrotin's avatar
Maxime Perrotin committed
1136
1137
1138
1139
                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


Maxime Perrotin's avatar
Maxime Perrotin committed
1140
1141

            except RecognitionException as re:
Maxime Perrotin's avatar
Maxime Perrotin committed
1142
1143
1144
1145
                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
1146
        finally:
Maxime Perrotin's avatar
Maxime Perrotin committed
1147
1148
1149
1150
1151
            pass
        return retval

    # $ANTLR end "entity_in_system"

Maxime Perrotin's avatar
Maxime Perrotin committed
1152

Maxime Perrotin's avatar
Maxime Perrotin committed
1153
1154
    class signal_declaration_return(ParserRuleReturnScope):
        def __init__(self):
Maxime Perrotin's avatar
Maxime Perrotin committed
1155
            super().__init__()
Maxime Perrotin's avatar
Maxime Perrotin committed
1156
1157
1158
1159
1160
1161

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
1162

Maxime Perrotin's avatar
Maxime Perrotin committed
1163
    # $ANTLR start "signal_declaration"
1164
    # 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
1165
1166
1167
1168
    def signal_declaration(self, ):
        retval = self.signal_declaration_return()
        retval.start = self.input.LT(1)

Maxime Perrotin's avatar
Maxime Perrotin committed
1169

Maxime Perrotin's avatar
Maxime Perrotin committed
1170
1171
        root_0 = None

1172
1173
1174
1175
1176
        SIGNAL26 = None
        paramnames25 = None
        signal_id27 = None
        input_params28 = None
        end29 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1177

1178
        SIGNAL26_tree = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1179
        stream_SIGNAL = RewriteRuleTokenStream(self._adaptor, "token SIGNAL")
Maxime Perrotin's avatar
Maxime Perrotin committed
1180
        stream_paramnames = RewriteRuleSubtreeStream(self._adaptor, "rule paramnames")
1181
        stream_input_params = RewriteRuleSubtreeStream(self._adaptor, "rule input_params")
Maxime Perrotin's avatar
Maxime Perrotin committed
1182
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
1183
        stream_signal_id = RewriteRuleSubtreeStream(self._adaptor, "rule signal_id")
Maxime Perrotin's avatar
Maxime Perrotin committed
1184
1185
        try:
            try:
1186
1187
                # 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
1188
                pass 
1189
                # sdl92.g:193:17: ( paramnames )?
1190
1191
                alt8 = 2
                LA8_0 = self.input.LA(1)
Maxime Perrotin's avatar
Maxime Perrotin committed
1192

1193
                if (LA8_0 == 228) :
1194
1195
                    alt8 = 1
                if alt8 == 1:
Maxime Perrotin's avatar
Maxime Perrotin committed
1196
                    # sdl92.g:193:17: paramnames
Maxime Perrotin's avatar
Maxime Perrotin committed
1197
                    pass 
1198
                    self._state.following.append(self.FOLLOW_paramnames_in_signal_declaration1833)
1199
                    paramnames25 = self.paramnames()
Maxime Perrotin's avatar
Maxime Perrotin committed
1200
1201
1202

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1203
                        stream_paramnames.add(paramnames25.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1204
1205
1206



Maxime Perrotin's avatar
Maxime Perrotin committed
1207
1208
1209


                SIGNAL26 = self.match(self.input, SIGNAL, self.FOLLOW_SIGNAL_in_signal_declaration1852) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1210
                if self._state.backtracking == 0:
1211
                    stream_SIGNAL.add(SIGNAL26)
Maxime Perrotin's avatar
Maxime Perrotin committed
1212
1213


1214
                self._state.following.append(self.FOLLOW_signal_id_in_signal_declaration1854)
1215
                signal_id27 = self.signal_id()
Maxime Perrotin's avatar
Maxime Perrotin committed
1216
1217
1218

                self._state.following.pop()
                if self._state.backtracking == 0:
1219
                    stream_signal_id.add(signal_id27.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1220
1221


1222
                # sdl92.g:194:34: ( input_params )?
1223
1224
                alt9 = 2
                LA9_0 = self.input.LA(1)
Maxime Perrotin's avatar
Maxime Perrotin committed
1225

1226
1227
1228
                if (LA9_0 == L_PAREN) :
                    alt9 = 1
                if alt9 == 1:
Maxime Perrotin's avatar
Maxime Perrotin committed
1229
                    # sdl92.g:194:34: input_params
Maxime Perrotin's avatar
Maxime Perrotin committed
1230
                    pass 
1231
                    self._state.following.append(self.FOLLOW_input_params_in_signal_declaration1856)
1232
                    input_params28 = self.input_params()
Maxime Perrotin's avatar
Maxime Perrotin committed
1233
1234
1235

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1236
                        stream_input_params.add(input_params28.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1237
1238
1239



Maxime Perrotin's avatar
Maxime Perrotin committed
1240
1241


1242
                self._state.following.append(self.FOLLOW_end_in_signal_declaration1859)
1243
                end29 = self.end()
Maxime Perrotin's avatar
Maxime Perrotin committed
1244
1245
1246

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

Maxime Perrotin's avatar
Maxime Perrotin committed
1249

Maxime Perrotin's avatar
Maxime Perrotin committed
1250
                # AST Rewrite
Maxime Perrotin's avatar
Maxime Perrotin committed
1251
                # elements: SIGNAL, paramnames, signal_id, input_params
Maxime Perrotin's avatar
Maxime Perrotin committed
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
                # 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()
1266
1267
                    # 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
1268
                    root_1 = self._adaptor.nil()
Maxime Perrotin's avatar
Maxime Perrotin committed
1269
1270
1271
                    root_1 = self._adaptor.becomeRoot(
                    stream_SIGNAL.nextNode()
                    , root_1)
Maxime Perrotin's avatar
Maxime Perrotin committed
1272

1273
                    # sdl92.g:195:26: ( paramnames )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1274
1275
1276
1277
1278
                    if stream_paramnames.hasNext():
                        self._adaptor.addChild(root_1, stream_paramnames.nextTree())


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

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

1282
                    # sdl92.g:195:48: ( input_params )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
                    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
1293

Maxime Perrotin's avatar
Maxime Perrotin committed
1294
1295
1296
1297
                    retval.tree = root_0



Maxime Perrotin's avatar
Maxime Perrotin committed
1298
1299


Maxime Perrotin's avatar
Maxime Perrotin committed
1300
1301
1302
                retval.stop = self.input.LT(-1)


Maxime Perrotin's avatar
Maxime Perrotin committed
1303
                if self._state.backtracking == 0:
Maxime Perrotin's avatar
Maxime Perrotin committed
1304
1305
1306
1307
                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


Maxime Perrotin's avatar
Maxime Perrotin committed
1308
1309

            except RecognitionException as re:
Maxime Perrotin's avatar
Maxime Perrotin committed
1310
1311
1312
1313
                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
1314
        finally:
Maxime Perrotin's avatar
Maxime Perrotin committed
1315
1316
1317
1318
1319
            pass
        return retval

    # $ANTLR end "signal_declaration"

Maxime Perrotin's avatar
Maxime Perrotin committed
1320

Maxime Perrotin's avatar
Maxime Perrotin committed
1321
1322
    class channel_return(ParserRuleReturnScope):
        def __init__(self):
Maxime Perrotin's avatar
Maxime Perrotin committed
1323
            super().__init__()
Maxime Perrotin's avatar
Maxime Perrotin committed
1324
1325
1326
1327
1328
1329

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
1330

Maxime Perrotin's avatar
Maxime Perrotin committed
1331
    # $ANTLR start "channel"
1332
    # sdl92.g:199:1: channel : CHANNEL channel_id ( route )+ ENDCHANNEL end -> ^( CHANNEL channel_id ( route )+ ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
1333
1334
1335
1336
    def channel(self, ):
        retval = self.channel_return()
        retval.start = self.input.LT(1)

Maxime Perrotin's avatar
Maxime Perrotin committed
1337

Maxime Perrotin's avatar
Maxime Perrotin committed
1338
1339
        root_0 = None

1340
1341
1342
1343
1344
        CHANNEL30 = None
        ENDCHANNEL33 = None
        channel_id31 = None
        route32 = None
        end34 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1345

1346
1347
        CHANNEL30_tree = None
        ENDCHANNEL33_tree = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1348
1349
1350
        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
1351
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
1352
        stream_channel_id = RewriteRuleSubtreeStream(self._adaptor, "rule channel_id")
Maxime Perrotin's avatar
Maxime Perrotin committed
1353
1354
        try:
            try:
1355
1356
                # 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
1357
                pass 
Maxime Perrotin's avatar
Maxime Perrotin committed
1358
                CHANNEL30 = self.match(self.input, CHANNEL, self.FOLLOW_CHANNEL_in_channel1918) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1359
                if self._state.backtracking == 0:
1360
                    stream_CHANNEL.add(CHANNEL30)
Maxime Perrotin's avatar
Maxime Perrotin committed
1361
1362