sdl92Parser.py 878 KB
Newer Older
1
# $ANTLR 3.1.3 Mar 17, 2009 19:23:44 sdl92.g 2014-05-17 07:26:46
Maxime Perrotin's avatar
Maxime Perrotin committed
2
3
4
5
6
7
8
9
10
11
12
13
14
15

import sys
from antlr3 import *
from antlr3.compat import set, frozenset

from antlr3.tree import *



# for convenience in actions
HIDDEN = BaseRecognizer.HIDDEN

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

# token names
tokenNames = [
    "<invalid>", "<EOR>", "<DOWN>", "<UP>", 
    "FOR", "RANGE", "TIMER", "LABEL", "IFTHENELSE", "COMMENT", "VALUE", 
    "CHOICE", "SEQUENCE", "SEQOF", "EMPTYSTR", "FLOAT", "FLOAT2", "BITSTR", 
    "OCTSTR", "STRING", "EXPRESSION", "DIGITS", "ENDTEXT", "PROCESS", "NUMBER_OF_INSTANCES", 
    "TRANSITION", "STATE", "INPUT_NONE", "SAVE", "PROVIDED", "SIGNAL_LIST", 
    "INPUT", "STIMULUS", "ACTION", "PROCEDURE_CALL", "PROCEDURE", "SET", 
    "RESET", "EXPORT", "DECISION", "ALTERNATIVE", "ANSWER", "CLOSED_RANGE", 
    "OPEN_RANGE", "CONSTANT", "ELSE", "ALL", "TO", "VIA", "VIAPATH", "OUTPUT", 
    "OUTPUT_BODY", "ASSIGN", "TEXT", "NEXTSTATE", "JOIN", "TERMINATOR", 
    "RETURN", "PROCEDURE_NAME", "PARAMS", "FIELD_NAME", "PRIMARY", "PRIMARY_ID", 
    "IF", "THEN", "FI", "CIF", "HYPERLINK", "STATELIST", "INPUTLIST", "INFORMAL_TEXT", 
    "VARIABLE", "VARIABLES", "SORT", "DCL", "MINUS", "GROUND", "TEXTAREA", 
    "TEXTAREA_CONTENT", "TASK", "TASK_BODY", "QUESTION", "FPAR", "PARAM", 
    "INOUT", "EXTERNAL", "IN", "STOP", "SYSTEM", "USE", "SIGNAL", "CHANNEL", 
    "CONNECTION", "ROUTE", "BLOCK", "PARAMNAMES", "ASN1", "FLOATING_LABEL", 
242
243
    "COMPOSITE_STATE", "CONNECT", "ENDSYSTEM", "ENDCHANNEL", "FROM", "WITH", 
    "ENDBLOCK", "SIGNALROUTE", "AND", "REFERENCED", "ENDPROCESS", "ENDPROCEDURE", 
244
245
246
247
248
249
250
251
252
253
254
    "INT", "START", "ENDCONNECTION", "SEMI", "ENDSTATE", "ASTERISK", "SUBSTRUCTURE", 
    "ENDSUBSTRUCTURE", "OUT", "NONE", "PRIORITY", "L_PAREN", "R_PAREN", 
    "COMMA", "CALL", "ENDALTERNATIVE", "ENDDECISION", "ANY", "EQ", "NEQ", 
    "GT", "LT", "LE", "GE", "CREATE", "THIS", "ID", "ENDFOR", "IMPLIES", 
    "OR", "XOR", "PLUS", "DASH", "APPEND", "DIV", "MOD", "REM", "BitStringLiteral", 
    "OctetStringLiteral", "TRUE", "FALSE", "StringLiteral", "NULL", "PLUS_INFINITY", 
    "MINUS_INFINITY", "FloatingPointLiteral", "L_BRACKET", "R_BRACKET", 
    "MANTISSA", "BASE", "EXPONENT", "NOT", "KEEP", "SPECIFIC", "GEODE", 
    "ASNFILENAME", "END", "ASSIG_OP", "A", "N", "Y", "D", "C", "L", "E", 
    "K", "P", "R", "M", "S", "I", "F", "G", "O", "H", "T", "X", "U", "V", 
    "W", "B", "J", "DOT", "STR", "ALPHA", "Exponent", "WS", "COMMENT2", 
Maxime Perrotin's avatar
Maxime Perrotin committed
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
    "Q", "Z", "':'", "'ALL'", "'!'", "'(.'", "'.)'", "'ERROR'", "'ACTIVE'", 
    "'ANY'", "'IMPORT'", "'VIEW'", "'/* CIF'", "'*/'"
]




class sdl92Parser(Parser):
    grammarFileName = "sdl92.g"
    antlr_version = version_str_to_tuple("3.1.3 Mar 17, 2009 19:23:44")
    antlr_version_str = "3.1.3 Mar 17, 2009 19:23:44"
    tokenNames = tokenNames

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

        super(sdl92Parser, self).__init__(input, state, *args, **kwargs)

274
275
276
277
278
279
280
281
282
        self.dfa19 = self.DFA19(
            self, 19,
            eot = self.DFA19_eot,
            eof = self.DFA19_eof,
            min = self.DFA19_min,
            max = self.DFA19_max,
            accept = self.DFA19_accept,
            special = self.DFA19_special,
            transition = self.DFA19_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
283
284
285
286
287
288
289
290
291
292
293
294
295
            )

        self.dfa35 = self.DFA35(
            self, 35,
            eot = self.DFA35_eot,
            eof = self.DFA35_eof,
            min = self.DFA35_min,
            max = self.DFA35_max,
            accept = self.DFA35_accept,
            special = self.DFA35_special,
            transition = self.DFA35_transition
            )

296
297
298
299
300
301
302
303
304
        self.dfa36 = self.DFA36(
            self, 36,
            eot = self.DFA36_eot,
            eof = self.DFA36_eof,
            min = self.DFA36_min,
            max = self.DFA36_max,
            accept = self.DFA36_accept,
            special = self.DFA36_special,
            transition = self.DFA36_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
305
306
            )

307
308
309
310
311
312
313
314
315
        self.dfa40 = self.DFA40(
            self, 40,
            eot = self.DFA40_eot,
            eof = self.DFA40_eof,
            min = self.DFA40_min,
            max = self.DFA40_max,
            accept = self.DFA40_accept,
            special = self.DFA40_special,
            transition = self.DFA40_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
316
317
            )

318
319
320
321
322
323
324
325
326
        self.dfa58 = self.DFA58(
            self, 58,
            eot = self.DFA58_eot,
            eof = self.DFA58_eof,
            min = self.DFA58_min,
            max = self.DFA58_max,
            accept = self.DFA58_accept,
            special = self.DFA58_special,
            transition = self.DFA58_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
327
328
            )

329
330
331
332
333
334
335
336
337
338
339
        self.dfa59 = self.DFA59(
            self, 59,
            eot = self.DFA59_eot,
            eof = self.DFA59_eof,
            min = self.DFA59_min,
            max = self.DFA59_max,
            accept = self.DFA59_accept,
            special = self.DFA59_special,
            transition = self.DFA59_transition
            )

340
341
342
343
344
345
346
347
348
        self.dfa60 = self.DFA60(
            self, 60,
            eot = self.DFA60_eot,
            eof = self.DFA60_eof,
            min = self.DFA60_min,
            max = self.DFA60_max,
            accept = self.DFA60_accept,
            special = self.DFA60_special,
            transition = self.DFA60_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
349
350
            )

351
352
353
354
355
356
357
358
359
        self.dfa64 = self.DFA64(
            self, 64,
            eot = self.DFA64_eot,
            eof = self.DFA64_eof,
            min = self.DFA64_min,
            max = self.DFA64_max,
            accept = self.DFA64_accept,
            special = self.DFA64_special,
            transition = self.DFA64_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
360
361
362
363
364
365
366
367
368
369
370
371
372
            )

        self.dfa75 = self.DFA75(
            self, 75,
            eot = self.DFA75_eot,
            eof = self.DFA75_eof,
            min = self.DFA75_min,
            max = self.DFA75_max,
            accept = self.DFA75_accept,
            special = self.DFA75_special,
            transition = self.DFA75_transition
            )

373
374
375
376
377
378
379
380
381
        self.dfa76 = self.DFA76(
            self, 76,
            eot = self.DFA76_eot,
            eof = self.DFA76_eof,
            min = self.DFA76_min,
            max = self.DFA76_max,
            accept = self.DFA76_accept,
            special = self.DFA76_special,
            transition = self.DFA76_transition
382
383
            )

384
385
386
387
388
389
390
391
392
        self.dfa84 = self.DFA84(
            self, 84,
            eot = self.DFA84_eot,
            eof = self.DFA84_eof,
            min = self.DFA84_min,
            max = self.DFA84_max,
            accept = self.DFA84_accept,
            special = self.DFA84_special,
            transition = self.DFA84_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
393
394
            )

395
396
397
398
399
400
401
402
403
        self.dfa81 = self.DFA81(
            self, 81,
            eot = self.DFA81_eot,
            eof = self.DFA81_eof,
            min = self.DFA81_min,
            max = self.DFA81_max,
            accept = self.DFA81_accept,
            special = self.DFA81_special,
            transition = self.DFA81_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
404
405
            )

406
407
408
409
410
411
412
413
414
        self.dfa82 = self.DFA82(
            self, 82,
            eot = self.DFA82_eot,
            eof = self.DFA82_eof,
            min = self.DFA82_min,
            max = self.DFA82_max,
            accept = self.DFA82_accept,
            special = self.DFA82_special,
            transition = self.DFA82_transition
415
416
            )

417
418
419
420
421
422
423
424
425
        self.dfa83 = self.DFA83(
            self, 83,
            eot = self.DFA83_eot,
            eof = self.DFA83_eof,
            min = self.DFA83_min,
            max = self.DFA83_max,
            accept = self.DFA83_accept,
            special = self.DFA83_special,
            transition = self.DFA83_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
426
427
428
429
430
431
432
433
434
435
436
            )

        self.dfa85 = self.DFA85(
            self, 85,
            eot = self.DFA85_eot,
            eof = self.DFA85_eof,
            min = self.DFA85_min,
            max = self.DFA85_max,
            accept = self.DFA85_accept,
            special = self.DFA85_special,
            transition = self.DFA85_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
437
438
            )

439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
        self.dfa86 = self.DFA86(
            self, 86,
            eot = self.DFA86_eot,
            eof = self.DFA86_eof,
            min = self.DFA86_min,
            max = self.DFA86_max,
            accept = self.DFA86_accept,
            special = self.DFA86_special,
            transition = self.DFA86_transition
            )

        self.dfa97 = self.DFA97(
            self, 97,
            eot = self.DFA97_eot,
            eof = self.DFA97_eof,
            min = self.DFA97_min,
            max = self.DFA97_max,
            accept = self.DFA97_accept,
            special = self.DFA97_special,
            transition = self.DFA97_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
459
460
            )

461
462
463
464
465
466
467
468
469
        self.dfa95 = self.DFA95(
            self, 95,
            eot = self.DFA95_eot,
            eof = self.DFA95_eof,
            min = self.DFA95_min,
            max = self.DFA95_max,
            accept = self.DFA95_accept,
            special = self.DFA95_special,
            transition = self.DFA95_transition
470
471
            )

472
473
474
475
476
477
478
479
480
        self.dfa105 = self.DFA105(
            self, 105,
            eot = self.DFA105_eot,
            eof = self.DFA105_eof,
            min = self.DFA105_min,
            max = self.DFA105_max,
            accept = self.DFA105_accept,
            special = self.DFA105_special,
            transition = self.DFA105_transition
481
482
            )

483
484
485
486
487
488
489
490
491
        self.dfa141 = self.DFA141(
            self, 141,
            eot = self.DFA141_eot,
            eof = self.DFA141_eof,
            min = self.DFA141_min,
            max = self.DFA141_max,
            accept = self.DFA141_accept,
            special = self.DFA141_special,
            transition = self.DFA141_transition
492
493
            )

494
495
496
497
498
499
500
501
502
        self.dfa151 = self.DFA151(
            self, 151,
            eot = self.DFA151_eot,
            eof = self.DFA151_eof,
            min = self.DFA151_min,
            max = self.DFA151_max,
            accept = self.DFA151_accept,
            special = self.DFA151_special,
            transition = self.DFA151_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
503
504
            )

505
506
507
508
509
510
511
512
513
        self.dfa161 = self.DFA161(
            self, 161,
            eot = self.DFA161_eot,
            eof = self.DFA161_eof,
            min = self.DFA161_min,
            max = self.DFA161_max,
            accept = self.DFA161_accept,
            special = self.DFA161_special,
            transition = self.DFA161_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
            )






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


        
    def getTreeAdaptor(self):
        return self._adaptor

    def setTreeAdaptor(self, adaptor):
        self._adaptor = adaptor

    adaptor = property(getTreeAdaptor, setTreeAdaptor)


    class pr_file_return(ParserRuleReturnScope):
        def __init__(self):
            super(sdl92Parser.pr_file_return, self).__init__()

            self.tree = None




    # $ANTLR start "pr_file"
546
    # sdl92.g:124:1: pr_file : ( use_clause | system_definition | process_definition )+ ;
Maxime Perrotin's avatar
Maxime Perrotin committed
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
    def pr_file(self, ):

        retval = self.pr_file_return()
        retval.start = self.input.LT(1)

        root_0 = None

        use_clause1 = None

        system_definition2 = None

        process_definition3 = None



        try:
            try:
564
565
                # sdl92.g:125:9: ( ( use_clause | system_definition | process_definition )+ )
                # sdl92.g:125:17: ( use_clause | system_definition | process_definition )+
Maxime Perrotin's avatar
Maxime Perrotin committed
566
567
568
                pass 
                root_0 = self._adaptor.nil()

569
                # sdl92.g:125:17: ( use_clause | system_definition | process_definition )+
Maxime Perrotin's avatar
Maxime Perrotin committed
570
571
572
573
                cnt1 = 0
                while True: #loop1
                    alt1 = 4
                    LA1 = self.input.LA(1)
574
575
576
577
578
579
580
581
582
583
                    if LA1 == 210:
                        LA1_2 = self.input.LA(2)

                        if (LA1_2 == KEEP) :
                            alt1 = 1
                        elif (LA1_2 == LABEL or LA1_2 == COMMENT or LA1_2 == PROCESS or LA1_2 == STATE or LA1_2 == PROVIDED or LA1_2 == INPUT or (PROCEDURE_CALL <= LA1_2 <= PROCEDURE) or LA1_2 == DECISION or LA1_2 == ANSWER or LA1_2 == OUTPUT or (TEXT <= LA1_2 <= JOIN) or LA1_2 == RETURN or LA1_2 == TASK or LA1_2 == STOP or LA1_2 == CONNECT or LA1_2 == START) :
                            alt1 = 3


                    elif LA1 == USE:
Maxime Perrotin's avatar
Maxime Perrotin committed
584
585
586
587
588
589
590
                        alt1 = 1
                    elif LA1 == SYSTEM:
                        alt1 = 2
                    elif LA1 == PROCESS:
                        alt1 = 3

                    if alt1 == 1:
591
                        # sdl92.g:125:18: use_clause
Maxime Perrotin's avatar
Maxime Perrotin committed
592
                        pass 
593
                        self._state.following.append(self.FOLLOW_use_clause_in_pr_file1134)
Maxime Perrotin's avatar
Maxime Perrotin committed
594
595
596
597
598
599
600
601
                        use_clause1 = self.use_clause()

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


                    elif alt1 == 2:
602
                        # sdl92.g:126:19: system_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
603
                        pass 
604
                        self._state.following.append(self.FOLLOW_system_definition_in_pr_file1154)
Maxime Perrotin's avatar
Maxime Perrotin committed
605
606
607
608
609
610
611
612
                        system_definition2 = self.system_definition()

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


                    elif alt1 == 3:
613
                        # sdl92.g:127:19: process_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
614
                        pass 
615
                        self._state.following.append(self.FOLLOW_process_definition_in_pr_file1174)
Maxime Perrotin's avatar
Maxime Perrotin committed
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
                        process_definition3 = self.process_definition()

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


                    else:
                        if cnt1 >= 1:
                            break #loop1

                        if self._state.backtracking > 0:
                            raise BacktrackingFailed

                        eee = EarlyExitException(1, self.input)
                        raise eee

                    cnt1 += 1



                retval.stop = self.input.LT(-1)

                if self._state.backtracking == 0:

                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
                retval.tree = self._adaptor.errorNode(self.input, retval.start, self.input.LT(-1), re)
        finally:

            pass
        return retval

    # $ANTLR end "pr_file"

    class system_definition_return(ParserRuleReturnScope):
        def __init__(self):
            super(sdl92Parser.system_definition_return, self).__init__()

            self.tree = None




    # $ANTLR start "system_definition"
666
    # sdl92.g:130: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
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
    def system_definition(self, ):

        retval = self.system_definition_return()
        retval.start = self.input.LT(1)

        root_0 = None

        SYSTEM4 = None
        ENDSYSTEM8 = None
        system_name5 = None

        end6 = None

        entity_in_system7 = None

        system_name9 = None

        end10 = None


        SYSTEM4_tree = None
        ENDSYSTEM8_tree = None
        stream_ENDSYSTEM = RewriteRuleTokenStream(self._adaptor, "token ENDSYSTEM")
        stream_SYSTEM = RewriteRuleTokenStream(self._adaptor, "token SYSTEM")
        stream_entity_in_system = RewriteRuleSubtreeStream(self._adaptor, "rule entity_in_system")
        stream_system_name = RewriteRuleSubtreeStream(self._adaptor, "rule system_name")
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
        try:
            try:
696
697
                # sdl92.g:131:9: ( SYSTEM system_name end ( entity_in_system )* ENDSYSTEM ( system_name )? end -> ^( SYSTEM system_name ( entity_in_system )* ) )
                # sdl92.g:131:17: SYSTEM system_name end ( entity_in_system )* ENDSYSTEM ( system_name )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
698
                pass 
699
                SYSTEM4=self.match(self.input, SYSTEM, self.FOLLOW_SYSTEM_in_system_definition1199) 
Maxime Perrotin's avatar
Maxime Perrotin committed
700
701
                if self._state.backtracking == 0:
                    stream_SYSTEM.add(SYSTEM4)
702
                self._state.following.append(self.FOLLOW_system_name_in_system_definition1201)
Maxime Perrotin's avatar
Maxime Perrotin committed
703
704
705
706
707
                system_name5 = self.system_name()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_system_name.add(system_name5.tree)
708
                self._state.following.append(self.FOLLOW_end_in_system_definition1203)
Maxime Perrotin's avatar
Maxime Perrotin committed
709
710
711
712
713
                end6 = self.end()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_end.add(end6.tree)
714
                # sdl92.g:132:17: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
715
716
717
718
                while True: #loop2
                    alt2 = 2
                    LA2_0 = self.input.LA(1)

719
                    if (LA2_0 == PROCEDURE or (SIGNAL <= LA2_0 <= CHANNEL) or LA2_0 == BLOCK or LA2_0 == 210) :
Maxime Perrotin's avatar
Maxime Perrotin committed
720
721
722
723
724
725
                        alt2 = 1


                    if alt2 == 1:
                        # sdl92.g:0:0: entity_in_system
                        pass 
726
                        self._state.following.append(self.FOLLOW_entity_in_system_in_system_definition1221)
Maxime Perrotin's avatar
Maxime Perrotin committed
727
728
729
730
731
732
733
734
735
                        entity_in_system7 = self.entity_in_system()

                        self._state.following.pop()
                        if self._state.backtracking == 0:
                            stream_entity_in_system.add(entity_in_system7.tree)


                    else:
                        break #loop2
736
                ENDSYSTEM8=self.match(self.input, ENDSYSTEM, self.FOLLOW_ENDSYSTEM_in_system_definition1240) 
Maxime Perrotin's avatar
Maxime Perrotin committed
737
738
                if self._state.backtracking == 0:
                    stream_ENDSYSTEM.add(ENDSYSTEM8)
739
                # sdl92.g:133:27: ( system_name )?
Maxime Perrotin's avatar
Maxime Perrotin committed
740
741
742
743
744
745
746
747
                alt3 = 2
                LA3_0 = self.input.LA(1)

                if (LA3_0 == ID) :
                    alt3 = 1
                if alt3 == 1:
                    # sdl92.g:0:0: system_name
                    pass 
748
                    self._state.following.append(self.FOLLOW_system_name_in_system_definition1242)
Maxime Perrotin's avatar
Maxime Perrotin committed
749
750
751
752
753
754
755
756
                    system_name9 = self.system_name()

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



757
                self._state.following.append(self.FOLLOW_end_in_system_definition1245)
Maxime Perrotin's avatar
Maxime Perrotin committed
758
759
760
761
762
763
764
                end10 = self.end()

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

                # AST Rewrite
765
                # elements: SYSTEM, entity_in_system, system_name
Maxime Perrotin's avatar
Maxime Perrotin committed
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
                # 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()
782
783
                    # 134:9: -> ^( SYSTEM system_name ( entity_in_system )* )
                    # sdl92.g:134:17: ^( SYSTEM system_name ( entity_in_system )* )
Maxime Perrotin's avatar
Maxime Perrotin committed
784
785
786
787
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_SYSTEM.nextNode(), root_1)

                    self._adaptor.addChild(root_1, stream_system_name.nextTree())
788
                    # sdl92.g:134:38: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
                    while stream_entity_in_system.hasNext():
                        self._adaptor.addChild(root_1, stream_entity_in_system.nextTree())


                    stream_entity_in_system.reset();

                    self._adaptor.addChild(root_0, root_1)



                    retval.tree = root_0



                retval.stop = self.input.LT(-1)

                if self._state.backtracking == 0:

                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
                retval.tree = self._adaptor.errorNode(self.input, retval.start, self.input.LT(-1), re)
        finally:

            pass
        return retval

    # $ANTLR end "system_definition"

    class use_clause_return(ParserRuleReturnScope):
        def __init__(self):
            super(sdl92Parser.use_clause_return, self).__init__()

            self.tree = None




    # $ANTLR start "use_clause"
832
    # sdl92.g:137:1: use_clause : ( use_asn1 )? USE package_name end -> ^( USE ( use_asn1 )? package_name ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
    def use_clause(self, ):

        retval = self.use_clause_return()
        retval.start = self.input.LT(1)

        root_0 = None

        USE12 = None
        use_asn111 = None

        package_name13 = None

        end14 = None


        USE12_tree = None
        stream_USE = RewriteRuleTokenStream(self._adaptor, "token USE")
        stream_use_asn1 = RewriteRuleSubtreeStream(self._adaptor, "rule use_asn1")
        stream_package_name = RewriteRuleSubtreeStream(self._adaptor, "rule package_name")
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
        try:
            try:
855
856
                # sdl92.g:138:9: ( ( use_asn1 )? USE package_name end -> ^( USE ( use_asn1 )? package_name ) )
                # sdl92.g:138:17: ( use_asn1 )? USE package_name end
Maxime Perrotin's avatar
Maxime Perrotin committed
857
                pass 
858
                # sdl92.g:138:17: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
859
860
861
                alt4 = 2
                LA4_0 = self.input.LA(1)

862
                if (LA4_0 == 210) :
Maxime Perrotin's avatar
Maxime Perrotin committed
863
864
865
866
                    alt4 = 1
                if alt4 == 1:
                    # sdl92.g:0:0: use_asn1
                    pass 
867
                    self._state.following.append(self.FOLLOW_use_asn1_in_use_clause1292)
Maxime Perrotin's avatar
Maxime Perrotin committed
868
869
870
871
872
873
874
875
                    use_asn111 = self.use_asn1()

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



876
                USE12=self.match(self.input, USE, self.FOLLOW_USE_in_use_clause1311) 
Maxime Perrotin's avatar
Maxime Perrotin committed
877
878
                if self._state.backtracking == 0:
                    stream_USE.add(USE12)
879
                self._state.following.append(self.FOLLOW_package_name_in_use_clause1313)
Maxime Perrotin's avatar
Maxime Perrotin committed
880
881
882
883
884
                package_name13 = self.package_name()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_package_name.add(package_name13.tree)
885
                self._state.following.append(self.FOLLOW_end_in_use_clause1315)
Maxime Perrotin's avatar
Maxime Perrotin committed
886
887
888
889
890
891
892
                end14 = self.end()

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

                # AST Rewrite
893
                # elements: USE, package_name, use_asn1
Maxime Perrotin's avatar
Maxime Perrotin committed
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
                # 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()
910
911
                    # 140:9: -> ^( USE ( use_asn1 )? package_name )
                    # sdl92.g:140:17: ^( USE ( use_asn1 )? package_name )
Maxime Perrotin's avatar
Maxime Perrotin committed
912
913
914
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_USE.nextNode(), root_1)

915
                    # sdl92.g:140:23: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
                    if stream_use_asn1.hasNext():
                        self._adaptor.addChild(root_1, stream_use_asn1.nextTree())


                    stream_use_asn1.reset();
                    self._adaptor.addChild(root_1, stream_package_name.nextTree())

                    self._adaptor.addChild(root_0, root_1)



                    retval.tree = root_0



                retval.stop = self.input.LT(-1)

                if self._state.backtracking == 0:

                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
                retval.tree = self._adaptor.errorNode(self.input, retval.start, self.input.LT(-1), re)
        finally:

            pass
        return retval

    # $ANTLR end "use_clause"

    class entity_in_system_return(ParserRuleReturnScope):
        def __init__(self):
            super(sdl92Parser.entity_in_system_return, self).__init__()

            self.tree = None




    # $ANTLR start "entity_in_system"
960
    # sdl92.g:146:1: entity_in_system : ( signal_declaration | procedure | channel | block_definition );
Maxime Perrotin's avatar
Maxime Perrotin committed
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
    def entity_in_system(self, ):

        retval = self.entity_in_system_return()
        retval.start = self.input.LT(1)

        root_0 = None

        signal_declaration15 = None

        procedure16 = None

        channel17 = None

        block_definition18 = None



        try:
            try:
980
                # sdl92.g:147:9: ( signal_declaration | procedure | channel | block_definition )
Maxime Perrotin's avatar
Maxime Perrotin committed
981
982
                alt5 = 4
                LA5 = self.input.LA(1)
983
                if LA5 == 210:
Maxime Perrotin's avatar
Maxime Perrotin committed
984
985
                    LA5_1 = self.input.LA(2)

986
                    if (LA5_1 == LABEL or LA5_1 == COMMENT or LA5_1 == PROCESS or LA5_1 == STATE or LA5_1 == PROVIDED or LA5_1 == INPUT or (PROCEDURE_CALL <= LA5_1 <= PROCEDURE) or LA5_1 == DECISION or LA5_1 == ANSWER or LA5_1 == OUTPUT or (TEXT <= LA5_1 <= JOIN) or LA5_1 == RETURN or LA5_1 == TASK or LA5_1 == STOP or LA5_1 == CONNECT or LA5_1 == START) :
987
                        alt5 = 2
Maxime Perrotin's avatar
Maxime Perrotin committed
988
989
                    elif (LA5_1 == KEEP) :
                        alt5 = 1
Maxime Perrotin's avatar
Maxime Perrotin committed
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
                    else:
                        if self._state.backtracking > 0:
                            raise BacktrackingFailed

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

                        raise nvae

                elif LA5 == SIGNAL:
                    alt5 = 1
                elif LA5 == PROCEDURE:
                    alt5 = 2
                elif LA5 == CHANNEL:
                    alt5 = 3
                elif LA5 == BLOCK:
                    alt5 = 4
                else:
                    if self._state.backtracking > 0:
                        raise BacktrackingFailed

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

                    raise nvae

                if alt5 == 1:
1015
                    # sdl92.g:147:17: signal_declaration
Maxime Perrotin's avatar
Maxime Perrotin committed
1016
1017
1018
                    pass 
                    root_0 = self._adaptor.nil()

1019
                    self._state.following.append(self.FOLLOW_signal_declaration_in_entity_in_system1364)
Maxime Perrotin's avatar
Maxime Perrotin committed
1020
1021
1022
1023
1024
1025
1026
1027
                    signal_declaration15 = self.signal_declaration()

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


                elif alt5 == 2:
1028
                    # sdl92.g:148:19: procedure
Maxime Perrotin's avatar
Maxime Perrotin committed
1029
1030
1031
                    pass 
                    root_0 = self._adaptor.nil()

1032
                    self._state.following.append(self.FOLLOW_procedure_in_entity_in_system1384)
Maxime Perrotin's avatar
Maxime Perrotin committed
1033
1034
1035
1036
1037
1038
1039
1040
                    procedure16 = self.procedure()

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


                elif alt5 == 3:
1041
                    # sdl92.g:149:19: channel
Maxime Perrotin's avatar
Maxime Perrotin committed
1042
1043
1044
                    pass 
                    root_0 = self._adaptor.nil()

1045
                    self._state.following.append(self.FOLLOW_channel_in_entity_in_system1404)
Maxime Perrotin's avatar
Maxime Perrotin committed
1046
1047
1048
1049
1050
1051
1052
1053
                    channel17 = self.channel()

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


                elif alt5 == 4:
1054
                    # sdl92.g:150:19: block_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
1055
1056
1057
                    pass 
                    root_0 = self._adaptor.nil()

1058
                    self._state.following.append(self.FOLLOW_block_definition_in_entity_in_system1424)
Maxime Perrotin's avatar
Maxime Perrotin committed
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
                    block_definition18 = self.block_definition()

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


                retval.stop = self.input.LT(-1)

                if self._state.backtracking == 0:

                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
                retval.tree = self._adaptor.errorNode(self.input, retval.start, self.input.LT(-1), re)
        finally:

            pass
        return retval

    # $ANTLR end "entity_in_system"

    class signal_declaration_return(ParserRuleReturnScope):
        def __init__(self):
            super(sdl92Parser.signal_declaration_return, self).__init__()

            self.tree = None




    # $ANTLR start "signal_declaration"
1095
    # sdl92.g:155:1: signal_declaration : ( paramnames )? SIGNAL signal_id ( input_params )? end -> ^( SIGNAL ( paramnames )? signal_id ( input_params )? ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
    def signal_declaration(self, ):

        retval = self.signal_declaration_return()
        retval.start = self.input.LT(1)

        root_0 = None

        SIGNAL20 = None
        paramnames19 = None

        signal_id21 = None

        input_params22 = None

        end23 = None


        SIGNAL20_tree = None
        stream_SIGNAL = RewriteRuleTokenStream(self._adaptor, "token SIGNAL")
        stream_input_params = RewriteRuleSubtreeStream(self._adaptor, "rule input_params")
        stream_paramnames = RewriteRuleSubtreeStream(self._adaptor, "rule paramnames")
        stream_signal_id = RewriteRuleSubtreeStream(self._adaptor, "rule signal_id")
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
        try:
            try:
1121
1122
                # sdl92.g:156:9: ( ( paramnames )? SIGNAL signal_id ( input_params )? end -> ^( SIGNAL ( paramnames )? signal_id ( input_params )? ) )
                # sdl92.g:156:17: ( paramnames )? SIGNAL signal_id ( input_params )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
1123
                pass 
1124
                # sdl92.g:156:17: ( paramnames )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1125
1126
1127
                alt6 = 2
                LA6_0 = self.input.LA(1)

1128
                if (LA6_0 == 210) :
Maxime Perrotin's avatar
Maxime Perrotin committed
1129
1130
1131
1132
                    alt6 = 1
                if alt6 == 1:
                    # sdl92.g:0:0: paramnames
                    pass 
1133
                    self._state.following.append(self.FOLLOW_paramnames_in_signal_declaration1448)
Maxime Perrotin's avatar
Maxime Perrotin committed
1134
1135
1136
1137
1138
1139
1140
1141
                    paramnames19 = self.paramnames()

                    self._state.following.pop()
                    if self._state.backtracking == 0:
                        stream_paramnames.add(paramnames19.tree)



1142
                SIGNAL20=self.match(self.input, SIGNAL, self.FOLLOW_SIGNAL_in_signal_declaration1467) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1143
1144
                if self._state.backtracking == 0:
                    stream_SIGNAL.add(SIGNAL20)
1145
                self._state.following.append(self.FOLLOW_signal_id_in_signal_declaration1469)
Maxime Perrotin's avatar
Maxime Perrotin committed
1146
1147
1148
1149
1150
                signal_id21 = self.signal_id()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_signal_id.add(signal_id21.tree)
1151
                # sdl92.g:157:34: ( input_params )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1152
1153
1154
1155
1156
1157
1158
1159
                alt7 = 2
                LA7_0 = self.input.LA(1)

                if (LA7_0 == L_PAREN) :
                    alt7 = 1
                if alt7 == 1:
                    # sdl92.g:0:0: input_params
                    pass 
1160
                    self._state.following.append(self.FOLLOW_input_params_in_signal_declaration1471)
Maxime Perrotin's avatar
Maxime Perrotin committed
1161
1162
1163
1164
1165
1166
1167
1168
                    input_params22 = self.input_params()

                    self._state.following.pop()
                    if self._state.backtracking == 0:
                        stream_input_params.add(input_params22.tree)



1169
                self._state.following.append(self.FOLLOW_end_in_signal_declaration1474)
Maxime Perrotin's avatar
Maxime Perrotin committed
1170
1171
1172
1173
1174
1175
1176
                end23 = self.end()

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

                # AST Rewrite
1177
                # elements: signal_id, input_params, SIGNAL, paramnames
Maxime Perrotin's avatar
Maxime Perrotin committed
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
                # 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()
1194
1195
                    # 158:9: -> ^( SIGNAL ( paramnames )? signal_id ( input_params )? )
                    # sdl92.g:158:17: ^( SIGNAL ( paramnames )? signal_id ( input_params )? )
Maxime Perrotin's avatar
Maxime Perrotin committed
1196
1197
1198
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_SIGNAL.nextNode(), root_1)

1199
                    # sdl92.g:158:26: ( paramnames )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1200
1201
1202
1203
1204
1205
                    if stream_paramnames.hasNext():
                        self._adaptor.addChild(root_1, stream_paramnames.nextTree())


                    stream_paramnames.reset();
                    self._adaptor.addChild(root_1, stream_signal_id.nextTree())
1206
                    # sdl92.g:158:48: ( input_params )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
                    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)



                    retval.tree = root_0



                retval.stop = self.input.LT(-1)

                if self._state.backtracking == 0:

                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
                retval.tree = self._adaptor.errorNode(self.input, retval.start, self.input.LT(-1), re)
        finally:

            pass
        return retval

    # $ANTLR end "signal_declaration"

    class channel_return(ParserRuleReturnScope):
        def __init__(self):
            super(sdl92Parser.channel_return, self).__init__()

            self.tree = None




    # $ANTLR start "channel"
1250
    # sdl92.g:161:1: channel : CHANNEL channel_id ( route )+ ENDCHANNEL end -> ^( CHANNEL channel_id ( route )+ ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
    def channel(self, ):

        retval = self.channel_return()
        retval.start = self.input.LT(1)

        root_0 = None

        CHANNEL24 = None
        ENDCHANNEL27 = None
        channel_id25 = None

        route26 = None

        end28 = None


        CHANNEL24_tree = None
        ENDCHANNEL27_tree = None
        stream_CHANNEL = RewriteRuleTokenStream(self._adaptor, "token CHANNEL")
        stream_ENDCHANNEL = RewriteRuleTokenStream(self._adaptor, "token ENDCHANNEL")
        stream_route = RewriteRuleSubtreeStream(self._adaptor, "rule route")
        stream_channel_id = RewriteRuleSubtreeStream(self._adaptor, "rule channel_id")
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
        try:
            try:
1276
1277
                # sdl92.g:162:9: ( CHANNEL channel_id ( route )+ ENDCHANNEL end -> ^( CHANNEL channel_id ( route )+ ) )
                # sdl92.g:162:17: CHANNEL channel_id ( route )+ ENDCHANNEL end
Maxime Perrotin's avatar
Maxime Perrotin committed
1278
                pass 
1279
                CHANNEL24=self.match(self.input, CHANNEL, self.FOLLOW_CHANNEL_in_channel1524) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1280
1281
                if self._state.backtracking == 0:
                    stream_CHANNEL.add(CHANNEL24)
1282
                self._state.following.append(self.FOLLOW_channel_id_in_channel1526)
Maxime Perrotin's avatar
Maxime Perrotin committed
1283
1284
1285
1286
1287
                channel_id25 = self.channel_id()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_channel_id.add(channel_id25.tree)
1288
                # sdl92.g:163:17: ( route )+
Maxime Perrotin's avatar
Maxime Perrotin committed
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
                cnt8 = 0
                while True: #loop8
                    alt8 = 2
                    LA8_0 = self.input.LA(1)

                    if (LA8_0 == FROM) :
                        alt8 = 1


                    if alt8 == 1:
                        # sdl92.g:0:0: route
                        pass 
1301
                        self._state.following.append(self.FOLLOW_route_in_channel1544)
Maxime Perrotin's avatar
Maxime Perrotin committed
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
                        route26 = self.route()

                        self._state.following.pop()
                        if self._state.backtracking == 0:
                            stream_route.add(route26.tree)


                    else:
                        if cnt8 >= 1:
                            break #loop8

                        if self._state.backtracking > 0:
                            raise BacktrackingFailed

                        eee = EarlyExitException(8, self.input)
                        raise eee

                    cnt8 += 1
1320
                ENDCHANNEL27=self.match(self.input, ENDCHANNEL, self.FOLLOW_ENDCHANNEL_in_channel1563) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1321
1322
                if self._state.backtracking == 0:
                    stream_ENDCHANNEL.add(ENDCHANNEL27)
1323
                self._state.following.append(self.FOLLOW_end_in_channel1565)
Maxime Perrotin's avatar
Maxime Perrotin committed
1324
1325
1326
1327
1328
1329
1330
                end28 = self.end()

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

                # AST Rewrite
1331
                # elements: CHANNEL, channel_id, route
Maxime Perrotin's avatar
Maxime Perrotin committed
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
                # 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()
1348
1349
                    # 165:9: -> ^( CHANNEL channel_id ( route )+ )
                    # sdl92.g:165:17: ^( CHANNEL channel_id ( route )+ )
Maxime Perrotin's avatar
Maxime Perrotin committed
1350
1351
1352
1353
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_CHANNEL.nextNode(), root_1)

                    self._adaptor.addChild(root_1, stream_channel_id.nextTree())
1354
                    # sdl92.g:165:38: ( route )+
Maxime Perrotin's avatar
Maxime Perrotin committed
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
                    if not (stream_route.hasNext()):
                        raise RewriteEarlyExitException()

                    while stream_route.hasNext():
                        self._adaptor.addChild(root_1, stream_route.nextTree())


                    stream_route.reset()

                    self._adaptor.addChild(root_0, root_1)



                    retval.tree = root_0



                retval.stop = self.input.LT(-1)

                if self._state.backtracking == 0:

                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
                retval.tree = self._adaptor.errorNode(self.input, retval.start, self.input.LT(-1), re)
        finally:

            pass
        return retval

    # $ANTLR end "channel"

    class route_return(ParserRuleReturnScope):
        def __init__(self):
            super(sdl92Parser.route_return, self).__init__()

            self.tree = None




    # $ANTLR start "route"
1401
    # sdl92.g:168:1: route : FROM source_id TO dest_id WITH signal_id ( ',' signal_id )* end -> ^( ROUTE source_id dest_id ( signal_id )+ ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
    def route(self, ):

        retval = self.route_return()
        retval.start = self.input.LT(1)

        root_0 = None

        FROM29 = None
        TO31 = None
        WITH33 = None
        char_literal35 = None
        source_id30 = None

        dest_id32 = None

        signal_id34 = None

        signal_id36 = None

        end37 = None


        FROM29_tree = None
        TO31_tree = None
        WITH33_tree = None
        char_literal35_tree = None
        stream_FROM = RewriteRuleTokenStream(self._adaptor, "token FROM")
        stream_TO = RewriteRuleTokenStream(self._adaptor, "token TO")
        stream_COMMA = RewriteRuleTokenStream(self._adaptor, "token COMMA")
        stream_WITH = RewriteRuleTokenStream(self._adaptor, "token WITH")
        stream_source_id = RewriteRuleSubtreeStream(self._adaptor, "rule source_id")
        stream_dest_id = RewriteRuleSubtreeStream(self._adaptor, "rule dest_id")
        stream_signal_id = RewriteRuleSubtreeStream(self._adaptor, "rule signal_id")
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
        try:
            try:
1438
1439
                # sdl92.g:169:9: ( FROM source_id TO dest_id WITH signal_id ( ',' signal_id )* end -> ^( ROUTE source_id dest_id ( signal_id )+ ) )
                # sdl92.g:169:17: FROM source_id TO dest_id WITH signal_id ( ',' signal_id )* end
Maxime Perrotin's avatar
Maxime Perrotin committed
1440
                pass 
1441
                FROM29=self.match(self.input, FROM, self.FOLLOW_FROM_in_route1612) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1442
1443
                if self._state.backtracking == 0:
                    stream_FROM.add(FROM29)
1444
                self._state.following.append(self.FOLLOW_source_id_in_route1614)
Maxime Perrotin's avatar
Maxime Perrotin committed
1445
1446
1447
1448
1449
                source_id30 = self.source_id()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_source_id.add(source_id30.tree)
1450
                TO31=self.match(self.input, TO, self.FOLLOW_TO_in_route1616) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1451
1452
                if self._state.backtracking == 0:
                    stream_TO.add(TO31)
1453
                self._state.following.append(self.FOLLOW_dest_id_in_route1618)
Maxime Perrotin's avatar
Maxime Perrotin committed
1454
1455
1456
1457
1458
                dest_id32 = self.dest_id()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_dest_id.add(dest_id32.tree)
1459
                WITH33=self.match(self.input, WITH, self.FOLLOW_WITH_in_route1620) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1460
1461
                if self._state.backtracking == 0:
                    stream_WITH.add(WITH33)
1462
                self._state.following.append(self.FOLLOW_signal_id_in_route1622)
Maxime Perrotin's avatar
Maxime Perrotin committed
1463
1464
1465
1466
1467
                signal_id34 = self.signal_id()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_signal_id.add(signal_id34.tree)
1468
                # sdl92.g:169:58: ( ',' signal_id )*
Maxime Perrotin's avatar
Maxime Perrotin committed
1469
1470
1471
1472
1473
1474
1475
1476
1477
                while True: #loop9
                    alt9 = 2
                    LA9_0 = self.input.LA(1)

                    if (LA9_0 == COMMA) :
                        alt9 = 1


                    if alt9 == 1:
1478
                        # sdl92.g:169:59: ',' signal_id
Maxime Perrotin's avatar
Maxime Perrotin committed
1479
                        pass 
1480
                        char_literal35=self.match(self.input, COMMA, self.FOLLOW_COMMA_in_route1625) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1481
1482
                        if self._state.backtracking == 0:
                            stream_COMMA.add(char_literal35)
1483
                        self._state.following.append(self.FOLLOW_signal_id_in_route1627)
Maxime Perrotin's avatar
Maxime Perrotin committed
1484
1485
1486
1487
1488
1489
1490
1491
1492
                        signal_id36 = self.signal_id()

                        self._state.following.pop()
                        if self._state.backtracking == 0:
                            stream_signal_id.add(signal_id36.tree)


                    else:
                        break #loop9
1493
                self._state.following.append(self.FOLLOW_end_in_route1631)
Maxime Perrotin's avatar
Maxime Perrotin committed
1494
1495
1496
1497
1498
1499
1500
                end37 = self.end()

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

                # AST Rewrite
1501
                # elements: dest_id, source_id, signal_id
Maxime Perrotin's avatar
Maxime Perrotin committed
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
                # 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()
1518
1519
                    # 170:9: -> ^( ROUTE source_id dest_id ( signal_id )+ )
                    # sdl92.g:170:17: ^( ROUTE source_id dest_id ( signal_id )+ )
Maxime Perrotin's avatar
Maxime Perrotin committed
1520
1521
1522
1523
1524
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(self._adaptor.createFromType(ROUTE, "ROUTE"), root_1)

                    self._adaptor.addChild(root_1, stream_source_id.nextTree())
                    self._adaptor.addChild(root_1, stream_dest_id.nextTree())
1525
                    # sdl92.g:170:43: ( signal_id )+
Maxime Perrotin's avatar
Maxime Perrotin committed
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
                    if not (stream_signal_id.hasNext()):
                        raise RewriteEarlyExitException()

                    while stream_signal_id.hasNext():
                        self._adaptor.addChild(root_1, stream_signal_id.nextTree())


                    stream_signal_id.reset()

                    self._adaptor.addChild(root_0, root_1)



                    retval.tree = root_0



                retval.stop = self.input.LT(-1)

                if self._state.backtracking == 0:

                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
                retval.tree = self._adaptor.errorNode(self.input, retval.start, self.input.LT(-1), re)
        finally:

            pass
        return retval

    # $ANTLR end "route"

    class block_definition_return(ParserRuleReturnScope):
        def __init__(self):
            super(sdl92Parser.block_definition_return, self).__init__()

            self.tree = None




    # $ANTLR start "block_definition"
1572
    # sdl92.g:173:1: block_definition : BLOCK block_id end ( entity_in_block )* ENDBLOCK end -> ^( BLOCK block_id ( entity_in_block )* ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
    def block_definition(self, ):

        retval = self.block_definition_return()
        retval.start = self.input.LT(1)

        root_0 = None

        BLOCK38 = None
        ENDBLOCK42 = None
        block_id39 = None

        end40 = None

        entity_in_block41 = None

        end43 = None


        BLOCK38_tree = None
        ENDBLOCK42_tree = None
        stream_ENDBLOCK = RewriteRuleTokenStream(self._adaptor, "token ENDBLOCK")
        stream_BLOCK = RewriteRuleTokenStream(self._adaptor, "token BLOCK")
        stream_entity_in_block = RewriteRuleSubtreeStream(self._adaptor, "rule entity_in_block")
        stream_end = RewriteRuleSubtreeStream(self._adaptor, "rule end")
        stream_block_id = RewriteRuleSubtreeStream(self._adaptor, "rule block_id")
        try:
            try:
1600
1601
                # sdl92.g:174:9: ( BLOCK block_id end ( entity_in_block )* ENDBLOCK end -> ^( BLOCK block_id ( entity_in_block )* ) )
                # sdl92.g:174:17: BLOCK block_id end ( entity_in_block )* ENDBLOCK end
Maxime Perrotin's avatar
Maxime Perrotin committed
1602
                pass 
1603
                BLOCK38=self.match(self.input, BLOCK, self.FOLLOW_BLOCK_in_block_definition1680) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1604
1605
                if self._state.backtracking == 0:
                    stream_BLOCK.add(BLOCK38)
1606
                self._state.following.append(self.FOLLOW_block_id_in_block_definition1682)
Maxime Perrotin's avatar
Maxime Perrotin committed
1607
1608
1609
1610
1611
                block_id39 = self.block_id()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_block_id.add(block_id39.tree)
1612
                self._state.following.append(self.FOLLOW_end_in_block_definition1684)
Maxime Perrotin's avatar
Maxime Perrotin committed
1613
1614
1615
1616
1617
                end40 = self.end()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_end.add(end40.tree)
1618
                # sdl92.g:175:17: ( entity_in_block )*
Maxime Perrotin's avatar
Maxime Perrotin committed
1619
1620
1621
1622
                while True: #loop10
                    alt10 = 2
                    LA10_0 = self.input.LA(1)

1623
                    if (LA10_0 == PROCESS or LA10_0 == SIGNAL or LA10_0 == BLOCK or LA10_0 == CONNECT or LA10_0 == SIGNALROUTE or LA10_0 == 210) :
Maxime Perrotin's avatar
Maxime Perrotin committed
1624
1625
1626
1627
1628
1629
                        alt10 = 1


                    if alt10 == 1:
                        # sdl92.g:0:0: entity_in_block
                        pass 
1630
                        self._state.following.append(self.FOLLOW_entity_in_block_in_block_definition1702)
Maxime Perrotin's avatar
Maxime Perrotin committed
1631
1632
1633
1634
1635
1636
1637
1638
1639
                        entity_in_block41 = self.entity_in_block()

                        self._state.following.pop()
                        if self._state.backtracking == 0:
                            stream_entity_in_block.add(entity_in_block41.tree)


                    else:
                        break #loop10
1640
                ENDBLOCK42=self.match(self.input, ENDBLOCK, self.FOLLOW_ENDBLOCK_in_block_definition1722) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1641
1642
                if self._state.backtracking == 0:
                    stream_ENDBLOCK.add(ENDBLOCK42)
1643
                self._state.following.append(self.FOLLOW_end_in_block_definition1724)
Maxime Perrotin's avatar
Maxime Perrotin committed
1644
1645
1646
1647
1648
1649
1650
                end43 = self.end()

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

                # AST Rewrite
1651
                # elements: entity_in_block, block_id, BLOCK
Maxime Perrotin's avatar
Maxime Perrotin committed
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
                # 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()
1668
1669
                    # 177:9: -> ^( BLOCK block_id ( entity_in_block )* )
                    # sdl92.g:177:17: ^( BLOCK block_id ( entity_in_block )* )
Maxime Perrotin's avatar
Maxime Perrotin committed
1670
1671
1672
1673
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_BLOCK.nextNode(), root_1)

                    self._adaptor.addChild(root_1, stream_block_id.nextTree())
1674
                    # sdl92.g:177:34: ( entity_in_block )*
Maxime Perrotin's avatar
Maxime Perrotin committed
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
                    while stream_entity_in_block.hasNext():
                        self._adaptor.addChild(root_1, stream_entity_in_block.nextTree())


                    stream_entity_in_block.reset();

                    self._adaptor.addChild(root_0, root_1)



                    retval.tree = root_0



                retval.stop = self.input.LT(-1)

                if self._state.backtracking == 0:

                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
                retval.tree = self._adaptor.errorNode(self.input, retval.start, self.input.LT(-1), re)
        finally:

            pass
        return retval

    # $ANTLR end "block_definition"

    class entity_in_block_return(ParserRuleReturnScope):
        def __init__(self):
            super(sdl92Parser.entity_in_block_return, self).__init__()

            self.tree = None




    # $ANTLR start "entity_in_block"
1718
    # sdl92.g:184:1: entity_in_block : ( signal_declaration | signalroute | connection | block_definition | process_definition );
Maxime Perrotin's avatar
Maxime Perrotin committed
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
    def entity_in_block(self, ):

        retval = self.entity_in_block_return()
        retval.start = self.input.LT(1)

        root_0 = None

        signal_declaration44 = None

        signalroute45 = None

        connection46 = None

        block_definition47 = None

        process_definition48 = None



        try:
            try:
1740
                # sdl92.g:185:9: ( signal_declaration | signalroute | connection | block_definition | process_definition )
Maxime Perrotin's avatar
Maxime Perrotin committed
1741
1742
                alt11 = 5
                LA11 = self.input.LA(1)
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
                if LA11 == 210:
                    LA11_1 = self.input.LA(2)

                    if (LA11_1 == LABEL or LA11_1 == COMMENT or LA11_1 == PROCESS or LA11_1 == STATE or LA11_1 == PROVIDED or LA11_1 == INPUT or (PROCEDURE_CALL <= LA11_1 <= PROCEDURE) or LA11_1 == DECISION or LA11_1 == ANSWER or LA11_1 == OUTPUT or (TEXT <= LA11_1 <= JOIN) or LA11_1 == RETURN or LA11_1 == TASK or LA11_1 == STOP or LA11_1 == CONNECT or LA11_1 == START) :
                        alt11 = 5
                    elif (LA11_1 == KEEP) :
                        alt11 = 1
                    else:
                        if self._state.backtracking > 0:
                            raise BacktrackingFailed

                        nvae = NoViableAltException("", 11, 1, self.input)

                        raise nvae

                elif LA11 == SIGNAL:
Maxime Perrotin's avatar
Maxime Perrotin committed
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
                    alt11 = 1
                elif LA11 == SIGNALROUTE:
                    alt11 = 2
                elif LA11 == CONNECT:
                    alt11 = 3
                elif LA11 == BLOCK:
                    alt11 = 4
                elif LA11 == PROCESS:
                    alt11 = 5
                else:
                    if self._state.backtracking > 0:
                        raise BacktrackingFailed

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

                    raise nvae

                if alt11 == 1:
1777
                    # sdl92.g:185:17: signal_declaration
Maxime Perrotin's avatar
Maxime Perrotin committed
1778
1779
1780
                    pass 
                    root_0 = self._adaptor.nil()

1781
                    self._state.following.append(self.FOLLOW_signal_declaration_in_entity_in_block1773)
Maxime Perrotin's avatar
Maxime Perrotin committed
1782
1783
1784
1785
1786
1787
1788
1789
                    signal_declaration44 = self.signal_declaration()

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


                elif alt11 == 2:
1790
                    # sdl92.g:186:19: signalroute
Maxime Perrotin's avatar
Maxime Perrotin committed
1791
1792
1793
                    pass 
                    root_0 = self._adaptor.nil()

1794
                    self._state.following.append(self.FOLLOW_signalroute_in_entity_in_block1793)
Maxime Perrotin's avatar
Maxime Perrotin committed
1795
1796
1797
1798
1799
1800
1801
1802
                    signalroute45 = self.signalroute()

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


                elif alt11 == 3:
1803
                    # sdl92.g:187:19: connection
Maxime Perrotin's avatar
Maxime Perrotin committed
1804
1805
1806
                    pass 
                    root_0 = self._adaptor.nil()

1807
                    self._state.following.append(self.FOLLOW_connection_in_entity_in_block1813)
Maxime Perrotin's avatar
Maxime Perrotin committed
1808
1809
1810
1811
1812
1813
1814
1815
                    connection46 = self.connection()

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


                elif alt11 == 4:
1816
                    # sdl92.g:188:19: block_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
1817
1818
1819
                    pass 
                    root_0 = self._adaptor.nil()

1820
                    self._state.following.append(self.FOLLOW_block_definition_in_entity_in_block1833)
Maxime Perrotin's avatar
Maxime Perrotin committed
1821
1822
1823
1824
1825
1826
1827
1828
                    block_definition47 = self.block_definition()

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


                elif alt11 == 5:
1829
                    # sdl92.g:189:19: process_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
1830
1831
1832
                    pass 
                    root_0 = self._adaptor.nil()

1833
                    self._state.following.append(self.FOLLOW_process_definition_in_entity_in_block1853)
Maxime Perrotin's avatar
Maxime Perrotin committed
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
                    process_definition48 = self.process_definition()

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


                retval.stop = self.input.LT(-1)

                if self._state.backtracking == 0:

                    retval.tree = self._adaptor.rulePostProcessing(root_0)
                    self._adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop)


            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
                retval.tree = self._adaptor.errorNode(self.input, retval.start, self.input.LT(-1), re)
        finally:

            pass
        return retval

    # $ANTLR end "entity_in_block"

    class signalroute_return(ParserRuleReturnScope):
        def __init__(self):
            super(sdl92Parser.signalroute_return, self).__init__()

            self.tree = None




    # $ANTLR start "signalroute"
1870
    # sdl92.g:192:1: signalroute : SIGNALROUTE route_id ( route )+ -> ^( SIGNALROUTE route_id ( route )+ ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
    def signalroute(self, ):

        retval = self.signalroute_return()
        retval.start = self.input.LT(1)

        root_0 = None

        SIGNALROUTE49 = None
        route_id50 = None

        route51 = None


        SIGNALROUTE49_tree = None
        stream_SIGNALROUTE = RewriteRuleTokenStream(self._adaptor, "token SIGNALROUTE")
        stream_route_id = RewriteRuleSubtreeStream(self._adaptor, "rule route_id")
        stream_route = RewriteRuleSubtreeStream(self._adaptor, "rule route")
        try:
            try:
1890
1891
                # sdl92.g:193:9: ( SIGNALROUTE route_id ( route )+ -> ^( SIGNALROUTE route_id ( route )+ ) )
                # sdl92.g:193:17: SIGNALROUTE route_id ( route )+
Maxime Perrotin's avatar
Maxime Perrotin committed
1892
                pass 
1893
                SIGNALROUTE49=self.match(self.input, SIGNALROUTE, self.FOLLOW_SIGNALROUTE_in_signalroute1876) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1894
1895
                if self._state.backtracking == 0:
                    stream_SIGNALROUTE.add(SIGNALROUTE49)