sdl92Parser.py 2.17 MB
Newer Older
1
# $ANTLR 3.5.2 sdl92.g 2020-07-08 14:24:25
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
16
EOF=-1
T__224=224
Maxime Perrotin's avatar
Maxime Perrotin committed
17
T__225=225
18
T__226=226
Maxime Perrotin's avatar
Maxime Perrotin committed
19
20
21
T__227=227
T__228=228
T__229=229
Maxime Perrotin's avatar
Maxime Perrotin committed
22
T__230=230
Maxime Perrotin's avatar
Maxime Perrotin committed
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
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
Maxime Perrotin's avatar
Maxime Perrotin committed
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
MKSTRING=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=223
Maxime Perrotin's avatar
Maxime Perrotin committed
243
244
245
246

# token names
tokenNamesMap = {
    0: "<invalid>", 1: "<EOR>", 2: "<DOWN>", 3: "<UP>",
Maxime Perrotin's avatar
Maxime Perrotin committed
247
248
    -1: "EOF", 224: "T__224", 225: "T__225", 226: "T__226", 227: "T__227", 
    228: "T__228", 229: "T__229", 230: "T__230", 4: "A", 5: "ACTION", 6: "ACTIVE", 
Maxime Perrotin's avatar
Maxime Perrotin committed
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
    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", 
Maxime Perrotin's avatar
Maxime Perrotin committed
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
    118: "MANTISSA", 119: "MINUS_INFINITY", 120: "MKSTRING", 121: "MOD", 
    122: "N", 123: "NEG", 124: "NEQ", 125: "NEWTYPE", 126: "NEXTSTATE", 
    127: "NONE", 128: "NOT", 129: "NUMBER_OF_INSTANCES", 130: "O", 131: "OCTSTR", 
    132: "OPEN_RANGE", 133: "OR", 134: "OUT", 135: "OUTPUT", 136: "OUTPUT_BODY", 
    137: "P", 138: "PARAM", 139: "PARAMNAMES", 140: "PARAMS", 141: "PAREN", 
    142: "PFPAR", 143: "PLUS", 144: "PLUS_INFINITY", 145: "POINT", 146: "PRIMARY", 
    147: "PRIORITY", 148: "PROCEDURE", 149: "PROCEDURE_CALL", 150: "PROCEDURE_NAME", 
    151: "PROCESS", 152: "PROVIDED", 153: "Q", 154: "QUESTION", 155: "R", 
    156: "RANGE", 157: "REFERENCED", 158: "REM", 159: "RESET", 160: "RETURN", 
    161: "RETURNS", 162: "ROUTE", 163: "R_BRACKET", 164: "R_PAREN", 165: "S", 
    166: "SAVE", 167: "SELECTOR", 168: "SEMI", 169: "SEQOF", 170: "SEQUENCE", 
    171: "SET", 172: "SIGNAL", 173: "SIGNALROUTE", 174: "SIGNAL_LIST", 175: "SORT", 
    176: "SPECIFIC", 177: "START", 178: "STATE", 179: "STATELIST", 180: "STATE_AGGREGATION", 
    181: "STATE_PARTITION_CONNECTION", 182: "STIMULUS", 183: "STOP", 184: "STOPIF", 
    185: "STR", 186: "STRING", 187: "STRUCT", 188: "SUBSTRUCTURE", 189: "SYNONYM", 
    190: "SYNONYM_LIST", 191: "SYNTYPE", 192: "SYSTEM", 193: "T", 194: "TASK", 
    195: "TASK_BODY", 196: "TERMINATOR", 197: "TEXT", 198: "TEXTAREA", 199: "TEXTAREA_CONTENT", 
    200: "THEN", 201: "THIS", 202: "TIMER", 203: "TO", 204: "TRANSITION", 
    205: "TRUE", 206: "TYPE", 207: "TYPE_INSTANCE", 208: "U", 209: "USE", 
    210: "V", 211: "VALUE", 212: "VARIABLE", 213: "VARIABLES", 214: "VIA", 
    215: "VIAPATH", 216: "VIEW", 217: "W", 218: "WITH", 219: "WS", 220: "X", 
    221: "XOR", 222: "Y", 223: "Z"
Maxime Perrotin's avatar
Maxime Perrotin committed
292
293
}
Token.registerTokenNamesMap(tokenNamesMap)
Maxime Perrotin's avatar
Maxime Perrotin committed
294
295
296

# token names
tokenNames = [
Maxime Perrotin's avatar
Maxime Perrotin committed
297
298
299
300
301
    "<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", 
302
    "COMPOSITE_STATE", "CONDITIONAL", "CONNECT", "CONNECTION", "CONSTANT", 
Maxime Perrotin's avatar
Maxime Perrotin committed
303
304
305
306
307
308
309
310
311
312
    "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", 
Maxime Perrotin's avatar
Maxime Perrotin committed
313
314
    "LT", "L_BRACKET", "L_PAREN", "M", "MANTISSA", "MINUS_INFINITY", "MKSTRING", 
    "MOD", "N", "NEG", "NEQ", "NEWTYPE", "NEXTSTATE", "NONE", "NOT", "NUMBER_OF_INSTANCES", 
Maxime Perrotin's avatar
Maxime Perrotin committed
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
    "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
330
331
332
333
334
335
]



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

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

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

345
346
347
348
349
350
351
352
353
        self.dfa53 = self.DFA53(
            self, 53,
            eot = self.DFA53_eot,
            eof = self.DFA53_eof,
            min = self.DFA53_min,
            max = self.DFA53_max,
            accept = self.DFA53_accept,
            special = self.DFA53_special,
            transition = self.DFA53_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
354
355
            )

356
357
358
359
360
361
362
363
364
        self.dfa91 = self.DFA91(
            self, 91,
            eot = self.DFA91_eot,
            eof = self.DFA91_eof,
            min = self.DFA91_min,
            max = self.DFA91_max,
            accept = self.DFA91_accept,
            special = self.DFA91_special,
            transition = self.DFA91_transition
365
366
            )

367
368
369
370
371
372
373
374
375
        self.dfa133 = self.DFA133(
            self, 133,
            eot = self.DFA133_eot,
            eof = self.DFA133_eof,
            min = self.DFA133_min,
            max = self.DFA133_max,
            accept = self.DFA133_accept,
            special = self.DFA133_special,
            transition = self.DFA133_transition
376
377
            )

378
379
380
381
382
383
384
385
386
        self.dfa194 = self.DFA194(
            self, 194,
            eot = self.DFA194_eot,
            eof = self.DFA194_eof,
            min = self.DFA194_min,
            max = self.DFA194_max,
            accept = self.DFA194_accept,
            special = self.DFA194_special,
            transition = self.DFA194_transition
387
388
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
389
390
391



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

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


Maxime Perrotin's avatar
Maxime Perrotin committed
398

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

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
417

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

Maxime Perrotin's avatar
Maxime Perrotin committed
424

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

        use_clause1 = None
        system_definition2 = None
        process_definition3 = None


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

Maxime Perrotin's avatar
Maxime Perrotin committed
439

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

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


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

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

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

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

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

                        if self._state.backtracking > 0:
                            raise BacktrackingFailed

Maxime Perrotin's avatar
Maxime Perrotin committed
504

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

                    cnt1 += 1



Maxime Perrotin's avatar
Maxime Perrotin committed
512

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


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


Maxime Perrotin's avatar
Maxime Perrotin committed
521
522

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

    # $ANTLR end "pr_file"

Maxime Perrotin's avatar
Maxime Perrotin committed
533

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

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
543

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

Maxime Perrotin's avatar
Maxime Perrotin committed
550

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


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


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

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


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

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


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

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


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


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

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


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

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

Maxime Perrotin's avatar
Maxime Perrotin committed
651

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

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

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

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



Maxime Perrotin's avatar
Maxime Perrotin committed
693
694


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


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


Maxime Perrotin's avatar
Maxime Perrotin committed
703
704

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

    # $ANTLR end "system_definition"

Maxime Perrotin's avatar
Maxime Perrotin committed
715

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

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
725

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

Maxime Perrotin's avatar
Maxime Perrotin committed
732

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

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

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

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


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


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


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

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


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


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

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

Maxime Perrotin's avatar
Maxime Perrotin committed
820

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

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

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


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

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

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

                    self._adaptor.addChild(root_0, root_1)



Maxime Perrotin's avatar
Maxime Perrotin committed
871

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



Maxime Perrotin's avatar
Maxime Perrotin committed
876
877


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


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


Maxime Perrotin's avatar
Maxime Perrotin committed
886
887

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

    # $ANTLR end "use_clause"

Maxime Perrotin's avatar
Maxime Perrotin committed
898

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

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
908

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

Maxime Perrotin's avatar
Maxime Perrotin committed
915

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


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

Maxime Perrotin's avatar
Maxime Perrotin committed
939
940
941


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

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



Maxime Perrotin's avatar
Maxime Perrotin committed
962

963
964
965
966
967
                    else:
                        break #loop6



Maxime Perrotin's avatar
Maxime Perrotin committed
968

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


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


Maxime Perrotin's avatar
Maxime Perrotin committed
977
978

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

    # $ANTLR end "def_selection_list"

Maxime Perrotin's avatar
Maxime Perrotin committed
989

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

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
999

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

Maxime Perrotin's avatar
Maxime Perrotin committed
1006

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

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


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

Maxime Perrotin's avatar
Maxime Perrotin committed
1034

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

                        raise nvae

Maxime Perrotin's avatar
Maxime Perrotin committed
1039
1040

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

Maxime Perrotin's avatar
Maxime Perrotin committed
1052

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

                    raise nvae

Maxime Perrotin's avatar
Maxime Perrotin committed
1057

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

Maxime Perrotin's avatar
Maxime Perrotin committed
1063

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

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


Maxime Perrotin's avatar
Maxime Perrotin committed
1072

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

Maxime Perrotin's avatar
Maxime Perrotin committed
1078

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

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


Maxime Perrotin's avatar
Maxime Perrotin committed
1087

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

Maxime Perrotin's avatar
Maxime Perrotin committed
1093

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

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


Maxime Perrotin's avatar
Maxime Perrotin committed
1102

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

Maxime Perrotin's avatar
Maxime Perrotin committed
1108

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

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


Maxime Perrotin's avatar
Maxime Perrotin committed
1117

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

Maxime Perrotin's avatar
Maxime Perrotin committed
1123

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

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


Maxime Perrotin's avatar
Maxime Perrotin committed
1132

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


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


Maxime Perrotin's avatar
Maxime Perrotin committed
1141
1142

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

    # $ANTLR end "entity_in_system"

Maxime Perrotin's avatar
Maxime Perrotin committed
1153

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

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
1163

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

Maxime Perrotin's avatar
Maxime Perrotin committed
1170

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

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

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

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

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



Maxime Perrotin's avatar
Maxime Perrotin committed
1208
1209
1210


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


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

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


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

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

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



Maxime Perrotin's avatar
Maxime Perrotin committed
1241
1242


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

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

Maxime Perrotin's avatar
Maxime Perrotin committed
1250

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

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


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

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

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

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



Maxime Perrotin's avatar
Maxime Perrotin committed
1299
1300


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


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


Maxime Perrotin's avatar
Maxime Perrotin committed
1309
1310

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

    # $ANTLR end "signal_declaration"

Maxime Perrotin's avatar
Maxime Perrotin committed
1321

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

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
1331

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

Maxime Perrotin's avatar
Maxime Perrotin committed
1338

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

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

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


1364
                self._state.following.append(self.FOLLOW_channel_id_in_channel1920)
1365
                channel_id31 = self.channel_id()
Maxime Perrotin's avatar
Maxime Perrotin committed
1366
1367
1368

                self._state.following.pop()
                if self._state.backtracking == 0:
1369
                    stream_channel_id.add(channel_id31.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1370
1371


1372
                # sdl92.g:201:17: ( route )+
1373
1374
1375
1376
                cnt10 = 0
                while True: #loop10
                    alt10 = 2
                    LA10_0 = self.input.LA(1)
Maxime Perrotin's avatar
Maxime Perrotin committed
1377

1378
1379
                    if (LA10_0 == FROM) :
                        alt10 = 1