]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/LangParser.c
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.databoard / cpp / DataBoardTest / DataBoard / LangParser.c
1 /** \file
2  *  This C source file was generated by $ANTLR version 3.2 Sep 23, 2009 12:02:23
3  *
4  *     -  From the grammar source file : Lang.g
5  *     -                            On : 2010-02-24 13:27:52
6  *     -                for the parser : LangParserParser *
7  * Editing it, at least manually, is not wise. 
8  *
9  * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
10  *
11  *
12 */
13 // [The "BSD licence"]
14 // Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
15 // http://www.temporal-wave.com
16 // http://www.linkedin.com/in/jimidle
17 //
18 // All rights reserved.
19 //
20 // Redistribution and use in source and binary forms, with or without
21 // modification, are permitted provided that the following conditions
22 // are met:
23 // 1. Redistributions of source code must retain the above copyright
24 //    notice, this list of conditions and the following disclaimer.
25 // 2. Redistributions in binary form must reproduce the above copyright
26 //    notice, this list of conditions and the following disclaimer in the
27 //    documentation and/or other materials provided with the distribution.
28 // 3. The name of the author may not be used to endorse or promote products
29 //    derived from this software without specific prior written permission.
30 //
31 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
32 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
33 // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
34 // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
35 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
36 // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
37 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
38 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
40 // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41
42 /* -----------------------------------------
43  * Include the ANTLR3 generated header file.
44  */
45 #include    "LangParser.h"
46 /* ----------------------------------------- */
47
48
49
50
51
52 /* MACROS that hide the C interface implementations from the
53  * generated code, which makes it a little more understandable to the human eye.
54  * I am very much against using C pre-processor macros for function calls and bits
55  * of code as you cannot see what is happening when single stepping in debuggers
56  * and so on. The exception (in my book at least) is for generated code, where you are
57  * not maintaining it, but may wish to read and understand it. If you single step it, you know that input()
58  * hides some indirect calls, but is always referring to the input stream. This is
59  * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig
60  * the runtime interfaces without changing the generated code too often, without
61  * confusing the reader of the generated output, who may not wish to know the gory
62  * details of the interface inheritance.
63  */
64  
65 #define         CTX     ctx
66
67 /* Aids in accessing scopes for grammar programmers
68  */
69 #undef  SCOPE_TYPE
70 #undef  SCOPE_STACK
71 #undef  SCOPE_TOP
72 #define SCOPE_TYPE(scope)   pLangParser_##scope##_SCOPE
73 #define SCOPE_STACK(scope)  pLangParser_##scope##Stack
74 #define SCOPE_TOP(scope)    ctx->pLangParser_##scope##Top
75 #define SCOPE_SIZE(scope)               ctx->pLangParser_##scope##Stack_limit
76 #define SCOPE_INSTANCE(scope, i)        (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i))
77
78 /* Macros for accessing things in the parser
79  */
80  
81 #undef      PARSER                  
82 #undef      RECOGNIZER              
83 #undef      HAVEPARSEDRULE
84 #undef          MEMOIZE
85 #undef      INPUT
86 #undef      STRSTREAM
87 #undef      HASEXCEPTION
88 #undef      EXCEPTION
89 #undef      MATCHT
90 #undef      MATCHANYT
91 #undef      FOLLOWSTACK
92 #undef      FOLLOWPUSH
93 #undef      FOLLOWPOP
94 #undef      PRECOVER
95 #undef      PREPORTERROR
96 #undef      LA
97 #undef      LT
98 #undef      CONSTRUCTEX
99 #undef      CONSUME
100 #undef      MARK
101 #undef      REWIND
102 #undef      REWINDLAST
103 #undef      PERRORRECOVERY
104 #undef      HASFAILED
105 #undef      FAILEDFLAG
106 #undef      RECOVERFROMMISMATCHEDSET
107 #undef      RECOVERFROMMISMATCHEDELEMENT
108 #undef          INDEX
109 #undef      ADAPTOR
110 #undef          SEEK
111 #undef      RULEMEMO                
112 #undef          DBG
113
114 #define     PARSER                                                      ctx->pParser  
115 #define     RECOGNIZER                                          PARSER->rec
116 #define         PSRSTATE                                                RECOGNIZER->state
117 #define     HAVEPARSEDRULE(r)                           RECOGNIZER->alreadyParsedRule(RECOGNIZER, r)
118 #define         MEMOIZE(ri,si)                                  RECOGNIZER->memoize(RECOGNIZER, ri, si)
119 #define     INPUT                                                       PARSER->tstream
120 #define     STRSTREAM                                           INPUT
121 #define         ISTREAM                                                 INPUT->istream
122 #define         INDEX()                                                 ISTREAM->index(INPUT->istream)
123 #define     HASEXCEPTION()                                      (PSRSTATE->error == ANTLR3_TRUE)
124 #define     EXCEPTION                                           PSRSTATE->exception
125 #define     MATCHT(t, fs)                                       RECOGNIZER->match(RECOGNIZER, t, fs)
126 #define     MATCHANYT()                                         RECOGNIZER->matchAny(RECOGNIZER)
127 #define     FOLLOWSTACK                                     PSRSTATE->following
128 #define     FOLLOWPUSH(x)                                       FOLLOWSTACK->push(FOLLOWSTACK, ((void *)(&(x))), NULL)
129 #define     FOLLOWPOP()                                         FOLLOWSTACK->pop(FOLLOWSTACK)
130 #define     PRECOVER()                                          RECOGNIZER->recover(RECOGNIZER)
131 #define     PREPORTERROR()                                      RECOGNIZER->reportError(RECOGNIZER)
132 #define     LA(n)                                                       INPUT->istream->_LA(ISTREAM, n)
133 #define     LT(n)                                                       INPUT->_LT(INPUT, n)
134 #define     CONSTRUCTEX()                                       RECOGNIZER->exConstruct(RECOGNIZER)
135 #define     CONSUME()                                           ISTREAM->consume(ISTREAM)
136 #define     MARK()                                                      ISTREAM->mark(ISTREAM)
137 #define     REWIND(m)                                           ISTREAM->rewind(ISTREAM, m)
138 #define     REWINDLAST()                                        ISTREAM->rewindLast(ISTREAM)
139 #define         SEEK(n)                                                 ISTREAM->seek(ISTREAM, n)
140 #define     PERRORRECOVERY                                      PSRSTATE->errorRecovery
141 #define     FAILEDFLAG                                          PSRSTATE->failed
142 #define     HASFAILED()                                         (FAILEDFLAG == ANTLR3_TRUE)
143 #define     BACKTRACKING                                        PSRSTATE->backtracking
144 #define     RECOVERFROMMISMATCHEDSET(s)         RECOGNIZER->recoverFromMismatchedSet(RECOGNIZER, s)
145 #define     RECOVERFROMMISMATCHEDELEMENT(e)     RECOGNIZER->recoverFromMismatchedElement(RECOGNIZER, s)
146 #define     ADAPTOR                         ctx->adaptor
147 #define         RULEMEMO                                                PSRSTATE->ruleMemo
148 #define         DBG                                                             RECOGNIZER->debugger
149
150 #define         TOKTEXT(tok, txt)                               tok, (pANTLR3_UINT8)txt
151
152 /* The 4 tokens defined below may well clash with your own #defines or token types. If so
153  * then for the present you must use different names for your defines as these are hard coded
154  * in the code generator. It would be better not to use such names internally, and maybe
155  * we can change this in a forthcoming release. I deliberately do not #undef these
156  * here as this will at least give you a redefined error somewhere if they clash.
157  */
158 #define     UP      ANTLR3_TOKEN_UP
159 #define     DOWN    ANTLR3_TOKEN_DOWN
160 #define     EOR     ANTLR3_TOKEN_EOR
161 #define     INVALID ANTLR3_TOKEN_INVALID
162
163
164 /* =============================================================================
165  * Functions to create and destroy scopes. First come the rule scopes, followed
166  * by the global declared scopes.
167  */
168
169
170
171 /* ============================================================================= */
172
173 /* =============================================================================
174  * Start of recognizer
175  */
176
177
178
179 /** \brief Table of all token names in symbolic order, mainly used for
180  *         error reporting.
181  */
182 pANTLR3_UINT8   LangParserTokenNames[7+4]
183      = {
184         (pANTLR3_UINT8) "<invalid>",       /* String to print to indicate an invalid token */
185         (pANTLR3_UINT8) "<EOR>",
186         (pANTLR3_UINT8) "<DOWN>", 
187         (pANTLR3_UINT8) "<UP>", 
188         (pANTLR3_UINT8) "DECL",
189         (pANTLR3_UINT8) "ID",
190         (pANTLR3_UINT8) "INTTYPE",
191         (pANTLR3_UINT8) "FLOATTYPE",
192         (pANTLR3_UINT8) "INT",
193         (pANTLR3_UINT8) "WS",
194         (pANTLR3_UINT8) "';'"
195        };
196
197         
198
199 // Forward declare the locally static matching functions we have generated.
200 //
201 static LangParser_start_return  start    (pLangParser ctx);
202 static LangParser_decl_return   decl    (pLangParser ctx);
203 static LangParser_type_return   type    (pLangParser ctx);
204 static void     LangParserFree(pLangParser ctx);
205 /* For use in tree output where we are accumulating rule labels via label += ruleRef
206  * we need a function that knows how to free a return scope when the list is destroyed. 
207  * We cannot just use ANTLR3_FREE because in debug tracking mode, this is a macro.
208  */
209 static  void ANTLR3_CDECL freeScope(void * scope)
210 {
211     ANTLR3_FREE(scope);
212 }
213
214 /** \brief Name of the grammar file that generated this code
215  */
216 static const char fileName[] = "Lang.g";
217
218 /** \brief Return the name of the grammar file that generated this code.
219  */
220 static const char * getGrammarFileName()
221 {
222         return fileName;
223 }
224 /** \brief Create a new LangParser parser and return a context for it.
225  *
226  * \param[in] instream Pointer to an input stream interface.
227  *
228  * \return Pointer to new parser context upon success.
229  */
230 ANTLR3_API pLangParser
231 LangParserNew   (pANTLR3_COMMON_TOKEN_STREAM instream)
232 {
233         // See if we can create a new parser with the standard constructor
234         //
235         return LangParserNewSSD(instream, NULL);
236 }
237
238 /** \brief Create a new LangParser parser and return a context for it.
239  *
240  * \param[in] instream Pointer to an input stream interface.
241  *
242  * \return Pointer to new parser context upon success.
243  */
244 ANTLR3_API pLangParser
245 LangParserNewSSD   (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
246 {
247     pLangParser ctx;        /* Context structure we will build and return   */
248     
249     ctx = (pLangParser) ANTLR3_CALLOC(1, sizeof(LangParser));
250     
251     if  (ctx == NULL)
252     {
253                 // Failed to allocate memory for parser context
254                 //
255         return  NULL;
256     }
257     
258     /* -------------------------------------------------------------------
259      * Memory for basic structure is allocated, now to fill in
260      * the base ANTLR3 structures. We initialize the function pointers
261      * for the standard ANTLR3 parser function set, but upon return
262      * from here, the programmer may set the pointers to provide custom
263      * implementations of each function. 
264      *
265      * We don't use the macros defined in LangParser.h here, in order that you can get a sense
266      * of what goes where.
267      */
268
269     /* Create a base parser/recognizer, using the supplied token stream
270      */
271     ctx->pParser            = antlr3ParserNewStream(ANTLR3_SIZE_HINT, instream->tstream, state);
272     /* Install the implementation of our LangParser interface
273      */
274     ctx->start  = start;
275     ctx->decl   = decl;
276     ctx->type   = type;
277     ctx->free                   = LangParserFree;
278     ctx->getGrammarFileName     = getGrammarFileName;
279     
280     /* Install the scope pushing methods.
281      */
282     ADAPTOR     = ANTLR3_TREE_ADAPTORNew(instream->tstream->tokenSource->strFactory);
283     ctx->vectors        = antlr3VectorFactoryNew(0);
284     
285
286         
287     /* Install the token table
288      */
289     PSRSTATE->tokenNames   = LangParserTokenNames;
290     
291     
292     /* Return the newly built parser to the caller
293      */
294     return  ctx;
295 }
296
297 /** Free the parser resources
298  */
299  static void
300  LangParserFree(pLangParser ctx)
301  {
302     /* Free any scope memory
303      */
304     
305     ctx->vectors->close(ctx->vectors);
306     /* We created the adaptor so we must free it
307      */
308     ADAPTOR->free(ADAPTOR);
309         // Free this parser
310         //
311     ctx->pParser->free(ctx->pParser);
312     ANTLR3_FREE(ctx);
313
314     /* Everything is released, so we can return
315      */
316     return;
317  }
318  
319 /** Return token names used by this parser
320  *
321  * The returned pointer is used as an index into the token names table (using the token 
322  * number as the index).
323  * 
324  * \return Pointer to first char * in the table.
325  */
326 static pANTLR3_UINT8    *getTokenNames() 
327 {
328         return LangParserTokenNames; 
329 }
330
331     
332 /* Declare the bitsets
333  */
334
335 /** Bitset defining follow set for error recovery in rule state: FOLLOW_decl_in_start91  */
336 static  ANTLR3_BITWORD FOLLOW_decl_in_start91_bits[]    = { ANTLR3_UINT64_LIT(0x00000000000000C2) };
337 static  ANTLR3_BITSET_LIST FOLLOW_decl_in_start91       = { FOLLOW_decl_in_start91_bits, 1      };
338 /** Bitset defining follow set for error recovery in rule state: FOLLOW_type_in_decl103  */
339 static  ANTLR3_BITWORD FOLLOW_type_in_decl103_bits[]    = { ANTLR3_UINT64_LIT(0x0000000000000020) };
340 static  ANTLR3_BITSET_LIST FOLLOW_type_in_decl103       = { FOLLOW_type_in_decl103_bits, 1      };
341 /** Bitset defining follow set for error recovery in rule state: FOLLOW_ID_in_decl105  */
342 static  ANTLR3_BITWORD FOLLOW_ID_in_decl105_bits[]      = { ANTLR3_UINT64_LIT(0x0000000000000400) };
343 static  ANTLR3_BITSET_LIST FOLLOW_ID_in_decl105 = { FOLLOW_ID_in_decl105_bits, 1        };
344 /** Bitset defining follow set for error recovery in rule state: FOLLOW_10_in_decl107  */
345 static  ANTLR3_BITWORD FOLLOW_10_in_decl107_bits[]      = { ANTLR3_UINT64_LIT(0x0000000000000002) };
346 static  ANTLR3_BITSET_LIST FOLLOW_10_in_decl107 = { FOLLOW_10_in_decl107_bits, 1        };
347 /** Bitset defining follow set for error recovery in rule state: FOLLOW_set_in_type0  */
348 static  ANTLR3_BITWORD FOLLOW_set_in_type0_bits[]       = { ANTLR3_UINT64_LIT(0x0000000000000002) };
349 static  ANTLR3_BITSET_LIST FOLLOW_set_in_type0  = { FOLLOW_set_in_type0_bits, 1 };
350      
351
352  
353  
354 /* ==============================================
355  * Parsing rules
356  */
357 /** 
358  * $ANTLR start start
359  * Lang.g:20:1: start : ( decl )+ ;
360  */
361 static LangParser_start_return
362 start(pLangParser ctx)
363 {   
364     LangParser_start_return retval;
365
366     pANTLR3_BASE_TREE root_0;
367
368     LangParser_decl_return decl1;
369     #undef      RETURN_TYPE_decl1
370     #define     RETURN_TYPE_decl1 LangParser_decl_return
371
372
373     /* Initialize rule variables
374      */
375
376
377     root_0 = NULL;
378
379     decl1.tree = NULL;
380
381     retval.start = LT(1); retval.stop = retval.start;
382
383
384
385     retval.tree  = NULL;
386     {
387         // Lang.g:20:7: ( ( decl )+ )
388         // Lang.g:20:9: ( decl )+
389         {
390             root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
391
392             // Lang.g:20:9: ( decl )+
393             {
394                 int cnt1=0;
395
396                 for (;;)
397                 {
398                     int alt1=2;
399                 switch ( LA(1) ) 
400                 {
401                 case INTTYPE:
402                 case FLOATTYPE:
403                         {
404                                 alt1=1;
405                         }
406                     break;
407
408                 }
409
410                 switch (alt1) 
411                 {
412                     case 1:
413                         // Lang.g:20:9: decl
414                         {
415                             FOLLOWPUSH(FOLLOW_decl_in_start91);
416                             decl1=decl(ctx);
417
418                             FOLLOWPOP();
419                             if  (HASEXCEPTION())
420                             {
421                                 goto rulestartEx;
422                             }
423
424                             ADAPTOR->addChild(ADAPTOR, root_0, decl1.tree);
425
426                         }
427                         break;
428
429                     default:
430                     
431                         if ( cnt1 >= 1 )
432                         {
433                             goto loop1;
434                         }
435                         /* mismatchedSetEx()
436                          */
437                         CONSTRUCTEX();
438                         EXCEPTION->type = ANTLR3_EARLY_EXIT_EXCEPTION;
439                         EXCEPTION->name = (void *)ANTLR3_EARLY_EXIT_NAME;
440
441
442                         goto rulestartEx;
443                 }
444                 cnt1++;
445                 }
446                 loop1: ;        /* Jump to here if this rule does not match */
447             }
448
449         }
450
451     }
452     
453
454     // This is where rules clean up and exit
455     //
456     goto rulestartEx; /* Prevent compiler warnings */
457     rulestartEx: ;
458     retval.stop = LT(-1);
459
460         retval.stop = LT(-1);
461         retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
462         ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
463
464             if (HASEXCEPTION())
465             {
466                 PREPORTERROR();
467                 PRECOVER();
468                 retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
469             }
470
471
472     return retval;
473 }
474 /* $ANTLR end start */
475
476 /** 
477  * $ANTLR start decl
478  * Lang.g:23:1: decl : type ID ';' -> ^( DECL type ID ) ;
479  */
480 static LangParser_decl_return
481 decl(pLangParser ctx)
482 {   
483     LangParser_decl_return retval;
484
485     pANTLR3_BASE_TREE root_0;
486
487     pANTLR3_COMMON_TOKEN    ID3;
488     pANTLR3_COMMON_TOKEN    char_literal4;
489     LangParser_type_return type2;
490     #undef      RETURN_TYPE_type2
491     #define     RETURN_TYPE_type2 LangParser_type_return
492
493     pANTLR3_BASE_TREE ID3_tree;
494     pANTLR3_BASE_TREE char_literal4_tree;
495     pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_10;
496     pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_ID;
497     pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_type;
498     /* Initialize rule variables
499      */
500
501
502     root_0 = NULL;
503
504     ID3       = NULL;
505     char_literal4       = NULL;
506     type2.tree = NULL;
507
508     retval.start = LT(1); retval.stop = retval.start;
509
510     ID3_tree   = NULL;
511     char_literal4_tree   = NULL;
512
513     stream_10   = NULL;
514     #define CREATE_stream_10  if (stream_10 == NULL) {stream_10 = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token 10"); } 
515     stream_ID   = NULL;
516     #define CREATE_stream_ID  if (stream_ID == NULL) {stream_ID = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token ID"); } 
517     stream_type   = NULL;
518     #define CREATE_stream_type  if (stream_type == NULL) {stream_type = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule type"); }
519
520     retval.tree  = NULL;
521     {
522         // Lang.g:23:6: ( type ID ';' -> ^( DECL type ID ) )
523         // Lang.g:23:8: type ID ';'
524         {
525             FOLLOWPUSH(FOLLOW_type_in_decl103);
526             type2=type(ctx);
527
528             FOLLOWPOP();
529             if  (HASEXCEPTION())
530             {
531                 goto ruledeclEx;
532             }
533
534             CREATE_stream_type; stream_type->add(stream_type, type2.tree, NULL);
535             ID3 = (pANTLR3_COMMON_TOKEN) MATCHT(ID, &FOLLOW_ID_in_decl105); 
536             if  (HASEXCEPTION())
537             {
538                 goto ruledeclEx;
539             }
540              
541             CREATE_stream_ID; stream_ID->add(stream_ID, ID3, NULL);
542
543             char_literal4 = (pANTLR3_COMMON_TOKEN) MATCHT(10, &FOLLOW_10_in_decl107); 
544             if  (HASEXCEPTION())
545             {
546                 goto ruledeclEx;
547             }
548              
549             CREATE_stream_10; stream_10->add(stream_10, char_literal4, NULL);
550
551
552              
553             /* AST REWRITE
554              * elements          : ID, type
555              * token labels      : 
556              * rule labels       : retval
557              * token list labels : 
558              * rule list labels  : 
559              */
560             {
561                 pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
562
563                 stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR,  RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
564
565                 root_0                      = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
566                 retval.tree    = root_0;
567                 // 23:20: -> ^( DECL type ID )
568                 {
569                     // Lang.g:23:23: ^( DECL type ID )
570                     {
571                         pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
572                         root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, (pANTLR3_BASE_TREE)ADAPTOR->createTypeText(ADAPTOR, DECL, (pANTLR3_UINT8)"DECL"), root_1));
573
574                         ADAPTOR->addChild(ADAPTOR, root_1, stream_type == NULL ? NULL : stream_type->nextTree(stream_type));
575                         ADAPTOR->addChild(ADAPTOR, root_1, stream_ID == NULL ? NULL : stream_ID->nextNode(stream_ID));
576
577                         ADAPTOR->addChild(ADAPTOR, root_0, root_1);
578                     }
579
580                 }
581
582                 retval.tree = root_0; // set result root
583                 if (stream_retval != NULL) stream_retval->free(stream_retval);
584
585
586             }
587         }
588
589     }
590     
591
592     // This is where rules clean up and exit
593     //
594     goto ruledeclEx; /* Prevent compiler warnings */
595     ruledeclEx: ;
596     retval.stop = LT(-1);
597
598         retval.stop = LT(-1);
599         retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
600         ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
601         if (stream_10 != NULL) stream_10->free(stream_10);
602         if (stream_ID != NULL) stream_ID->free(stream_ID);
603         if (stream_type != NULL) stream_type->free(stream_type);
604
605             if (HASEXCEPTION())
606             {
607                 PREPORTERROR();
608                 PRECOVER();
609                 retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
610             }
611
612
613     return retval;
614 }
615 /* $ANTLR end decl */
616
617 /** 
618  * $ANTLR start type
619  * Lang.g:26:1: type : ( INTTYPE | FLOATTYPE );
620  */
621 static LangParser_type_return
622 type(pLangParser ctx)
623 {   
624     LangParser_type_return retval;
625
626     pANTLR3_BASE_TREE root_0;
627
628     pANTLR3_COMMON_TOKEN    set5;
629
630     pANTLR3_BASE_TREE set5_tree;
631
632     /* Initialize rule variables
633      */
634
635
636     root_0 = NULL;
637
638     set5       = NULL;
639     retval.start = LT(1); retval.stop = retval.start;
640
641     set5_tree   = NULL;
642
643
644     retval.tree  = NULL;
645     {
646         // Lang.g:26:6: ( INTTYPE | FLOATTYPE )
647         // Lang.g:
648         {
649             root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
650
651             set5=(pANTLR3_COMMON_TOKEN)LT(1);
652             if ( ((LA(1) >= INTTYPE) && (LA(1) <= FLOATTYPE)) )
653             {
654                 CONSUME();
655                 ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set5)));
656                 PERRORRECOVERY=ANTLR3_FALSE;
657             }
658             else 
659             {
660                 CONSTRUCTEX();
661                 EXCEPTION->type         = ANTLR3_MISMATCHED_SET_EXCEPTION;
662                 EXCEPTION->name         = (void *)ANTLR3_MISMATCHED_SET_NAME;
663                 EXCEPTION->expectingSet = &FOLLOW_set_in_type0;
664                 RECOVERFROMMISMATCHEDSET(&FOLLOW_set_in_type0);    goto ruletypeEx;
665             }
666
667
668         }
669
670     }
671     
672
673     // This is where rules clean up and exit
674     //
675     goto ruletypeEx; /* Prevent compiler warnings */
676     ruletypeEx: ;
677     retval.stop = LT(-1);
678
679         retval.stop = LT(-1);
680         retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
681         ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
682
683             if (HASEXCEPTION())
684             {
685                 PREPORTERROR();
686                 PRECOVER();
687                 retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
688             }
689
690
691     return retval;
692 }
693 /* $ANTLR end type */
694 /* End of parsing rules
695  * ==============================================
696  */
697
698 /* ==============================================
699  * Syntactic predicates
700  */
701 /* End of syntactic predicates
702  * ==============================================
703  */
704
705  
706  
707
708
709
710 /* End of code
711  * =============================================================================
712  */