Source code: org/media/mn8/parser/mn8Parser.java
1 // $ANTLR 2.7.1: "mn8.g" -> "mn8Parser.java"$
2
3 package org.media.mn8.parser;
4
5 import org.media.mn8.*;
6 import org.media.mn8.concepts.*;
7 import java.util.Vector;
8 import antlr.CommonAST;
9
10 import antlr.TokenBuffer;
11 import antlr.TokenStreamException;
12 import antlr.TokenStreamIOException;
13 import antlr.ANTLRException;
14 import antlr.LLkParser;
15 import antlr.Token;
16 import antlr.TokenStream;
17 import antlr.RecognitionException;
18 import antlr.NoViableAltException;
19 import antlr.MismatchedTokenException;
20 import antlr.SemanticException;
21 import antlr.ParserSharedInputState;
22 import antlr.collections.impl.BitSet;
23 import antlr.collections.AST;
24 import antlr.ASTPair;
25 import antlr.collections.impl.ASTArray;
26
27 /**
28 * The parser for mn8.<br>
29 * This class is automaticaly generated by
30 * <a href="http://www.antlr.org">ANTLR</a>.
31 * @author <a href="mailto:remus@nolimits.ro">Remus Pereni</a>
32 * @version $Revision: 1.78 $ $Date: 2002/10/22 19:22:41 $
33 */
34 public class mn8Parser extends antlr.LLkParser
35 implements mn8TokenTypes
36 {
37
38 public String conceptFile = null;
39 private String _conceptName = null;
40 boolean debug=false;
41 mn8ConceptDefinition _conceptDef = null;
42 Vector deepElementType = new Vector();
43
44 AST cloneASTNode( AST node ) {
45 AST result = new CommonAST();
46 result.initialize( node );
47 if( node.getFirstChild() != null ) {
48 result.setFirstChild( cloneASTNode( node.getFirstChild() ));
49 }
50
51 if( node.getNextSibling() != null) {
52 result.setNextSibling( cloneASTNode( node.getNextSibling() ));
53 }
54
55 return result;
56 }
57
58
59
60 protected mn8Parser(TokenBuffer tokenBuf, int k) {
61 super(tokenBuf,k);
62 tokenNames = _tokenNames;
63 }
64
65 public mn8Parser(TokenBuffer tokenBuf) {
66 this(tokenBuf,2);
67 }
68
69 protected mn8Parser(TokenStream lexer, int k) {
70 super(lexer,k);
71 tokenNames = _tokenNames;
72 }
73
74 public mn8Parser(TokenStream lexer) {
75 this(lexer,2);
76 }
77
78 public mn8Parser(ParserSharedInputState state) {
79 super(state,2);
80 tokenNames = _tokenNames;
81 }
82
83 public final void imaginaryTokens() throws RecognitionException, TokenStreamException {
84
85 returnAST = null;
86 ASTPair currentAST = new ASTPair();
87 AST imaginaryTokens_AST = null;
88
89 try { // for error handling
90 AST tmp1_AST = null;
91 if (inputState.guessing==0) {
92 tmp1_AST = (AST)astFactory.create(LT(1));
93 astFactory.addASTChild(currentAST, tmp1_AST);
94 }
95 match(CONCEPT_DEFINITION);
96 AST tmp2_AST = null;
97 if (inputState.guessing==0) {
98 tmp2_AST = (AST)astFactory.create(LT(1));
99 astFactory.addASTChild(currentAST, tmp2_AST);
100 }
101 match(METHOD_DEFINITION);
102 AST tmp3_AST = null;
103 if (inputState.guessing==0) {
104 tmp3_AST = (AST)astFactory.create(LT(1));
105 astFactory.addASTChild(currentAST, tmp3_AST);
106 }
107 match(IMPLEMENTS_CLAUSE);
108 AST tmp4_AST = null;
109 if (inputState.guessing==0) {
110 tmp4_AST = (AST)astFactory.create(LT(1));
111 astFactory.addASTChild(currentAST, tmp4_AST);
112 }
113 match(BLOCK);
114 AST tmp5_AST = null;
115 if (inputState.guessing==0) {
116 tmp5_AST = (AST)astFactory.create(LT(1));
117 astFactory.addASTChild(currentAST, tmp5_AST);
118 }
119 match(ARRAY_DECLARATOR);
120 AST tmp6_AST = null;
121 if (inputState.guessing==0) {
122 tmp6_AST = (AST)astFactory.create(LT(1));
123 astFactory.addASTChild(currentAST, tmp6_AST);
124 }
125 match(TYPE);
126 AST tmp7_AST = null;
127 if (inputState.guessing==0) {
128 tmp7_AST = (AST)astFactory.create(LT(1));
129 astFactory.addASTChild(currentAST, tmp7_AST);
130 }
131 match(UNARY_MINUS);
132 AST tmp8_AST = null;
133 if (inputState.guessing==0) {
134 tmp8_AST = (AST)astFactory.create(LT(1));
135 astFactory.addASTChild(currentAST, tmp8_AST);
136 }
137 match(UNARY_PLUS);
138 AST tmp9_AST = null;
139 if (inputState.guessing==0) {
140 tmp9_AST = (AST)astFactory.create(LT(1));
141 astFactory.addASTChild(currentAST, tmp9_AST);
142 }
143 match(ATTRIDENT);
144 AST tmp10_AST = null;
145 if (inputState.guessing==0) {
146 tmp10_AST = (AST)astFactory.create(LT(1));
147 astFactory.addASTChild(currentAST, tmp10_AST);
148 }
149 match(ELMETIDENTIFIER);
150 AST tmp11_AST = null;
151 if (inputState.guessing==0) {
152 tmp11_AST = (AST)astFactory.create(LT(1));
153 astFactory.addASTChild(currentAST, tmp11_AST);
154 }
155 match(EXPR);
156 AST tmp12_AST = null;
157 if (inputState.guessing==0) {
158 tmp12_AST = (AST)astFactory.create(LT(1));
159 astFactory.addASTChild(currentAST, tmp12_AST);
160 }
161 match(ELIST);
162 AST tmp13_AST = null;
163 if (inputState.guessing==0) {
164 tmp13_AST = (AST)astFactory.create(LT(1));
165 astFactory.addASTChild(currentAST, tmp13_AST);
166 }
167 match(OLIST);
168 AST tmp14_AST = null;
169 if (inputState.guessing==0) {
170 tmp14_AST = (AST)astFactory.create(LT(1));
171 astFactory.addASTChild(currentAST, tmp14_AST);
172 }
173 match(METHOD_CALL);
174 AST tmp15_AST = null;
175 if (inputState.guessing==0) {
176 tmp15_AST = (AST)astFactory.create(LT(1));
177 astFactory.addASTChild(currentAST, tmp15_AST);
178 }
179 match(POST_INC);
180 AST tmp16_AST = null;
181 if (inputState.guessing==0) {
182 tmp16_AST = (AST)astFactory.create(LT(1));
183 astFactory.addASTChild(currentAST, tmp16_AST);
184 }
185 match(POST_DEC);
186 AST tmp17_AST = null;
187 if (inputState.guessing==0) {
188 tmp17_AST = (AST)astFactory.create(LT(1));
189 astFactory.addASTChild(currentAST, tmp17_AST);
190 }
191 match(CONDITION);
192 AST tmp18_AST = null;
193 if (inputState.guessing==0) {
194 tmp18_AST = (AST)astFactory.create(LT(1));
195 astFactory.addASTChild(currentAST, tmp18_AST);
196 }
197 match(IF_BLOCK);
198 AST tmp19_AST = null;
199 if (inputState.guessing==0) {
200 tmp19_AST = (AST)astFactory.create(LT(1));
201 astFactory.addASTChild(currentAST, tmp19_AST);
202 }
203 match(ELSE_BLOCK);
204 AST tmp20_AST = null;
205 if (inputState.guessing==0) {
206 tmp20_AST = (AST)astFactory.create(LT(1));
207 astFactory.addASTChild(currentAST, tmp20_AST);
208 }
209 match(ELIF_BLOCK);
210 AST tmp21_AST = null;
211 if (inputState.guessing==0) {
212 tmp21_AST = (AST)astFactory.create(LT(1));
213 astFactory.addASTChild(currentAST, tmp21_AST);
214 }
215 match(FIND_FIRST);
216 AST tmp22_AST = null;
217 if (inputState.guessing==0) {
218 tmp22_AST = (AST)astFactory.create(LT(1));
219 astFactory.addASTChild(currentAST, tmp22_AST);
220 }
221 match(FIND_LAST);
222 AST tmp23_AST = null;
223 if (inputState.guessing==0) {
224 tmp23_AST = (AST)astFactory.create(LT(1));
225 astFactory.addASTChild(currentAST, tmp23_AST);
226 }
227 match(SOURCE);
228 AST tmp24_AST = null;
229 if (inputState.guessing==0) {
230 tmp24_AST = (AST)astFactory.create(LT(1));
231 astFactory.addASTChild(currentAST, tmp24_AST);
232 }
233 match(ELEM);
234 AST tmp25_AST = null;
235 if (inputState.guessing==0) {
236 tmp25_AST = (AST)astFactory.create(LT(1));
237 astFactory.addASTChild(currentAST, tmp25_AST);
238 }
239 match(METH);
240 AST tmp26_AST = null;
241 if (inputState.guessing==0) {
242 tmp26_AST = (AST)astFactory.create(LT(1));
243 astFactory.addASTChild(currentAST, tmp26_AST);
244 }
245 match(VARIABLE);
246 AST tmp27_AST = null;
247 if (inputState.guessing==0) {
248 tmp27_AST = (AST)astFactory.create(LT(1));
249 astFactory.addASTChild(currentAST, tmp27_AST);
250 }
251 match(PARAMETER);
252 AST tmp28_AST = null;
253 if (inputState.guessing==0) {
254 tmp28_AST = (AST)astFactory.create(LT(1));
255 astFactory.addASTChild(currentAST, tmp28_AST);
256 }
257 match(PAREN_EXPR);
258 AST tmp29_AST = null;
259 if (inputState.guessing==0) {
260 tmp29_AST = (AST)astFactory.create(LT(1));
261 astFactory.addASTChild(currentAST, tmp29_AST);
262 }
263 match(PRINT);
264 AST tmp30_AST = null;
265 if (inputState.guessing==0) {
266 tmp30_AST = (AST)astFactory.create(LT(1));
267 astFactory.addASTChild(currentAST, tmp30_AST);
268 }
269 match(ELEM_VALREF);
270 AST tmp31_AST = null;
271 if (inputState.guessing==0) {
272 tmp31_AST = (AST)astFactory.create(LT(1));
273 astFactory.addASTChild(currentAST, tmp31_AST);
274 }
275 match(DEBUG_INFO);
276 imaginaryTokens_AST = (AST)currentAST.root;
277 }
278 catch (RecognitionException ex) {
279 if (inputState.guessing==0) {
280 reportError(ex);
281 consume();
282 consumeUntil(_tokenSet_0);
283 } else {
284 throw ex;
285 }
286 }
287 returnAST = imaginaryTokens_AST;
288 }
289
290 public final void mn8ScriptFile(
291 String conceptName
292 ) throws RecognitionException, TokenStreamException {
293
294 returnAST = null;
295 ASTPair currentAST = new ASTPair();
296 AST mn8ScriptFile_AST = null;
297 _conceptName = conceptName;
298
299 try { // for error handling
300 {
301 switch ( LA(1)) {
302 case EOL:
303 {
304 eol();
305 if (inputState.guessing==0) {
306 astFactory.addASTChild(currentAST, returnAST);
307 }
308 break;
309 }
310 case EOF:
311 case VARIABLE:
312 case PRINT:
313 case DEFINE:
314 case IDENT:
315 case LBRACK:
316 case STRING_LITERAL:
317 case ATTR:
318 case LPAREN:
319 case EXIT:
320 case RETURN:
321 case SWITCH:
322 case FIND:
323 case FIRST:
324 case LAST:
325 case EACH:
326 case DO:
327 case WHILE:
328 case IF:
329 case PLUS:
330 case MINUS:
331 case INC:
332 case DEC:
333 case LNOT:
334 case SEP:
335 case DOT:
336 case NUM_INT:
337 case CHAR_LITERAL:
338 case NUM_REAL:
339 case SUPER:
340 case NIL:
341 case THIS:
342 case TRUE:
343 case FALSE:
344 {
345 break;
346 }
347 default:
348 {
349 throw new NoViableAltException(LT(1), getFilename());
350 }
351 }
352 }
353 {
354 boolean synPredMatched6 = false;
355 if (((LA(1)==EOF||LA(1)==DEFINE) && (LA(2)==EOF||LA(2)==IDENT))) {
356 int _m6 = mark();
357 synPredMatched6 = true;
358 inputState.guessing++;
359 try {
360 {
361 match(DEFINE);
362 }
363 }
364 catch (RecognitionException pe) {
365 synPredMatched6 = false;
366 }
367 rewind(_m6);
368 inputState.guessing--;
369 }
370 if ( synPredMatched6 ) {
371 {
372 _loop8:
373 do {
374 if ((LA(1)==DEFINE)) {
375 conceptDefinition();
376 if (inputState.guessing==0) {
377 astFactory.addASTChild(currentAST, returnAST);
378 }
379 }
380 else {
381 break _loop8;
382 }
383
384 } while (true);
385 }
386 }
387 else if ((_tokenSet_1.member(LA(1))) && (_tokenSet_2.member(LA(2)))) {
388 {
389 _loop10:
390 do {
391 if ((_tokenSet_3.member(LA(1)))) {
392 statement();
393 if (inputState.guessing==0) {
394 astFactory.addASTChild(currentAST, returnAST);
395 }
396 }
397 else {
398 break _loop10;
399 }
400
401 } while (true);
402 }
403 }
404 else {
405 throw new NoViableAltException(LT(1), getFilename());
406 }
407
408 }
409 mn8ScriptFile_AST = (AST)currentAST.root;
410 }
411 catch (RecognitionException ex) {
412 if (inputState.guessing==0) {
413 reportError(ex);
414 consume();
415 consumeUntil(_tokenSet_0);
416 } else {
417 throw ex;
418 }
419 }
420 returnAST = mn8ScriptFile_AST;
421 }
422
423 public final void eol() throws RecognitionException, TokenStreamException {
424
425 returnAST = null;
426 ASTPair currentAST = new ASTPair();
427 AST eol_AST = null;
428
429 try { // for error handling
430 {
431 int _cnt180=0;
432 _loop180:
433 do {
434 if ((LA(1)==EOL)) {
435 AST tmp32_AST = null;
436 tmp32_AST = (AST)astFactory.create(LT(1));
437 match(EOL);
438 }
439 else {
440 if ( _cnt180>=1 ) { break _loop180; } else {throw new NoViableAltException(LT(1), getFilename());}
441 }
442
443 _cnt180++;
444 } while (true);
445 }
446 eol_AST = (AST)currentAST.root;
447 }
448 catch (RecognitionException ex) {
449 if (inputState.guessing==0) {
450 reportError(ex);
451 consume();
452 consumeUntil(_tokenSet_4);
453 } else {
454 throw ex;
455 }
456 }
457 returnAST = eol_AST;
458 }
459
460 public final void conceptDefinition() throws RecognitionException, TokenStreamException {
461
462 returnAST = null;
463 ASTPair currentAST = new ASTPair();
464 AST conceptDefinition_AST = null;
465 Token d = null;
466 AST d_AST = null;
467 Token type = null;
468 AST type_AST = null;
469 Vector extendsList = null; String label = null;
470
471 try { // for error handling
472 d = LT(1);
473 if (inputState.guessing==0) {
474 d_AST = (AST)astFactory.create(d);
475 astFactory.makeASTRoot(currentAST, d_AST);
476 }
477 match(DEFINE);
478 type = LT(1);
479 if (inputState.guessing==0) {
480 type_AST = (AST)astFactory.create(type);
481 astFactory.addASTChild(currentAST, type_AST);
482 }
483 match(IDENT);
484 {
485 switch ( LA(1)) {
486 case LABEL:
487 {
488 label=labelDeclaration();
489 if (inputState.guessing==0) {
490 astFactory.addASTChild(currentAST, returnAST);
491 }
492 break;
493 }
494 case LBRACK:
495 case EXTENDS:
496 {
497 break;
498 }
499 default:
500 {
501 throw new NoViableAltException(LT(1), getFilename());
502 }
503 }
504 }
505 {
506 switch ( LA(1)) {
507 case EXTENDS:
508 {
509 extendsList=extendsDeclaration();
510 if (inputState.guessing==0) {
511 astFactory.addASTChild(currentAST, returnAST);
512 }
513 break;
514 }
515 case LBRACK:
516 {
517 break;
518 }
519 default:
520 {
521 throw new NoViableAltException(LT(1), getFilename());
522 }
523 }
524 }
525 AST tmp33_AST = null;
526 tmp33_AST = (AST)astFactory.create(LT(1));
527 match(LBRACK);
528 eol();
529 if (inputState.guessing==0) {
530 astFactory.addASTChild(currentAST, returnAST);
531 }
532 if ( inputState.guessing==0 ) {
533
534 if( _conceptName == null ) _conceptName = type_AST.getText();
535 if( type == null )
536 throw new RecognitionException(" you have to have a name for the new concept", "", d_AST.getLine());
537 deepElementType.clear();
538 deepElementType.add(type_AST.getText());
539 label = label == null ? type_AST.getText() : label;
540
541 if( _conceptName.equalsIgnoreCase(type_AST.getText())) {
542 _conceptDef = new mn8ConceptDefinition(type_AST.getText(), label, extendsList);
543 } else {
544 _conceptDef = null;
545 }
546 int pos = type_AST.getText().indexOf(":");
547 if( pos != -1 ) {
548 conceptFile = type_AST.getText().substring(0, pos) + ".mn8";
549 } else {
550 conceptFile = type_AST.getText() + ".mn8";
551 }
552
553 }
554 {
555 _loop15:
556 do {
557 if ((_tokenSet_5.member(LA(1)))) {
558 conceptBodyComponent();
559 if (inputState.guessing==0) {
560 astFactory.addASTChild(currentAST, returnAST);
561 }
562 }
563 else {
564 break _loop15;
565 }
566
567 } while (true);
568 }
569 AST tmp34_AST = null;
570 tmp34_AST = (AST)astFactory.create(LT(1));
571 match(RBRACK);
572 eol();
573 if (inputState.guessing==0) {
574 astFactory.addASTChild(currentAST, returnAST);
575 }
576 if ( inputState.guessing==0 ) {
577
578 if( _conceptDef != null ) {
579 _conceptDef.setTokenNames(getTokenNames());
580 ConceptRegister.getReference().register(type_AST.getText(), _conceptDef);
581 }
582
583 }
584 conceptDefinition_AST = (AST)currentAST.root;
585 }
586 catch (RecognitionException ex) {
587 if (inputState.guessing==0) {
588 reportError(ex);
589 consume();
590 consumeUntil(_tokenSet_6);
591 } else {
592 throw ex;
593 }
594 }
595 returnAST = conceptDefinition_AST;
596 }
597
598 public final void statement() throws RecognitionException, TokenStreamException {
599
600 returnAST = null;
601 ASTPair currentAST = new ASTPair();
602 AST statement_AST = null;
603
604 try { // for error handling
605 switch ( LA(1)) {
606 case PRINT:
607 {
608 printStatement();
609 if (inputState.guessing==0) {
610 astFactory.addASTChild(currentAST, returnAST);
611 }
612 statement_AST = (AST)currentAST.root;
613 break;
614 }
615 case LBRACK:
616 {
617 statementBlock();
618 if (inputState.guessing==0) {
619 astFactory.addASTChild(currentAST, returnAST);
620 }
621 statement_AST = (AST)currentAST.root;
622 break;
623 }
624 case SWITCH:
625 {
626 caseBlock();
627 if (inputState.guessing==0) {
628 astFactory.addASTChild(currentAST, returnAST);
629 }
630 statement_AST = (AST)currentAST.root;
631 break;
632 }
633 case EXIT:
634 {
635 exitStatement();
636 if (inputState.guessing==0) {
637 astFactory.addASTChild(currentAST, returnAST);
638 }
639 statement_AST = (AST)currentAST.root;
640 break;
641 }
642 case WHILE:
643 {
644 whileDoLoopBlock();
645 if (inputState.guessing==0) {
646 astFactory.addASTChild(currentAST, returnAST);
647 }
648 statement_AST = (AST)currentAST.root;
649 break;
650 }
651 case DO:
652 {
653 doWhileLoopBlock();
654 if (inputState.guessing==0) {
655 astFactory.addASTChild(currentAST, returnAST);
656 }
657 statement_AST = (AST)currentAST.root;
658 break;
659 }
660 case IF:
661 {
662 ifThenBlock();
663 if (inputState.guessing==0) {
664 astFactory.addASTChild(currentAST, returnAST);
665 }
666 statement_AST = (AST)currentAST.root;
667 break;
668 }
669 case FIND:
670 {
671 findStatement();
672 if (inputState.guessing==0) {
673 astFactory.addASTChild(currentAST, returnAST);
674 }
675 statement_AST = (AST)currentAST.root;
676 break;
677 }
678 case RETURN:
679 {
680 returnStatement();
681 if (inputState.guessing==0) {
682 astFactory.addASTChild(currentAST, returnAST);
683 }
684 statement_AST = (AST)currentAST.root;
685 break;
686 }
687 case EACH:
688 {
689 eachBlock();
690 if (inputState.guessing==0) {
691 astFactory.addASTChild(currentAST, returnAST);
692 }
693 statement_AST = (AST)currentAST.root;
694 break;
695 }
696 default:
697 boolean synPredMatched50 = false;
698 if (((_tokenSet_7.member(LA(1))) && (_tokenSet_8.member(LA(2))))) {
699 int _m50 = mark();
700 synPredMatched50 = true;
701 inputState.guessing++;
702 try {
703 {
704 expression();
705 match(TO);
706 }
707 }
708 catch (RecognitionException pe) {
709 synPredMatched50 = false;
710 }
711 rewind(_m50);
712 inputState.guessing--;
713 }
714 if ( synPredMatched50 ) {
715 toStatement();
716 if (inputState.guessing==0) {
717 astFactory.addASTChild(currentAST, returnAST);
718 }
719 statement_AST = (AST)currentAST.root;
720 }
721 else {
722 boolean synPredMatched52 = false;
723 if (((LA(1)==VARIABLE) && (LA(2)==TYPEOF))) {
724 int _m52 = mark();
725 synPredMatched52 = true;
726 inputState.guessing++;
727 try {
728 {
729 match(VARIABLE);
730 match(TYPEOF);
731 }
732 }
733 catch (RecognitionException pe) {
734 synPredMatched52 = false;
735 }
736 rewind(_m52);
737 inputState.guessing--;
738 }
739 if ( synPredMatched52 ) {
740 typeofStatement();
741 if (inputState.guessing==0) {
742 astFactory.addASTChild(currentAST, returnAST);
743 }
744 statement_AST = (AST)currentAST.root;
745 }
746 else if ((_tokenSet_7.member(LA(1))) && (_tokenSet_9.member(LA(2)))) {
747 expression();
748 if (inputState.guessing==0) {
749 astFactory.addASTChild(currentAST, returnAST);
750 }
751 eol();
752 if (inputState.guessing==0) {
753 astFactory.addASTChild(currentAST, returnAST);
754 }
755 statement_AST = (AST)currentAST.root;
756 }
757 else if ((LA(1)==VARIABLE) && (LA(2)==FROM)) {
758 fromStatement();
759 if (inputState.guessing==0) {
760 astFactory.addASTChild(currentAST, returnAST);
761 }
762 statement_AST = (AST)currentAST.root;
763 }
764 else {
765 throw new NoViableAltException(LT(1), getFilename());
766 }
767 }}
768 }
769 catch (RecognitionException ex) {
770 if (inputState.guessing==0) {
771 reportError(ex);
772 consume();
773 consumeUntil(_tokenSet_10);
774 } else {
775 throw ex;
776 }
777 }
778 returnAST = statement_AST;
779 }
780
781 public final String labelDeclaration() throws RecognitionException, TokenStreamException {
782 String label;
783
784 returnAST = null;
785 ASTPair currentAST = new ASTPair();
786 AST labelDeclaration_AST = null;
787 Token lb = null;
788 AST lb_AST = null;
789 label = null;
790
791 try { // for error handling
792 AST tmp35_AST = null;
793 if (inputState.guessing==0) {
794 tmp35_AST = (AST)astFactory.create(LT(1));
795 astFactory.makeASTRoot(currentAST, tmp35_AST);
796 }
797 match(LABEL);
798 lb = LT(1);
799 if (inputState.guessing==0) {
800 lb_AST = (AST)astFactory.create(lb);
801 astFactory.addASTChild(currentAST, lb_AST);
802 }
803 match(STRING_LITERAL);
804 if ( inputState.guessing==0 ) {
805 if( lb_AST != null )
806 label = lb_AST.getText();
807 else
808 label = null;
809
810 }
811 labelDeclaration_AST = (AST)currentAST.root;
812 }
813 catch (RecognitionException ex) {
814 if (inputState.guessing==0) {
815 reportError(ex);
816 consume();
817 consumeUntil(_tokenSet_11);
818 } else {
819 throw ex;
820 }
821 }
822 returnAST = labelDeclaration_AST;
823 return label;
824 }
825
826 public final Vector extendsDeclaration() throws RecognitionException, TokenStreamException {
827 Vector extendsList;
828
829 returnAST = null;
830 ASTPair currentAST = new ASTPair();
831 AST extendsDeclaration_AST = null;
832 extendsList = null;
833
834 try { // for error handling
835 AST tmp36_AST = null;
836 if (inputState.guessing==0) {
837 tmp36_AST = (AST)astFactory.create(LT(1));
838 astFactory.makeASTRoot(currentAST, tmp36_AST);
839 }
840 match(EXTENDS);
841 extendsList=extendedConceptsList();
842 if (inputState.guessing==0) {
843 astFactory.addASTChild(currentAST, returnAST);
844 }
845 extendsDeclaration_AST = (AST)currentAST.root;
846 }
847 catch (RecognitionException ex) {
848 if (inputState.guessing==0) {
849 reportError(ex);
850 consume();
851 consumeUntil(_tokenSet_12);
852 } else {
853 throw ex;
854 }
855 }
856 returnAST = extendsDeclaration_AST;
857 return extendsList;
858 }
859
860 public final void conceptBodyComponent() throws RecognitionException, TokenStreamException {
861
862 returnAST = null;
863 ASTPair currentAST = new ASTPair();
864 AST conceptBodyComponent_AST = null;
865 Token sta = null;
866 AST sta_AST = null;
867
868 mn8ScriptAttribute attribute = null;
869 mn8ScriptElement element = null;
870
871
872 try { // for error handling
873 {
874 switch ( LA(1)) {
875 case STATIC:
876 {
877 sta = LT(1);
878 if (inputState.guessing==0) {
879 sta_AST = (AST)astFactory.create(sta);
880 astFactory.addASTChild(currentAST, sta_AST);
881 }
882 match(STATIC);
883 break;
884 }
885 case IDENT:
886 case ATTR:
887 case COLON:
888 {
889 break;
890 }
891 default:
892 {
893 throw new NoViableAltException(LT(1), getFilename());
894 }
895 }
896 }
897 {
898 switch ( LA(1)) {
899 case ATTR:
900 {
901 attribute=attributeDeclaration(sta);
902 if (inputState.guessing==0) {
903 astFactory.addASTChild(currentAST, returnAST);
904 }
905 if ( inputState.guessing==0 ) {
906 if( _conceptDef != null ) _conceptDef.putAttribute( attribute );
907 }
908 break;
909 }
910 case IDENT:
911 {
912 element=elementDeclaration(sta, _conceptDef);
913 if (inputState.guessing==0) {
914 astFactory.addASTChild(currentAST, returnAST);
915 }
916 if ( inputState.guessing==0 ) {
917 if( _conceptDef != null) _conceptDef.putElement( element);
918 }
919 break;
920 }
921 case COLON:
922 {
923 methodDeclaration(sta);
924 if (inputState.guessing==0) {
925 astFactory.addASTChild(currentAST, returnAST);
926 }
927 break;
928 }
929 default:
930 {
931 throw new NoViableAltException(LT(1), getFilename());
932 }
933 }
934 }
935 conceptBodyComponent_AST = (AST)currentAST.root;
936 }
937 catch (RecognitionException ex) {
938 if (inputState.guessing==0) {
939 reportError(ex);
940 consume();
941 consumeUntil(_tokenSet_13);
942 } else {
943 throw ex;
944 }
945 }
946 returnAST = conceptBodyComponent_AST;
947 }
948
949 public final Vector extendedConceptsList() throws RecognitionException, TokenStreamException {
950 Vector extendsList;
951
952 returnAST = null;
953 ASTPair currentAST = new ASTPair();
954 AST extendedConceptsList_AST = null;
955 Token i = null;
956 AST i_AST = null;
957 Token r = null;
958 AST r_AST = null;
959 extendsList = new Vector();
960
961 try { // for error handling
962 i = LT(1);
963 if (inputState.guessing==0) {
964 i_AST = (AST)astFactory.create(i);
965 astFactory.addASTChild(currentAST, i_AST);
966 }
967 match(IDENT);
968 if ( inputState.guessing==0 ) {
969
970 if( !i_AST.getText().equalsIgnoreCase("concept")) {
971 extendsList.add(new StringConcept(i_AST.getText()));
972 }
973
974 }
975 {
976 _loop20:
977 do {
978 if ((LA(1)==COMMA)) {
979 AST tmp37_AST = null;
980 tmp37_AST = (AST)astFactory.create(LT(1));
981 match(COMMA);
982 r = LT(1);
983 if (inputState.guessing==0) {
984 r_AST = (AST)astFactory.create(r);
985 astFactory.addASTChild(currentAST, r_AST);
986 }
987 match(IDENT);
988 if ( inputState.guessing==0 ) {
989
990 if( r_AST != null) {
991 if( !r_AST.getText().equalsIgnoreCase("concept")) {
992 extendsList.add(new StringConcept(r_AST.getText()));
993 }
994 }
995
996 }
997 }
998 else {
999 break _loop20;
1000 }
1001
1002 } while (true);
1003 }
1004 extendedConceptsList_AST = (AST)currentAST.root;
1005 }
1006 catch (RecognitionException ex) {
1007 if (inputState.guessing==0) {
1008 reportError(ex);
1009 consume();
1010 consumeUntil(_tokenSet_12);
1011 } else {
1012 throw ex;
1013 }
1014 }
1015 returnAST = extendedConceptsList_AST;
1016 return extendsList;
1017 }
1018
1019 public final mn8ScriptAttribute attributeDeclaration(
1020 Token isStatic
1021 ) throws RecognitionException, TokenStreamException {
1022 mn8ScriptAttribute attribute;
1023
1024 returnAST = null;
1025 ASTPair currentAST = new ASTPair();
1026 AST attributeDeclaration_AST = null;
1027 Token name = null;
1028 AST name_AST = null;
1029 Token hidden = null;
1030 AST hidden_AST = null;
1031 Token showEmpty = null;
1032 AST showEmpty_AST = null;
1033 AST initial_AST = null;
1034 Token type = null;
1035 AST type_AST = null;
1036 Token label = null;
1037 AST label_AST = null;
1038 attribute = null;
1039
1040 try { // for error handling
1041 AST tmp38_AST = null;
1042 if (inputState.guessing==0) {
1043 tmp38_AST = (AST)astFactory.create(LT(1));
1044 astFactory.makeASTRoot(currentAST, tmp38_AST);
1045 }
1046 match(ATTR);
1047 name = LT(1);
1048 if (inputState.guessing==0) {
1049 name_AST = (AST)astFactory.create(name);
1050 astFactory.addASTChild(currentAST, name_AST);
1051 }
1052 match(IDENT);
1053 {
1054 switch ( LA(1)) {
1055 case NOT:
1056 {
1057 hidden = LT(1);
1058 if (inputState.guessing==0) {
1059 hidden_AST = (AST)astFactory.create(hidden);
1060 astFactory.addASTChild(currentAST, hidden_AST);
1061 }
1062 match(NOT);
1063 break;
1064 }
1065 case QUESTION:
1066 {
1067 showEmpty = LT(1);
1068 if (inputState.guessing==0) {
1069 showEmpty_AST = (AST)astFactory.create(showEmpty);
1070 astFactory.addASTChild(currentAST, showEmpty_AST);
1071 }
1072 match(QUESTION);
1073 break;
1074 }
1075 case LABEL:
1076 case ASSIGN:
1077 case TYPEOF:
1078 case EOL:
1079 {
1080 break;
1081 }
1082 default:
1083 {
1084 throw new NoViableAltException(LT(1), getFilename());
1085 }
1086 }
1087 }
1088 {
1089 switch ( LA(1)) {
1090 case ASSIGN:
1091 {
1092 AST tmp39_AST = null;
1093 if (inputState.guessing==0) {
1094 tmp39_AST = (AST)astFactory.create(LT(1));
1095 astFactory.addASTChild(currentAST, tmp39_AST);
1096 }
1097 match(ASSIGN);
1098 primaryExpression();
1099 if (inputState.guessing==0) {
1100 initial_AST = (AST)returnAST;
1101 astFactory.addASTChild(currentAST, returnAST);
1102 }
1103 break;
1104 }
1105 case LABEL:
1106 case TYPEOF:
1107 case EOL:
1108 {
1109 break;
1110 }
1111 default:
1112 {
1113 throw new NoViableAltException(LT(1), getFilename());
1114 }
1115 }
1116 }
1117 {
1118 switch ( LA(1)) {
1119 case TYPEOF:
1120 {
1121 AST tmp40_AST = null;
1122 if (inputState.guessing==0) {
1123 tmp40_AST = (AST)astFactory.create(LT(1));
1124 astFactory.addASTChild(currentAST, tmp40_AST);
1125 }
1126 match(TYPEOF);
1127 type = LT(1);
1128 if (inputState.guessing==0) {
1129 type_AST = (AST)astFactory.create(type);
1130 astFactory.addASTChild(currentAST, type_AST);
1131 }
1132 match(IDENT);
1133 break;
1134 }
1135 case LABEL:
1136 case EOL:
1137 {
1138 break;
1139 }
1140 default:
1141 {
1142 throw new NoViableAltException(LT(1), getFilename());
1143 }
1144 }
1145 }
1146 {
1147 switch ( LA(1)) {
1148 case LABEL:
1149 {
1150 AST tmp41_AST = null;
1151 if (inputState.guessing==0) {
1152 tmp41_AST = (AST)astFactory.create(LT(1));
1153 astFactory.addASTChild(currentAST, tmp41_AST);
1154 }
1155 match(LABEL);
1156 label = LT(1);
1157 if (inputState.guessing==0) {
1158 label_AST = (AST)astFactory.create(label);
1159 astFactory.addASTChild(currentAST, label_AST);
1160 }
1161 match(STRING_LITERAL);
1162 break;
1163 }
1164 case EOL:
1165 {
1166 break;
1167 }
1168 default:
1169 {
1170 throw new NoViableAltException(LT(1), getFilename());
1171 }
1172 }
1173 }
1174 eol();
1175 if (inputState.guessing==0) {
1176 astFactory.addASTChild(currentAST, returnAST);
1177 }
1178 if ( inputState.guessing==0 ) {
1179 if( _conceptDef != null ) {
1180 attribute = new mn8ScriptAttribute( name_AST.getText(),
1181 null,
1182 ( isStatic == null ? false : true ),
1183 ( label_AST == null ? name_AST.getText() : label_AST.getText()),
1184 ( type_AST == null ? "Nil" : type_AST.getText() ),
1185 _conceptDef.getConceptType().toString(),
1186 initial_AST);
1187 if( hidden_AST != null ) attribute.setHidden(new LogicalConcept(true));
1188 if( showEmpty_AST != null ) attribute.setShowEmpty(new LogicalConcept(false));
1189
1190 if( attribute.isStatic() )
1191 GlobalScope.getReference().insertGlobalInstance( _conceptDef.getConceptType().toString(),
1192 "@" + name_AST.getText(),
1193 attribute.newInstance());
1194 }
1195
1196 }
1197 attributeDeclaration_AST = (AST)currentAST.root;
1198 }
1199 catch (RecognitionException ex) {
1200 if (inputState.guessing==0) {
1201 reportError(ex);
1202 consume();
1203 consumeUntil(_tokenSet_13);
1204 } else {
1205 throw ex;
1206 }
1207 }
1208 returnAST = attributeDeclaration_AST;
1209 return attribute;
1210 }
1211
1212 public final mn8ScriptElement elementDeclaration(
1213 Token isStatic, ConceptDefinition conceptDef
1214 ) throws RecognitionException, TokenStreamException {
1215 mn8ScriptElement element;
1216
1217 returnAST = null;
1218 ASTPair currentAST = new ASTPair();
1219 AST elementDeclaration_AST = null;
1220 Token name = null;
1221 AST name_AST = null;
1222 Token multi = null;
1223 AST multi_AST = null;
1224 Token hidden = null;
1225 AST hidden_AST = null;
1226 Token showEmpty = null;
1227 AST showEmpty_AST = null;
1228 AST initial_AST = null;
1229 Token type = null;
1230 AST type_AST = null;
1231 Token label = null;
1232 AST label_AST = null;
1233 element = null; mn8ScriptAttribute attribute = null; mn8ScriptElement innerElement = null;
1234
1235 try { // for error handling
1236 name = LT(1);
1237 if (inputState.guessing==0) {
1238 name_AST = (AST)astFactory.create(name);
1239 astFactory.addASTChild(currentAST, name_AST);
1240 }
1241 match(IDENT);
1242 {
1243 switch ( LA(1)) {
1244 case STAR:
1245 {
1246 multi = LT(1);
1247 if (inputState.guessing==0) {
1248 multi_AST = (AST)astFactory.create(multi);
1249 astFactory.addASTChild(currentAST, multi_AST);
1250 }
1251 match(STAR);
1252 break;
1253 }
1254 case LBRACK:
1255 case LABEL:
1256 case NOT:
1257 case QUESTION:
1258 case ASSIGN:
1259 case TYPEOF:
1260 case EOL:
1261 {
1262 break;
1263 }
1264 default:
1265 {
1266 throw new NoViableAltException(LT(1), getFilename());
1267 }
1268 }
1269 }
1270 {
1271 switch ( LA(1)) {
1272 case NOT:
1273 {
1274 hidden = LT(1);
1275 if (inputState.guessing==0) {
1276 hidden_AST = (AST)astFactory.create(hidden);
1277 astFactory.addASTChild(currentAST, hidden_AST);
1278 }
1279 match(NOT);
1280 break;
1281 }
1282 case QUESTION:
1283 {
1284 showEmpty = LT(1);
1285 if (inputState.guessing==0) {
1286 showEmpty_AST = (AST)astFactory.create(showEmpty);
1287 astFactory.addASTChild(currentAST, showEmpty_AST);
1288 }
1289 match(QUESTION);
1290 break;
1291 }
1292 case LBRACK:
1293 case LABEL:
1294 case ASSIGN:
1295 case TYPEOF:
1296 case EOL:
1297 {
1298 break;
1299 }
1300 default:
1301 {
1302 throw new NoViableAltException(LT(1), getFilename());
1303 }
1304 }
1305 }
1306 {
1307 switch ( LA(1)) {
1308 case ASSIGN:
1309 {
1310 AST tmp42_AST = null;
1311 if (inputState.guessing==0) {
1312 tmp42_AST = (AST)astFactory.create(LT(1));
1313 astFactory.addASTChild(currentAST, tmp42_AST);
1314 }
1315 match(ASSIGN);
1316 primaryExpression();
1317 if (inputState.guessing==0) {
1318 initial_AST = (AST)returnAST;
1319 astFactory.addASTChild(currentAST, returnAST);
1320 }
1321 break;
1322 }
1323 case LBRACK:
1324 case LABEL:
1325 case TYPEOF:
1326 case EOL:
1327 {
1328 break;
1329 }
1330 default:
1331 {
1332 throw new NoViableAltException(LT(1), getFilename());
1333 }
1334 }
1335 }
1336 {
1337 switch ( LA(1)) {
1338 case TYPEOF:
1339 {
1340 AST tmp43_AST = null;
1341 if (inputState.guessing==0) {
1342 tmp43_AST = (AST)astFactory.create(LT(1));
1343 astFactory.addASTChild(currentAST, tmp43_AST);
1344 }
1345 match(TYPEOF);
1346 type = LT(1);
1347 if (inputState.guessing==0) {
1348 type_AST = (AST)astFactory.create(type);
1349 astFactory.addASTChild(currentAST, type_AST);
1350 }
1351 match(IDENT);
1352 break;
1353 }
1354 case LBRACK:
1355 case LABEL:
1356 case EOL:
1357 {
1358 break;
1359 }
1360 default:
1361 {
1362 throw new NoViableAltException(LT(1), getFilename());
1363 }
1364 }
1365 }
1366 {
1367 switch ( LA(1)) {
1368 case LABEL:
1369 {
1370 AST tmp44_AST = null;
1371 if (inputState.guessing==0) {
1372 tmp44_AST = (AST)astFactory.create(LT(1));
1373 astFactory.addASTChild(currentAST, tmp44_AST);
1374 }
1375 match(LABEL);
1376 label = LT(1);
1377 if (inputState.guessing==0) {
1378 label_AST = (AST)astFactory.create(label);
1379 astFactory.addASTChild(currentAST, label_AST);
1380 }
1381 match(STRING_LITERAL);
1382 break;
1383 }
1384 case LBRACK:
1385 case EOL:
1386 {
1387 break;
1388 }
1389 default:
1390 {
1391 throw new NoViableAltException(LT(1), getFilename());
1392 }
1393 }
1394 }
1395 if ( inputState.guessing==0 ) {
1396 if( _conceptDef != null ) {
1397 element = new mn8ScriptElement( name_AST.getText(),
1398 null,
1399 ( isStatic == null ? false : true ),
1400 ( label_AST == null ? name_AST.getText() : label_AST.getText()),
1401 ( type_AST == null ? "Element" : type_AST.getText() ),
1402 conceptDef.getConceptType().toString(),
1403 initial_AST,
1404 ( multi_AST != null ? true : false ) );
1405
1406 if( hidden_AST != null ) element.setHidden(new LogicalConcept(true));
1407 if( showEmpty_AST != null ) element.setShowEmpty(new LogicalConcept(false));
1408
1409 if( element.isStatic() )
1410 GlobalScope.getReference().insertGlobalInstance( conceptDef.getConceptType().toString(),
1411 name_AST.getText(),
1412 element.newInstance());
1413 }
1414
1415 }
1416 {
1417 switch ( LA(1)) {
1418 case LBRACK:
1419 {
1420 AST tmp45_AST = null;
1421 tmp45_AST = (AST)astFactory.create(LT(1));
1422 match(LBRACK);
1423 eol();
1424 if (inputState.guessing==0) {
1425 astFactory.addASTChild(currentAST, returnAST);
1426 }
1427 if ( inputState.guessing==0 ) {
1428
1429 if( _conceptDef != null ) {
1430 if( type_AST != null )
1431 throw new RuntimeException("Warning:" + type_AST.getLine() + ": Elements containing an subtype concept definition " +
1432 "can not explicitely declare a type.");
1433
1434 if( initial_AST != null )
1435 throw new RuntimeException("Warning:" + initial_AST.getLine() + ": Elements containing an subtype concept definition " +
1436 "can not declari initial values to them.");
1437
1438 deepElementType.add( name_AST.getText());
1439 String elemInstantType= "";
1440 for( int i = 0 ; i < deepElementType.size(); i++) {
1441 if( i > 0) elemInstantType += ":";
1442 elemInstantType+= (String)deepElementType.elementAt(i);
1443 }
1444
1445 element = new mn8ScriptElement( name_AST.getText(),
1446 null,
1447 ( isStatic == null ? false : true ),
1448 ( label_AST == null ? name_AST.getText() : label_AST.getText()),
1449 ( elemInstantType ),
1450 conceptDef.getConceptType().toString(),
1451 initial_AST,
1452 ( multi_AST != null ? true : false) );
1453
1454 if( hidden_AST != null ) element.setHidden(new LogicalConcept(true));
1455 if( showEmpty_AST != null ) element.setShowEmpty(new LogicalConcept(false));
1456
1457 if( element.isStatic() )
1458 GlobalScope.getReference().insertGlobalInstance( conceptDef.getConceptType().toString(),
1459 name_AST.getText(),
1460 element.newInstance());
1461
1462 conceptDef = new mn8ConceptDefinition( elemInstantType,
1463 label_AST == null ? name_AST.getText() : label_AST.getText(),
1464 null );
1465
1466 }
1467
1468 }
1469 {
1470 _loop37:
1471 do {
1472 switch ( LA(1)) {
1473 case ATTR:
1474 {
1475 attribute=attributeDeclaration(isStatic);
1476 if (inputState.guessing==0) {
1477 astFactory.addASTChild(currentAST, returnAST);
1478 }
1479 if ( inputState.guessing==0 ) {
1480 if ( _conceptDef != null ) conceptDef.putAttribute( attribute);
1481 }
1482 break;
1483 }
1484 case IDENT:
1485 {
1486 innerElement=elementDeclaration(isStatic, conceptDef);
1487 if (inputState.guessing==0) {
1488 astFactory.addASTChild(currentAST, returnAST);
1489 }
1490 if ( inputState.guessing==0 ) {
1491
1492 if( _conceptDef != null ) conceptDef.putElement( innerElement );
1493
1494 }
1495 break;
1496 }
1497 default:
1498 {
1499 break _loop37;
1500 }
1501 }
1502 } while (true);
1503 }
1504 if ( inputState.guessing==0 ) {
1505 if( _conceptDef != null ) {
1506 _conceptDef.setTokenNames(getTokenNames());
1507 ConceptRegister.getReference().register(conceptDef.getConceptType().toString(), conceptDef);
1508 deepElementType.remove( name_AST.getText());
1509 }
1510
1511 }
1512 AST tmp46_AST = null;
1513 tmp46_AST = (AST)astFactory.create(LT(1));
1514 match(RBRACK);
1515 break;
1516 }
1517 case EOL:
1518 {
1519 break;
1520 }
1521 default:
1522 {
1523 throw new NoViableAltException(LT(1), getFilename());
1524 }
1525 }
1526 }
1527 eol();
1528 if (inputState.guessing==0) {
1529 astFactory.addASTChild(currentAST, returnAST);
1530 }
1531 elementDeclaration_AST = (AST)currentAST.root;
1532 }
1533 catch (RecognitionException ex) {
1534 if (inputState.guessing==0) {
1535 reportError(ex);
1536 consume();
1537 consumeUntil(_tokenSet_13);
1538 } else {
1539 throw ex;
1540 }
1541 }
1542 returnAST = elementDeclaration_AST;
1543 return element;
1544 }
1545
1546 public final void methodDeclaration(
1547 Token isStatic
1548 ) throws RecognitionException, TokenStreamException {
1549
1550 returnAST = null;
1551 ASTPair currentAST = new ASTPair();
1552 AST methodDeclaration_AST = null;
1553 Token name = null;
1554 AST name_AST = null;
1555 AST codeBlock_AST = null;
1556 Token returnType = null;
1557 AST returnType_AST = null;
1558 AST e_AST = null;
1559 Vector paramNames = new Vector(); Vector paramTypes = new Vector(); String operator = null;
1560
1561 try { // for error handling
1562 AST tmp47_AST = null;
1563 if (inputState.guessing==0) {
1564 tmp47_AST = (AST)astFactory.create(LT(1));
1565 astFactory.makeASTRoot(currentAST, tmp47_AST);
1566 }
1567 match(COLON);
1568 {
1569 switch ( LA(1)) {
1570 case IDENT:
1571 {
1572 name = LT(1);
1573 if (inputState.guessing==0) {
1574 name_AST = (AST)astFactory.create(name);
1575 astFactory.addASTChild(currentAST, name_AST);
1576 }
1577 match(IDENT);
1578 break;
1579 }
1580 case NOT:
1581 case STAR:
1582 case PLUS_ASSIGN:
1583 case MINUS_ASSIGN:
1584 case STAR_ASSIGN:
1585 case DIV_ASSIGN:
1586 case NOT_EQUAL:
1587 case EQUAL:
1588 case LT:
1589 case GT:
1590 case LE:
1591 case GE:
1592 case PLUS:
1593 case MINUS:
1594 case DIV:
1595 case INC:
1596 case DEC:
1597 {
1598 operator=operator();
1599 if (inputState.guessing==0) {
1600 astFactory.addASTChild(currentAST, returnAST);
1601 }
1602 break;
1603 }
1604 default:
1605 {
1606 throw new NoViableAltException(LT(1), getFilename());
1607 }
1608 }
1609 }
1610 {
1611 switch ( LA(1)) {
1612 case LPAREN:
1613 {
1614 AST tmp48_AST = null;
1615 tmp48_AST = (AST)astFactory.create(LT(1));
1616 match(LPAREN);
1617 break;
1618 }
1619 case VARIABLE:
1620 case LBRACK:
1621 case RPAREN:
1622 {
1623 break;
1624 }
1625 default:
1626 {
1627 throw new NoViableAltException(LT(1), getFilename());
1628 }
1629 }
1630 }
1631 {
1632 switch ( LA(1)) {
1633 case VARIABLE:
1634 {
1635 parameterList(paramNames, paramTypes);
1636 if (inputState.guessing==0) {
1637 astFactory.addASTChild(currentAST, returnAST);
1638 }
1639 break;
1640 }
1641 case LBRACK:
1642 case RPAREN:
1643 {
1644 break;
1645 }
1646 default:
1647 {
1648 throw new NoViableAltException(LT(1), getFilename());
1649 }
1650 }
1651 }
1652 {
1653 switch ( LA(1)) {
1654 case RPAREN:
1655 {
1656 AST tmp49_AST = null;
1657 tmp49_AST = (AST)astFactory.create(LT(1));
1658 match(RPAREN);
1659 break;
1660 }
1661 case LBRACK:
1662 {
1663 break;
1664 }
1665 default:
1666 {
1667 throw new NoViableAltException(LT(1), getFilename());
1668 }
1669 }
1670 }
1671 block();
1672 if (inputState.guessing==0) {
1673 codeBlock_AST = (AST)returnAST;
1674 astFactory.addASTChild(currentAST, returnAST);
1675 }
1676 {
1677 switch ( LA(1)) {
1678 case TYPEOF:
1679 {
1680 AST tmp50_AST = null;
1681 if (inputState.guessing==0) {
1682 tmp50_AST = (AST)astFactory.create(LT(1));
1683 astFactory.addASTChild(currentAST, tmp50_AST);
1684 }
1685 match(TYPEOF);
1686 returnType = LT(1);
1687 if (inputState.guessing==0) {
1688 returnType_AST = (AST)astFactory.create(returnType);
1689 astFactory.addASTChild(currentAST, returnType_AST);
1690 }
1691 match(IDENT);
1692 break;
1693 }
1694 case EOL:
1695 {
1696 break;
1697 }
1698 default:
1699 {
1700 throw new NoViableAltException(LT(1), getFilename());
1701 }
1702 }
1703 }
1704 eol();
1705 if (inputState.guessing==0) {
1706 e_AST = (AST)returnAST;
1707 astFactory.addASTChild(currentAST, returnAST);
1708 }
1709 if ( inputState.guessing==0 ) {
1710 if ( _conceptDef != null ) {
1711 String methodName ;
1712
1713 if( name_AST != null ) {
1714 methodName = name_AST.getText() ;
1715 } else {
1716 methodName = operator ;
1717 }
1718
1719 mn8ScriptMethod method = new mn8ScriptMethod( methodName,
1720 ( isStatic == null ? false : true ),
1721 paramTypes,
1722 paramNames,
1723 _conceptDef,
1724 ( returnType_AST == null ? null : returnType_AST.getText()) );
1725
1726 method.lineNr = tmp47_AST.getLine();
1727
1728 if( name_AST != null && name_AST.getText().equalsIgnoreCase("