1 | // $ANTLR 2.7.2: "pascal.tree.g" -> "PascalTreeParserSuper.java"$ |
---|
2 | |
---|
3 | import antlr.TreeParser; |
---|
4 | import antlr.Token; |
---|
5 | import antlr.collections.AST; |
---|
6 | import antlr.RecognitionException; |
---|
7 | import antlr.ANTLRException; |
---|
8 | import antlr.NoViableAltException; |
---|
9 | import antlr.MismatchedTokenException; |
---|
10 | import antlr.SemanticException; |
---|
11 | import antlr.collections.impl.BitSet; |
---|
12 | import antlr.ASTPair; |
---|
13 | import antlr.collections.impl.ASTArray; |
---|
14 | |
---|
15 | |
---|
16 | public class PascalTreeParserSuper extends antlr.TreeParser implements PascalTreeParserSuperTokenTypes |
---|
17 | { |
---|
18 | public PascalTreeParserSuper() { |
---|
19 | tokenNames = _tokenNames; |
---|
20 | } |
---|
21 | |
---|
22 | public final void program(AST _t) throws RecognitionException { |
---|
23 | |
---|
24 | PascalAST program_AST_in = (PascalAST)_t; |
---|
25 | |
---|
26 | try { // for error handling |
---|
27 | programHeading(_t); |
---|
28 | _t = _retTree; |
---|
29 | block(_t); |
---|
30 | _t = _retTree; |
---|
31 | } |
---|
32 | catch (RecognitionException ex) { |
---|
33 | reportError(ex); |
---|
34 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
35 | } |
---|
36 | _retTree = _t; |
---|
37 | } |
---|
38 | |
---|
39 | public final void programHeading(AST _t) throws RecognitionException { |
---|
40 | |
---|
41 | PascalAST programHeading_AST_in = (PascalAST)_t; |
---|
42 | |
---|
43 | try { // for error handling |
---|
44 | if (_t==null) _t=ASTNULL; |
---|
45 | switch ( _t.getType()) { |
---|
46 | case PROGRAM: |
---|
47 | { |
---|
48 | AST __t3 = _t; |
---|
49 | PascalAST tmp1_AST_in = (PascalAST)_t; |
---|
50 | match(_t,PROGRAM); |
---|
51 | _t = _t.getFirstChild(); |
---|
52 | PascalAST tmp2_AST_in = (PascalAST)_t; |
---|
53 | match(_t,IDENT); |
---|
54 | _t = _t.getNextSibling(); |
---|
55 | identifierList(_t); |
---|
56 | _t = _retTree; |
---|
57 | _t = __t3; |
---|
58 | _t = _t.getNextSibling(); |
---|
59 | break; |
---|
60 | } |
---|
61 | case UNIT: |
---|
62 | { |
---|
63 | AST __t4 = _t; |
---|
64 | PascalAST tmp3_AST_in = (PascalAST)_t; |
---|
65 | match(_t,UNIT); |
---|
66 | _t = _t.getFirstChild(); |
---|
67 | PascalAST tmp4_AST_in = (PascalAST)_t; |
---|
68 | match(_t,IDENT); |
---|
69 | _t = _t.getNextSibling(); |
---|
70 | _t = __t4; |
---|
71 | _t = _t.getNextSibling(); |
---|
72 | break; |
---|
73 | } |
---|
74 | default: |
---|
75 | { |
---|
76 | throw new NoViableAltException(_t); |
---|
77 | } |
---|
78 | } |
---|
79 | } |
---|
80 | catch (RecognitionException ex) { |
---|
81 | reportError(ex); |
---|
82 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
83 | } |
---|
84 | _retTree = _t; |
---|
85 | } |
---|
86 | |
---|
87 | public final void block(AST _t) throws RecognitionException { |
---|
88 | |
---|
89 | PascalAST block_AST_in = (PascalAST)_t; |
---|
90 | |
---|
91 | try { // for error handling |
---|
92 | { |
---|
93 | _loop8: |
---|
94 | do { |
---|
95 | if (_t==null) _t=ASTNULL; |
---|
96 | switch ( _t.getType()) { |
---|
97 | case LABEL: |
---|
98 | { |
---|
99 | labelDeclarationPart(_t); |
---|
100 | _t = _retTree; |
---|
101 | break; |
---|
102 | } |
---|
103 | case CONST: |
---|
104 | { |
---|
105 | constantDefinitionPart(_t); |
---|
106 | _t = _retTree; |
---|
107 | break; |
---|
108 | } |
---|
109 | case TYPE: |
---|
110 | { |
---|
111 | typeDefinitionPart(_t); |
---|
112 | _t = _retTree; |
---|
113 | break; |
---|
114 | } |
---|
115 | case VAR: |
---|
116 | { |
---|
117 | variableDeclarationPart(_t); |
---|
118 | _t = _retTree; |
---|
119 | break; |
---|
120 | } |
---|
121 | case FUNCTION: |
---|
122 | case PROCEDURE: |
---|
123 | { |
---|
124 | procedureAndFunctionDeclarationPart(_t); |
---|
125 | _t = _retTree; |
---|
126 | break; |
---|
127 | } |
---|
128 | case USES: |
---|
129 | { |
---|
130 | usesUnitsPart(_t); |
---|
131 | _t = _retTree; |
---|
132 | break; |
---|
133 | } |
---|
134 | case IMPLEMENTATION: |
---|
135 | { |
---|
136 | PascalAST tmp5_AST_in = (PascalAST)_t; |
---|
137 | match(_t,IMPLEMENTATION); |
---|
138 | _t = _t.getNextSibling(); |
---|
139 | break; |
---|
140 | } |
---|
141 | default: |
---|
142 | { |
---|
143 | break _loop8; |
---|
144 | } |
---|
145 | } |
---|
146 | } while (true); |
---|
147 | } |
---|
148 | compoundStatement(_t); |
---|
149 | _t = _retTree; |
---|
150 | } |
---|
151 | catch (RecognitionException ex) { |
---|
152 | reportError(ex); |
---|
153 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
154 | } |
---|
155 | _retTree = _t; |
---|
156 | } |
---|
157 | |
---|
158 | public final void identifierList(AST _t) throws RecognitionException { |
---|
159 | |
---|
160 | PascalAST identifierList_AST_in = (PascalAST)_t; |
---|
161 | |
---|
162 | try { // for error handling |
---|
163 | AST __t104 = _t; |
---|
164 | PascalAST tmp6_AST_in = (PascalAST)_t; |
---|
165 | match(_t,IDLIST); |
---|
166 | _t = _t.getFirstChild(); |
---|
167 | { |
---|
168 | int _cnt106=0; |
---|
169 | _loop106: |
---|
170 | do { |
---|
171 | if (_t==null) _t=ASTNULL; |
---|
172 | if ((_t.getType()==IDENT)) { |
---|
173 | PascalAST tmp7_AST_in = (PascalAST)_t; |
---|
174 | match(_t,IDENT); |
---|
175 | _t = _t.getNextSibling(); |
---|
176 | } |
---|
177 | else { |
---|
178 | if ( _cnt106>=1 ) { break _loop106; } else {throw new NoViableAltException(_t);} |
---|
179 | } |
---|
180 | |
---|
181 | _cnt106++; |
---|
182 | } while (true); |
---|
183 | } |
---|
184 | _t = __t104; |
---|
185 | _t = _t.getNextSibling(); |
---|
186 | } |
---|
187 | catch (RecognitionException ex) { |
---|
188 | reportError(ex); |
---|
189 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
190 | } |
---|
191 | _retTree = _t; |
---|
192 | } |
---|
193 | |
---|
194 | public final void identifier(AST _t) throws RecognitionException { |
---|
195 | |
---|
196 | PascalAST identifier_AST_in = (PascalAST)_t; |
---|
197 | |
---|
198 | try { // for error handling |
---|
199 | PascalAST tmp8_AST_in = (PascalAST)_t; |
---|
200 | match(_t,IDENT); |
---|
201 | _t = _t.getNextSibling(); |
---|
202 | } |
---|
203 | catch (RecognitionException ex) { |
---|
204 | reportError(ex); |
---|
205 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
206 | } |
---|
207 | _retTree = _t; |
---|
208 | } |
---|
209 | |
---|
210 | public final void labelDeclarationPart(AST _t) throws RecognitionException { |
---|
211 | |
---|
212 | PascalAST labelDeclarationPart_AST_in = (PascalAST)_t; |
---|
213 | |
---|
214 | try { // for error handling |
---|
215 | AST __t12 = _t; |
---|
216 | PascalAST tmp9_AST_in = (PascalAST)_t; |
---|
217 | match(_t,LABEL); |
---|
218 | _t = _t.getFirstChild(); |
---|
219 | { |
---|
220 | int _cnt14=0; |
---|
221 | _loop14: |
---|
222 | do { |
---|
223 | if (_t==null) _t=ASTNULL; |
---|
224 | if ((_t.getType()==NUM_INT)) { |
---|
225 | label(_t); |
---|
226 | _t = _retTree; |
---|
227 | } |
---|
228 | else { |
---|
229 | if ( _cnt14>=1 ) { break _loop14; } else {throw new NoViableAltException(_t);} |
---|
230 | } |
---|
231 | |
---|
232 | _cnt14++; |
---|
233 | } while (true); |
---|
234 | } |
---|
235 | _t = __t12; |
---|
236 | _t = _t.getNextSibling(); |
---|
237 | } |
---|
238 | catch (RecognitionException ex) { |
---|
239 | reportError(ex); |
---|
240 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
241 | } |
---|
242 | _retTree = _t; |
---|
243 | } |
---|
244 | |
---|
245 | public final void constantDefinitionPart(AST _t) throws RecognitionException { |
---|
246 | |
---|
247 | PascalAST constantDefinitionPart_AST_in = (PascalAST)_t; |
---|
248 | |
---|
249 | try { // for error handling |
---|
250 | AST __t17 = _t; |
---|
251 | PascalAST tmp10_AST_in = (PascalAST)_t; |
---|
252 | match(_t,CONST); |
---|
253 | _t = _t.getFirstChild(); |
---|
254 | { |
---|
255 | int _cnt19=0; |
---|
256 | _loop19: |
---|
257 | do { |
---|
258 | if (_t==null) _t=ASTNULL; |
---|
259 | if ((_t.getType()==EQUAL)) { |
---|
260 | constantDefinition(_t); |
---|
261 | _t = _retTree; |
---|
262 | } |
---|
263 | else { |
---|
264 | if ( _cnt19>=1 ) { break _loop19; } else {throw new NoViableAltException(_t);} |
---|
265 | } |
---|
266 | |
---|
267 | _cnt19++; |
---|
268 | } while (true); |
---|
269 | } |
---|
270 | _t = __t17; |
---|
271 | _t = _t.getNextSibling(); |
---|
272 | } |
---|
273 | catch (RecognitionException ex) { |
---|
274 | reportError(ex); |
---|
275 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
276 | } |
---|
277 | _retTree = _t; |
---|
278 | } |
---|
279 | |
---|
280 | public final void typeDefinitionPart(AST _t) throws RecognitionException { |
---|
281 | |
---|
282 | PascalAST typeDefinitionPart_AST_in = (PascalAST)_t; |
---|
283 | |
---|
284 | try { // for error handling |
---|
285 | AST __t31 = _t; |
---|
286 | PascalAST tmp11_AST_in = (PascalAST)_t; |
---|
287 | match(_t,TYPE); |
---|
288 | _t = _t.getFirstChild(); |
---|
289 | { |
---|
290 | int _cnt33=0; |
---|
291 | _loop33: |
---|
292 | do { |
---|
293 | if (_t==null) _t=ASTNULL; |
---|
294 | if ((_t.getType()==TYPEDECL)) { |
---|
295 | typeDefinition(_t); |
---|
296 | _t = _retTree; |
---|
297 | } |
---|
298 | else { |
---|
299 | if ( _cnt33>=1 ) { break _loop33; } else {throw new NoViableAltException(_t);} |
---|
300 | } |
---|
301 | |
---|
302 | _cnt33++; |
---|
303 | } while (true); |
---|
304 | } |
---|
305 | _t = __t31; |
---|
306 | _t = _t.getNextSibling(); |
---|
307 | } |
---|
308 | catch (RecognitionException ex) { |
---|
309 | reportError(ex); |
---|
310 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
311 | } |
---|
312 | _retTree = _t; |
---|
313 | } |
---|
314 | |
---|
315 | /** Yields a list of VARDECL-rooted subtrees with VAR at the overall root */ |
---|
316 | public final void variableDeclarationPart(AST _t) throws RecognitionException { |
---|
317 | |
---|
318 | PascalAST variableDeclarationPart_AST_in = (PascalAST)_t; |
---|
319 | |
---|
320 | try { // for error handling |
---|
321 | AST __t83 = _t; |
---|
322 | PascalAST tmp12_AST_in = (PascalAST)_t; |
---|
323 | match(_t,VAR); |
---|
324 | _t = _t.getFirstChild(); |
---|
325 | { |
---|
326 | int _cnt85=0; |
---|
327 | _loop85: |
---|
328 | do { |
---|
329 | if (_t==null) _t=ASTNULL; |
---|
330 | if ((_t.getType()==VARDECL)) { |
---|
331 | variableDeclaration(_t); |
---|
332 | _t = _retTree; |
---|
333 | } |
---|
334 | else { |
---|
335 | if ( _cnt85>=1 ) { break _loop85; } else {throw new NoViableAltException(_t);} |
---|
336 | } |
---|
337 | |
---|
338 | _cnt85++; |
---|
339 | } while (true); |
---|
340 | } |
---|
341 | _t = __t83; |
---|
342 | _t = _t.getNextSibling(); |
---|
343 | } |
---|
344 | catch (RecognitionException ex) { |
---|
345 | reportError(ex); |
---|
346 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
347 | } |
---|
348 | _retTree = _t; |
---|
349 | } |
---|
350 | |
---|
351 | public final void procedureAndFunctionDeclarationPart(AST _t) throws RecognitionException { |
---|
352 | |
---|
353 | PascalAST procedureAndFunctionDeclarationPart_AST_in = (PascalAST)_t; |
---|
354 | |
---|
355 | try { // for error handling |
---|
356 | procedureOrFunctionDeclaration(_t); |
---|
357 | _t = _retTree; |
---|
358 | } |
---|
359 | catch (RecognitionException ex) { |
---|
360 | reportError(ex); |
---|
361 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
362 | } |
---|
363 | _retTree = _t; |
---|
364 | } |
---|
365 | |
---|
366 | public final void usesUnitsPart(AST _t) throws RecognitionException { |
---|
367 | |
---|
368 | PascalAST usesUnitsPart_AST_in = (PascalAST)_t; |
---|
369 | |
---|
370 | try { // for error handling |
---|
371 | AST __t10 = _t; |
---|
372 | PascalAST tmp13_AST_in = (PascalAST)_t; |
---|
373 | match(_t,USES); |
---|
374 | _t = _t.getFirstChild(); |
---|
375 | identifierList(_t); |
---|
376 | _t = _retTree; |
---|
377 | _t = __t10; |
---|
378 | _t = _t.getNextSibling(); |
---|
379 | } |
---|
380 | catch (RecognitionException ex) { |
---|
381 | reportError(ex); |
---|
382 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
383 | } |
---|
384 | _retTree = _t; |
---|
385 | } |
---|
386 | |
---|
387 | public final void compoundStatement(AST _t) throws RecognitionException { |
---|
388 | |
---|
389 | PascalAST compoundStatement_AST_in = (PascalAST)_t; |
---|
390 | |
---|
391 | try { // for error handling |
---|
392 | statements(_t); |
---|
393 | _t = _retTree; |
---|
394 | } |
---|
395 | catch (RecognitionException ex) { |
---|
396 | reportError(ex); |
---|
397 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
398 | } |
---|
399 | _retTree = _t; |
---|
400 | } |
---|
401 | |
---|
402 | public final void label(AST _t) throws RecognitionException { |
---|
403 | |
---|
404 | PascalAST label_AST_in = (PascalAST)_t; |
---|
405 | |
---|
406 | try { // for error handling |
---|
407 | PascalAST tmp14_AST_in = (PascalAST)_t; |
---|
408 | match(_t,NUM_INT); |
---|
409 | _t = _t.getNextSibling(); |
---|
410 | } |
---|
411 | catch (RecognitionException ex) { |
---|
412 | reportError(ex); |
---|
413 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
414 | } |
---|
415 | _retTree = _t; |
---|
416 | } |
---|
417 | |
---|
418 | public final void constantDefinition(AST _t) throws RecognitionException { |
---|
419 | |
---|
420 | PascalAST constantDefinition_AST_in = (PascalAST)_t; |
---|
421 | |
---|
422 | try { // for error handling |
---|
423 | AST __t21 = _t; |
---|
424 | PascalAST tmp15_AST_in = (PascalAST)_t; |
---|
425 | match(_t,EQUAL); |
---|
426 | _t = _t.getFirstChild(); |
---|
427 | PascalAST tmp16_AST_in = (PascalAST)_t; |
---|
428 | match(_t,IDENT); |
---|
429 | _t = _t.getNextSibling(); |
---|
430 | constant(_t); |
---|
431 | _t = _retTree; |
---|
432 | _t = __t21; |
---|
433 | _t = _t.getNextSibling(); |
---|
434 | } |
---|
435 | catch (RecognitionException ex) { |
---|
436 | reportError(ex); |
---|
437 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
438 | } |
---|
439 | _retTree = _t; |
---|
440 | } |
---|
441 | |
---|
442 | public final void constant(AST _t) throws RecognitionException { |
---|
443 | |
---|
444 | PascalAST constant_AST_in = (PascalAST)_t; |
---|
445 | |
---|
446 | try { // for error handling |
---|
447 | if (_t==null) _t=ASTNULL; |
---|
448 | switch ( _t.getType()) { |
---|
449 | case NUM_INT: |
---|
450 | { |
---|
451 | PascalAST tmp17_AST_in = (PascalAST)_t; |
---|
452 | match(_t,NUM_INT); |
---|
453 | _t = _t.getNextSibling(); |
---|
454 | break; |
---|
455 | } |
---|
456 | case NUM_REAL: |
---|
457 | { |
---|
458 | PascalAST tmp18_AST_in = (PascalAST)_t; |
---|
459 | match(_t,NUM_REAL); |
---|
460 | _t = _t.getNextSibling(); |
---|
461 | break; |
---|
462 | } |
---|
463 | case PLUS: |
---|
464 | { |
---|
465 | AST __t23 = _t; |
---|
466 | PascalAST tmp19_AST_in = (PascalAST)_t; |
---|
467 | match(_t,PLUS); |
---|
468 | _t = _t.getFirstChild(); |
---|
469 | { |
---|
470 | if (_t==null) _t=ASTNULL; |
---|
471 | switch ( _t.getType()) { |
---|
472 | case NUM_INT: |
---|
473 | { |
---|
474 | PascalAST tmp20_AST_in = (PascalAST)_t; |
---|
475 | match(_t,NUM_INT); |
---|
476 | _t = _t.getNextSibling(); |
---|
477 | break; |
---|
478 | } |
---|
479 | case NUM_REAL: |
---|
480 | { |
---|
481 | PascalAST tmp21_AST_in = (PascalAST)_t; |
---|
482 | match(_t,NUM_REAL); |
---|
483 | _t = _t.getNextSibling(); |
---|
484 | break; |
---|
485 | } |
---|
486 | case IDENT: |
---|
487 | { |
---|
488 | PascalAST tmp22_AST_in = (PascalAST)_t; |
---|
489 | match(_t,IDENT); |
---|
490 | _t = _t.getNextSibling(); |
---|
491 | break; |
---|
492 | } |
---|
493 | default: |
---|
494 | { |
---|
495 | throw new NoViableAltException(_t); |
---|
496 | } |
---|
497 | } |
---|
498 | } |
---|
499 | _t = __t23; |
---|
500 | _t = _t.getNextSibling(); |
---|
501 | break; |
---|
502 | } |
---|
503 | case MINUS: |
---|
504 | { |
---|
505 | AST __t25 = _t; |
---|
506 | PascalAST tmp23_AST_in = (PascalAST)_t; |
---|
507 | match(_t,MINUS); |
---|
508 | _t = _t.getFirstChild(); |
---|
509 | { |
---|
510 | if (_t==null) _t=ASTNULL; |
---|
511 | switch ( _t.getType()) { |
---|
512 | case NUM_INT: |
---|
513 | { |
---|
514 | PascalAST tmp24_AST_in = (PascalAST)_t; |
---|
515 | match(_t,NUM_INT); |
---|
516 | _t = _t.getNextSibling(); |
---|
517 | break; |
---|
518 | } |
---|
519 | case NUM_REAL: |
---|
520 | { |
---|
521 | PascalAST tmp25_AST_in = (PascalAST)_t; |
---|
522 | match(_t,NUM_REAL); |
---|
523 | _t = _t.getNextSibling(); |
---|
524 | break; |
---|
525 | } |
---|
526 | case IDENT: |
---|
527 | { |
---|
528 | PascalAST tmp26_AST_in = (PascalAST)_t; |
---|
529 | match(_t,IDENT); |
---|
530 | _t = _t.getNextSibling(); |
---|
531 | break; |
---|
532 | } |
---|
533 | default: |
---|
534 | { |
---|
535 | throw new NoViableAltException(_t); |
---|
536 | } |
---|
537 | } |
---|
538 | } |
---|
539 | _t = __t25; |
---|
540 | _t = _t.getNextSibling(); |
---|
541 | break; |
---|
542 | } |
---|
543 | case IDENT: |
---|
544 | { |
---|
545 | PascalAST tmp27_AST_in = (PascalAST)_t; |
---|
546 | match(_t,IDENT); |
---|
547 | _t = _t.getNextSibling(); |
---|
548 | break; |
---|
549 | } |
---|
550 | case STRING_LITERAL: |
---|
551 | { |
---|
552 | PascalAST tmp28_AST_in = (PascalAST)_t; |
---|
553 | match(_t,STRING_LITERAL); |
---|
554 | _t = _t.getNextSibling(); |
---|
555 | break; |
---|
556 | } |
---|
557 | case CHR: |
---|
558 | { |
---|
559 | AST __t27 = _t; |
---|
560 | PascalAST tmp29_AST_in = (PascalAST)_t; |
---|
561 | match(_t,CHR); |
---|
562 | _t = _t.getFirstChild(); |
---|
563 | { |
---|
564 | if (_t==null) _t=ASTNULL; |
---|
565 | switch ( _t.getType()) { |
---|
566 | case NUM_INT: |
---|
567 | { |
---|
568 | PascalAST tmp30_AST_in = (PascalAST)_t; |
---|
569 | match(_t,NUM_INT); |
---|
570 | _t = _t.getNextSibling(); |
---|
571 | break; |
---|
572 | } |
---|
573 | case NUM_REAL: |
---|
574 | { |
---|
575 | PascalAST tmp31_AST_in = (PascalAST)_t; |
---|
576 | match(_t,NUM_REAL); |
---|
577 | _t = _t.getNextSibling(); |
---|
578 | break; |
---|
579 | } |
---|
580 | default: |
---|
581 | { |
---|
582 | throw new NoViableAltException(_t); |
---|
583 | } |
---|
584 | } |
---|
585 | } |
---|
586 | _t = __t27; |
---|
587 | _t = _t.getNextSibling(); |
---|
588 | break; |
---|
589 | } |
---|
590 | default: |
---|
591 | { |
---|
592 | throw new NoViableAltException(_t); |
---|
593 | } |
---|
594 | } |
---|
595 | } |
---|
596 | catch (RecognitionException ex) { |
---|
597 | reportError(ex); |
---|
598 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
599 | } |
---|
600 | _retTree = _t; |
---|
601 | } |
---|
602 | |
---|
603 | public final void string(AST _t) throws RecognitionException { |
---|
604 | |
---|
605 | PascalAST string_AST_in = (PascalAST)_t; |
---|
606 | |
---|
607 | try { // for error handling |
---|
608 | PascalAST tmp32_AST_in = (PascalAST)_t; |
---|
609 | match(_t,STRING_LITERAL); |
---|
610 | _t = _t.getNextSibling(); |
---|
611 | } |
---|
612 | catch (RecognitionException ex) { |
---|
613 | reportError(ex); |
---|
614 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
615 | } |
---|
616 | _retTree = _t; |
---|
617 | } |
---|
618 | |
---|
619 | public final void typeDefinition(AST _t) throws RecognitionException { |
---|
620 | |
---|
621 | PascalAST typeDefinition_AST_in = (PascalAST)_t; |
---|
622 | |
---|
623 | try { // for error handling |
---|
624 | AST __t35 = _t; |
---|
625 | PascalAST tmp33_AST_in = (PascalAST)_t; |
---|
626 | match(_t,TYPEDECL); |
---|
627 | _t = _t.getFirstChild(); |
---|
628 | PascalAST tmp34_AST_in = (PascalAST)_t; |
---|
629 | match(_t,IDENT); |
---|
630 | _t = _t.getNextSibling(); |
---|
631 | { |
---|
632 | if (_t==null) _t=ASTNULL; |
---|
633 | switch ( _t.getType()) { |
---|
634 | case SCALARTYPE: |
---|
635 | case IDENT: |
---|
636 | case DOTDOT: |
---|
637 | case CHAR: |
---|
638 | case BOOLEAN: |
---|
639 | case INTEGER: |
---|
640 | case REAL: |
---|
641 | case STRING: |
---|
642 | case PACKED: |
---|
643 | case ARRAY: |
---|
644 | case RECORD: |
---|
645 | case SET: |
---|
646 | case FILE: |
---|
647 | case POINTER: |
---|
648 | { |
---|
649 | type(_t); |
---|
650 | _t = _retTree; |
---|
651 | break; |
---|
652 | } |
---|
653 | case FUNCTION: |
---|
654 | { |
---|
655 | AST __t37 = _t; |
---|
656 | PascalAST tmp35_AST_in = (PascalAST)_t; |
---|
657 | match(_t,FUNCTION); |
---|
658 | _t = _t.getFirstChild(); |
---|
659 | { |
---|
660 | if (_t==null) _t=ASTNULL; |
---|
661 | switch ( _t.getType()) { |
---|
662 | case ARGDECLS: |
---|
663 | { |
---|
664 | formalParameterList(_t); |
---|
665 | _t = _retTree; |
---|
666 | break; |
---|
667 | } |
---|
668 | case IDENT: |
---|
669 | case CHAR: |
---|
670 | case BOOLEAN: |
---|
671 | case INTEGER: |
---|
672 | case REAL: |
---|
673 | case STRING: |
---|
674 | { |
---|
675 | break; |
---|
676 | } |
---|
677 | default: |
---|
678 | { |
---|
679 | throw new NoViableAltException(_t); |
---|
680 | } |
---|
681 | } |
---|
682 | } |
---|
683 | resultType(_t); |
---|
684 | _t = _retTree; |
---|
685 | _t = __t37; |
---|
686 | _t = _t.getNextSibling(); |
---|
687 | break; |
---|
688 | } |
---|
689 | case PROCEDURE: |
---|
690 | { |
---|
691 | AST __t39 = _t; |
---|
692 | PascalAST tmp36_AST_in = (PascalAST)_t; |
---|
693 | match(_t,PROCEDURE); |
---|
694 | _t = _t.getFirstChild(); |
---|
695 | { |
---|
696 | if (_t==null) _t=ASTNULL; |
---|
697 | switch ( _t.getType()) { |
---|
698 | case ARGDECLS: |
---|
699 | { |
---|
700 | formalParameterList(_t); |
---|
701 | _t = _retTree; |
---|
702 | break; |
---|
703 | } |
---|
704 | case 3: |
---|
705 | { |
---|
706 | break; |
---|
707 | } |
---|
708 | default: |
---|
709 | { |
---|
710 | throw new NoViableAltException(_t); |
---|
711 | } |
---|
712 | } |
---|
713 | } |
---|
714 | _t = __t39; |
---|
715 | _t = _t.getNextSibling(); |
---|
716 | break; |
---|
717 | } |
---|
718 | default: |
---|
719 | { |
---|
720 | throw new NoViableAltException(_t); |
---|
721 | } |
---|
722 | } |
---|
723 | } |
---|
724 | _t = __t35; |
---|
725 | _t = _t.getNextSibling(); |
---|
726 | } |
---|
727 | catch (RecognitionException ex) { |
---|
728 | reportError(ex); |
---|
729 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
730 | } |
---|
731 | _retTree = _t; |
---|
732 | } |
---|
733 | |
---|
734 | public final void type(AST _t) throws RecognitionException { |
---|
735 | |
---|
736 | PascalAST type_AST_in = (PascalAST)_t; |
---|
737 | |
---|
738 | try { // for error handling |
---|
739 | if (_t==null) _t=ASTNULL; |
---|
740 | switch ( _t.getType()) { |
---|
741 | case SCALARTYPE: |
---|
742 | { |
---|
743 | AST __t42 = _t; |
---|
744 | PascalAST tmp37_AST_in = (PascalAST)_t; |
---|
745 | match(_t,SCALARTYPE); |
---|
746 | _t = _t.getFirstChild(); |
---|
747 | identifierList(_t); |
---|
748 | _t = _retTree; |
---|
749 | _t = __t42; |
---|
750 | _t = _t.getNextSibling(); |
---|
751 | break; |
---|
752 | } |
---|
753 | case DOTDOT: |
---|
754 | { |
---|
755 | AST __t43 = _t; |
---|
756 | PascalAST tmp38_AST_in = (PascalAST)_t; |
---|
757 | match(_t,DOTDOT); |
---|
758 | _t = _t.getFirstChild(); |
---|
759 | constant(_t); |
---|
760 | _t = _retTree; |
---|
761 | constant(_t); |
---|
762 | _t = _retTree; |
---|
763 | _t = __t43; |
---|
764 | _t = _t.getNextSibling(); |
---|
765 | break; |
---|
766 | } |
---|
767 | case IDENT: |
---|
768 | case CHAR: |
---|
769 | case BOOLEAN: |
---|
770 | case INTEGER: |
---|
771 | case REAL: |
---|
772 | case STRING: |
---|
773 | { |
---|
774 | typeIdentifier(_t); |
---|
775 | _t = _retTree; |
---|
776 | break; |
---|
777 | } |
---|
778 | case PACKED: |
---|
779 | case ARRAY: |
---|
780 | case RECORD: |
---|
781 | case SET: |
---|
782 | case FILE: |
---|
783 | { |
---|
784 | structuredType(_t); |
---|
785 | _t = _retTree; |
---|
786 | break; |
---|
787 | } |
---|
788 | case POINTER: |
---|
789 | { |
---|
790 | AST __t44 = _t; |
---|
791 | PascalAST tmp39_AST_in = (PascalAST)_t; |
---|
792 | match(_t,POINTER); |
---|
793 | _t = _t.getFirstChild(); |
---|
794 | typeIdentifier(_t); |
---|
795 | _t = _retTree; |
---|
796 | _t = __t44; |
---|
797 | _t = _t.getNextSibling(); |
---|
798 | break; |
---|
799 | } |
---|
800 | default: |
---|
801 | { |
---|
802 | throw new NoViableAltException(_t); |
---|
803 | } |
---|
804 | } |
---|
805 | } |
---|
806 | catch (RecognitionException ex) { |
---|
807 | reportError(ex); |
---|
808 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
809 | } |
---|
810 | _retTree = _t; |
---|
811 | } |
---|
812 | |
---|
813 | public final void formalParameterList(AST _t) throws RecognitionException { |
---|
814 | |
---|
815 | PascalAST formalParameterList_AST_in = (PascalAST)_t; |
---|
816 | |
---|
817 | try { // for error handling |
---|
818 | AST __t94 = _t; |
---|
819 | PascalAST tmp40_AST_in = (PascalAST)_t; |
---|
820 | match(_t,ARGDECLS); |
---|
821 | _t = _t.getFirstChild(); |
---|
822 | { |
---|
823 | int _cnt96=0; |
---|
824 | _loop96: |
---|
825 | do { |
---|
826 | if (_t==null) _t=ASTNULL; |
---|
827 | if ((_tokenSet_0.member(_t.getType()))) { |
---|
828 | formalParameterSection(_t); |
---|
829 | _t = _retTree; |
---|
830 | } |
---|
831 | else { |
---|
832 | if ( _cnt96>=1 ) { break _loop96; } else {throw new NoViableAltException(_t);} |
---|
833 | } |
---|
834 | |
---|
835 | _cnt96++; |
---|
836 | } while (true); |
---|
837 | } |
---|
838 | _t = __t94; |
---|
839 | _t = _t.getNextSibling(); |
---|
840 | } |
---|
841 | catch (RecognitionException ex) { |
---|
842 | reportError(ex); |
---|
843 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
844 | } |
---|
845 | _retTree = _t; |
---|
846 | } |
---|
847 | |
---|
848 | public final void resultType(AST _t) throws RecognitionException { |
---|
849 | |
---|
850 | PascalAST resultType_AST_in = (PascalAST)_t; |
---|
851 | |
---|
852 | try { // for error handling |
---|
853 | typeIdentifier(_t); |
---|
854 | _t = _retTree; |
---|
855 | } |
---|
856 | catch (RecognitionException ex) { |
---|
857 | reportError(ex); |
---|
858 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
859 | } |
---|
860 | _retTree = _t; |
---|
861 | } |
---|
862 | |
---|
863 | public final void typeIdentifier(AST _t) throws RecognitionException { |
---|
864 | |
---|
865 | PascalAST typeIdentifier_AST_in = (PascalAST)_t; |
---|
866 | |
---|
867 | try { // for error handling |
---|
868 | if (_t==null) _t=ASTNULL; |
---|
869 | switch ( _t.getType()) { |
---|
870 | case IDENT: |
---|
871 | { |
---|
872 | PascalAST tmp41_AST_in = (PascalAST)_t; |
---|
873 | match(_t,IDENT); |
---|
874 | _t = _t.getNextSibling(); |
---|
875 | break; |
---|
876 | } |
---|
877 | case CHAR: |
---|
878 | { |
---|
879 | PascalAST tmp42_AST_in = (PascalAST)_t; |
---|
880 | match(_t,CHAR); |
---|
881 | _t = _t.getNextSibling(); |
---|
882 | break; |
---|
883 | } |
---|
884 | case BOOLEAN: |
---|
885 | { |
---|
886 | PascalAST tmp43_AST_in = (PascalAST)_t; |
---|
887 | match(_t,BOOLEAN); |
---|
888 | _t = _t.getNextSibling(); |
---|
889 | break; |
---|
890 | } |
---|
891 | case INTEGER: |
---|
892 | { |
---|
893 | PascalAST tmp44_AST_in = (PascalAST)_t; |
---|
894 | match(_t,INTEGER); |
---|
895 | _t = _t.getNextSibling(); |
---|
896 | break; |
---|
897 | } |
---|
898 | case REAL: |
---|
899 | { |
---|
900 | PascalAST tmp45_AST_in = (PascalAST)_t; |
---|
901 | match(_t,REAL); |
---|
902 | _t = _t.getNextSibling(); |
---|
903 | break; |
---|
904 | } |
---|
905 | case STRING: |
---|
906 | { |
---|
907 | AST __t46 = _t; |
---|
908 | PascalAST tmp46_AST_in = (PascalAST)_t; |
---|
909 | match(_t,STRING); |
---|
910 | _t = _t.getFirstChild(); |
---|
911 | { |
---|
912 | if (_t==null) _t=ASTNULL; |
---|
913 | switch ( _t.getType()) { |
---|
914 | case IDENT: |
---|
915 | { |
---|
916 | PascalAST tmp47_AST_in = (PascalAST)_t; |
---|
917 | match(_t,IDENT); |
---|
918 | _t = _t.getNextSibling(); |
---|
919 | break; |
---|
920 | } |
---|
921 | case NUM_INT: |
---|
922 | { |
---|
923 | PascalAST tmp48_AST_in = (PascalAST)_t; |
---|
924 | match(_t,NUM_INT); |
---|
925 | _t = _t.getNextSibling(); |
---|
926 | break; |
---|
927 | } |
---|
928 | case NUM_REAL: |
---|
929 | { |
---|
930 | PascalAST tmp49_AST_in = (PascalAST)_t; |
---|
931 | match(_t,NUM_REAL); |
---|
932 | _t = _t.getNextSibling(); |
---|
933 | break; |
---|
934 | } |
---|
935 | case 3: |
---|
936 | { |
---|
937 | break; |
---|
938 | } |
---|
939 | default: |
---|
940 | { |
---|
941 | throw new NoViableAltException(_t); |
---|
942 | } |
---|
943 | } |
---|
944 | } |
---|
945 | _t = __t46; |
---|
946 | _t = _t.getNextSibling(); |
---|
947 | break; |
---|
948 | } |
---|
949 | default: |
---|
950 | { |
---|
951 | throw new NoViableAltException(_t); |
---|
952 | } |
---|
953 | } |
---|
954 | } |
---|
955 | catch (RecognitionException ex) { |
---|
956 | reportError(ex); |
---|
957 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
958 | } |
---|
959 | _retTree = _t; |
---|
960 | } |
---|
961 | |
---|
962 | public final void structuredType(AST _t) throws RecognitionException { |
---|
963 | |
---|
964 | PascalAST structuredType_AST_in = (PascalAST)_t; |
---|
965 | |
---|
966 | try { // for error handling |
---|
967 | if (_t==null) _t=ASTNULL; |
---|
968 | switch ( _t.getType()) { |
---|
969 | case PACKED: |
---|
970 | { |
---|
971 | AST __t49 = _t; |
---|
972 | PascalAST tmp50_AST_in = (PascalAST)_t; |
---|
973 | match(_t,PACKED); |
---|
974 | _t = _t.getFirstChild(); |
---|
975 | unpackedStructuredType(_t); |
---|
976 | _t = _retTree; |
---|
977 | _t = __t49; |
---|
978 | _t = _t.getNextSibling(); |
---|
979 | break; |
---|
980 | } |
---|
981 | case ARRAY: |
---|
982 | case RECORD: |
---|
983 | case SET: |
---|
984 | case FILE: |
---|
985 | { |
---|
986 | unpackedStructuredType(_t); |
---|
987 | _t = _retTree; |
---|
988 | break; |
---|
989 | } |
---|
990 | default: |
---|
991 | { |
---|
992 | throw new NoViableAltException(_t); |
---|
993 | } |
---|
994 | } |
---|
995 | } |
---|
996 | catch (RecognitionException ex) { |
---|
997 | reportError(ex); |
---|
998 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
999 | } |
---|
1000 | _retTree = _t; |
---|
1001 | } |
---|
1002 | |
---|
1003 | public final void unpackedStructuredType(AST _t) throws RecognitionException { |
---|
1004 | |
---|
1005 | PascalAST unpackedStructuredType_AST_in = (PascalAST)_t; |
---|
1006 | |
---|
1007 | try { // for error handling |
---|
1008 | if (_t==null) _t=ASTNULL; |
---|
1009 | switch ( _t.getType()) { |
---|
1010 | case ARRAY: |
---|
1011 | { |
---|
1012 | arrayType(_t); |
---|
1013 | _t = _retTree; |
---|
1014 | break; |
---|
1015 | } |
---|
1016 | case RECORD: |
---|
1017 | { |
---|
1018 | recordType(_t); |
---|
1019 | _t = _retTree; |
---|
1020 | break; |
---|
1021 | } |
---|
1022 | case SET: |
---|
1023 | { |
---|
1024 | setType(_t); |
---|
1025 | _t = _retTree; |
---|
1026 | break; |
---|
1027 | } |
---|
1028 | case FILE: |
---|
1029 | { |
---|
1030 | fileType(_t); |
---|
1031 | _t = _retTree; |
---|
1032 | break; |
---|
1033 | } |
---|
1034 | default: |
---|
1035 | { |
---|
1036 | throw new NoViableAltException(_t); |
---|
1037 | } |
---|
1038 | } |
---|
1039 | } |
---|
1040 | catch (RecognitionException ex) { |
---|
1041 | reportError(ex); |
---|
1042 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
1043 | } |
---|
1044 | _retTree = _t; |
---|
1045 | } |
---|
1046 | |
---|
1047 | /** Note here that the syntactic diff between brackets disappears. |
---|
1048 | * If the brackets mean different things semantically, we need |
---|
1049 | * two different alternatives here. |
---|
1050 | */ |
---|
1051 | public final void arrayType(AST _t) throws RecognitionException { |
---|
1052 | |
---|
1053 | PascalAST arrayType_AST_in = (PascalAST)_t; |
---|
1054 | |
---|
1055 | try { // for error handling |
---|
1056 | AST __t52 = _t; |
---|
1057 | PascalAST tmp51_AST_in = (PascalAST)_t; |
---|
1058 | match(_t,ARRAY); |
---|
1059 | _t = _t.getFirstChild(); |
---|
1060 | typeList(_t); |
---|
1061 | _t = _retTree; |
---|
1062 | type(_t); |
---|
1063 | _t = _retTree; |
---|
1064 | _t = __t52; |
---|
1065 | _t = _t.getNextSibling(); |
---|
1066 | } |
---|
1067 | catch (RecognitionException ex) { |
---|
1068 | reportError(ex); |
---|
1069 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
1070 | } |
---|
1071 | _retTree = _t; |
---|
1072 | } |
---|
1073 | |
---|
1074 | public final void recordType(AST _t) throws RecognitionException { |
---|
1075 | |
---|
1076 | PascalAST recordType_AST_in = (PascalAST)_t; |
---|
1077 | |
---|
1078 | try { // for error handling |
---|
1079 | AST __t58 = _t; |
---|
1080 | PascalAST tmp52_AST_in = (PascalAST)_t; |
---|
1081 | match(_t,RECORD); |
---|
1082 | _t = _t.getFirstChild(); |
---|
1083 | fieldList(_t); |
---|
1084 | _t = _retTree; |
---|
1085 | _t = __t58; |
---|
1086 | _t = _t.getNextSibling(); |
---|
1087 | } |
---|
1088 | catch (RecognitionException ex) { |
---|
1089 | reportError(ex); |
---|
1090 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
1091 | } |
---|
1092 | _retTree = _t; |
---|
1093 | } |
---|
1094 | |
---|
1095 | public final void setType(AST _t) throws RecognitionException { |
---|
1096 | |
---|
1097 | PascalAST setType_AST_in = (PascalAST)_t; |
---|
1098 | |
---|
1099 | try { // for error handling |
---|
1100 | AST __t78 = _t; |
---|
1101 | PascalAST tmp53_AST_in = (PascalAST)_t; |
---|
1102 | match(_t,SET); |
---|
1103 | _t = _t.getFirstChild(); |
---|
1104 | type(_t); |
---|
1105 | _t = _retTree; |
---|
1106 | _t = __t78; |
---|
1107 | _t = _t.getNextSibling(); |
---|
1108 | } |
---|
1109 | catch (RecognitionException ex) { |
---|
1110 | reportError(ex); |
---|
1111 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
1112 | } |
---|
1113 | _retTree = _t; |
---|
1114 | } |
---|
1115 | |
---|
1116 | public final void fileType(AST _t) throws RecognitionException { |
---|
1117 | |
---|
1118 | PascalAST fileType_AST_in = (PascalAST)_t; |
---|
1119 | |
---|
1120 | try { // for error handling |
---|
1121 | AST __t80 = _t; |
---|
1122 | PascalAST tmp54_AST_in = (PascalAST)_t; |
---|
1123 | match(_t,FILE); |
---|
1124 | _t = _t.getFirstChild(); |
---|
1125 | { |
---|
1126 | if (_t==null) _t=ASTNULL; |
---|
1127 | switch ( _t.getType()) { |
---|
1128 | case SCALARTYPE: |
---|
1129 | case IDENT: |
---|
1130 | case DOTDOT: |
---|
1131 | case CHAR: |
---|
1132 | case BOOLEAN: |
---|
1133 | case INTEGER: |
---|
1134 | case REAL: |
---|
1135 | case STRING: |
---|
1136 | case PACKED: |
---|
1137 | case ARRAY: |
---|
1138 | case RECORD: |
---|
1139 | case SET: |
---|
1140 | case FILE: |
---|
1141 | case POINTER: |
---|
1142 | { |
---|
1143 | type(_t); |
---|
1144 | _t = _retTree; |
---|
1145 | break; |
---|
1146 | } |
---|
1147 | case 3: |
---|
1148 | { |
---|
1149 | break; |
---|
1150 | } |
---|
1151 | default: |
---|
1152 | { |
---|
1153 | throw new NoViableAltException(_t); |
---|
1154 | } |
---|
1155 | } |
---|
1156 | } |
---|
1157 | _t = __t80; |
---|
1158 | _t = _t.getNextSibling(); |
---|
1159 | } |
---|
1160 | catch (RecognitionException ex) { |
---|
1161 | reportError(ex); |
---|
1162 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
1163 | } |
---|
1164 | _retTree = _t; |
---|
1165 | } |
---|
1166 | |
---|
1167 | public final void typeList(AST _t) throws RecognitionException { |
---|
1168 | |
---|
1169 | PascalAST typeList_AST_in = (PascalAST)_t; |
---|
1170 | |
---|
1171 | try { // for error handling |
---|
1172 | AST __t54 = _t; |
---|
1173 | PascalAST tmp55_AST_in = (PascalAST)_t; |
---|
1174 | match(_t,TYPELIST); |
---|
1175 | _t = _t.getFirstChild(); |
---|
1176 | { |
---|
1177 | int _cnt56=0; |
---|
1178 | _loop56: |
---|
1179 | do { |
---|
1180 | if (_t==null) _t=ASTNULL; |
---|
1181 | if ((_tokenSet_1.member(_t.getType()))) { |
---|
1182 | type(_t); |
---|
1183 | _t = _retTree; |
---|
1184 | } |
---|
1185 | else { |
---|
1186 | if ( _cnt56>=1 ) { break _loop56; } else {throw new NoViableAltException(_t);} |
---|
1187 | } |
---|
1188 | |
---|
1189 | _cnt56++; |
---|
1190 | } while (true); |
---|
1191 | } |
---|
1192 | _t = __t54; |
---|
1193 | _t = _t.getNextSibling(); |
---|
1194 | } |
---|
1195 | catch (RecognitionException ex) { |
---|
1196 | reportError(ex); |
---|
1197 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
1198 | } |
---|
1199 | _retTree = _t; |
---|
1200 | } |
---|
1201 | |
---|
1202 | public final void fieldList(AST _t) throws RecognitionException { |
---|
1203 | |
---|
1204 | PascalAST fieldList_AST_in = (PascalAST)_t; |
---|
1205 | |
---|
1206 | try { // for error handling |
---|
1207 | AST __t60 = _t; |
---|
1208 | PascalAST tmp56_AST_in = (PascalAST)_t; |
---|
1209 | match(_t,FIELDLIST); |
---|
1210 | _t = _t.getFirstChild(); |
---|
1211 | { |
---|
1212 | if (_t==null) _t=ASTNULL; |
---|
1213 | switch ( _t.getType()) { |
---|
1214 | case FIELD: |
---|
1215 | { |
---|
1216 | fixedPart(_t); |
---|
1217 | _t = _retTree; |
---|
1218 | { |
---|
1219 | if (_t==null) _t=ASTNULL; |
---|
1220 | switch ( _t.getType()) { |
---|
1221 | case CASE: |
---|
1222 | { |
---|
1223 | variantPart(_t); |
---|
1224 | _t = _retTree; |
---|
1225 | break; |
---|
1226 | } |
---|
1227 | case 3: |
---|
1228 | { |
---|
1229 | break; |
---|
1230 | } |
---|
1231 | default: |
---|
1232 | { |
---|
1233 | throw new NoViableAltException(_t); |
---|
1234 | } |
---|
1235 | } |
---|
1236 | } |
---|
1237 | break; |
---|
1238 | } |
---|
1239 | case CASE: |
---|
1240 | { |
---|
1241 | variantPart(_t); |
---|
1242 | _t = _retTree; |
---|
1243 | break; |
---|
1244 | } |
---|
1245 | default: |
---|
1246 | { |
---|
1247 | throw new NoViableAltException(_t); |
---|
1248 | } |
---|
1249 | } |
---|
1250 | } |
---|
1251 | _t = __t60; |
---|
1252 | _t = _t.getNextSibling(); |
---|
1253 | } |
---|
1254 | catch (RecognitionException ex) { |
---|
1255 | reportError(ex); |
---|
1256 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
1257 | } |
---|
1258 | _retTree = _t; |
---|
1259 | } |
---|
1260 | |
---|
1261 | public final void fixedPart(AST _t) throws RecognitionException { |
---|
1262 | |
---|
1263 | PascalAST fixedPart_AST_in = (PascalAST)_t; |
---|
1264 | |
---|
1265 | try { // for error handling |
---|
1266 | { |
---|
1267 | int _cnt65=0; |
---|
1268 | _loop65: |
---|
1269 | do { |
---|
1270 | if (_t==null) _t=ASTNULL; |
---|
1271 | if ((_t.getType()==FIELD)) { |
---|
1272 | recordSection(_t); |
---|
1273 | _t = _retTree; |
---|
1274 | } |
---|
1275 | else { |
---|
1276 | if ( _cnt65>=1 ) { break _loop65; } else {throw new NoViableAltException(_t);} |
---|
1277 | } |
---|
1278 | |
---|
1279 | _cnt65++; |
---|
1280 | } while (true); |
---|
1281 | } |
---|
1282 | } |
---|
1283 | catch (RecognitionException ex) { |
---|
1284 | reportError(ex); |
---|
1285 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
1286 | } |
---|
1287 | _retTree = _t; |
---|
1288 | } |
---|
1289 | |
---|
1290 | public final void variantPart(AST _t) throws RecognitionException { |
---|
1291 | |
---|
1292 | PascalAST variantPart_AST_in = (PascalAST)_t; |
---|
1293 | |
---|
1294 | try { // for error handling |
---|
1295 | AST __t69 = _t; |
---|
1296 | PascalAST tmp57_AST_in = (PascalAST)_t; |
---|
1297 | match(_t,CASE); |
---|
1298 | _t = _t.getFirstChild(); |
---|
1299 | tag(_t); |
---|
1300 | _t = _retTree; |
---|
1301 | { |
---|
1302 | int _cnt71=0; |
---|
1303 | _loop71: |
---|
1304 | do { |
---|
1305 | if (_t==null) _t=ASTNULL; |
---|
1306 | if ((_t.getType()==VARIANT_CASE)) { |
---|
1307 | variant(_t); |
---|
1308 | _t = _retTree; |
---|
1309 | } |
---|
1310 | else { |
---|
1311 | if ( _cnt71>=1 ) { break _loop71; } else {throw new NoViableAltException(_t);} |
---|
1312 | } |
---|
1313 | |
---|
1314 | _cnt71++; |
---|
1315 | } while (true); |
---|
1316 | } |
---|
1317 | _t = __t69; |
---|
1318 | _t = _t.getNextSibling(); |
---|
1319 | } |
---|
1320 | catch (RecognitionException ex) { |
---|
1321 | reportError(ex); |
---|
1322 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
1323 | } |
---|
1324 | _retTree = _t; |
---|
1325 | } |
---|
1326 | |
---|
1327 | public final void recordSection(AST _t) throws RecognitionException { |
---|
1328 | |
---|
1329 | PascalAST recordSection_AST_in = (PascalAST)_t; |
---|
1330 | |
---|
1331 | try { // for error handling |
---|
1332 | AST __t67 = _t; |
---|
1333 | PascalAST tmp58_AST_in = (PascalAST)_t; |
---|
1334 | match(_t,FIELD); |
---|
1335 | _t = _t.getFirstChild(); |
---|
1336 | identifierList(_t); |
---|
1337 | _t = _retTree; |
---|
1338 | type(_t); |
---|
1339 | _t = _retTree; |
---|
1340 | _t = __t67; |
---|
1341 | _t = _t.getNextSibling(); |
---|
1342 | } |
---|
1343 | catch (RecognitionException ex) { |
---|
1344 | reportError(ex); |
---|
1345 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
1346 | } |
---|
1347 | _retTree = _t; |
---|
1348 | } |
---|
1349 | |
---|
1350 | public final void tag(AST _t) throws RecognitionException { |
---|
1351 | |
---|
1352 | PascalAST tag_AST_in = (PascalAST)_t; |
---|
1353 | |
---|
1354 | try { // for error handling |
---|
1355 | if (_t==null) _t=ASTNULL; |
---|
1356 | switch ( _t.getType()) { |
---|
1357 | case VARIANT_TAG: |
---|
1358 | { |
---|
1359 | AST __t73 = _t; |
---|
1360 | PascalAST tmp59_AST_in = (PascalAST)_t; |
---|
1361 | match(_t,VARIANT_TAG); |
---|
1362 | _t = _t.getFirstChild(); |
---|
1363 | identifier(_t); |
---|
1364 | _t = _retTree; |
---|
1365 | typeIdentifier(_t); |
---|
1366 | _t = _retTree; |
---|
1367 | _t = __t73; |
---|
1368 | _t = _t.getNextSibling(); |
---|
1369 | break; |
---|
1370 | } |
---|
1371 | case VARIANT_TAG_NO_ID: |
---|
1372 | { |
---|
1373 | AST __t74 = _t; |
---|
1374 | PascalAST tmp60_AST_in = (PascalAST)_t; |
---|
1375 | match(_t,VARIANT_TAG_NO_ID); |
---|
1376 | _t = _t.getFirstChild(); |
---|
1377 | typeIdentifier(_t); |
---|
1378 | _t = _retTree; |
---|
1379 | _t = __t74; |
---|
1380 | _t = _t.getNextSibling(); |
---|
1381 | break; |
---|
1382 | } |
---|
1383 | default: |
---|
1384 | { |
---|
1385 | throw new NoViableAltException(_t); |
---|
1386 | } |
---|
1387 | } |
---|
1388 | } |
---|
1389 | catch (RecognitionException ex) { |
---|
1390 | reportError(ex); |
---|
1391 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
1392 | } |
---|
1393 | _retTree = _t; |
---|
1394 | } |
---|
1395 | |
---|
1396 | public final void variant(AST _t) throws RecognitionException { |
---|
1397 | |
---|
1398 | PascalAST variant_AST_in = (PascalAST)_t; |
---|
1399 | |
---|
1400 | try { // for error handling |
---|
1401 | AST __t76 = _t; |
---|
1402 | PascalAST tmp61_AST_in = (PascalAST)_t; |
---|
1403 | match(_t,VARIANT_CASE); |
---|
1404 | _t = _t.getFirstChild(); |
---|
1405 | constList(_t); |
---|
1406 | _t = _retTree; |
---|
1407 | fieldList(_t); |
---|
1408 | _t = _retTree; |
---|
1409 | _t = __t76; |
---|
1410 | _t = _t.getNextSibling(); |
---|
1411 | } |
---|
1412 | catch (RecognitionException ex) { |
---|
1413 | reportError(ex); |
---|
1414 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
1415 | } |
---|
1416 | _retTree = _t; |
---|
1417 | } |
---|
1418 | |
---|
1419 | public final void constList(AST _t) throws RecognitionException { |
---|
1420 | |
---|
1421 | PascalAST constList_AST_in = (PascalAST)_t; |
---|
1422 | |
---|
1423 | try { // for error handling |
---|
1424 | AST __t108 = _t; |
---|
1425 | PascalAST tmp62_AST_in = (PascalAST)_t; |
---|
1426 | match(_t,CONSTLIST); |
---|
1427 | _t = _t.getFirstChild(); |
---|
1428 | { |
---|
1429 | int _cnt110=0; |
---|
1430 | _loop110: |
---|
1431 | do { |
---|
1432 | if (_t==null) _t=ASTNULL; |
---|
1433 | if ((_tokenSet_2.member(_t.getType()))) { |
---|
1434 | constant(_t); |
---|
1435 | _t = _retTree; |
---|
1436 | } |
---|
1437 | else { |
---|
1438 | if ( _cnt110>=1 ) { break _loop110; } else {throw new NoViableAltException(_t);} |
---|
1439 | } |
---|
1440 | |
---|
1441 | _cnt110++; |
---|
1442 | } while (true); |
---|
1443 | } |
---|
1444 | _t = __t108; |
---|
1445 | _t = _t.getNextSibling(); |
---|
1446 | } |
---|
1447 | catch (RecognitionException ex) { |
---|
1448 | reportError(ex); |
---|
1449 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
1450 | } |
---|
1451 | _retTree = _t; |
---|
1452 | } |
---|
1453 | |
---|
1454 | public final void variableDeclaration(AST _t) throws RecognitionException { |
---|
1455 | |
---|
1456 | PascalAST variableDeclaration_AST_in = (PascalAST)_t; |
---|
1457 | |
---|
1458 | try { // for error handling |
---|
1459 | AST __t87 = _t; |
---|
1460 | PascalAST tmp63_AST_in = (PascalAST)_t; |
---|
1461 | match(_t,VARDECL); |
---|
1462 | _t = _t.getFirstChild(); |
---|
1463 | identifierList(_t); |
---|
1464 | _t = _retTree; |
---|
1465 | type(_t); |
---|
1466 | _t = _retTree; |
---|
1467 | _t = __t87; |
---|
1468 | _t = _t.getNextSibling(); |
---|
1469 | } |
---|
1470 | catch (RecognitionException ex) { |
---|
1471 | reportError(ex); |
---|
1472 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
1473 | } |
---|
1474 | _retTree = _t; |
---|
1475 | } |
---|
1476 | |
---|
1477 | public final void procedureOrFunctionDeclaration(AST _t) throws RecognitionException { |
---|
1478 | |
---|
1479 | PascalAST procedureOrFunctionDeclaration_AST_in = (PascalAST)_t; |
---|
1480 | |
---|
1481 | try { // for error handling |
---|
1482 | if (_t==null) _t=ASTNULL; |
---|
1483 | switch ( _t.getType()) { |
---|
1484 | case PROCEDURE: |
---|
1485 | { |
---|
1486 | procedureDeclaration(_t); |
---|
1487 | _t = _retTree; |
---|
1488 | break; |
---|
1489 | } |
---|
1490 | case FUNCTION: |
---|
1491 | { |
---|
1492 | functionDeclaration(_t); |
---|
1493 | _t = _retTree; |
---|
1494 | break; |
---|
1495 | } |
---|
1496 | default: |
---|
1497 | { |
---|
1498 | throw new NoViableAltException(_t); |
---|
1499 | } |
---|
1500 | } |
---|
1501 | } |
---|
1502 | catch (RecognitionException ex) { |
---|
1503 | reportError(ex); |
---|
1504 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
1505 | } |
---|
1506 | _retTree = _t; |
---|
1507 | } |
---|
1508 | |
---|
1509 | public final void procedureDeclaration(AST _t) throws RecognitionException { |
---|
1510 | |
---|
1511 | PascalAST procedureDeclaration_AST_in = (PascalAST)_t; |
---|
1512 | |
---|
1513 | try { // for error handling |
---|
1514 | AST __t91 = _t; |
---|
1515 | PascalAST tmp64_AST_in = (PascalAST)_t; |
---|
1516 | match(_t,PROCEDURE); |
---|
1517 | _t = _t.getFirstChild(); |
---|
1518 | PascalAST tmp65_AST_in = (PascalAST)_t; |
---|
1519 | match(_t,IDENT); |
---|
1520 | _t = _t.getNextSibling(); |
---|
1521 | { |
---|
1522 | if (_t==null) _t=ASTNULL; |
---|
1523 | switch ( _t.getType()) { |
---|
1524 | case ARGDECLS: |
---|
1525 | { |
---|
1526 | formalParameterList(_t); |
---|
1527 | _t = _retTree; |
---|
1528 | break; |
---|
1529 | } |
---|
1530 | case BLOCK: |
---|
1531 | case IMPLEMENTATION: |
---|
1532 | case USES: |
---|
1533 | case LABEL: |
---|
1534 | case CONST: |
---|
1535 | case TYPE: |
---|
1536 | case FUNCTION: |
---|
1537 | case PROCEDURE: |
---|
1538 | case VAR: |
---|
1539 | { |
---|
1540 | break; |
---|
1541 | } |
---|
1542 | default: |
---|
1543 | { |
---|
1544 | throw new NoViableAltException(_t); |
---|
1545 | } |
---|
1546 | } |
---|
1547 | } |
---|
1548 | block(_t); |
---|
1549 | _t = _retTree; |
---|
1550 | _t = __t91; |
---|
1551 | _t = _t.getNextSibling(); |
---|
1552 | } |
---|
1553 | catch (RecognitionException ex) { |
---|
1554 | reportError(ex); |
---|
1555 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
1556 | } |
---|
1557 | _retTree = _t; |
---|
1558 | } |
---|
1559 | |
---|
1560 | public final void functionDeclaration(AST _t) throws RecognitionException { |
---|
1561 | |
---|
1562 | PascalAST functionDeclaration_AST_in = (PascalAST)_t; |
---|
1563 | |
---|
1564 | try { // for error handling |
---|
1565 | AST __t112 = _t; |
---|
1566 | PascalAST tmp66_AST_in = (PascalAST)_t; |
---|
1567 | match(_t,FUNCTION); |
---|
1568 | _t = _t.getFirstChild(); |
---|
1569 | PascalAST tmp67_AST_in = (PascalAST)_t; |
---|
1570 | match(_t,IDENT); |
---|
1571 | _t = _t.getNextSibling(); |
---|
1572 | { |
---|
1573 | if (_t==null) _t=ASTNULL; |
---|
1574 | switch ( _t.getType()) { |
---|
1575 | case ARGDECLS: |
---|
1576 | { |
---|
1577 | formalParameterList(_t); |
---|
1578 | _t = _retTree; |
---|
1579 | break; |
---|
1580 | } |
---|
1581 | case IDENT: |
---|
1582 | case CHAR: |
---|
1583 | case BOOLEAN: |
---|
1584 | case INTEGER: |
---|
1585 | case REAL: |
---|
1586 | case STRING: |
---|
1587 | { |
---|
1588 | break; |
---|
1589 | } |
---|
1590 | default: |
---|
1591 | { |
---|
1592 | throw new NoViableAltException(_t); |
---|
1593 | } |
---|
1594 | } |
---|
1595 | } |
---|
1596 | resultType(_t); |
---|
1597 | _t = _retTree; |
---|
1598 | block(_t); |
---|
1599 | _t = _retTree; |
---|
1600 | _t = __t112; |
---|
1601 | _t = _t.getNextSibling(); |
---|
1602 | } |
---|
1603 | catch (RecognitionException ex) { |
---|
1604 | reportError(ex); |
---|
1605 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
1606 | } |
---|
1607 | _retTree = _t; |
---|
1608 | } |
---|
1609 | |
---|
1610 | public final void formalParameterSection(AST _t) throws RecognitionException { |
---|
1611 | |
---|
1612 | PascalAST formalParameterSection_AST_in = (PascalAST)_t; |
---|
1613 | |
---|
1614 | try { // for error handling |
---|
1615 | if (_t==null) _t=ASTNULL; |
---|
1616 | switch ( _t.getType()) { |
---|
1617 | case ARGDECL: |
---|
1618 | { |
---|
1619 | parameterGroup(_t); |
---|
1620 | _t = _retTree; |
---|
1621 | break; |
---|
1622 | } |
---|
1623 | case VAR: |
---|
1624 | { |
---|
1625 | AST __t98 = _t; |
---|
1626 | PascalAST tmp68_AST_in = (PascalAST)_t; |
---|
1627 | match(_t,VAR); |
---|
1628 | _t = _t.getFirstChild(); |
---|
1629 | parameterGroup(_t); |
---|
1630 | _t = _retTree; |
---|
1631 | _t = __t98; |
---|
1632 | _t = _t.getNextSibling(); |
---|
1633 | break; |
---|
1634 | } |
---|
1635 | case FUNCTION: |
---|
1636 | { |
---|
1637 | AST __t99 = _t; |
---|
1638 | PascalAST tmp69_AST_in = (PascalAST)_t; |
---|
1639 | match(_t,FUNCTION); |
---|
1640 | _t = _t.getFirstChild(); |
---|
1641 | parameterGroup(_t); |
---|
1642 | _t = _retTree; |
---|
1643 | _t = __t99; |
---|
1644 | _t = _t.getNextSibling(); |
---|
1645 | break; |
---|
1646 | } |
---|
1647 | case PROCEDURE: |
---|
1648 | { |
---|
1649 | AST __t100 = _t; |
---|
1650 | PascalAST tmp70_AST_in = (PascalAST)_t; |
---|
1651 | match(_t,PROCEDURE); |
---|
1652 | _t = _t.getFirstChild(); |
---|
1653 | parameterGroup(_t); |
---|
1654 | _t = _retTree; |
---|
1655 | _t = __t100; |
---|
1656 | _t = _t.getNextSibling(); |
---|
1657 | break; |
---|
1658 | } |
---|
1659 | default: |
---|
1660 | { |
---|
1661 | throw new NoViableAltException(_t); |
---|
1662 | } |
---|
1663 | } |
---|
1664 | } |
---|
1665 | catch (RecognitionException ex) { |
---|
1666 | reportError(ex); |
---|
1667 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
1668 | } |
---|
1669 | _retTree = _t; |
---|
1670 | } |
---|
1671 | |
---|
1672 | public final void parameterGroup(AST _t) throws RecognitionException { |
---|
1673 | |
---|
1674 | PascalAST parameterGroup_AST_in = (PascalAST)_t; |
---|
1675 | |
---|
1676 | try { // for error handling |
---|
1677 | AST __t102 = _t; |
---|
1678 | PascalAST tmp71_AST_in = (PascalAST)_t; |
---|
1679 | match(_t,ARGDECL); |
---|
1680 | _t = _t.getFirstChild(); |
---|
1681 | identifierList(_t); |
---|
1682 | _t = _retTree; |
---|
1683 | typeIdentifier(_t); |
---|
1684 | _t = _retTree; |
---|
1685 | _t = __t102; |
---|
1686 | _t = _t.getNextSibling(); |
---|
1687 | } |
---|
1688 | catch (RecognitionException ex) { |
---|
1689 | reportError(ex); |
---|
1690 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
1691 | } |
---|
1692 | _retTree = _t; |
---|
1693 | } |
---|
1694 | |
---|
1695 | public final void statement(AST _t) throws RecognitionException { |
---|
1696 | |
---|
1697 | PascalAST statement_AST_in = (PascalAST)_t; |
---|
1698 | |
---|
1699 | try { // for error handling |
---|
1700 | if (_t==null) _t=ASTNULL; |
---|
1701 | switch ( _t.getType()) { |
---|
1702 | case COLON: |
---|
1703 | { |
---|
1704 | AST __t116 = _t; |
---|
1705 | PascalAST tmp72_AST_in = (PascalAST)_t; |
---|
1706 | match(_t,COLON); |
---|
1707 | _t = _t.getFirstChild(); |
---|
1708 | label(_t); |
---|
1709 | _t = _retTree; |
---|
1710 | unlabelledStatement(_t); |
---|
1711 | _t = _retTree; |
---|
1712 | _t = __t116; |
---|
1713 | _t = _t.getNextSibling(); |
---|
1714 | break; |
---|
1715 | } |
---|
1716 | case BLOCK: |
---|
1717 | case PROC_CALL: |
---|
1718 | case CASE: |
---|
1719 | case ASSIGN: |
---|
1720 | case GOTO: |
---|
1721 | case IF: |
---|
1722 | case WHILE: |
---|
1723 | case REPEAT: |
---|
1724 | case FOR: |
---|
1725 | case WITH: |
---|
1726 | { |
---|
1727 | unlabelledStatement(_t); |
---|
1728 | _t = _retTree; |
---|
1729 | break; |
---|
1730 | } |
---|
1731 | default: |
---|
1732 | { |
---|
1733 | throw new NoViableAltException(_t); |
---|
1734 | } |
---|
1735 | } |
---|
1736 | } |
---|
1737 | catch (RecognitionException ex) { |
---|
1738 | reportError(ex); |
---|
1739 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
1740 | } |
---|
1741 | _retTree = _t; |
---|
1742 | } |
---|
1743 | |
---|
1744 | public final void unlabelledStatement(AST _t) throws RecognitionException { |
---|
1745 | |
---|
1746 | PascalAST unlabelledStatement_AST_in = (PascalAST)_t; |
---|
1747 | |
---|
1748 | try { // for error handling |
---|
1749 | if (_t==null) _t=ASTNULL; |
---|
1750 | switch ( _t.getType()) { |
---|
1751 | case PROC_CALL: |
---|
1752 | case ASSIGN: |
---|
1753 | case GOTO: |
---|
1754 | { |
---|
1755 | simpleStatement(_t); |
---|
1756 | _t = _retTree; |
---|
1757 | break; |
---|
1758 | } |
---|
1759 | case BLOCK: |
---|
1760 | case CASE: |
---|
1761 | case IF: |
---|
1762 | case WHILE: |
---|
1763 | case REPEAT: |
---|
1764 | case FOR: |
---|
1765 | case WITH: |
---|
1766 | { |
---|
1767 | structuredStatement(_t); |
---|
1768 | _t = _retTree; |
---|
1769 | break; |
---|
1770 | } |
---|
1771 | default: |
---|
1772 | { |
---|
1773 | throw new NoViableAltException(_t); |
---|
1774 | } |
---|
1775 | } |
---|
1776 | } |
---|
1777 | catch (RecognitionException ex) { |
---|
1778 | reportError(ex); |
---|
1779 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
1780 | } |
---|
1781 | _retTree = _t; |
---|
1782 | } |
---|
1783 | |
---|
1784 | public final void simpleStatement(AST _t) throws RecognitionException { |
---|
1785 | |
---|
1786 | PascalAST simpleStatement_AST_in = (PascalAST)_t; |
---|
1787 | |
---|
1788 | try { // for error handling |
---|
1789 | if (_t==null) _t=ASTNULL; |
---|
1790 | switch ( _t.getType()) { |
---|
1791 | case ASSIGN: |
---|
1792 | { |
---|
1793 | assignmentStatement(_t); |
---|
1794 | _t = _retTree; |
---|
1795 | break; |
---|
1796 | } |
---|
1797 | case PROC_CALL: |
---|
1798 | { |
---|
1799 | procedureStatement(_t); |
---|
1800 | _t = _retTree; |
---|
1801 | break; |
---|
1802 | } |
---|
1803 | case GOTO: |
---|
1804 | { |
---|
1805 | gotoStatement(_t); |
---|
1806 | _t = _retTree; |
---|
1807 | break; |
---|
1808 | } |
---|
1809 | default: |
---|
1810 | { |
---|
1811 | throw new NoViableAltException(_t); |
---|
1812 | } |
---|
1813 | } |
---|
1814 | } |
---|
1815 | catch (RecognitionException ex) { |
---|
1816 | reportError(ex); |
---|
1817 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
1818 | } |
---|
1819 | _retTree = _t; |
---|
1820 | } |
---|
1821 | |
---|
1822 | public final void structuredStatement(AST _t) throws RecognitionException { |
---|
1823 | |
---|
1824 | PascalAST structuredStatement_AST_in = (PascalAST)_t; |
---|
1825 | |
---|
1826 | try { // for error handling |
---|
1827 | if (_t==null) _t=ASTNULL; |
---|
1828 | switch ( _t.getType()) { |
---|
1829 | case BLOCK: |
---|
1830 | { |
---|
1831 | compoundStatement(_t); |
---|
1832 | _t = _retTree; |
---|
1833 | break; |
---|
1834 | } |
---|
1835 | case CASE: |
---|
1836 | case IF: |
---|
1837 | { |
---|
1838 | conditionalStatement(_t); |
---|
1839 | _t = _retTree; |
---|
1840 | break; |
---|
1841 | } |
---|
1842 | case WHILE: |
---|
1843 | case REPEAT: |
---|
1844 | case FOR: |
---|
1845 | { |
---|
1846 | repetetiveStatement(_t); |
---|
1847 | _t = _retTree; |
---|
1848 | break; |
---|
1849 | } |
---|
1850 | case WITH: |
---|
1851 | { |
---|
1852 | withStatement(_t); |
---|
1853 | _t = _retTree; |
---|
1854 | break; |
---|
1855 | } |
---|
1856 | default: |
---|
1857 | { |
---|
1858 | throw new NoViableAltException(_t); |
---|
1859 | } |
---|
1860 | } |
---|
1861 | } |
---|
1862 | catch (RecognitionException ex) { |
---|
1863 | reportError(ex); |
---|
1864 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
1865 | } |
---|
1866 | _retTree = _t; |
---|
1867 | } |
---|
1868 | |
---|
1869 | public final void assignmentStatement(AST _t) throws RecognitionException { |
---|
1870 | |
---|
1871 | PascalAST assignmentStatement_AST_in = (PascalAST)_t; |
---|
1872 | |
---|
1873 | try { // for error handling |
---|
1874 | AST __t120 = _t; |
---|
1875 | PascalAST tmp73_AST_in = (PascalAST)_t; |
---|
1876 | match(_t,ASSIGN); |
---|
1877 | _t = _t.getFirstChild(); |
---|
1878 | variable(_t); |
---|
1879 | _t = _retTree; |
---|
1880 | expression(_t); |
---|
1881 | _t = _retTree; |
---|
1882 | _t = __t120; |
---|
1883 | _t = _t.getNextSibling(); |
---|
1884 | } |
---|
1885 | catch (RecognitionException ex) { |
---|
1886 | reportError(ex); |
---|
1887 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
1888 | } |
---|
1889 | _retTree = _t; |
---|
1890 | } |
---|
1891 | |
---|
1892 | public final void procedureStatement(AST _t) throws RecognitionException { |
---|
1893 | |
---|
1894 | PascalAST procedureStatement_AST_in = (PascalAST)_t; |
---|
1895 | |
---|
1896 | try { // for error handling |
---|
1897 | AST __t166 = _t; |
---|
1898 | PascalAST tmp74_AST_in = (PascalAST)_t; |
---|
1899 | match(_t,PROC_CALL); |
---|
1900 | _t = _t.getFirstChild(); |
---|
1901 | PascalAST tmp75_AST_in = (PascalAST)_t; |
---|
1902 | match(_t,IDENT); |
---|
1903 | _t = _t.getNextSibling(); |
---|
1904 | { |
---|
1905 | if (_t==null) _t=ASTNULL; |
---|
1906 | switch ( _t.getType()) { |
---|
1907 | case ARGLIST: |
---|
1908 | { |
---|
1909 | parameterList(_t); |
---|
1910 | _t = _retTree; |
---|
1911 | break; |
---|
1912 | } |
---|
1913 | case 3: |
---|
1914 | { |
---|
1915 | break; |
---|
1916 | } |
---|
1917 | default: |
---|
1918 | { |
---|
1919 | throw new NoViableAltException(_t); |
---|
1920 | } |
---|
1921 | } |
---|
1922 | } |
---|
1923 | _t = __t166; |
---|
1924 | _t = _t.getNextSibling(); |
---|
1925 | } |
---|
1926 | catch (RecognitionException ex) { |
---|
1927 | reportError(ex); |
---|
1928 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
1929 | } |
---|
1930 | _retTree = _t; |
---|
1931 | } |
---|
1932 | |
---|
1933 | public final void gotoStatement(AST _t) throws RecognitionException { |
---|
1934 | |
---|
1935 | PascalAST gotoStatement_AST_in = (PascalAST)_t; |
---|
1936 | |
---|
1937 | try { // for error handling |
---|
1938 | AST __t170 = _t; |
---|
1939 | PascalAST tmp76_AST_in = (PascalAST)_t; |
---|
1940 | match(_t,GOTO); |
---|
1941 | _t = _t.getFirstChild(); |
---|
1942 | label(_t); |
---|
1943 | _t = _retTree; |
---|
1944 | _t = __t170; |
---|
1945 | _t = _t.getNextSibling(); |
---|
1946 | } |
---|
1947 | catch (RecognitionException ex) { |
---|
1948 | reportError(ex); |
---|
1949 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
1950 | } |
---|
1951 | _retTree = _t; |
---|
1952 | } |
---|
1953 | |
---|
1954 | /** A variable is an id with a suffix and can look like: |
---|
1955 | * id |
---|
1956 | * id[expr,...] |
---|
1957 | * id.id |
---|
1958 | * id.id[expr,...] |
---|
1959 | * id^ |
---|
1960 | * id^.id |
---|
1961 | * id^.id[expr,...] |
---|
1962 | * ... |
---|
1963 | * |
---|
1964 | * LL has a really hard time with this construct as it's naturally |
---|
1965 | * left-recursive. We have to turn into a simple loop rather than |
---|
1966 | * recursive loop, hence, the suffixes. I keep in the same rule |
---|
1967 | * for easy tree construction. |
---|
1968 | */ |
---|
1969 | public final void variable(AST _t) throws RecognitionException { |
---|
1970 | |
---|
1971 | PascalAST variable_AST_in = (PascalAST)_t; |
---|
1972 | |
---|
1973 | try { // for error handling |
---|
1974 | if (_t==null) _t=ASTNULL; |
---|
1975 | switch ( _t.getType()) { |
---|
1976 | case LBRACK: |
---|
1977 | { |
---|
1978 | AST __t122 = _t; |
---|
1979 | PascalAST tmp77_AST_in = (PascalAST)_t; |
---|
1980 | match(_t,LBRACK); |
---|
1981 | _t = _t.getFirstChild(); |
---|
1982 | variable(_t); |
---|
1983 | _t = _retTree; |
---|
1984 | { |
---|
1985 | int _cnt124=0; |
---|
1986 | _loop124: |
---|
1987 | do { |
---|
1988 | if (_t==null) _t=ASTNULL; |
---|
1989 | if ((_tokenSet_3.member(_t.getType()))) { |
---|
1990 | expression(_t); |
---|
1991 | _t = _retTree; |
---|
1992 | } |
---|
1993 | else { |
---|
1994 | if ( _cnt124>=1 ) { break _loop124; } else {throw new NoViableAltException(_t);} |
---|
1995 | } |
---|
1996 | |
---|
1997 | _cnt124++; |
---|
1998 | } while (true); |
---|
1999 | } |
---|
2000 | _t = __t122; |
---|
2001 | _t = _t.getNextSibling(); |
---|
2002 | break; |
---|
2003 | } |
---|
2004 | case LBRACK2: |
---|
2005 | { |
---|
2006 | AST __t125 = _t; |
---|
2007 | PascalAST tmp78_AST_in = (PascalAST)_t; |
---|
2008 | match(_t,LBRACK2); |
---|
2009 | _t = _t.getFirstChild(); |
---|
2010 | variable(_t); |
---|
2011 | _t = _retTree; |
---|
2012 | { |
---|
2013 | int _cnt127=0; |
---|
2014 | _loop127: |
---|
2015 | do { |
---|
2016 | if (_t==null) _t=ASTNULL; |
---|
2017 | if ((_tokenSet_3.member(_t.getType()))) { |
---|
2018 | expression(_t); |
---|
2019 | _t = _retTree; |
---|
2020 | } |
---|
2021 | else { |
---|
2022 | if ( _cnt127>=1 ) { break _loop127; } else {throw new NoViableAltException(_t);} |
---|
2023 | } |
---|
2024 | |
---|
2025 | _cnt127++; |
---|
2026 | } while (true); |
---|
2027 | } |
---|
2028 | _t = __t125; |
---|
2029 | _t = _t.getNextSibling(); |
---|
2030 | break; |
---|
2031 | } |
---|
2032 | case DOT: |
---|
2033 | { |
---|
2034 | AST __t128 = _t; |
---|
2035 | PascalAST tmp79_AST_in = (PascalAST)_t; |
---|
2036 | match(_t,DOT); |
---|
2037 | _t = _t.getFirstChild(); |
---|
2038 | variable(_t); |
---|
2039 | _t = _retTree; |
---|
2040 | PascalAST tmp80_AST_in = (PascalAST)_t; |
---|
2041 | match(_t,IDENT); |
---|
2042 | _t = _t.getNextSibling(); |
---|
2043 | _t = __t128; |
---|
2044 | _t = _t.getNextSibling(); |
---|
2045 | break; |
---|
2046 | } |
---|
2047 | case POINTER: |
---|
2048 | { |
---|
2049 | AST __t129 = _t; |
---|
2050 | PascalAST tmp81_AST_in = (PascalAST)_t; |
---|
2051 | match(_t,POINTER); |
---|
2052 | _t = _t.getFirstChild(); |
---|
2053 | variable(_t); |
---|
2054 | _t = _retTree; |
---|
2055 | _t = __t129; |
---|
2056 | _t = _t.getNextSibling(); |
---|
2057 | break; |
---|
2058 | } |
---|
2059 | case AT: |
---|
2060 | { |
---|
2061 | AST __t130 = _t; |
---|
2062 | PascalAST tmp82_AST_in = (PascalAST)_t; |
---|
2063 | match(_t,AT); |
---|
2064 | _t = _t.getFirstChild(); |
---|
2065 | PascalAST tmp83_AST_in = (PascalAST)_t; |
---|
2066 | match(_t,IDENT); |
---|
2067 | _t = _t.getNextSibling(); |
---|
2068 | _t = __t130; |
---|
2069 | _t = _t.getNextSibling(); |
---|
2070 | break; |
---|
2071 | } |
---|
2072 | case IDENT: |
---|
2073 | { |
---|
2074 | PascalAST tmp84_AST_in = (PascalAST)_t; |
---|
2075 | match(_t,IDENT); |
---|
2076 | _t = _t.getNextSibling(); |
---|
2077 | break; |
---|
2078 | } |
---|
2079 | default: |
---|
2080 | { |
---|
2081 | throw new NoViableAltException(_t); |
---|
2082 | } |
---|
2083 | } |
---|
2084 | } |
---|
2085 | catch (RecognitionException ex) { |
---|
2086 | reportError(ex); |
---|
2087 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
2088 | } |
---|
2089 | _retTree = _t; |
---|
2090 | } |
---|
2091 | |
---|
2092 | public final void expression(AST _t) throws RecognitionException { |
---|
2093 | |
---|
2094 | PascalAST expression_AST_in = (PascalAST)_t; |
---|
2095 | |
---|
2096 | try { // for error handling |
---|
2097 | if (_t==null) _t=ASTNULL; |
---|
2098 | switch ( _t.getType()) { |
---|
2099 | case EQUAL: |
---|
2100 | { |
---|
2101 | AST __t132 = _t; |
---|
2102 | PascalAST tmp85_AST_in = (PascalAST)_t; |
---|
2103 | match(_t,EQUAL); |
---|
2104 | _t = _t.getFirstChild(); |
---|
2105 | expression(_t); |
---|
2106 | _t = _retTree; |
---|
2107 | expression(_t); |
---|
2108 | _t = _retTree; |
---|
2109 | _t = __t132; |
---|
2110 | _t = _t.getNextSibling(); |
---|
2111 | break; |
---|
2112 | } |
---|
2113 | case NOT_EQUAL: |
---|
2114 | { |
---|
2115 | AST __t133 = _t; |
---|
2116 | PascalAST tmp86_AST_in = (PascalAST)_t; |
---|
2117 | match(_t,NOT_EQUAL); |
---|
2118 | _t = _t.getFirstChild(); |
---|
2119 | expression(_t); |
---|
2120 | _t = _retTree; |
---|
2121 | expression(_t); |
---|
2122 | _t = _retTree; |
---|
2123 | _t = __t133; |
---|
2124 | _t = _t.getNextSibling(); |
---|
2125 | break; |
---|
2126 | } |
---|
2127 | case LT: |
---|
2128 | { |
---|
2129 | AST __t134 = _t; |
---|
2130 | PascalAST tmp87_AST_in = (PascalAST)_t; |
---|
2131 | match(_t,LT); |
---|
2132 | _t = _t.getFirstChild(); |
---|
2133 | expression(_t); |
---|
2134 | _t = _retTree; |
---|
2135 | expression(_t); |
---|
2136 | _t = _retTree; |
---|
2137 | _t = __t134; |
---|
2138 | _t = _t.getNextSibling(); |
---|
2139 | break; |
---|
2140 | } |
---|
2141 | case LE: |
---|
2142 | { |
---|
2143 | AST __t135 = _t; |
---|
2144 | PascalAST tmp88_AST_in = (PascalAST)_t; |
---|
2145 | match(_t,LE); |
---|
2146 | _t = _t.getFirstChild(); |
---|
2147 | expression(_t); |
---|
2148 | _t = _retTree; |
---|
2149 | expression(_t); |
---|
2150 | _t = _retTree; |
---|
2151 | _t = __t135; |
---|
2152 | _t = _t.getNextSibling(); |
---|
2153 | break; |
---|
2154 | } |
---|
2155 | case GE: |
---|
2156 | { |
---|
2157 | AST __t136 = _t; |
---|
2158 | PascalAST tmp89_AST_in = (PascalAST)_t; |
---|
2159 | match(_t,GE); |
---|
2160 | _t = _t.getFirstChild(); |
---|
2161 | expression(_t); |
---|
2162 | _t = _retTree; |
---|
2163 | expression(_t); |
---|
2164 | _t = _retTree; |
---|
2165 | _t = __t136; |
---|
2166 | _t = _t.getNextSibling(); |
---|
2167 | break; |
---|
2168 | } |
---|
2169 | case GT: |
---|
2170 | { |
---|
2171 | AST __t137 = _t; |
---|
2172 | PascalAST tmp90_AST_in = (PascalAST)_t; |
---|
2173 | match(_t,GT); |
---|
2174 | _t = _t.getFirstChild(); |
---|
2175 | expression(_t); |
---|
2176 | _t = _retTree; |
---|
2177 | expression(_t); |
---|
2178 | _t = _retTree; |
---|
2179 | _t = __t137; |
---|
2180 | _t = _t.getNextSibling(); |
---|
2181 | break; |
---|
2182 | } |
---|
2183 | case IN: |
---|
2184 | { |
---|
2185 | AST __t138 = _t; |
---|
2186 | PascalAST tmp91_AST_in = (PascalAST)_t; |
---|
2187 | match(_t,IN); |
---|
2188 | _t = _t.getFirstChild(); |
---|
2189 | expression(_t); |
---|
2190 | _t = _retTree; |
---|
2191 | expression(_t); |
---|
2192 | _t = _retTree; |
---|
2193 | _t = __t138; |
---|
2194 | _t = _t.getNextSibling(); |
---|
2195 | break; |
---|
2196 | } |
---|
2197 | case PLUS: |
---|
2198 | { |
---|
2199 | AST __t139 = _t; |
---|
2200 | PascalAST tmp92_AST_in = (PascalAST)_t; |
---|
2201 | match(_t,PLUS); |
---|
2202 | _t = _t.getFirstChild(); |
---|
2203 | expression(_t); |
---|
2204 | _t = _retTree; |
---|
2205 | { |
---|
2206 | if (_t==null) _t=ASTNULL; |
---|
2207 | switch ( _t.getType()) { |
---|
2208 | case FUNC_CALL: |
---|
2209 | case DOT: |
---|
2210 | case IDENT: |
---|
2211 | case EQUAL: |
---|
2212 | case CHR: |
---|
2213 | case NUM_INT: |
---|
2214 | case NUM_REAL: |
---|
2215 | case PLUS: |
---|
2216 | case MINUS: |
---|
2217 | case STRING_LITERAL: |
---|
2218 | case LBRACK: |
---|
2219 | case LBRACK2: |
---|
2220 | case SET: |
---|
2221 | case POINTER: |
---|
2222 | case AT: |
---|
2223 | case NOT_EQUAL: |
---|
2224 | case LT: |
---|
2225 | case LE: |
---|
2226 | case GE: |
---|
2227 | case GT: |
---|
2228 | case IN: |
---|
2229 | case OR: |
---|
2230 | case STAR: |
---|
2231 | case SLASH: |
---|
2232 | case DIV: |
---|
2233 | case MOD: |
---|
2234 | case AND: |
---|
2235 | case NOT: |
---|
2236 | case NIL: |
---|
2237 | { |
---|
2238 | expression(_t); |
---|
2239 | _t = _retTree; |
---|
2240 | break; |
---|
2241 | } |
---|
2242 | case 3: |
---|
2243 | { |
---|
2244 | break; |
---|
2245 | } |
---|
2246 | default: |
---|
2247 | { |
---|
2248 | throw new NoViableAltException(_t); |
---|
2249 | } |
---|
2250 | } |
---|
2251 | } |
---|
2252 | _t = __t139; |
---|
2253 | _t = _t.getNextSibling(); |
---|
2254 | break; |
---|
2255 | } |
---|
2256 | case MINUS: |
---|
2257 | { |
---|
2258 | AST __t141 = _t; |
---|
2259 | PascalAST tmp93_AST_in = (PascalAST)_t; |
---|
2260 | match(_t,MINUS); |
---|
2261 | _t = _t.getFirstChild(); |
---|
2262 | expression(_t); |
---|
2263 | _t = _retTree; |
---|
2264 | { |
---|
2265 | if (_t==null) _t=ASTNULL; |
---|
2266 | switch ( _t.getType()) { |
---|
2267 | case FUNC_CALL: |
---|
2268 | case DOT: |
---|
2269 | case IDENT: |
---|
2270 | case EQUAL: |
---|
2271 | case CHR: |
---|
2272 | case NUM_INT: |
---|
2273 | case NUM_REAL: |
---|
2274 | case PLUS: |
---|
2275 | case MINUS: |
---|
2276 | case STRING_LITERAL: |
---|
2277 | case LBRACK: |
---|
2278 | case LBRACK2: |
---|
2279 | case SET: |
---|
2280 | case POINTER: |
---|
2281 | case AT: |
---|
2282 | case NOT_EQUAL: |
---|
2283 | case LT: |
---|
2284 | case LE: |
---|
2285 | case GE: |
---|
2286 | case GT: |
---|
2287 | case IN: |
---|
2288 | case OR: |
---|
2289 | case STAR: |
---|
2290 | case SLASH: |
---|
2291 | case DIV: |
---|
2292 | case MOD: |
---|
2293 | case AND: |
---|
2294 | case NOT: |
---|
2295 | case NIL: |
---|
2296 | { |
---|
2297 | expression(_t); |
---|
2298 | _t = _retTree; |
---|
2299 | break; |
---|
2300 | } |
---|
2301 | case 3: |
---|
2302 | { |
---|
2303 | break; |
---|
2304 | } |
---|
2305 | default: |
---|
2306 | { |
---|
2307 | throw new NoViableAltException(_t); |
---|
2308 | } |
---|
2309 | } |
---|
2310 | } |
---|
2311 | _t = __t141; |
---|
2312 | _t = _t.getNextSibling(); |
---|
2313 | break; |
---|
2314 | } |
---|
2315 | case OR: |
---|
2316 | { |
---|
2317 | AST __t143 = _t; |
---|
2318 | PascalAST tmp94_AST_in = (PascalAST)_t; |
---|
2319 | match(_t,OR); |
---|
2320 | _t = _t.getFirstChild(); |
---|
2321 | expression(_t); |
---|
2322 | _t = _retTree; |
---|
2323 | expression(_t); |
---|
2324 | _t = _retTree; |
---|
2325 | _t = __t143; |
---|
2326 | _t = _t.getNextSibling(); |
---|
2327 | break; |
---|
2328 | } |
---|
2329 | case STAR: |
---|
2330 | { |
---|
2331 | AST __t144 = _t; |
---|
2332 | PascalAST tmp95_AST_in = (PascalAST)_t; |
---|
2333 | match(_t,STAR); |
---|
2334 | _t = _t.getFirstChild(); |
---|
2335 | expression(_t); |
---|
2336 | _t = _retTree; |
---|
2337 | expression(_t); |
---|
2338 | _t = _retTree; |
---|
2339 | _t = __t144; |
---|
2340 | _t = _t.getNextSibling(); |
---|
2341 | break; |
---|
2342 | } |
---|
2343 | case SLASH: |
---|
2344 | { |
---|
2345 | AST __t145 = _t; |
---|
2346 | PascalAST tmp96_AST_in = (PascalAST)_t; |
---|
2347 | match(_t,SLASH); |
---|
2348 | _t = _t.getFirstChild(); |
---|
2349 | expression(_t); |
---|
2350 | _t = _retTree; |
---|
2351 | expression(_t); |
---|
2352 | _t = _retTree; |
---|
2353 | _t = __t145; |
---|
2354 | _t = _t.getNextSibling(); |
---|
2355 | break; |
---|
2356 | } |
---|
2357 | case DIV: |
---|
2358 | { |
---|
2359 | AST __t146 = _t; |
---|
2360 | PascalAST tmp97_AST_in = (PascalAST)_t; |
---|
2361 | match(_t,DIV); |
---|
2362 | _t = _t.getFirstChild(); |
---|
2363 | expression(_t); |
---|
2364 | _t = _retTree; |
---|
2365 | expression(_t); |
---|
2366 | _t = _retTree; |
---|
2367 | _t = __t146; |
---|
2368 | _t = _t.getNextSibling(); |
---|
2369 | break; |
---|
2370 | } |
---|
2371 | case MOD: |
---|
2372 | { |
---|
2373 | AST __t147 = _t; |
---|
2374 | PascalAST tmp98_AST_in = (PascalAST)_t; |
---|
2375 | match(_t,MOD); |
---|
2376 | _t = _t.getFirstChild(); |
---|
2377 | expression(_t); |
---|
2378 | _t = _retTree; |
---|
2379 | expression(_t); |
---|
2380 | _t = _retTree; |
---|
2381 | _t = __t147; |
---|
2382 | _t = _t.getNextSibling(); |
---|
2383 | break; |
---|
2384 | } |
---|
2385 | case AND: |
---|
2386 | { |
---|
2387 | AST __t148 = _t; |
---|
2388 | PascalAST tmp99_AST_in = (PascalAST)_t; |
---|
2389 | match(_t,AND); |
---|
2390 | _t = _t.getFirstChild(); |
---|
2391 | expression(_t); |
---|
2392 | _t = _retTree; |
---|
2393 | expression(_t); |
---|
2394 | _t = _retTree; |
---|
2395 | _t = __t148; |
---|
2396 | _t = _t.getNextSibling(); |
---|
2397 | break; |
---|
2398 | } |
---|
2399 | case NOT: |
---|
2400 | { |
---|
2401 | AST __t149 = _t; |
---|
2402 | PascalAST tmp100_AST_in = (PascalAST)_t; |
---|
2403 | match(_t,NOT); |
---|
2404 | _t = _t.getFirstChild(); |
---|
2405 | expression(_t); |
---|
2406 | _t = _retTree; |
---|
2407 | _t = __t149; |
---|
2408 | _t = _t.getNextSibling(); |
---|
2409 | break; |
---|
2410 | } |
---|
2411 | case DOT: |
---|
2412 | case IDENT: |
---|
2413 | case LBRACK: |
---|
2414 | case LBRACK2: |
---|
2415 | case POINTER: |
---|
2416 | case AT: |
---|
2417 | { |
---|
2418 | variable(_t); |
---|
2419 | _t = _retTree; |
---|
2420 | break; |
---|
2421 | } |
---|
2422 | case FUNC_CALL: |
---|
2423 | { |
---|
2424 | functionDesignator(_t); |
---|
2425 | _t = _retTree; |
---|
2426 | break; |
---|
2427 | } |
---|
2428 | case SET: |
---|
2429 | { |
---|
2430 | set(_t); |
---|
2431 | _t = _retTree; |
---|
2432 | break; |
---|
2433 | } |
---|
2434 | case NUM_INT: |
---|
2435 | { |
---|
2436 | PascalAST tmp101_AST_in = (PascalAST)_t; |
---|
2437 | match(_t,NUM_INT); |
---|
2438 | _t = _t.getNextSibling(); |
---|
2439 | break; |
---|
2440 | } |
---|
2441 | case NUM_REAL: |
---|
2442 | { |
---|
2443 | PascalAST tmp102_AST_in = (PascalAST)_t; |
---|
2444 | match(_t,NUM_REAL); |
---|
2445 | _t = _t.getNextSibling(); |
---|
2446 | break; |
---|
2447 | } |
---|
2448 | case CHR: |
---|
2449 | { |
---|
2450 | AST __t150 = _t; |
---|
2451 | PascalAST tmp103_AST_in = (PascalAST)_t; |
---|
2452 | match(_t,CHR); |
---|
2453 | _t = _t.getFirstChild(); |
---|
2454 | { |
---|
2455 | if (_t==null) _t=ASTNULL; |
---|
2456 | switch ( _t.getType()) { |
---|
2457 | case NUM_INT: |
---|
2458 | { |
---|
2459 | PascalAST tmp104_AST_in = (PascalAST)_t; |
---|
2460 | match(_t,NUM_INT); |
---|
2461 | _t = _t.getNextSibling(); |
---|
2462 | break; |
---|
2463 | } |
---|
2464 | case NUM_REAL: |
---|
2465 | { |
---|
2466 | PascalAST tmp105_AST_in = (PascalAST)_t; |
---|
2467 | match(_t,NUM_REAL); |
---|
2468 | _t = _t.getNextSibling(); |
---|
2469 | break; |
---|
2470 | } |
---|
2471 | default: |
---|
2472 | { |
---|
2473 | throw new NoViableAltException(_t); |
---|
2474 | } |
---|
2475 | } |
---|
2476 | } |
---|
2477 | _t = __t150; |
---|
2478 | _t = _t.getNextSibling(); |
---|
2479 | break; |
---|
2480 | } |
---|
2481 | case STRING_LITERAL: |
---|
2482 | { |
---|
2483 | string(_t); |
---|
2484 | _t = _retTree; |
---|
2485 | break; |
---|
2486 | } |
---|
2487 | case NIL: |
---|
2488 | { |
---|
2489 | PascalAST tmp106_AST_in = (PascalAST)_t; |
---|
2490 | match(_t,NIL); |
---|
2491 | _t = _t.getNextSibling(); |
---|
2492 | break; |
---|
2493 | } |
---|
2494 | default: |
---|
2495 | { |
---|
2496 | throw new NoViableAltException(_t); |
---|
2497 | } |
---|
2498 | } |
---|
2499 | } |
---|
2500 | catch (RecognitionException ex) { |
---|
2501 | reportError(ex); |
---|
2502 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
2503 | } |
---|
2504 | _retTree = _t; |
---|
2505 | } |
---|
2506 | |
---|
2507 | public final void functionDesignator(AST _t) throws RecognitionException { |
---|
2508 | |
---|
2509 | PascalAST functionDesignator_AST_in = (PascalAST)_t; |
---|
2510 | |
---|
2511 | try { // for error handling |
---|
2512 | AST __t153 = _t; |
---|
2513 | PascalAST tmp107_AST_in = (PascalAST)_t; |
---|
2514 | match(_t,FUNC_CALL); |
---|
2515 | _t = _t.getFirstChild(); |
---|
2516 | PascalAST tmp108_AST_in = (PascalAST)_t; |
---|
2517 | match(_t,IDENT); |
---|
2518 | _t = _t.getNextSibling(); |
---|
2519 | { |
---|
2520 | if (_t==null) _t=ASTNULL; |
---|
2521 | switch ( _t.getType()) { |
---|
2522 | case ARGLIST: |
---|
2523 | { |
---|
2524 | parameterList(_t); |
---|
2525 | _t = _retTree; |
---|
2526 | break; |
---|
2527 | } |
---|
2528 | case 3: |
---|
2529 | { |
---|
2530 | break; |
---|
2531 | } |
---|
2532 | default: |
---|
2533 | { |
---|
2534 | throw new NoViableAltException(_t); |
---|
2535 | } |
---|
2536 | } |
---|
2537 | } |
---|
2538 | _t = __t153; |
---|
2539 | _t = _t.getNextSibling(); |
---|
2540 | } |
---|
2541 | catch (RecognitionException ex) { |
---|
2542 | reportError(ex); |
---|
2543 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
2544 | } |
---|
2545 | _retTree = _t; |
---|
2546 | } |
---|
2547 | |
---|
2548 | public final void set(AST _t) throws RecognitionException { |
---|
2549 | |
---|
2550 | PascalAST set_AST_in = (PascalAST)_t; |
---|
2551 | |
---|
2552 | try { // for error handling |
---|
2553 | AST __t160 = _t; |
---|
2554 | PascalAST tmp109_AST_in = (PascalAST)_t; |
---|
2555 | match(_t,SET); |
---|
2556 | _t = _t.getFirstChild(); |
---|
2557 | { |
---|
2558 | _loop162: |
---|
2559 | do { |
---|
2560 | if (_t==null) _t=ASTNULL; |
---|
2561 | if ((_tokenSet_4.member(_t.getType()))) { |
---|
2562 | element(_t); |
---|
2563 | _t = _retTree; |
---|
2564 | } |
---|
2565 | else { |
---|
2566 | break _loop162; |
---|
2567 | } |
---|
2568 | |
---|
2569 | } while (true); |
---|
2570 | } |
---|
2571 | _t = __t160; |
---|
2572 | _t = _t.getNextSibling(); |
---|
2573 | } |
---|
2574 | catch (RecognitionException ex) { |
---|
2575 | reportError(ex); |
---|
2576 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
2577 | } |
---|
2578 | _retTree = _t; |
---|
2579 | } |
---|
2580 | |
---|
2581 | public final void parameterList(AST _t) throws RecognitionException { |
---|
2582 | |
---|
2583 | PascalAST parameterList_AST_in = (PascalAST)_t; |
---|
2584 | |
---|
2585 | try { // for error handling |
---|
2586 | AST __t156 = _t; |
---|
2587 | PascalAST tmp110_AST_in = (PascalAST)_t; |
---|
2588 | match(_t,ARGLIST); |
---|
2589 | _t = _t.getFirstChild(); |
---|
2590 | { |
---|
2591 | int _cnt158=0; |
---|
2592 | _loop158: |
---|
2593 | do { |
---|
2594 | if (_t==null) _t=ASTNULL; |
---|
2595 | if ((_tokenSet_3.member(_t.getType()))) { |
---|
2596 | actualParameter(_t); |
---|
2597 | _t = _retTree; |
---|
2598 | } |
---|
2599 | else { |
---|
2600 | if ( _cnt158>=1 ) { break _loop158; } else {throw new NoViableAltException(_t);} |
---|
2601 | } |
---|
2602 | |
---|
2603 | _cnt158++; |
---|
2604 | } while (true); |
---|
2605 | } |
---|
2606 | _t = __t156; |
---|
2607 | _t = _t.getNextSibling(); |
---|
2608 | } |
---|
2609 | catch (RecognitionException ex) { |
---|
2610 | reportError(ex); |
---|
2611 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
2612 | } |
---|
2613 | _retTree = _t; |
---|
2614 | } |
---|
2615 | |
---|
2616 | public final void actualParameter(AST _t) throws RecognitionException { |
---|
2617 | |
---|
2618 | PascalAST actualParameter_AST_in = (PascalAST)_t; |
---|
2619 | |
---|
2620 | try { // for error handling |
---|
2621 | expression(_t); |
---|
2622 | _t = _retTree; |
---|
2623 | } |
---|
2624 | catch (RecognitionException ex) { |
---|
2625 | reportError(ex); |
---|
2626 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
2627 | } |
---|
2628 | _retTree = _t; |
---|
2629 | } |
---|
2630 | |
---|
2631 | public final void element(AST _t) throws RecognitionException { |
---|
2632 | |
---|
2633 | PascalAST element_AST_in = (PascalAST)_t; |
---|
2634 | |
---|
2635 | try { // for error handling |
---|
2636 | if (_t==null) _t=ASTNULL; |
---|
2637 | switch ( _t.getType()) { |
---|
2638 | case DOTDOT: |
---|
2639 | { |
---|
2640 | AST __t164 = _t; |
---|
2641 | PascalAST tmp111_AST_in = (PascalAST)_t; |
---|
2642 | match(_t,DOTDOT); |
---|
2643 | _t = _t.getFirstChild(); |
---|
2644 | expression(_t); |
---|
2645 | _t = _retTree; |
---|
2646 | expression(_t); |
---|
2647 | _t = _retTree; |
---|
2648 | _t = __t164; |
---|
2649 | _t = _t.getNextSibling(); |
---|
2650 | break; |
---|
2651 | } |
---|
2652 | case FUNC_CALL: |
---|
2653 | case DOT: |
---|
2654 | case IDENT: |
---|
2655 | case EQUAL: |
---|
2656 | case CHR: |
---|
2657 | case NUM_INT: |
---|
2658 | case NUM_REAL: |
---|
2659 | case PLUS: |
---|
2660 | case MINUS: |
---|
2661 | case STRING_LITERAL: |
---|
2662 | case LBRACK: |
---|
2663 | case LBRACK2: |
---|
2664 | case SET: |
---|
2665 | case POINTER: |
---|
2666 | case AT: |
---|
2667 | case NOT_EQUAL: |
---|
2668 | case LT: |
---|
2669 | case LE: |
---|
2670 | case GE: |
---|
2671 | case GT: |
---|
2672 | case IN: |
---|
2673 | case OR: |
---|
2674 | case STAR: |
---|
2675 | case SLASH: |
---|
2676 | case DIV: |
---|
2677 | case MOD: |
---|
2678 | case AND: |
---|
2679 | case NOT: |
---|
2680 | case NIL: |
---|
2681 | { |
---|
2682 | expression(_t); |
---|
2683 | _t = _retTree; |
---|
2684 | break; |
---|
2685 | } |
---|
2686 | default: |
---|
2687 | { |
---|
2688 | throw new NoViableAltException(_t); |
---|
2689 | } |
---|
2690 | } |
---|
2691 | } |
---|
2692 | catch (RecognitionException ex) { |
---|
2693 | reportError(ex); |
---|
2694 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
2695 | } |
---|
2696 | _retTree = _t; |
---|
2697 | } |
---|
2698 | |
---|
2699 | public final void conditionalStatement(AST _t) throws RecognitionException { |
---|
2700 | |
---|
2701 | PascalAST conditionalStatement_AST_in = (PascalAST)_t; |
---|
2702 | |
---|
2703 | try { // for error handling |
---|
2704 | if (_t==null) _t=ASTNULL; |
---|
2705 | switch ( _t.getType()) { |
---|
2706 | case IF: |
---|
2707 | { |
---|
2708 | ifStatement(_t); |
---|
2709 | _t = _retTree; |
---|
2710 | break; |
---|
2711 | } |
---|
2712 | case CASE: |
---|
2713 | { |
---|
2714 | caseStatement(_t); |
---|
2715 | _t = _retTree; |
---|
2716 | break; |
---|
2717 | } |
---|
2718 | default: |
---|
2719 | { |
---|
2720 | throw new NoViableAltException(_t); |
---|
2721 | } |
---|
2722 | } |
---|
2723 | } |
---|
2724 | catch (RecognitionException ex) { |
---|
2725 | reportError(ex); |
---|
2726 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
2727 | } |
---|
2728 | _retTree = _t; |
---|
2729 | } |
---|
2730 | |
---|
2731 | public final void repetetiveStatement(AST _t) throws RecognitionException { |
---|
2732 | |
---|
2733 | PascalAST repetetiveStatement_AST_in = (PascalAST)_t; |
---|
2734 | |
---|
2735 | try { // for error handling |
---|
2736 | if (_t==null) _t=ASTNULL; |
---|
2737 | switch ( _t.getType()) { |
---|
2738 | case WHILE: |
---|
2739 | { |
---|
2740 | whileStatement(_t); |
---|
2741 | _t = _retTree; |
---|
2742 | break; |
---|
2743 | } |
---|
2744 | case REPEAT: |
---|
2745 | { |
---|
2746 | repeatStatement(_t); |
---|
2747 | _t = _retTree; |
---|
2748 | break; |
---|
2749 | } |
---|
2750 | case FOR: |
---|
2751 | { |
---|
2752 | forStatement(_t); |
---|
2753 | _t = _retTree; |
---|
2754 | break; |
---|
2755 | } |
---|
2756 | default: |
---|
2757 | { |
---|
2758 | throw new NoViableAltException(_t); |
---|
2759 | } |
---|
2760 | } |
---|
2761 | } |
---|
2762 | catch (RecognitionException ex) { |
---|
2763 | reportError(ex); |
---|
2764 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
2765 | } |
---|
2766 | _retTree = _t; |
---|
2767 | } |
---|
2768 | |
---|
2769 | public final void withStatement(AST _t) throws RecognitionException { |
---|
2770 | |
---|
2771 | PascalAST withStatement_AST_in = (PascalAST)_t; |
---|
2772 | |
---|
2773 | try { // for error handling |
---|
2774 | AST __t201 = _t; |
---|
2775 | PascalAST tmp112_AST_in = (PascalAST)_t; |
---|
2776 | match(_t,WITH); |
---|
2777 | _t = _t.getFirstChild(); |
---|
2778 | recordVariableList(_t); |
---|
2779 | _t = _retTree; |
---|
2780 | statement(_t); |
---|
2781 | _t = _retTree; |
---|
2782 | _t = __t201; |
---|
2783 | _t = _t.getNextSibling(); |
---|
2784 | } |
---|
2785 | catch (RecognitionException ex) { |
---|
2786 | reportError(ex); |
---|
2787 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
2788 | } |
---|
2789 | _retTree = _t; |
---|
2790 | } |
---|
2791 | |
---|
2792 | public final void statements(AST _t) throws RecognitionException { |
---|
2793 | |
---|
2794 | PascalAST statements_AST_in = (PascalAST)_t; |
---|
2795 | |
---|
2796 | try { // for error handling |
---|
2797 | AST __t174 = _t; |
---|
2798 | PascalAST tmp113_AST_in = (PascalAST)_t; |
---|
2799 | match(_t,BLOCK); |
---|
2800 | _t = _t.getFirstChild(); |
---|
2801 | { |
---|
2802 | _loop176: |
---|
2803 | do { |
---|
2804 | if (_t==null) _t=ASTNULL; |
---|
2805 | if ((_tokenSet_5.member(_t.getType()))) { |
---|
2806 | statement(_t); |
---|
2807 | _t = _retTree; |
---|
2808 | } |
---|
2809 | else { |
---|
2810 | break _loop176; |
---|
2811 | } |
---|
2812 | |
---|
2813 | } while (true); |
---|
2814 | } |
---|
2815 | _t = __t174; |
---|
2816 | _t = _t.getNextSibling(); |
---|
2817 | } |
---|
2818 | catch (RecognitionException ex) { |
---|
2819 | reportError(ex); |
---|
2820 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
2821 | } |
---|
2822 | _retTree = _t; |
---|
2823 | } |
---|
2824 | |
---|
2825 | public final void ifStatement(AST _t) throws RecognitionException { |
---|
2826 | |
---|
2827 | PascalAST ifStatement_AST_in = (PascalAST)_t; |
---|
2828 | |
---|
2829 | try { // for error handling |
---|
2830 | AST __t179 = _t; |
---|
2831 | PascalAST tmp114_AST_in = (PascalAST)_t; |
---|
2832 | match(_t,IF); |
---|
2833 | _t = _t.getFirstChild(); |
---|
2834 | expression(_t); |
---|
2835 | _t = _retTree; |
---|
2836 | statement(_t); |
---|
2837 | _t = _retTree; |
---|
2838 | { |
---|
2839 | if (_t==null) _t=ASTNULL; |
---|
2840 | switch ( _t.getType()) { |
---|
2841 | case BLOCK: |
---|
2842 | case PROC_CALL: |
---|
2843 | case COLON: |
---|
2844 | case CASE: |
---|
2845 | case ASSIGN: |
---|
2846 | case GOTO: |
---|
2847 | case IF: |
---|
2848 | case WHILE: |
---|
2849 | case REPEAT: |
---|
2850 | case FOR: |
---|
2851 | case WITH: |
---|
2852 | { |
---|
2853 | statement(_t); |
---|
2854 | _t = _retTree; |
---|
2855 | break; |
---|
2856 | } |
---|
2857 | case 3: |
---|
2858 | { |
---|
2859 | break; |
---|
2860 | } |
---|
2861 | default: |
---|
2862 | { |
---|
2863 | throw new NoViableAltException(_t); |
---|
2864 | } |
---|
2865 | } |
---|
2866 | } |
---|
2867 | _t = __t179; |
---|
2868 | _t = _t.getNextSibling(); |
---|
2869 | } |
---|
2870 | catch (RecognitionException ex) { |
---|
2871 | reportError(ex); |
---|
2872 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
2873 | } |
---|
2874 | _retTree = _t; |
---|
2875 | } |
---|
2876 | |
---|
2877 | public final void caseStatement(AST _t) throws RecognitionException { |
---|
2878 | |
---|
2879 | PascalAST caseStatement_AST_in = (PascalAST)_t; |
---|
2880 | |
---|
2881 | try { // for error handling |
---|
2882 | AST __t182 = _t; |
---|
2883 | PascalAST tmp115_AST_in = (PascalAST)_t; |
---|
2884 | match(_t,CASE); |
---|
2885 | _t = _t.getFirstChild(); |
---|
2886 | expression(_t); |
---|
2887 | _t = _retTree; |
---|
2888 | { |
---|
2889 | int _cnt184=0; |
---|
2890 | _loop184: |
---|
2891 | do { |
---|
2892 | if (_t==null) _t=ASTNULL; |
---|
2893 | if ((_t.getType()==COLON)) { |
---|
2894 | caseListElement(_t); |
---|
2895 | _t = _retTree; |
---|
2896 | } |
---|
2897 | else { |
---|
2898 | if ( _cnt184>=1 ) { break _loop184; } else {throw new NoViableAltException(_t);} |
---|
2899 | } |
---|
2900 | |
---|
2901 | _cnt184++; |
---|
2902 | } while (true); |
---|
2903 | } |
---|
2904 | { |
---|
2905 | if (_t==null) _t=ASTNULL; |
---|
2906 | switch ( _t.getType()) { |
---|
2907 | case BLOCK: |
---|
2908 | { |
---|
2909 | statements(_t); |
---|
2910 | _t = _retTree; |
---|
2911 | break; |
---|
2912 | } |
---|
2913 | case 3: |
---|
2914 | { |
---|
2915 | break; |
---|
2916 | } |
---|
2917 | default: |
---|
2918 | { |
---|
2919 | throw new NoViableAltException(_t); |
---|
2920 | } |
---|
2921 | } |
---|
2922 | } |
---|
2923 | _t = __t182; |
---|
2924 | _t = _t.getNextSibling(); |
---|
2925 | } |
---|
2926 | catch (RecognitionException ex) { |
---|
2927 | reportError(ex); |
---|
2928 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
2929 | } |
---|
2930 | _retTree = _t; |
---|
2931 | } |
---|
2932 | |
---|
2933 | public final void caseListElement(AST _t) throws RecognitionException { |
---|
2934 | |
---|
2935 | PascalAST caseListElement_AST_in = (PascalAST)_t; |
---|
2936 | |
---|
2937 | try { // for error handling |
---|
2938 | AST __t187 = _t; |
---|
2939 | PascalAST tmp116_AST_in = (PascalAST)_t; |
---|
2940 | match(_t,COLON); |
---|
2941 | _t = _t.getFirstChild(); |
---|
2942 | constList(_t); |
---|
2943 | _t = _retTree; |
---|
2944 | statement(_t); |
---|
2945 | _t = _retTree; |
---|
2946 | _t = __t187; |
---|
2947 | _t = _t.getNextSibling(); |
---|
2948 | } |
---|
2949 | catch (RecognitionException ex) { |
---|
2950 | reportError(ex); |
---|
2951 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
2952 | } |
---|
2953 | _retTree = _t; |
---|
2954 | } |
---|
2955 | |
---|
2956 | public final void whileStatement(AST _t) throws RecognitionException { |
---|
2957 | |
---|
2958 | PascalAST whileStatement_AST_in = (PascalAST)_t; |
---|
2959 | |
---|
2960 | try { // for error handling |
---|
2961 | AST __t190 = _t; |
---|
2962 | PascalAST tmp117_AST_in = (PascalAST)_t; |
---|
2963 | match(_t,WHILE); |
---|
2964 | _t = _t.getFirstChild(); |
---|
2965 | expression(_t); |
---|
2966 | _t = _retTree; |
---|
2967 | statement(_t); |
---|
2968 | _t = _retTree; |
---|
2969 | _t = __t190; |
---|
2970 | _t = _t.getNextSibling(); |
---|
2971 | } |
---|
2972 | catch (RecognitionException ex) { |
---|
2973 | reportError(ex); |
---|
2974 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
2975 | } |
---|
2976 | _retTree = _t; |
---|
2977 | } |
---|
2978 | |
---|
2979 | public final void repeatStatement(AST _t) throws RecognitionException { |
---|
2980 | |
---|
2981 | PascalAST repeatStatement_AST_in = (PascalAST)_t; |
---|
2982 | |
---|
2983 | try { // for error handling |
---|
2984 | AST __t192 = _t; |
---|
2985 | PascalAST tmp118_AST_in = (PascalAST)_t; |
---|
2986 | match(_t,REPEAT); |
---|
2987 | _t = _t.getFirstChild(); |
---|
2988 | statements(_t); |
---|
2989 | _t = _retTree; |
---|
2990 | expression(_t); |
---|
2991 | _t = _retTree; |
---|
2992 | _t = __t192; |
---|
2993 | _t = _t.getNextSibling(); |
---|
2994 | } |
---|
2995 | catch (RecognitionException ex) { |
---|
2996 | reportError(ex); |
---|
2997 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
2998 | } |
---|
2999 | _retTree = _t; |
---|
3000 | } |
---|
3001 | |
---|
3002 | public final void forStatement(AST _t) throws RecognitionException { |
---|
3003 | |
---|
3004 | PascalAST forStatement_AST_in = (PascalAST)_t; |
---|
3005 | |
---|
3006 | try { // for error handling |
---|
3007 | AST __t194 = _t; |
---|
3008 | PascalAST tmp119_AST_in = (PascalAST)_t; |
---|
3009 | match(_t,FOR); |
---|
3010 | _t = _t.getFirstChild(); |
---|
3011 | PascalAST tmp120_AST_in = (PascalAST)_t; |
---|
3012 | match(_t,IDENT); |
---|
3013 | _t = _t.getNextSibling(); |
---|
3014 | forList(_t); |
---|
3015 | _t = _retTree; |
---|
3016 | statement(_t); |
---|
3017 | _t = _retTree; |
---|
3018 | _t = __t194; |
---|
3019 | _t = _t.getNextSibling(); |
---|
3020 | } |
---|
3021 | catch (RecognitionException ex) { |
---|
3022 | reportError(ex); |
---|
3023 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
3024 | } |
---|
3025 | _retTree = _t; |
---|
3026 | } |
---|
3027 | |
---|
3028 | public final void forList(AST _t) throws RecognitionException { |
---|
3029 | |
---|
3030 | PascalAST forList_AST_in = (PascalAST)_t; |
---|
3031 | |
---|
3032 | try { // for error handling |
---|
3033 | if (_t==null) _t=ASTNULL; |
---|
3034 | switch ( _t.getType()) { |
---|
3035 | case TO: |
---|
3036 | { |
---|
3037 | AST __t196 = _t; |
---|
3038 | PascalAST tmp121_AST_in = (PascalAST)_t; |
---|
3039 | match(_t,TO); |
---|
3040 | _t = _t.getFirstChild(); |
---|
3041 | initialValue(_t); |
---|
3042 | _t = _retTree; |
---|
3043 | finalValue(_t); |
---|
3044 | _t = _retTree; |
---|
3045 | _t = __t196; |
---|
3046 | _t = _t.getNextSibling(); |
---|
3047 | break; |
---|
3048 | } |
---|
3049 | case DOWNTO: |
---|
3050 | { |
---|
3051 | AST __t197 = _t; |
---|
3052 | PascalAST tmp122_AST_in = (PascalAST)_t; |
---|
3053 | match(_t,DOWNTO); |
---|
3054 | _t = _t.getFirstChild(); |
---|
3055 | initialValue(_t); |
---|
3056 | _t = _retTree; |
---|
3057 | finalValue(_t); |
---|
3058 | _t = _retTree; |
---|
3059 | _t = __t197; |
---|
3060 | _t = _t.getNextSibling(); |
---|
3061 | break; |
---|
3062 | } |
---|
3063 | default: |
---|
3064 | { |
---|
3065 | throw new NoViableAltException(_t); |
---|
3066 | } |
---|
3067 | } |
---|
3068 | } |
---|
3069 | catch (RecognitionException ex) { |
---|
3070 | reportError(ex); |
---|
3071 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
3072 | } |
---|
3073 | _retTree = _t; |
---|
3074 | } |
---|
3075 | |
---|
3076 | public final void initialValue(AST _t) throws RecognitionException { |
---|
3077 | |
---|
3078 | PascalAST initialValue_AST_in = (PascalAST)_t; |
---|
3079 | |
---|
3080 | try { // for error handling |
---|
3081 | expression(_t); |
---|
3082 | _t = _retTree; |
---|
3083 | } |
---|
3084 | catch (RecognitionException ex) { |
---|
3085 | reportError(ex); |
---|
3086 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
3087 | } |
---|
3088 | _retTree = _t; |
---|
3089 | } |
---|
3090 | |
---|
3091 | public final void finalValue(AST _t) throws RecognitionException { |
---|
3092 | |
---|
3093 | PascalAST finalValue_AST_in = (PascalAST)_t; |
---|
3094 | |
---|
3095 | try { // for error handling |
---|
3096 | expression(_t); |
---|
3097 | _t = _retTree; |
---|
3098 | } |
---|
3099 | catch (RecognitionException ex) { |
---|
3100 | reportError(ex); |
---|
3101 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
3102 | } |
---|
3103 | _retTree = _t; |
---|
3104 | } |
---|
3105 | |
---|
3106 | public final void recordVariableList(AST _t) throws RecognitionException { |
---|
3107 | |
---|
3108 | PascalAST recordVariableList_AST_in = (PascalAST)_t; |
---|
3109 | |
---|
3110 | try { // for error handling |
---|
3111 | { |
---|
3112 | int _cnt204=0; |
---|
3113 | _loop204: |
---|
3114 | do { |
---|
3115 | if (_t==null) _t=ASTNULL; |
---|
3116 | if ((_tokenSet_6.member(_t.getType()))) { |
---|
3117 | variable(_t); |
---|
3118 | _t = _retTree; |
---|
3119 | } |
---|
3120 | else { |
---|
3121 | if ( _cnt204>=1 ) { break _loop204; } else {throw new NoViableAltException(_t);} |
---|
3122 | } |
---|
3123 | |
---|
3124 | _cnt204++; |
---|
3125 | } while (true); |
---|
3126 | } |
---|
3127 | } |
---|
3128 | catch (RecognitionException ex) { |
---|
3129 | reportError(ex); |
---|
3130 | if (_t!=null) {_t = _t.getNextSibling();} |
---|
3131 | } |
---|
3132 | _retTree = _t; |
---|
3133 | } |
---|
3134 | |
---|
3135 | |
---|
3136 | public static final String[] _tokenNames = { |
---|
3137 | "<0>", |
---|
3138 | "EOF", |
---|
3139 | "<2>", |
---|
3140 | "NULL_TREE_LOOKAHEAD", |
---|
3141 | "BLOCK", |
---|
3142 | "IDLIST", |
---|
3143 | "ELIST", |
---|
3144 | "FUNC_CALL", |
---|
3145 | "PROC_CALL", |
---|
3146 | "SCALARTYPE", |
---|
3147 | "TYPELIST", |
---|
3148 | "VARIANT_TAG", |
---|
3149 | "VARIANT_TAG_NO_ID", |
---|
3150 | "VARIANT_CASE", |
---|
3151 | "CONSTLIST", |
---|
3152 | "FIELDLIST", |
---|
3153 | "ARGDECLS", |
---|
3154 | "VARDECL", |
---|
3155 | "ARGDECL", |
---|
3156 | "ARGLIST", |
---|
3157 | "TYPEDECL", |
---|
3158 | "FIELD", |
---|
3159 | "\"interface\"", |
---|
3160 | "DOT", |
---|
3161 | "\"program\"", |
---|
3162 | "LPAREN", |
---|
3163 | "RPAREN", |
---|
3164 | "SEMI", |
---|
3165 | "\"unit\"", |
---|
3166 | "IDENT", |
---|
3167 | "\"implementation\"", |
---|
3168 | "\"uses\"", |
---|
3169 | "\"label\"", |
---|
3170 | "COMMA", |
---|
3171 | "\"const\"", |
---|
3172 | "EQUAL", |
---|
3173 | "\"chr\"", |
---|
3174 | "NUM_INT", |
---|
3175 | "NUM_REAL", |
---|
3176 | "PLUS", |
---|
3177 | "MINUS", |
---|
3178 | "STRING_LITERAL", |
---|
3179 | "\"type\"", |
---|
3180 | "\"function\"", |
---|
3181 | "COLON", |
---|
3182 | "\"procedure\"", |
---|
3183 | "DOTDOT", |
---|
3184 | "\"char\"", |
---|
3185 | "\"boolean\"", |
---|
3186 | "\"integer\"", |
---|
3187 | "\"real\"", |
---|
3188 | "\"string\"", |
---|
3189 | "\"packed\"", |
---|
3190 | "LBRACK", |
---|
3191 | "RBRACK", |
---|
3192 | "\"array\"", |
---|
3193 | "\"of\"", |
---|
3194 | "LBRACK2", |
---|
3195 | "RBRACK2", |
---|
3196 | "\"record\"", |
---|
3197 | "\"end\"", |
---|
3198 | "\"case\"", |
---|
3199 | "\"set\"", |
---|
3200 | "\"file\"", |
---|
3201 | "POINTER", |
---|
3202 | "\"var\"", |
---|
3203 | "ASSIGN", |
---|
3204 | "AT", |
---|
3205 | "NOT_EQUAL", |
---|
3206 | "LT", |
---|
3207 | "LE", |
---|
3208 | "GE", |
---|
3209 | "GT", |
---|
3210 | "\"in\"", |
---|
3211 | "\"or\"", |
---|
3212 | "STAR", |
---|
3213 | "SLASH", |
---|
3214 | "\"div\"", |
---|
3215 | "\"mod\"", |
---|
3216 | "\"and\"", |
---|
3217 | "\"not\"", |
---|
3218 | "\"nil\"", |
---|
3219 | "\"goto\"", |
---|
3220 | "\"begin\"", |
---|
3221 | "\"if\"", |
---|
3222 | "\"then\"", |
---|
3223 | "\"else\"", |
---|
3224 | "\"while\"", |
---|
3225 | "\"do\"", |
---|
3226 | "\"repeat\"", |
---|
3227 | "\"until\"", |
---|
3228 | "\"for\"", |
---|
3229 | "\"to\"", |
---|
3230 | "\"downto\"", |
---|
3231 | "\"with\"", |
---|
3232 | "METHOD", |
---|
3233 | "ADDSUBOR", |
---|
3234 | "ASSIGNEQUAL", |
---|
3235 | "SIGN", |
---|
3236 | "FUNC", |
---|
3237 | "NODE_NOT_EMIT", |
---|
3238 | "MYASTVAR", |
---|
3239 | "LF", |
---|
3240 | "LCURLY", |
---|
3241 | "RCURLY", |
---|
3242 | "WS", |
---|
3243 | "COMMENT_1", |
---|
3244 | "COMMENT_2", |
---|
3245 | "EXPONENT" |
---|
3246 | }; |
---|
3247 | |
---|
3248 | private static final long[] mk_tokenSet_0() { |
---|
3249 | long[] data = { 43980465373184L, 2L, 0L, 0L}; |
---|
3250 | return data; |
---|
3251 | } |
---|
3252 | public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0()); |
---|
3253 | private static final long[] mk_tokenSet_1() { |
---|
3254 | long[] data = { -3990259638057565696L, 1L, 0L, 0L}; |
---|
3255 | return data; |
---|
3256 | } |
---|
3257 | public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1()); |
---|
3258 | private static final long[] mk_tokenSet_2() { |
---|
3259 | long[] data = { 4329863905280L, 0L}; |
---|
3260 | return data; |
---|
3261 | } |
---|
3262 | public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2()); |
---|
3263 | private static final long[] mk_tokenSet_3() { |
---|
3264 | long[] data = { 4764812769990017152L, 262137L, 0L, 0L}; |
---|
3265 | return data; |
---|
3266 | } |
---|
3267 | public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3()); |
---|
3268 | private static final long[] mk_tokenSet_4() { |
---|
3269 | long[] data = { 4764883138734194816L, 262137L, 0L, 0L}; |
---|
3270 | return data; |
---|
3271 | } |
---|
3272 | public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4()); |
---|
3273 | private static final long[] mk_tokenSet_5() { |
---|
3274 | long[] data = { 2305860601399738640L, 1251213316L, 0L, 0L}; |
---|
3275 | return data; |
---|
3276 | } |
---|
3277 | public static final BitSet _tokenSet_5 = new BitSet(mk_tokenSet_5()); |
---|
3278 | private static final long[] mk_tokenSet_6() { |
---|
3279 | long[] data = { 153122387875856384L, 9L, 0L, 0L}; |
---|
3280 | return data; |
---|
3281 | } |
---|
3282 | public static final BitSet _tokenSet_6 = new BitSet(mk_tokenSet_6()); |
---|
3283 | } |
---|
3284 | |
---|