sdl92Parser.py 2.21 MB
Newer Older
1
# $ANTLR 3.5.2 sdl92.g 2021-04-13 11:49:18
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
17
T__228=228
T__229=229
Maxime Perrotin's avatar
Maxime Perrotin committed
18
T__230=230
19
T__231=231
Maxime Perrotin's avatar
Maxime Perrotin committed
20
T__232=232
21
22
T__233=233
T__234=234
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
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
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
EXPORTED=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
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
INPUT_EXPRESSION=105
INPUT_NONE=106
INT=107
J=108
JOIN=109
K=110
KEEP=111
L=112
LABEL=113
LE=114
LITERAL=115
LT=116
L_BRACKET=117
L_PAREN=118
M=119
MANTISSA=120
MINUS_INFINITY=121
MKSTRING=122
MOD=123
MONITOR=124
N=125
NEG=126
NEQ=127
NEWTYPE=128
NEXTSTATE=129
NONE=130
NOT=131
NUMBER_OF_INSTANCES=132
O=133
OCTSTR=134
OPEN_RANGE=135
OR=136
OUT=137
OUTPUT=138
OUTPUT_BODY=139
OUTPUT_EXPRESSION=140
P=141
PARAM=142
PARAMNAMES=143
PARAMS=144
PAREN=145
PFPAR=146
PLUS=147
PLUS_INFINITY=148
POINT=149
PRIMARY=150
PRIORITY=151
PROCEDURE=152
PROCEDURE_CALL=153
PROCEDURE_NAME=154
PROCESS=155
PROVIDED=156
Q=157
QUESTION=158
R=159
RANGE=160
REFERENCED=161
REM=162
RESET=163
RETURN=164
RETURNS=165
ROUTE=166
R_BRACKET=167
R_PAREN=168
S=169
SAVE=170
SELECTOR=171
SEMI=172
SEQOF=173
SEQUENCE=174
SET=175
SIGNAL=176
SIGNALROUTE=177
SIGNAL_LIST=178
SORT=179
SPECIFIC=180
START=181
STATE=182
STATELIST=183
STATE_AGGREGATION=184
STATE_PARTITION_CONNECTION=185
STIMULUS=186
STOP=187
STOPIF=188
STR=189
STRING=190
STRUCT=191
SUBSTRUCTURE=192
SYNONYM=193
SYNONYM_LIST=194
SYNTYPE=195
SYSTEM=196
T=197
TASK=198
TASK_BODY=199
TERMINATOR=200
TEXT=201
TEXTAREA=202
TEXTAREA_CONTENT=203
THEN=204
THIS=205
TIMER=206
TO=207
TRANSITION=208
TRUE=209
TYPE=210
TYPE_INSTANCE=211
U=212
USE=213
V=214
VALUE=215
VARIABLE=216
VARIABLES=217
VIA=218
VIAPATH=219
VIEW=220
W=221
WITH=222
WS=223
X=224
XOR=225
Y=226
Z=227
Maxime Perrotin's avatar
Maxime Perrotin committed
247
248
249
250

# token names
tokenNamesMap = {
    0: "<invalid>", 1: "<EOR>", 2: "<DOWN>", 3: "<UP>",
251
252
    -1: "EOF", 228: "T__228", 229: "T__229", 230: "T__230", 231: "T__231", 
    232: "T__232", 233: "T__233", 234: "T__234", 4: "A", 5: "ACTION", 6: "ACTIVE", 
Maxime Perrotin's avatar
Maxime Perrotin committed
253
254
255
256
257
258
259
260
261
262
263
264
    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", 
265
266
267
268
269
270
    68: "EQ", 69: "EXPONENT", 70: "EXPORT", 71: "EXPORTED", 72: "EXPRESSION", 
    73: "EXTERNAL", 74: "Exponent", 75: "F", 76: "FALSE", 77: "FI", 78: "FIELD", 
    79: "FIELDS", 80: "FIELD_NAME", 81: "FLOAT", 82: "FLOAT2", 83: "FLOATING_LABEL", 
    84: "FOR", 85: "FPAR", 86: "FROM", 87: "G", 88: "GE", 89: "GEODE", 90: "GROUND", 
    91: "GT", 92: "H", 93: "HYPERLINK", 94: "I", 95: "ID", 96: "IF", 97: "IFTHENELSE", 
    98: "IMPLIES", 99: "IMPORT", 100: "IN", 101: "INFORMAL_TEXT", 102: "INOUT", 
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
    103: "INPUT", 104: "INPUTLIST", 105: "INPUT_EXPRESSION", 106: "INPUT_NONE", 
    107: "INT", 108: "J", 109: "JOIN", 110: "K", 111: "KEEP", 112: "L", 
    113: "LABEL", 114: "LE", 115: "LITERAL", 116: "LT", 117: "L_BRACKET", 
    118: "L_PAREN", 119: "M", 120: "MANTISSA", 121: "MINUS_INFINITY", 122: "MKSTRING", 
    123: "MOD", 124: "MONITOR", 125: "N", 126: "NEG", 127: "NEQ", 128: "NEWTYPE", 
    129: "NEXTSTATE", 130: "NONE", 131: "NOT", 132: "NUMBER_OF_INSTANCES", 
    133: "O", 134: "OCTSTR", 135: "OPEN_RANGE", 136: "OR", 137: "OUT", 138: "OUTPUT", 
    139: "OUTPUT_BODY", 140: "OUTPUT_EXPRESSION", 141: "P", 142: "PARAM", 
    143: "PARAMNAMES", 144: "PARAMS", 145: "PAREN", 146: "PFPAR", 147: "PLUS", 
    148: "PLUS_INFINITY", 149: "POINT", 150: "PRIMARY", 151: "PRIORITY", 
    152: "PROCEDURE", 153: "PROCEDURE_CALL", 154: "PROCEDURE_NAME", 155: "PROCESS", 
    156: "PROVIDED", 157: "Q", 158: "QUESTION", 159: "R", 160: "RANGE", 
    161: "REFERENCED", 162: "REM", 163: "RESET", 164: "RETURN", 165: "RETURNS", 
    166: "ROUTE", 167: "R_BRACKET", 168: "R_PAREN", 169: "S", 170: "SAVE", 
    171: "SELECTOR", 172: "SEMI", 173: "SEQOF", 174: "SEQUENCE", 175: "SET", 
    176: "SIGNAL", 177: "SIGNALROUTE", 178: "SIGNAL_LIST", 179: "SORT", 
    180: "SPECIFIC", 181: "START", 182: "STATE", 183: "STATELIST", 184: "STATE_AGGREGATION", 
    185: "STATE_PARTITION_CONNECTION", 186: "STIMULUS", 187: "STOP", 188: "STOPIF", 
    189: "STR", 190: "STRING", 191: "STRUCT", 192: "SUBSTRUCTURE", 193: "SYNONYM", 
    194: "SYNONYM_LIST", 195: "SYNTYPE", 196: "SYSTEM", 197: "T", 198: "TASK", 
    199: "TASK_BODY", 200: "TERMINATOR", 201: "TEXT", 202: "TEXTAREA", 203: "TEXTAREA_CONTENT", 
    204: "THEN", 205: "THIS", 206: "TIMER", 207: "TO", 208: "TRANSITION", 
    209: "TRUE", 210: "TYPE", 211: "TYPE_INSTANCE", 212: "U", 213: "USE", 
    214: "V", 215: "VALUE", 216: "VARIABLE", 217: "VARIABLES", 218: "VIA", 
    219: "VIAPATH", 220: "VIEW", 221: "W", 222: "WITH", 223: "WS", 224: "X", 
    225: "XOR", 226: "Y", 227: "Z"
Maxime Perrotin's avatar
Maxime Perrotin committed
297
298
}
Token.registerTokenNamesMap(tokenNamesMap)
Maxime Perrotin's avatar
Maxime Perrotin committed
299
300
301

# token names
tokenNames = [
Maxime Perrotin's avatar
Maxime Perrotin committed
302
303
304
305
306
    "<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", 
307
    "COMPOSITE_STATE", "CONDITIONAL", "CONNECT", "CONNECTION", "CONSTANT", 
Maxime Perrotin's avatar
Maxime Perrotin committed
308
309
310
311
    "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", 
312
313
314
315
316
    "ENDSYSTEM", "ENDTEXT", "ENTRY_POINT", "EQ", "EXPONENT", "EXPORT", "EXPORTED", 
    "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", 
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
    "INPUTLIST", "INPUT_EXPRESSION", "INPUT_NONE", "INT", "J", "JOIN", "K", 
    "KEEP", "L", "LABEL", "LE", "LITERAL", "LT", "L_BRACKET", "L_PAREN", 
    "M", "MANTISSA", "MINUS_INFINITY", "MKSTRING", "MOD", "MONITOR", "N", 
    "NEG", "NEQ", "NEWTYPE", "NEXTSTATE", "NONE", "NOT", "NUMBER_OF_INSTANCES", 
    "O", "OCTSTR", "OPEN_RANGE", "OR", "OUT", "OUTPUT", "OUTPUT_BODY", "OUTPUT_EXPRESSION", 
    "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
336
337
338
339
340
341
]



class sdl92Parser(Parser):
    grammarFileName = "sdl92.g"
Maxime Perrotin's avatar
Maxime Perrotin committed
342
    api_version = 1
Maxime Perrotin's avatar
Maxime Perrotin committed
343
344
345
346
347
348
    tokenNames = tokenNames

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

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

351
352
353
354
355
356
357
358
359
        self.dfa54 = self.DFA54(
            self, 54,
            eot = self.DFA54_eot,
            eof = self.DFA54_eof,
            min = self.DFA54_min,
            max = self.DFA54_max,
            accept = self.DFA54_accept,
            special = self.DFA54_special,
            transition = self.DFA54_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
360
361
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
362
363
364
365
366
367
368
369
370
        self.dfa96 = self.DFA96(
            self, 96,
            eot = self.DFA96_eot,
            eof = self.DFA96_eof,
            min = self.DFA96_min,
            max = self.DFA96_max,
            accept = self.DFA96_accept,
            special = self.DFA96_special,
            transition = self.DFA96_transition
371
372
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
373
374
375
376
377
378
379
380
381
        self.dfa138 = self.DFA138(
            self, 138,
            eot = self.DFA138_eot,
            eof = self.DFA138_eof,
            min = self.DFA138_min,
            max = self.DFA138_max,
            accept = self.DFA138_accept,
            special = self.DFA138_special,
            transition = self.DFA138_transition
382
383
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
384
385
386
387
388
389
390
391
392
        self.dfa199 = self.DFA199(
            self, 199,
            eot = self.DFA199_eot,
            eof = self.DFA199_eof,
            min = self.DFA199_min,
            max = self.DFA199_max,
            accept = self.DFA199_accept,
            special = self.DFA199_special,
            transition = self.DFA199_transition
393
394
            )

Maxime Perrotin's avatar
Maxime Perrotin committed
395
396
397



Maxime Perrotin's avatar
Maxime Perrotin committed
398
        self.delegates = []
Maxime Perrotin's avatar
Maxime Perrotin committed
399
400
401
402
403

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


Maxime Perrotin's avatar
Maxime Perrotin committed
404

Maxime Perrotin's avatar
Maxime Perrotin committed
405
406
407
408
409
410
411
412
413
414
415
    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
416
            super().__init__()
Maxime Perrotin's avatar
Maxime Perrotin committed
417
418
419
420
421
422

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
423

Maxime Perrotin's avatar
Maxime Perrotin committed
424
    # $ANTLR start "pr_file"
425
    # sdl92.g:149:1: pr_file : ( use_clause | system_definition | process_definition )+ ;
Maxime Perrotin's avatar
Maxime Perrotin committed
426
427
428
429
    def pr_file(self, ):
        retval = self.pr_file_return()
        retval.start = self.input.LT(1)

Maxime Perrotin's avatar
Maxime Perrotin committed
430

Maxime Perrotin's avatar
Maxime Perrotin committed
431
432
433
434
435
436
437
438
439
        root_0 = None

        use_clause1 = None
        system_definition2 = None
        process_definition3 = None


        try:
            try:
440
441
                # sdl92.g:150:9: ( ( use_clause | system_definition | process_definition )+ )
                # sdl92.g:150:17: ( use_clause | system_definition | process_definition )+
Maxime Perrotin's avatar
Maxime Perrotin committed
442
443
444
                pass 
                root_0 = self._adaptor.nil()

Maxime Perrotin's avatar
Maxime Perrotin committed
445

446
                # sdl92.g:150:17: ( use_clause | system_definition | process_definition )+
Maxime Perrotin's avatar
Maxime Perrotin committed
447
448
449
450
                cnt1 = 0
                while True: #loop1
                    alt1 = 4
                    LA1 = self.input.LA(1)
451
                    if LA1 in {233}:
452
453
                        LA1_2 = self.input.LA(2)

Maxime Perrotin's avatar
Maxime Perrotin committed
454
                        if (LA1_2 == KEEP) :
455
                            alt1 = 1
Maxime Perrotin's avatar
Maxime Perrotin committed
456
457
                        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
458
459


Maxime Perrotin's avatar
Maxime Perrotin committed
460
                    elif LA1 in {USE}:
Maxime Perrotin's avatar
Maxime Perrotin committed
461
                        alt1 = 1
Maxime Perrotin's avatar
Maxime Perrotin committed
462
                    elif LA1 in {SYSTEM}:
Maxime Perrotin's avatar
Maxime Perrotin committed
463
                        alt1 = 2
Maxime Perrotin's avatar
Maxime Perrotin committed
464
                    elif LA1 in {PROCESS}:
Maxime Perrotin's avatar
Maxime Perrotin committed
465
466
467
                        alt1 = 3

                    if alt1 == 1:
468
                        # sdl92.g:150:18: use_clause
Maxime Perrotin's avatar
Maxime Perrotin committed
469
                        pass 
470
                        self._state.following.append(self.FOLLOW_use_clause_in_pr_file1408)
Maxime Perrotin's avatar
Maxime Perrotin committed
471
472
473
474
475
476
477
                        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
478

Maxime Perrotin's avatar
Maxime Perrotin committed
479
                    elif alt1 == 2:
480
                        # sdl92.g:151:19: system_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
481
                        pass 
482
                        self._state.following.append(self.FOLLOW_system_definition_in_pr_file1428)
Maxime Perrotin's avatar
Maxime Perrotin committed
483
484
485
486
487
488
489
                        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
490

Maxime Perrotin's avatar
Maxime Perrotin committed
491
                    elif alt1 == 3:
492
                        # sdl92.g:152:19: process_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
493
                        pass 
494
                        self._state.following.append(self.FOLLOW_process_definition_in_pr_file1448)
Maxime Perrotin's avatar
Maxime Perrotin committed
495
496
497
498
499
500
501
                        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
502

Maxime Perrotin's avatar
Maxime Perrotin committed
503
504
505
506
507
508
509
                    else:
                        if cnt1 >= 1:
                            break #loop1

                        if self._state.backtracking > 0:
                            raise BacktrackingFailed

Maxime Perrotin's avatar
Maxime Perrotin committed
510

Maxime Perrotin's avatar
Maxime Perrotin committed
511
512
513
514
515
516
517
                        eee = EarlyExitException(1, self.input)
                        raise eee

                    cnt1 += 1



Maxime Perrotin's avatar
Maxime Perrotin committed
518

Maxime Perrotin's avatar
Maxime Perrotin committed
519
520
521
                retval.stop = self.input.LT(-1)


Maxime Perrotin's avatar
Maxime Perrotin committed
522
                if self._state.backtracking == 0:
Maxime Perrotin's avatar
Maxime Perrotin committed
523
524
525
526
                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


Maxime Perrotin's avatar
Maxime Perrotin committed
527
528

            except RecognitionException as re:
Maxime Perrotin's avatar
Maxime Perrotin committed
529
530
531
532
                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
533
        finally:
Maxime Perrotin's avatar
Maxime Perrotin committed
534
535
536
537
538
            pass
        return retval

    # $ANTLR end "pr_file"

Maxime Perrotin's avatar
Maxime Perrotin committed
539

Maxime Perrotin's avatar
Maxime Perrotin committed
540
541
    class system_definition_return(ParserRuleReturnScope):
        def __init__(self):
Maxime Perrotin's avatar
Maxime Perrotin committed
542
            super().__init__()
Maxime Perrotin's avatar
Maxime Perrotin committed
543
544
545
546
547
548

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
549

Maxime Perrotin's avatar
Maxime Perrotin committed
550
    # $ANTLR start "system_definition"
551
    # sdl92.g:156: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
552
553
554
555
    def system_definition(self, ):
        retval = self.system_definition_return()
        retval.start = self.input.LT(1)

Maxime Perrotin's avatar
Maxime Perrotin committed
556

Maxime Perrotin's avatar
Maxime Perrotin committed
557
558
559
560
561
562
563
564
565
566
567
568
        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
569
        stream_SYSTEM = RewriteRuleTokenStream(self._adaptor, "token SYSTEM")
570
        stream_ENDSYSTEM = RewriteRuleTokenStream(self._adaptor, "token ENDSYSTEM")
Maxime Perrotin's avatar
Maxime Perrotin committed
571
572
573
574
575
        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:
576
577
                # sdl92.g:157:9: ( SYSTEM system_name end ( entity_in_system )* ENDSYSTEM ( system_name )? end -> ^( SYSTEM system_name ( entity_in_system )* ) )
                # sdl92.g:157:17: SYSTEM system_name end ( entity_in_system )* ENDSYSTEM ( system_name )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
578
                pass 
579
                SYSTEM4 = self.match(self.input, SYSTEM, self.FOLLOW_SYSTEM_in_system_definition1482) 
Maxime Perrotin's avatar
Maxime Perrotin committed
580
581
                if self._state.backtracking == 0:
                    stream_SYSTEM.add(SYSTEM4)
Maxime Perrotin's avatar
Maxime Perrotin committed
582
583


584
                self._state.following.append(self.FOLLOW_system_name_in_system_definition1484)
Maxime Perrotin's avatar
Maxime Perrotin committed
585
586
587
588
589
                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
590
591


592
                self._state.following.append(self.FOLLOW_end_in_system_definition1486)
Maxime Perrotin's avatar
Maxime Perrotin committed
593
594
595
596
597
                end6 = self.end()

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


600
                # sdl92.g:158:17: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
601
602
603
604
                while True: #loop2
                    alt2 = 2
                    LA2_0 = self.input.LA(1)

605
                    if (LA2_0 in {BLOCK, CHANNEL, EXPORTED, PROCEDURE, SIGNAL, 233}) :
Maxime Perrotin's avatar
Maxime Perrotin committed
606
607
608
609
                        alt2 = 1


                    if alt2 == 1:
610
                        # sdl92.g:158:17: entity_in_system
Maxime Perrotin's avatar
Maxime Perrotin committed
611
                        pass 
612
                        self._state.following.append(self.FOLLOW_entity_in_system_in_system_definition1504)
Maxime Perrotin's avatar
Maxime Perrotin committed
613
614
615
616
617
618
619
                        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
620

Maxime Perrotin's avatar
Maxime Perrotin committed
621
622
                    else:
                        break #loop2
Maxime Perrotin's avatar
Maxime Perrotin committed
623
624


625
                ENDSYSTEM8 = self.match(self.input, ENDSYSTEM, self.FOLLOW_ENDSYSTEM_in_system_definition1523) 
Maxime Perrotin's avatar
Maxime Perrotin committed
626
627
                if self._state.backtracking == 0:
                    stream_ENDSYSTEM.add(ENDSYSTEM8)
Maxime Perrotin's avatar
Maxime Perrotin committed
628
629


630
                # sdl92.g:159:27: ( system_name )?
Maxime Perrotin's avatar
Maxime Perrotin committed
631
632
633
634
635
636
                alt3 = 2
                LA3_0 = self.input.LA(1)

                if (LA3_0 == ID) :
                    alt3 = 1
                if alt3 == 1:
637
                    # sdl92.g:159:27: system_name
Maxime Perrotin's avatar
Maxime Perrotin committed
638
                    pass 
639
                    self._state.following.append(self.FOLLOW_system_name_in_system_definition1525)
Maxime Perrotin's avatar
Maxime Perrotin committed
640
641
642
643
644
645
646
647
                    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
648
649


650
                self._state.following.append(self.FOLLOW_end_in_system_definition1528)
Maxime Perrotin's avatar
Maxime Perrotin committed
651
652
653
654
655
656
                end10 = self.end()

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

Maxime Perrotin's avatar
Maxime Perrotin committed
657

Maxime Perrotin's avatar
Maxime Perrotin committed
658
                # AST Rewrite
Maxime Perrotin's avatar
Maxime Perrotin committed
659
                # elements: SYSTEM, system_name, entity_in_system
Maxime Perrotin's avatar
Maxime Perrotin committed
660
661
662
663
664
665
666
667
668
669
670
671
672
673
                # 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()
674
675
                    # 160:9: -> ^( SYSTEM system_name ( entity_in_system )* )
                    # sdl92.g:160:17: ^( SYSTEM system_name ( entity_in_system )* )
Maxime Perrotin's avatar
Maxime Perrotin committed
676
                    root_1 = self._adaptor.nil()
Maxime Perrotin's avatar
Maxime Perrotin committed
677
678
679
                    root_1 = self._adaptor.becomeRoot(
                    stream_SYSTEM.nextNode()
                    , root_1)
Maxime Perrotin's avatar
Maxime Perrotin committed
680
681

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

683
                    # sdl92.g:160:38: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
684
685
686
687
688
689
690
691
692
693
                    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
694

Maxime Perrotin's avatar
Maxime Perrotin committed
695
696
697
698
                    retval.tree = root_0



Maxime Perrotin's avatar
Maxime Perrotin committed
699
700


Maxime Perrotin's avatar
Maxime Perrotin committed
701
702
703
                retval.stop = self.input.LT(-1)


Maxime Perrotin's avatar
Maxime Perrotin committed
704
                if self._state.backtracking == 0:
Maxime Perrotin's avatar
Maxime Perrotin committed
705
706
707
708
                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


Maxime Perrotin's avatar
Maxime Perrotin committed
709
710

            except RecognitionException as re:
Maxime Perrotin's avatar
Maxime Perrotin committed
711
712
713
714
                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
715
        finally:
Maxime Perrotin's avatar
Maxime Perrotin committed
716
717
718
719
720
            pass
        return retval

    # $ANTLR end "system_definition"

Maxime Perrotin's avatar
Maxime Perrotin committed
721

Maxime Perrotin's avatar
Maxime Perrotin committed
722
723
    class use_clause_return(ParserRuleReturnScope):
        def __init__(self):
Maxime Perrotin's avatar
Maxime Perrotin committed
724
            super().__init__()
Maxime Perrotin's avatar
Maxime Perrotin committed
725
726
727
728
729
730

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
731

Maxime Perrotin's avatar
Maxime Perrotin committed
732
    # $ANTLR start "use_clause"
733
    # sdl92.g:164: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
734
735
736
737
    def use_clause(self, ):
        retval = self.use_clause_return()
        retval.start = self.input.LT(1)

Maxime Perrotin's avatar
Maxime Perrotin committed
738

Maxime Perrotin's avatar
Maxime Perrotin committed
739
740
741
        root_0 = None

        USE12 = None
742
        char_literal14 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
743
744
        use_asn111 = None
        package_name13 = None
745
746
        def_selection_list15 = None
        end16 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
747
748

        USE12_tree = None
749
        char_literal14_tree = None
Maxime Perrotin's avatar
Maxime Perrotin committed
750
        stream_DIV = RewriteRuleTokenStream(self._adaptor, "token DIV")
751
        stream_USE = RewriteRuleTokenStream(self._adaptor, "token USE")
Maxime Perrotin's avatar
Maxime Perrotin committed
752
753
        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
754
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
755
        stream_def_selection_list = RewriteRuleSubtreeStream(self._adaptor, "rule def_selection_list")
Maxime Perrotin's avatar
Maxime Perrotin committed
756
757
        try:
            try:
758
759
                # sdl92.g:165:9: ( ( use_asn1 )? USE package_name ( '/' def_selection_list )? end -> ^( USE ( use_asn1 )? ( end )? package_name ( def_selection_list )? ) )
                # sdl92.g:165:17: ( use_asn1 )? USE package_name ( '/' def_selection_list )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
760
                pass 
761
                # sdl92.g:165:17: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
762
763
764
                alt4 = 2
                LA4_0 = self.input.LA(1)

765
                if (LA4_0 == 233) :
Maxime Perrotin's avatar
Maxime Perrotin committed
766
767
                    alt4 = 1
                if alt4 == 1:
768
                    # sdl92.g:165:17: use_asn1
Maxime Perrotin's avatar
Maxime Perrotin committed
769
                    pass 
770
                    self._state.following.append(self.FOLLOW_use_asn1_in_use_clause1584)
Maxime Perrotin's avatar
Maxime Perrotin committed
771
772
773
774
775
776
777
778
                    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
779
780


781
                USE12 = self.match(self.input, USE, self.FOLLOW_USE_in_use_clause1603) 
Maxime Perrotin's avatar
Maxime Perrotin committed
782
783
                if self._state.backtracking == 0:
                    stream_USE.add(USE12)
Maxime Perrotin's avatar
Maxime Perrotin committed
784
785


786
                self._state.following.append(self.FOLLOW_package_name_in_use_clause1605)
Maxime Perrotin's avatar
Maxime Perrotin committed
787
788
789
790
791
                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
792
793


794
                # sdl92.g:167:17: ( '/' def_selection_list )?
795
796
797
798
799
800
                alt5 = 2
                LA5_0 = self.input.LA(1)

                if (LA5_0 == DIV) :
                    alt5 = 1
                if alt5 == 1:
801
                    # sdl92.g:167:18: '/' def_selection_list
802
                    pass 
803
                    char_literal14 = self.match(self.input, DIV, self.FOLLOW_DIV_in_use_clause1624) 
804
805
                    if self._state.backtracking == 0:
                        stream_DIV.add(char_literal14)
Maxime Perrotin's avatar
Maxime Perrotin committed
806
807


808
                    self._state.following.append(self.FOLLOW_def_selection_list_in_use_clause1626)
809
810
811
812
813
814
815
816
                    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
817
818


819
                self._state.following.append(self.FOLLOW_end_in_use_clause1647)
820
                end16 = self.end()
Maxime Perrotin's avatar
Maxime Perrotin committed
821
822
823

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

Maxime Perrotin's avatar
Maxime Perrotin committed
826

Maxime Perrotin's avatar
Maxime Perrotin committed
827
                # AST Rewrite
Maxime Perrotin's avatar
Maxime Perrotin committed
828
                # elements: USE, use_asn1, end, package_name, def_selection_list
Maxime Perrotin's avatar
Maxime Perrotin committed
829
830
831
832
833
834
835
836
837
838
839
840
841
842
                # 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()
843
844
                    # 169:9: -> ^( USE ( use_asn1 )? ( end )? package_name ( def_selection_list )? )
                    # sdl92.g:169:17: ^( USE ( use_asn1 )? ( end )? package_name ( def_selection_list )? )
Maxime Perrotin's avatar
Maxime Perrotin committed
845
                    root_1 = self._adaptor.nil()
Maxime Perrotin's avatar
Maxime Perrotin committed
846
847
848
                    root_1 = self._adaptor.becomeRoot(
                    stream_USE.nextNode()
                    , root_1)
Maxime Perrotin's avatar
Maxime Perrotin committed
849

850
                    # sdl92.g:169:23: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
851
852
853
854
855
                    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
856

857
                    # sdl92.g:169:33: ( end )?
858
859
860
861
862
                    if stream_end.hasNext():
                        self._adaptor.addChild(root_1, stream_end.nextTree())


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

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

866
                    # sdl92.g:169:51: ( def_selection_list )?
867
868
869
870
871
                    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
872
873
874
875
876

                    self._adaptor.addChild(root_0, root_1)



Maxime Perrotin's avatar
Maxime Perrotin committed
877

Maxime Perrotin's avatar
Maxime Perrotin committed
878
879
880
881
                    retval.tree = root_0



Maxime Perrotin's avatar
Maxime Perrotin committed
882
883


Maxime Perrotin's avatar
Maxime Perrotin committed
884
885
886
                retval.stop = self.input.LT(-1)


Maxime Perrotin's avatar
Maxime Perrotin committed
887
                if self._state.backtracking == 0:
Maxime Perrotin's avatar
Maxime Perrotin committed
888
889
890
891
                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


Maxime Perrotin's avatar
Maxime Perrotin committed
892
893

            except RecognitionException as re:
Maxime Perrotin's avatar
Maxime Perrotin committed
894
895
896
897
                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
898
        finally:
Maxime Perrotin's avatar
Maxime Perrotin committed
899
900
901
902
903
            pass
        return retval

    # $ANTLR end "use_clause"

Maxime Perrotin's avatar
Maxime Perrotin committed
904

905
906
    class def_selection_list_return(ParserRuleReturnScope):
        def __init__(self):
Maxime Perrotin's avatar
Maxime Perrotin committed
907
            super().__init__()
908
909
910
911
912
913

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
914

915
    # $ANTLR start "def_selection_list"
916
    # sdl92.g:176:1: def_selection_list : ID ( ',' ! ID )* ;
917
918
919
920
    def def_selection_list(self, ):
        retval = self.def_selection_list_return()
        retval.start = self.input.LT(1)

Maxime Perrotin's avatar
Maxime Perrotin committed
921

922
923
924
925
926
927
928
929
930
931
932
933
        root_0 = None

        ID17 = None
        char_literal18 = None
        ID19 = None

        ID17_tree = None
        char_literal18_tree = None
        ID19_tree = None

        try:
            try:
934
935
                # sdl92.g:177:9: ( ID ( ',' ! ID )* )
                # sdl92.g:177:17: ID ( ',' ! ID )*
936
937
938
939
                pass 
                root_0 = self._adaptor.nil()


940
                ID17 = self.match(self.input, ID, self.FOLLOW_ID_in_def_selection_list1711)
Maxime Perrotin's avatar
Maxime Perrotin committed
941
                if self._state.backtracking == 0:
942
943
944
                    ID17_tree = self._adaptor.createWithPayload(ID17)
                    self._adaptor.addChild(root_0, ID17_tree)

Maxime Perrotin's avatar
Maxime Perrotin committed
945
946


947
                # sdl92.g:177:20: ( ',' ! ID )*
948
949
950
951
952
953
954
955
956
                while True: #loop6
                    alt6 = 2
                    LA6_0 = self.input.LA(1)

                    if (LA6_0 == COMMA) :
                        alt6 = 1


                    if alt6 == 1:
957
                        # sdl92.g:177:21: ',' ! ID
958
                        pass 
959
                        char_literal18 = self.match(self.input, COMMA, self.FOLLOW_COMMA_in_def_selection_list1714)
960

961
                        ID19 = self.match(self.input, ID, self.FOLLOW_ID_in_def_selection_list1717)
Maxime Perrotin's avatar
Maxime Perrotin committed
962
                        if self._state.backtracking == 0:
963
964
965
966
967
                            ID19_tree = self._adaptor.createWithPayload(ID19)
                            self._adaptor.addChild(root_0, ID19_tree)



Maxime Perrotin's avatar
Maxime Perrotin committed
968

969
970
971
972
973
                    else:
                        break #loop6



Maxime Perrotin's avatar
Maxime Perrotin committed
974

975
976
977
                retval.stop = self.input.LT(-1)


Maxime Perrotin's avatar
Maxime Perrotin committed
978
                if self._state.backtracking == 0:
979
980
981
982
                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


Maxime Perrotin's avatar
Maxime Perrotin committed
983
984

            except RecognitionException as re:
985
986
987
988
                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
989
        finally:
990
991
992
993
994
            pass
        return retval

    # $ANTLR end "def_selection_list"

Maxime Perrotin's avatar
Maxime Perrotin committed
995

Maxime Perrotin's avatar
Maxime Perrotin committed
996
997
    class entity_in_system_return(ParserRuleReturnScope):
        def __init__(self):
Maxime Perrotin's avatar
Maxime Perrotin committed
998
            super().__init__()
Maxime Perrotin's avatar
Maxime Perrotin committed
999
1000
1001
1002
1003
1004

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
1005

Maxime Perrotin's avatar
Maxime Perrotin committed
1006
    # $ANTLR start "entity_in_system"
1007
    # sdl92.g:184:1: entity_in_system : ( signal_declaration | text_area | procedure | channel | block_definition );
Maxime Perrotin's avatar
Maxime Perrotin committed
1008
1009
1010
1011
    def entity_in_system(self, ):
        retval = self.entity_in_system_return()
        retval.start = self.input.LT(1)

Maxime Perrotin's avatar
Maxime Perrotin committed
1012

Maxime Perrotin's avatar
Maxime Perrotin committed
1013
1014
        root_0 = None

1015
1016
1017
1018
1019
        signal_declaration20 = None
        text_area21 = None
        procedure22 = None
        channel23 = None
        block_definition24 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1020
1021
1022
1023


        try:
            try:
1024
                # sdl92.g:185:9: ( signal_declaration | text_area | procedure | channel | block_definition )
1025
1026
                alt7 = 5
                LA7 = self.input.LA(1)
1027
                if LA7 in {233}:
1028
1029
1030
1031
1032
1033
1034
1035
                    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
1036
1037
1038
1039
                    else:
                        if self._state.backtracking > 0:
                            raise BacktrackingFailed

Maxime Perrotin's avatar
Maxime Perrotin committed
1040

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

                        raise nvae

Maxime Perrotin's avatar
Maxime Perrotin committed
1045
1046

                elif LA7 in {SIGNAL}:
1047
                    alt7 = 1
1048
                elif LA7 in {EXPORTED, PROCEDURE}:
1049
                    alt7 = 3
Maxime Perrotin's avatar
Maxime Perrotin committed
1050
                elif LA7 in {CHANNEL}:
1051
                    alt7 = 4
Maxime Perrotin's avatar
Maxime Perrotin committed
1052
                elif LA7 in {BLOCK}:
1053
                    alt7 = 5
Maxime Perrotin's avatar
Maxime Perrotin committed
1054
1055
1056
1057
                else:
                    if self._state.backtracking > 0:
                        raise BacktrackingFailed

Maxime Perrotin's avatar
Maxime Perrotin committed
1058

1059
                    nvae = NoViableAltException("", 7, 0, self.input)
Maxime Perrotin's avatar
Maxime Perrotin committed
1060
1061
1062

                    raise nvae

Maxime Perrotin's avatar
Maxime Perrotin committed
1063

1064
                if alt7 == 1:
1065
                    # sdl92.g:185:17: signal_declaration
Maxime Perrotin's avatar
Maxime Perrotin committed
1066
1067
1068
                    pass 
                    root_0 = self._adaptor.nil()

Maxime Perrotin's avatar
Maxime Perrotin committed
1069

1070
                    self._state.following.append(self.FOLLOW_signal_declaration_in_entity_in_system1753)
1071
                    signal_declaration20 = self.signal_declaration()
Maxime Perrotin's avatar
Maxime Perrotin committed
1072
1073
1074

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


Maxime Perrotin's avatar
Maxime Perrotin committed
1078

1079
                elif alt7 == 2:
1080
                    # sdl92.g:186:19: text_area
Maxime Perrotin's avatar
Maxime Perrotin committed
1081
1082
1083
                    pass 
                    root_0 = self._adaptor.nil()

Maxime Perrotin's avatar
Maxime Perrotin committed
1084

1085
                    self._state.following.append(self.FOLLOW_text_area_in_entity_in_system1773)
1086
                    text_area21 = self.text_area()
Maxime Perrotin's avatar
Maxime Perrotin committed
1087
1088
1089

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


Maxime Perrotin's avatar
Maxime Perrotin committed
1093

1094
                elif alt7 == 3:
1095
                    # sdl92.g:187:19: procedure
Maxime Perrotin's avatar
Maxime Perrotin committed
1096
1097
1098
                    pass 
                    root_0 = self._adaptor.nil()

Maxime Perrotin's avatar
Maxime Perrotin committed
1099

1100
                    self._state.following.append(self.FOLLOW_procedure_in_entity_in_system1793)
1101
                    procedure22 = self.procedure()
Maxime Perrotin's avatar
Maxime Perrotin committed
1102
1103
1104

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


Maxime Perrotin's avatar
Maxime Perrotin committed
1108

1109
                elif alt7 == 4:
1110
                    # sdl92.g:188:19: channel
1111
1112
1113
                    pass 
                    root_0 = self._adaptor.nil()

Maxime Perrotin's avatar
Maxime Perrotin committed
1114

1115
                    self._state.following.append(self.FOLLOW_channel_in_entity_in_system1813)
1116
                    channel23 = self.channel()
1117
1118
1119

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1120
                        self._adaptor.addChild(root_0, channel23.tree)
1121
1122


Maxime Perrotin's avatar
Maxime Perrotin committed
1123

1124
                elif alt7 == 5:
1125
                    # sdl92.g:189:19: block_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
1126
1127
1128
                    pass 
                    root_0 = self._adaptor.nil()

Maxime Perrotin's avatar
Maxime Perrotin committed
1129

1130
                    self._state.following.append(self.FOLLOW_block_definition_in_entity_in_system1833)
1131
                    block_definition24 = self.block_definition()
Maxime Perrotin's avatar
Maxime Perrotin committed
1132
1133
1134

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


Maxime Perrotin's avatar
Maxime Perrotin committed
1138

Maxime Perrotin's avatar
Maxime Perrotin committed
1139
1140
1141
                retval.stop = self.input.LT(-1)


Maxime Perrotin's avatar
Maxime Perrotin committed
1142
                if self._state.backtracking == 0:
Maxime Perrotin's avatar
Maxime Perrotin committed
1143
1144
1145
1146
                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


Maxime Perrotin's avatar
Maxime Perrotin committed
1147
1148

            except RecognitionException as re:
Maxime Perrotin's avatar
Maxime Perrotin committed
1149
1150
1151
1152
                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
1153
        finally:
Maxime Perrotin's avatar
Maxime Perrotin committed
1154
1155
1156
1157
1158
            pass
        return retval

    # $ANTLR end "entity_in_system"

Maxime Perrotin's avatar
Maxime Perrotin committed
1159

Maxime Perrotin's avatar
Maxime Perrotin committed
1160
1161
    class signal_declaration_return(ParserRuleReturnScope):
        def __init__(self):
Maxime Perrotin's avatar
Maxime Perrotin committed
1162
            super().__init__()
Maxime Perrotin's avatar
Maxime Perrotin committed
1163
1164
1165
1166
1167
1168

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
1169

Maxime Perrotin's avatar
Maxime Perrotin committed
1170
    # $ANTLR start "signal_declaration"
1171
    # sdl92.g:195:1: signal_declaration : ( paramnames )? SIGNAL signal_id ( input_params )? end -> ^( SIGNAL ( paramnames )? signal_id ( input_params )? ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
1172
1173
1174
1175
    def signal_declaration(self, ):
        retval = self.signal_declaration_return()
        retval.start = self.input.LT(1)

Maxime Perrotin's avatar
Maxime Perrotin committed
1176

Maxime Perrotin's avatar
Maxime Perrotin committed
1177
1178
        root_0 = None

1179
1180
1181
1182
1183
        SIGNAL26 = None
        paramnames25 = None
        signal_id27 = None
        input_params28 = None
        end29 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1184

1185
        SIGNAL26_tree = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1186
        stream_SIGNAL = RewriteRuleTokenStream(self._adaptor, "token SIGNAL")
Maxime Perrotin's avatar
Maxime Perrotin committed
1187
        stream_paramnames = RewriteRuleSubtreeStream(self._adaptor, "rule paramnames")
1188
        stream_input_params = RewriteRuleSubtreeStream(self._adaptor, "rule input_params")
Maxime Perrotin's avatar
Maxime Perrotin committed
1189
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
1190
        stream_signal_id = RewriteRuleSubtreeStream(self._adaptor, "rule signal_id")
Maxime Perrotin's avatar
Maxime Perrotin committed
1191
1192
        try:
            try:
1193
1194
                # sdl92.g:196:9: ( ( paramnames )? SIGNAL signal_id ( input_params )? end -> ^( SIGNAL ( paramnames )? signal_id ( input_params )? ) )
                # sdl92.g:196:17: ( paramnames )? SIGNAL signal_id ( input_params )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
1195
                pass 
1196
                # sdl92.g:196:17: ( paramnames )?
1197
1198
                alt8 = 2
                LA8_0 = self.input.LA(1)
Maxime Perrotin's avatar
Maxime Perrotin committed
1199

1200
                if (LA8_0 == 233) :
1201
1202
                    alt8 = 1
                if alt8 == 1:
1203
                    # sdl92.g:196:17: paramnames
Maxime Perrotin's avatar
Maxime Perrotin committed
1204
                    pass 
1205
                    self._state.following.append(self.FOLLOW_paramnames_in_signal_declaration1866)
1206
                    paramnames25 = self.paramnames()
Maxime Perrotin's avatar
Maxime Perrotin committed
1207
1208
1209

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1210
                        stream_paramnames.add(paramnames25.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1211
1212
1213



Maxime Perrotin's avatar
Maxime Perrotin committed
1214
1215


1216
                SIGNAL26 = self.match(self.input, SIGNAL, self.FOLLOW_SIGNAL_in_signal_declaration1885) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1217
                if self._state.backtracking == 0:
1218
                    stream_SIGNAL.add(SIGNAL26)
Maxime Perrotin's avatar
Maxime Perrotin committed
1219
1220


1221
                self._state.following.append(self.FOLLOW_signal_id_in_signal_declaration1887)
1222
                signal_id27 = self.signal_id()
Maxime Perrotin's avatar
Maxime Perrotin committed
1223
1224
1225

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


1229
                # sdl92.g:197:34: ( input_params )?
1230
1231
                alt9 = 2
                LA9_0 = self.input.LA(1)
Maxime Perrotin's avatar
Maxime Perrotin committed
1232

1233
1234
1235
                if (LA9_0 == L_PAREN) :
                    alt9 = 1
                if alt9 == 1:
1236
                    # sdl92.g:197:34: input_params
Maxime Perrotin's avatar
Maxime Perrotin committed
1237
                    pass 
1238
                    self._state.following.append(self.FOLLOW_input_params_in_signal_declaration1889)
1239
                    input_params28 = self.input_params()
Maxime Perrotin's avatar
Maxime Perrotin committed
1240
1241
1242

                    self._state.following.pop()
                    if self._state.backtracking == 0:
1243
                        stream_input_params.add(input_params28.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1244
1245
1246



Maxime Perrotin's avatar
Maxime Perrotin committed
1247
1248


1249
                self._state.following.append(self.FOLLOW_end_in_signal_declaration1892)
1250
                end29 = self.end()
Maxime Perrotin's avatar
Maxime Perrotin committed
1251
1252
1253

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

Maxime Perrotin's avatar
Maxime Perrotin committed
1256

Maxime Perrotin's avatar
Maxime Perrotin committed
1257
                # AST Rewrite
Maxime Perrotin's avatar
Maxime Perrotin committed
1258
                # elements: SIGNAL, paramnames, signal_id, input_params
Maxime Perrotin's avatar
Maxime Perrotin committed
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
                # 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()
1273
1274
                    # 198:9: -> ^( SIGNAL ( paramnames )? signal_id ( input_params )? )
                    # sdl92.g:198:17: ^( SIGNAL ( paramnames )? signal_id ( input_params )? )
Maxime Perrotin's avatar
Maxime Perrotin committed
1275
                    root_1 = self._adaptor.nil()
Maxime Perrotin's avatar
Maxime Perrotin committed
1276
1277
1278
                    root_1 = self._adaptor.becomeRoot(
                    stream_SIGNAL.nextNode()
                    , root_1)
Maxime Perrotin's avatar
Maxime Perrotin committed
1279

1280
                    # sdl92.g:198:26: ( paramnames )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1281
1282
1283
1284
1285
                    if stream_paramnames.hasNext():
                        self._adaptor.addChild(root_1, stream_paramnames.nextTree())


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

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

1289
                    # sdl92.g:198:48: ( input_params )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
                    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
1300

Maxime Perrotin's avatar
Maxime Perrotin committed
1301
1302
1303
1304
                    retval.tree = root_0



Maxime Perrotin's avatar
Maxime Perrotin committed
1305
1306


Maxime Perrotin's avatar
Maxime Perrotin committed
1307
1308
1309
                retval.stop = self.input.LT(-1)


Maxime Perrotin's avatar
Maxime Perrotin committed
1310
                if self._state.backtracking == 0:
Maxime Perrotin's avatar
Maxime Perrotin committed
1311
1312
1313
1314
                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


Maxime Perrotin's avatar
Maxime Perrotin committed
1315
1316

            except RecognitionException as re:
Maxime Perrotin's avatar
Maxime Perrotin committed
1317
1318
1319
1320
                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
1321
        finally:
Maxime Perrotin's avatar
Maxime Perrotin committed
1322
1323
1324
1325
1326
            pass
        return retval

    # $ANTLR end "signal_declaration"

Maxime Perrotin's avatar
Maxime Perrotin committed
1327

Maxime Perrotin's avatar
Maxime Perrotin committed
1328
1329
    class channel_return(ParserRuleReturnScope):
        def __init__(self):
Maxime Perrotin's avatar
Maxime Perrotin committed
1330
            super().__init__()
Maxime Perrotin's avatar
Maxime Perrotin committed
1331
1332
1333
1334
1335
1336

            self.tree = None




Maxime Perrotin's avatar
Maxime Perrotin committed
1337

Maxime Perrotin's avatar
Maxime Perrotin committed
1338
    # $ANTLR start "channel"
1339
    # sdl92.g:202:1: channel : CHANNEL channel_id ( route )+ ENDCHANNEL end -> ^( CHANNEL channel_id ( route )+ ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
1340
1341
1342
1343
    def channel(self, ):
        retval = self.channel_return()
        retval.start = self.input.LT(1)

Maxime Perrotin's avatar
Maxime Perrotin committed
1344

Maxime Perrotin's avatar
Maxime Perrotin committed
1345
1346
        root_0 = None

1347
1348
1349
1350
1351
        CHANNEL30 = None
        ENDCHANNEL33 = None
        channel_id31 = None
        route32 = None
        end34 = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1352

1353
1354
        CHANNEL30_tree = None
        ENDCHANNEL33_tree = None
Maxime Perrotin's avatar
Maxime Perrotin committed
1355
1356
1357
        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
1358
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
1359
        stream_channel_id = RewriteRuleSubtreeStream(self._adaptor, "rule channel_id")
Maxime Perrotin's avatar
Maxime Perrotin committed
1360
1361
        try:
            try:
1362
1363
                # sdl92.g:203:9: ( CHANNEL channel_id ( route )+ ENDCHANNEL end -> ^( CHANNEL channel_id ( route )+ ) )
                # sdl92.g:203:17: CHANNEL channel_id ( route )+ ENDCHANNEL end
Maxime Perrotin's avatar
Maxime Perrotin committed
1364
                pass 
1365
                CHANNEL30 = self.match(self.input, CHANNEL, self.FOLLOW_CHANNEL_in_channel1951) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1366
                if self._state.backtracking == 0:
1367
                    stream_CHANNEL.add(CHANNEL30)
Maxime Perrotin's avatar
Maxime Perrotin committed
1368
1369


1370
                self._state.following.append(self.FOLLOW_channel_id_in_channel1953)
1371
                channel_id31 = self.channel_id()
Maxime Perrotin's avatar
Maxime Perrotin committed
1372
1373
1374

                self._state.following.pop()
                if self._state.backtracking == 0:
1375
                    stream_channel_id.add(channel_id31.tree)
Maxime Perrotin's avatar
Maxime Perrotin committed
1376
1377


1378
                # sdl92.g:204:17: ( route )+
1379
1380
1381
1382
                cnt10 = 0
                while True: #loop10
                    alt10 = 2
                    LA10_0 = self.input.LA(1)
Maxime Perrotin's avatar
Maxime Perrotin committed
1383