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

# 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", 
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
    "COMPOSITE_STATE", "CONNECT", "SYNTYPE", "ENDSYNTYPE", "NEWTYPE", "ENDNEWTYPE", 
    "ARRAY", "CONSTANTS", "STRUCT", "FIELDS", "FIELD", "ENDSYSTEM", "ENDCHANNEL", 
    "FROM", "WITH", "ENDBLOCK", "SIGNALROUTE", "AND", "REFERENCED", "ENDPROCESS", 
    "ENDPROCEDURE", "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", 
    "Q", "Z", "':'", "'TO'", "'VIA'", "'ALL'", "'!'", "'(.'", "'.)'", "'ERROR'", 
    "'ACTIVE'", "'ANY'", "'IMPORT'", "'VIEW'", "'/* CIF'", "'*/'"
Maxime Perrotin's avatar
Maxime Perrotin committed
269
270
271
272
273
274
275
]




class sdl92Parser(Parser):
    grammarFileName = "sdl92.g"
Maxime Perrotin's avatar
Maxime Perrotin committed
276
277
    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"
Maxime Perrotin's avatar
Maxime Perrotin committed
278
279
280
281
282
283
284
285
    tokenNames = tokenNames

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

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

286
287
288
289
290
291
292
293
294
        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
295
296
            )

297
298
299
300
301
302
303
304
305
        self.dfa37 = self.DFA37(
            self, 37,
            eot = self.DFA37_eot,
            eof = self.DFA37_eof,
            min = self.DFA37_min,
            max = self.DFA37_max,
            accept = self.DFA37_accept,
            special = self.DFA37_special,
            transition = self.DFA37_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
306
307
            )

308
309
310
311
312
313
314
315
316
        self.dfa42 = self.DFA42(
            self, 42,
            eot = self.DFA42_eot,
            eof = self.DFA42_eof,
            min = self.DFA42_min,
            max = self.DFA42_max,
            accept = self.DFA42_accept,
            special = self.DFA42_special,
            transition = self.DFA42_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
317
318
            )

319
320
321
322
323
324
325
326
327
        self.dfa43 = self.DFA43(
            self, 43,
            eot = self.DFA43_eot,
            eof = self.DFA43_eof,
            min = self.DFA43_min,
            max = self.DFA43_max,
            accept = self.DFA43_accept,
            special = self.DFA43_special,
            transition = self.DFA43_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
328
329
            )

330
331
332
333
334
335
336
337
338
        self.dfa47 = self.DFA47(
            self, 47,
            eot = self.DFA47_eot,
            eof = self.DFA47_eof,
            min = self.DFA47_min,
            max = self.DFA47_max,
            accept = self.DFA47_accept,
            special = self.DFA47_special,
            transition = self.DFA47_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
339
340
            )

341
342
343
344
345
346
347
348
349
        self.dfa65 = self.DFA65(
            self, 65,
            eot = self.DFA65_eot,
            eof = self.DFA65_eof,
            min = self.DFA65_min,
            max = self.DFA65_max,
            accept = self.DFA65_accept,
            special = self.DFA65_special,
            transition = self.DFA65_transition
350
351
            )

352
353
354
355
356
357
358
359
360
        self.dfa66 = self.DFA66(
            self, 66,
            eot = self.DFA66_eot,
            eof = self.DFA66_eof,
            min = self.DFA66_min,
            max = self.DFA66_max,
            accept = self.DFA66_accept,
            special = self.DFA66_special,
            transition = self.DFA66_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
361
362
            )

363
364
365
366
367
368
369
370
371
        self.dfa67 = self.DFA67(
            self, 67,
            eot = self.DFA67_eot,
            eof = self.DFA67_eof,
            min = self.DFA67_min,
            max = self.DFA67_max,
            accept = self.DFA67_accept,
            special = self.DFA67_special,
            transition = self.DFA67_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
372
373
            )

374
375
376
377
378
379
380
381
382
        self.dfa71 = self.DFA71(
            self, 71,
            eot = self.DFA71_eot,
            eof = self.DFA71_eof,
            min = self.DFA71_min,
            max = self.DFA71_max,
            accept = self.DFA71_accept,
            special = self.DFA71_special,
            transition = self.DFA71_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
383
384
            )

385
386
387
388
389
390
391
392
393
        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
394
395
            )

396
397
398
399
400
401
402
403
404
        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
405
406
            )

407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
        self.dfa91 = self.DFA91(
            self, 91,
            eot = self.DFA91_eot,
            eof = self.DFA91_eof,
            min = self.DFA91_min,
            max = self.DFA91_max,
            accept = self.DFA91_accept,
            special = self.DFA91_special,
            transition = self.DFA91_transition
            )

        self.dfa88 = self.DFA88(
            self, 88,
            eot = self.DFA88_eot,
            eof = self.DFA88_eof,
            min = self.DFA88_min,
            max = self.DFA88_max,
            accept = self.DFA88_accept,
            special = self.DFA88_special,
            transition = self.DFA88_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
427
428
            )

429
430
431
432
433
434
435
436
437
        self.dfa89 = self.DFA89(
            self, 89,
            eot = self.DFA89_eot,
            eof = self.DFA89_eof,
            min = self.DFA89_min,
            max = self.DFA89_max,
            accept = self.DFA89_accept,
            special = self.DFA89_special,
            transition = self.DFA89_transition
438
439
            )

440
441
442
443
444
445
446
447
448
        self.dfa90 = self.DFA90(
            self, 90,
            eot = self.DFA90_eot,
            eof = self.DFA90_eof,
            min = self.DFA90_min,
            max = self.DFA90_max,
            accept = self.DFA90_accept,
            special = self.DFA90_special,
            transition = self.DFA90_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
449
450
            )

451
452
453
454
455
456
457
458
459
        self.dfa92 = self.DFA92(
            self, 92,
            eot = self.DFA92_eot,
            eof = self.DFA92_eof,
            min = self.DFA92_min,
            max = self.DFA92_max,
            accept = self.DFA92_accept,
            special = self.DFA92_special,
            transition = self.DFA92_transition
460
461
            )

462
463
464
465
466
467
468
469
470
        self.dfa93 = self.DFA93(
            self, 93,
            eot = self.DFA93_eot,
            eof = self.DFA93_eof,
            min = self.DFA93_min,
            max = self.DFA93_max,
            accept = self.DFA93_accept,
            special = self.DFA93_special,
            transition = self.DFA93_transition
471
472
            )

473
474
475
476
477
478
479
480
481
        self.dfa104 = self.DFA104(
            self, 104,
            eot = self.DFA104_eot,
            eof = self.DFA104_eof,
            min = self.DFA104_min,
            max = self.DFA104_max,
            accept = self.DFA104_accept,
            special = self.DFA104_special,
            transition = self.DFA104_transition
482
483
            )

484
485
486
487
488
489
490
491
492
        self.dfa102 = self.DFA102(
            self, 102,
            eot = self.DFA102_eot,
            eof = self.DFA102_eof,
            min = self.DFA102_min,
            max = self.DFA102_max,
            accept = self.DFA102_accept,
            special = self.DFA102_special,
            transition = self.DFA102_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
493
494
            )

495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
        self.dfa112 = self.DFA112(
            self, 112,
            eot = self.DFA112_eot,
            eof = self.DFA112_eof,
            min = self.DFA112_min,
            max = self.DFA112_max,
            accept = self.DFA112_accept,
            special = self.DFA112_special,
            transition = self.DFA112_transition
            )

        self.dfa149 = self.DFA149(
            self, 149,
            eot = self.DFA149_eot,
            eof = self.DFA149_eof,
            min = self.DFA149_min,
            max = self.DFA149_max,
            accept = self.DFA149_accept,
            special = self.DFA149_special,
            transition = self.DFA149_transition
            )

        self.dfa159 = self.DFA159(
            self, 159,
            eot = self.DFA159_eot,
            eof = self.DFA159_eof,
            min = self.DFA159_min,
            max = self.DFA159_max,
            accept = self.DFA159_accept,
            special = self.DFA159_special,
            transition = self.DFA159_transition
            )

        self.dfa169 = self.DFA169(
            self, 169,
            eot = self.DFA169_eot,
            eof = self.DFA169_eof,
            min = self.DFA169_min,
            max = self.DFA169_max,
            accept = self.DFA169_accept,
            special = self.DFA169_special,
            transition = self.DFA169_transition
Maxime Perrotin's avatar
Maxime Perrotin committed
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
            )






        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"
569
    # sdl92.g:133:1: pr_file : ( use_clause | system_definition | process_definition )+ ;
Maxime Perrotin's avatar
Maxime Perrotin committed
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
    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:
587
588
                # sdl92.g:134:9: ( ( use_clause | system_definition | process_definition )+ )
                # sdl92.g:134:17: ( use_clause | system_definition | process_definition )+
Maxime Perrotin's avatar
Maxime Perrotin committed
589
590
591
                pass 
                root_0 = self._adaptor.nil()

592
                # sdl92.g:134:17: ( use_clause | system_definition | process_definition )+
Maxime Perrotin's avatar
Maxime Perrotin committed
593
594
595
596
                cnt1 = 0
                while True: #loop1
                    alt1 = 4
                    LA1 = self.input.LA(1)
597
                    if LA1 == 221:
598
599
                        LA1_2 = self.input.LA(2)

600
                        if (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) :
601
                            alt1 = 3
602
603
                        elif (LA1_2 == KEEP) :
                            alt1 = 1
604
605
606


                    elif LA1 == USE:
Maxime Perrotin's avatar
Maxime Perrotin committed
607
608
609
610
611
612
613
                        alt1 = 1
                    elif LA1 == SYSTEM:
                        alt1 = 2
                    elif LA1 == PROCESS:
                        alt1 = 3

                    if alt1 == 1:
614
                        # sdl92.g:134:18: use_clause
Maxime Perrotin's avatar
Maxime Perrotin committed
615
                        pass 
616
                        self._state.following.append(self.FOLLOW_use_clause_in_pr_file1233)
Maxime Perrotin's avatar
Maxime Perrotin committed
617
618
619
620
621
622
623
624
                        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:
625
                        # sdl92.g:135:19: system_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
626
                        pass 
627
                        self._state.following.append(self.FOLLOW_system_definition_in_pr_file1253)
Maxime Perrotin's avatar
Maxime Perrotin committed
628
629
630
631
632
633
634
635
                        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:
636
                        # sdl92.g:136:19: process_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
637
                        pass 
638
                        self._state.following.append(self.FOLLOW_process_definition_in_pr_file1273)
Maxime Perrotin's avatar
Maxime Perrotin committed
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
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
                        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"
689
    # sdl92.g:139: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
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
    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:
719
720
                # sdl92.g:140:9: ( SYSTEM system_name end ( entity_in_system )* ENDSYSTEM ( system_name )? end -> ^( SYSTEM system_name ( entity_in_system )* ) )
                # sdl92.g:140:17: SYSTEM system_name end ( entity_in_system )* ENDSYSTEM ( system_name )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
721
                pass 
722
                SYSTEM4=self.match(self.input, SYSTEM, self.FOLLOW_SYSTEM_in_system_definition1298) 
Maxime Perrotin's avatar
Maxime Perrotin committed
723
724
                if self._state.backtracking == 0:
                    stream_SYSTEM.add(SYSTEM4)
725
                self._state.following.append(self.FOLLOW_system_name_in_system_definition1300)
Maxime Perrotin's avatar
Maxime Perrotin committed
726
727
728
729
730
                system_name5 = self.system_name()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_system_name.add(system_name5.tree)
731
                self._state.following.append(self.FOLLOW_end_in_system_definition1302)
Maxime Perrotin's avatar
Maxime Perrotin committed
732
733
734
735
736
                end6 = self.end()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_end.add(end6.tree)
737
                # sdl92.g:141:17: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
738
739
740
741
                while True: #loop2
                    alt2 = 2
                    LA2_0 = self.input.LA(1)

742
                    if (LA2_0 == PROCEDURE or (SIGNAL <= LA2_0 <= CHANNEL) or LA2_0 == BLOCK or LA2_0 == 221) :
Maxime Perrotin's avatar
Maxime Perrotin committed
743
744
745
746
747
748
                        alt2 = 1


                    if alt2 == 1:
                        # sdl92.g:0:0: entity_in_system
                        pass 
749
                        self._state.following.append(self.FOLLOW_entity_in_system_in_system_definition1320)
Maxime Perrotin's avatar
Maxime Perrotin committed
750
751
752
753
754
755
756
757
758
                        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
759
                ENDSYSTEM8=self.match(self.input, ENDSYSTEM, self.FOLLOW_ENDSYSTEM_in_system_definition1339) 
Maxime Perrotin's avatar
Maxime Perrotin committed
760
761
                if self._state.backtracking == 0:
                    stream_ENDSYSTEM.add(ENDSYSTEM8)
762
                # sdl92.g:142:27: ( system_name )?
Maxime Perrotin's avatar
Maxime Perrotin committed
763
764
765
766
767
768
769
770
                alt3 = 2
                LA3_0 = self.input.LA(1)

                if (LA3_0 == ID) :
                    alt3 = 1
                if alt3 == 1:
                    # sdl92.g:0:0: system_name
                    pass 
771
                    self._state.following.append(self.FOLLOW_system_name_in_system_definition1341)
Maxime Perrotin's avatar
Maxime Perrotin committed
772
773
774
775
776
777
778
779
                    system_name9 = self.system_name()

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



780
                self._state.following.append(self.FOLLOW_end_in_system_definition1344)
Maxime Perrotin's avatar
Maxime Perrotin committed
781
782
783
784
785
786
787
                end10 = self.end()

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

                # AST Rewrite
Maxime Perrotin's avatar
Maxime Perrotin committed
788
                # elements: system_name, entity_in_system, SYSTEM
Maxime Perrotin's avatar
Maxime Perrotin committed
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
                # 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()
805
806
                    # 143:9: -> ^( SYSTEM system_name ( entity_in_system )* )
                    # sdl92.g:143:17: ^( SYSTEM system_name ( entity_in_system )* )
Maxime Perrotin's avatar
Maxime Perrotin committed
807
808
809
810
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_SYSTEM.nextNode(), root_1)

                    self._adaptor.addChild(root_1, stream_system_name.nextTree())
811
                    # sdl92.g:143:38: ( entity_in_system )*
Maxime Perrotin's avatar
Maxime Perrotin committed
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
                    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"
855
    # sdl92.g:146:1: use_clause : ( use_asn1 )? USE package_name end -> ^( USE ( use_asn1 )? package_name ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
    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:
878
879
                # sdl92.g:147:9: ( ( use_asn1 )? USE package_name end -> ^( USE ( use_asn1 )? package_name ) )
                # sdl92.g:147:17: ( use_asn1 )? USE package_name end
Maxime Perrotin's avatar
Maxime Perrotin committed
880
                pass 
881
                # sdl92.g:147:17: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
882
883
884
                alt4 = 2
                LA4_0 = self.input.LA(1)

885
                if (LA4_0 == 221) :
Maxime Perrotin's avatar
Maxime Perrotin committed
886
887
888
889
                    alt4 = 1
                if alt4 == 1:
                    # sdl92.g:0:0: use_asn1
                    pass 
890
                    self._state.following.append(self.FOLLOW_use_asn1_in_use_clause1391)
Maxime Perrotin's avatar
Maxime Perrotin committed
891
892
893
894
895
896
897
898
                    use_asn111 = self.use_asn1()

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



899
                USE12=self.match(self.input, USE, self.FOLLOW_USE_in_use_clause1410) 
Maxime Perrotin's avatar
Maxime Perrotin committed
900
901
                if self._state.backtracking == 0:
                    stream_USE.add(USE12)
902
                self._state.following.append(self.FOLLOW_package_name_in_use_clause1412)
Maxime Perrotin's avatar
Maxime Perrotin committed
903
904
905
906
907
                package_name13 = self.package_name()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_package_name.add(package_name13.tree)
908
                self._state.following.append(self.FOLLOW_end_in_use_clause1414)
Maxime Perrotin's avatar
Maxime Perrotin committed
909
910
911
912
913
914
915
                end14 = self.end()

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

                # AST Rewrite
Maxime Perrotin's avatar
Maxime Perrotin committed
916
                # elements: USE, package_name, use_asn1
Maxime Perrotin's avatar
Maxime Perrotin committed
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
                # 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()
933
934
                    # 149:9: -> ^( USE ( use_asn1 )? package_name )
                    # sdl92.g:149:17: ^( USE ( use_asn1 )? package_name )
Maxime Perrotin's avatar
Maxime Perrotin committed
935
936
937
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_USE.nextNode(), root_1)

938
                    # sdl92.g:149:23: ( use_asn1 )?
Maxime Perrotin's avatar
Maxime Perrotin committed
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
                    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"
983
    # sdl92.g:155:1: entity_in_system : ( signal_declaration | procedure | channel | block_definition );
Maxime Perrotin's avatar
Maxime Perrotin committed
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
    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:
1003
                # sdl92.g:156:9: ( signal_declaration | procedure | channel | block_definition )
Maxime Perrotin's avatar
Maxime Perrotin committed
1004
1005
                alt5 = 4
                LA5 = self.input.LA(1)
1006
                if LA5 == 221:
Maxime Perrotin's avatar
Maxime Perrotin committed
1007
1008
                    LA5_1 = self.input.LA(2)

1009
                    if (LA5_1 == KEEP) :
Maxime Perrotin's avatar
Maxime Perrotin committed
1010
                        alt5 = 1
1011
1012
                    elif (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) :
                        alt5 = 2
Maxime Perrotin's avatar
Maxime Perrotin committed
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
                    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:
1038
                    # sdl92.g:156:17: signal_declaration
Maxime Perrotin's avatar
Maxime Perrotin committed
1039
1040
1041
                    pass 
                    root_0 = self._adaptor.nil()

1042
                    self._state.following.append(self.FOLLOW_signal_declaration_in_entity_in_system1463)
Maxime Perrotin's avatar
Maxime Perrotin committed
1043
1044
1045
1046
1047
1048
1049
1050
                    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:
1051
                    # sdl92.g:157:19: procedure
Maxime Perrotin's avatar
Maxime Perrotin committed
1052
1053
1054
                    pass 
                    root_0 = self._adaptor.nil()

1055
                    self._state.following.append(self.FOLLOW_procedure_in_entity_in_system1483)
Maxime Perrotin's avatar
Maxime Perrotin committed
1056
1057
1058
1059
1060
1061
1062
1063
                    procedure16 = self.procedure()

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


                elif alt5 == 3:
1064
                    # sdl92.g:158:19: channel
Maxime Perrotin's avatar
Maxime Perrotin committed
1065
1066
1067
                    pass 
                    root_0 = self._adaptor.nil()

1068
                    self._state.following.append(self.FOLLOW_channel_in_entity_in_system1503)
Maxime Perrotin's avatar
Maxime Perrotin committed
1069
1070
1071
1072
1073
1074
1075
1076
                    channel17 = self.channel()

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


                elif alt5 == 4:
1077
                    # sdl92.g:159:19: block_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
1078
1079
1080
                    pass 
                    root_0 = self._adaptor.nil()

1081
                    self._state.following.append(self.FOLLOW_block_definition_in_entity_in_system1523)
Maxime Perrotin's avatar
Maxime Perrotin committed
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
                    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"
1118
    # sdl92.g:164:1: signal_declaration : ( paramnames )? SIGNAL signal_id ( input_params )? end -> ^( SIGNAL ( paramnames )? signal_id ( input_params )? ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
    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:
1144
1145
                # sdl92.g:165:9: ( ( paramnames )? SIGNAL signal_id ( input_params )? end -> ^( SIGNAL ( paramnames )? signal_id ( input_params )? ) )
                # sdl92.g:165:17: ( paramnames )? SIGNAL signal_id ( input_params )? end
Maxime Perrotin's avatar
Maxime Perrotin committed
1146
                pass 
1147
                # sdl92.g:165:17: ( paramnames )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1148
1149
1150
                alt6 = 2
                LA6_0 = self.input.LA(1)

1151
                if (LA6_0 == 221) :
Maxime Perrotin's avatar
Maxime Perrotin committed
1152
1153
1154
1155
                    alt6 = 1
                if alt6 == 1:
                    # sdl92.g:0:0: paramnames
                    pass 
1156
                    self._state.following.append(self.FOLLOW_paramnames_in_signal_declaration1547)
Maxime Perrotin's avatar
Maxime Perrotin committed
1157
1158
1159
1160
1161
1162
1163
1164
                    paramnames19 = self.paramnames()

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



1165
                SIGNAL20=self.match(self.input, SIGNAL, self.FOLLOW_SIGNAL_in_signal_declaration1566) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1166
1167
                if self._state.backtracking == 0:
                    stream_SIGNAL.add(SIGNAL20)
1168
                self._state.following.append(self.FOLLOW_signal_id_in_signal_declaration1568)
Maxime Perrotin's avatar
Maxime Perrotin committed
1169
1170
1171
1172
1173
                signal_id21 = self.signal_id()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_signal_id.add(signal_id21.tree)
1174
                # sdl92.g:166:34: ( input_params )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1175
1176
1177
1178
1179
1180
1181
1182
                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 
1183
                    self._state.following.append(self.FOLLOW_input_params_in_signal_declaration1570)
Maxime Perrotin's avatar
Maxime Perrotin committed
1184
1185
1186
1187
1188
1189
1190
1191
                    input_params22 = self.input_params()

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



1192
                self._state.following.append(self.FOLLOW_end_in_signal_declaration1573)
Maxime Perrotin's avatar
Maxime Perrotin committed
1193
1194
1195
1196
1197
1198
1199
                end23 = self.end()

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

                # AST Rewrite
Maxime Perrotin's avatar
Maxime Perrotin committed
1200
                # elements: paramnames, SIGNAL, signal_id, input_params
Maxime Perrotin's avatar
Maxime Perrotin committed
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
                # 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()
1217
1218
                    # 167:9: -> ^( SIGNAL ( paramnames )? signal_id ( input_params )? )
                    # sdl92.g:167:17: ^( SIGNAL ( paramnames )? signal_id ( input_params )? )
Maxime Perrotin's avatar
Maxime Perrotin committed
1219
1220
1221
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_SIGNAL.nextNode(), root_1)

1222
                    # sdl92.g:167:26: ( paramnames )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1223
1224
1225
1226
1227
1228
                    if stream_paramnames.hasNext():
                        self._adaptor.addChild(root_1, stream_paramnames.nextTree())


                    stream_paramnames.reset();
                    self._adaptor.addChild(root_1, stream_signal_id.nextTree())
1229
                    # sdl92.g:167:48: ( input_params )?
Maxime Perrotin's avatar
Maxime Perrotin committed
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
                    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"
1273
    # sdl92.g:170:1: channel : CHANNEL channel_id ( route )+ ENDCHANNEL end -> ^( CHANNEL channel_id ( route )+ ) ;
Maxime Perrotin's avatar
Maxime Perrotin committed
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
    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:
1299
1300
                # sdl92.g:171:9: ( CHANNEL channel_id ( route )+ ENDCHANNEL end -> ^( CHANNEL channel_id ( route )+ ) )
                # sdl92.g:171:17: CHANNEL channel_id ( route )+ ENDCHANNEL end
Maxime Perrotin's avatar
Maxime Perrotin committed
1301
                pass 
1302
                CHANNEL24=self.match(self.input, CHANNEL, self.FOLLOW_CHANNEL_in_channel1623) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1303
1304
                if self._state.backtracking == 0:
                    stream_CHANNEL.add(CHANNEL24)
1305
                self._state.following.append(self.FOLLOW_channel_id_in_channel1625)
Maxime Perrotin's avatar
Maxime Perrotin committed
1306
1307
1308
1309
1310
                channel_id25 = self.channel_id()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_channel_id.add(channel_id25.tree)
1311
                # sdl92.g:172:17: ( route )+
Maxime Perrotin's avatar
Maxime Perrotin committed
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
                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 
1324
                        self._state.following.append(self.FOLLOW_route_in_channel1643)
Maxime Perrotin's avatar
Maxime Perrotin committed
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
                        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
1343
                ENDCHANNEL27=self.match(self.input, ENDCHANNEL, self.FOLLOW_ENDCHANNEL_in_channel1662) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1344
1345
                if self._state.backtracking == 0:
                    stream_ENDCHANNEL.add(ENDCHANNEL27)
1346
                self._state.following.append(self.FOLLOW_end_in_channel1664)
Maxime Perrotin's avatar
Maxime Perrotin committed
1347
1348
1349
1350
1351
1352
1353
                end28 = self.end()

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

                # AST Rewrite
Maxime Perrotin's avatar
Maxime Perrotin committed
1354
                # elements: channel_id, route, CHANNEL
Maxime Perrotin's avatar
Maxime Perrotin committed
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
                # 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()
1371
1372
                    # 174:9: -> ^( CHANNEL channel_id ( route )+ )
                    # sdl92.g:174:17: ^( CHANNEL channel_id ( route )+ )
Maxime Perrotin's avatar
Maxime Perrotin committed
1373
1374
1375
1376
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_CHANNEL.nextNode(), root_1)

                    self._adaptor.addChild(root_1, stream_channel_id.nextTree())
1377
                    # sdl92.g:174:38: ( route )+
Maxime Perrotin's avatar
Maxime Perrotin committed
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
                    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"
1424
    # sdl92.g:177: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
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
    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:
1461
1462
                # sdl92.g:178:9: ( FROM source_id TO dest_id WITH signal_id ( ',' signal_id )* end -> ^( ROUTE source_id dest_id ( signal_id )+ ) )
                # sdl92.g:178:17: FROM source_id TO dest_id WITH signal_id ( ',' signal_id )* end
Maxime Perrotin's avatar
Maxime Perrotin committed
1463
                pass 
1464
                FROM29=self.match(self.input, FROM, self.FOLLOW_FROM_in_route1711) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1465
1466
                if self._state.backtracking == 0:
                    stream_FROM.add(FROM29)
1467
                self._state.following.append(self.FOLLOW_source_id_in_route1713)
Maxime Perrotin's avatar
Maxime Perrotin committed
1468
1469
1470
1471
1472
                source_id30 = self.source_id()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_source_id.add(source_id30.tree)
1473
                TO31=self.match(self.input, TO, self.FOLLOW_TO_in_route1715) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1474
1475
                if self._state.backtracking == 0:
                    stream_TO.add(TO31)
1476
                self._state.following.append(self.FOLLOW_dest_id_in_route1717)
Maxime Perrotin's avatar
Maxime Perrotin committed
1477
1478
1479
1480
1481
                dest_id32 = self.dest_id()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_dest_id.add(dest_id32.tree)
1482
                WITH33=self.match(self.input, WITH, self.FOLLOW_WITH_in_route1719) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1483
1484
                if self._state.backtracking == 0:
                    stream_WITH.add(WITH33)
1485
                self._state.following.append(self.FOLLOW_signal_id_in_route1721)
Maxime Perrotin's avatar
Maxime Perrotin committed
1486
1487
1488
1489
1490
                signal_id34 = self.signal_id()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_signal_id.add(signal_id34.tree)
1491
                # sdl92.g:178:58: ( ',' signal_id )*
Maxime Perrotin's avatar
Maxime Perrotin committed
1492
1493
1494
1495
1496
1497
1498
1499
1500
                while True: #loop9
                    alt9 = 2
                    LA9_0 = self.input.LA(1)

                    if (LA9_0 == COMMA) :
                        alt9 = 1


                    if alt9 == 1:
1501
                        # sdl92.g:178:59: ',' signal_id
Maxime Perrotin's avatar
Maxime Perrotin committed
1502
                        pass 
1503
                        char_literal35=self.match(self.input, COMMA, self.FOLLOW_COMMA_in_route1724) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1504
1505
                        if self._state.backtracking == 0:
                            stream_COMMA.add(char_literal35)
1506
                        self._state.following.append(self.FOLLOW_signal_id_in_route1726)
Maxime Perrotin's avatar
Maxime Perrotin committed
1507
1508
1509
1510
1511
1512
1513
1514
1515
                        signal_id36 = self.signal_id()

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


                    else:
                        break #loop9
1516
                self._state.following.append(self.FOLLOW_end_in_route1730)
Maxime Perrotin's avatar
Maxime Perrotin committed
1517
1518
1519
1520
1521
1522
1523
                end37 = self.end()

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

                # AST Rewrite
1524
                # elements: source_id, signal_id, dest_id
Maxime Perrotin's avatar
Maxime Perrotin committed
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
                # 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()
1541
1542
                    # 179:9: -> ^( ROUTE source_id dest_id ( signal_id )+ )
                    # sdl92.g:179:17: ^( ROUTE source_id dest_id ( signal_id )+ )
Maxime Perrotin's avatar
Maxime Perrotin committed
1543
1544
1545
1546
1547
                    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())
1548
                    # sdl92.g:179:43: ( signal_id )+
Maxime Perrotin's avatar
Maxime Perrotin committed
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
                    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"
1595
    # sdl92.g:182: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
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
    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:
1623
1624
                # sdl92.g:183:9: ( BLOCK block_id end ( entity_in_block )* ENDBLOCK end -> ^( BLOCK block_id ( entity_in_block )* ) )
                # sdl92.g:183:17: BLOCK block_id end ( entity_in_block )* ENDBLOCK end
Maxime Perrotin's avatar
Maxime Perrotin committed
1625
                pass 
1626
                BLOCK38=self.match(self.input, BLOCK, self.FOLLOW_BLOCK_in_block_definition1779) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1627
1628
                if self._state.backtracking == 0:
                    stream_BLOCK.add(BLOCK38)
1629
                self._state.following.append(self.FOLLOW_block_id_in_block_definition1781)
Maxime Perrotin's avatar
Maxime Perrotin committed
1630
1631
1632
1633
1634
                block_id39 = self.block_id()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_block_id.add(block_id39.tree)
1635
                self._state.following.append(self.FOLLOW_end_in_block_definition1783)
Maxime Perrotin's avatar
Maxime Perrotin committed
1636
1637
1638
1639
1640
                end40 = self.end()

                self._state.following.pop()
                if self._state.backtracking == 0:
                    stream_end.add(end40.tree)
1641
                # sdl92.g:184:17: ( entity_in_block )*
Maxime Perrotin's avatar
Maxime Perrotin committed
1642
1643
1644
1645
                while True: #loop10
                    alt10 = 2
                    LA10_0 = self.input.LA(1)

1646
                    if (LA10_0 == PROCESS or LA10_0 == SIGNAL or LA10_0 == BLOCK or LA10_0 == CONNECT or LA10_0 == SIGNALROUTE or LA10_0 == 221) :
Maxime Perrotin's avatar
Maxime Perrotin committed
1647
1648
1649
1650
1651
1652
                        alt10 = 1


                    if alt10 == 1:
                        # sdl92.g:0:0: entity_in_block
                        pass 
1653
                        self._state.following.append(self.FOLLOW_entity_in_block_in_block_definition1801)
Maxime Perrotin's avatar
Maxime Perrotin committed
1654
1655
1656
1657
1658
1659
1660
1661
1662
                        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
1663
                ENDBLOCK42=self.match(self.input, ENDBLOCK, self.FOLLOW_ENDBLOCK_in_block_definition1821) 
Maxime Perrotin's avatar
Maxime Perrotin committed
1664
1665
                if self._state.backtracking == 0:
                    stream_ENDBLOCK.add(ENDBLOCK42)
1666
                self._state.following.append(self.FOLLOW_end_in_block_definition1823)
Maxime Perrotin's avatar
Maxime Perrotin committed
1667
1668
1669
1670
1671
1672
1673
                end43 = self.end()

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

                # AST Rewrite
1674
                # elements: entity_in_block, BLOCK, block_id
Maxime Perrotin's avatar
Maxime Perrotin committed
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
                # 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()
1691
1692
                    # 186:9: -> ^( BLOCK block_id ( entity_in_block )* )
                    # sdl92.g:186:17: ^( BLOCK block_id ( entity_in_block )* )
Maxime Perrotin's avatar
Maxime Perrotin committed
1693
1694
1695
1696
                    root_1 = self._adaptor.nil()
                    root_1 = self._adaptor.becomeRoot(stream_BLOCK.nextNode(), root_1)

                    self._adaptor.addChild(root_1, stream_block_id.nextTree())
1697
                    # sdl92.g:186:34: ( entity_in_block )*
Maxime Perrotin's avatar
Maxime Perrotin committed
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
                    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"
1741
    # sdl92.g:193:1: entity_in_block : ( signal_declaration | signalroute | connection | block_definition | process_definition );
Maxime Perrotin's avatar
Maxime Perrotin committed
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
    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:
1763
                # sdl92.g:194:9: ( signal_declaration | signalroute | connection | block_definition | process_definition )
Maxime Perrotin's avatar
Maxime Perrotin committed
1764
1765
                alt11 = 5
                LA11 = self.input.LA(1)
1766
                if LA11 == 221:
1767
1768
                    LA11_1 = self.input.LA(2)

1769
                    if (LA11_1 == KEEP) :
1770
                        alt11 = 1
1771
1772
                    elif (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
1773
1774
1775
1776
1777
1778
1779
1780
1781
                    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
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
                    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:
1800
                    # sdl92.g:194:17: signal_declaration
Maxime Perrotin's avatar
Maxime Perrotin committed
1801
1802
1803
                    pass 
                    root_0 = self._adaptor.nil()

1804
                    self._state.following.append(self.FOLLOW_signal_declaration_in_entity_in_block1872)
Maxime Perrotin's avatar
Maxime Perrotin committed
1805
1806
1807
1808
1809
1810
1811
1812
                    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:
1813
                    # sdl92.g:195:19: signalroute
Maxime Perrotin's avatar
Maxime Perrotin committed
1814
1815
1816
                    pass 
                    root_0 = self._adaptor.nil()

1817
                    self._state.following.append(self.FOLLOW_signalroute_in_entity_in_block1892)
Maxime Perrotin's avatar
Maxime Perrotin committed
1818
1819
1820
1821
1822
1823
1824
1825
                    signalroute45 = self.signalroute()

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


                elif alt11 == 3:
1826
                    # sdl92.g:196:19: connection
Maxime Perrotin's avatar
Maxime Perrotin committed
1827
1828
1829
                    pass 
                    root_0 = self._adaptor.nil()

1830
                    self._state.following.append(self.FOLLOW_connection_in_entity_in_block1912)
Maxime Perrotin's avatar
Maxime Perrotin committed
1831
1832
1833
1834
1835
1836
1837
1838
                    connection46 = self.connection()

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


                elif alt11 == 4:
1839
                    # sdl92.g:197:19: block_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
1840
1841
1842
                    pass 
                    root_0 = self._adaptor.nil()

1843
                    self._state.following.append(self.FOLLOW_block_definition_in_entity_in_block1932)
Maxime Perrotin's avatar
Maxime Perrotin committed
1844
1845
1846
1847
1848
1849
1850
1851
                    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:
1852
                    # sdl92.g:198:19: process_definition
Maxime Perrotin's avatar
Maxime Perrotin committed
1853
1854
1855
                    pass 
                    root_0 = self._adaptor.nil()

1856
                    self._state.following.append(self.FOLLOW_process_definition_in_entity_in_block1952)
Maxime Perrotin's avatar
Maxime Perrotin committed
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
</