]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/LangLexer.c
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.databoard / cpp / DataBoardTest / DataBoard / LangLexer.c
1 /** \file\r
2  *  This C source file was generated by $ANTLR version 3.2 Sep 23, 2009 12:02:23\r
3  *\r
4  *     -  From the grammar source file : Lang.g\r
5  *     -                            On : 2010-02-24 13:27:55\r
6  *     -                 for the lexer : LangLexerLexer *\r
7  * Editing it, at least manually, is not wise. \r
8  *\r
9  * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.\r
10  *\r
11  *\r
12 */\r
13 // [The "BSD licence"]\r
14 // Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC\r
15 // http://www.temporal-wave.com\r
16 // http://www.linkedin.com/in/jimidle\r
17 //\r
18 // All rights reserved.\r
19 //\r
20 // Redistribution and use in source and binary forms, with or without\r
21 // modification, are permitted provided that the following conditions\r
22 // are met:\r
23 // 1. Redistributions of source code must retain the above copyright\r
24 //    notice, this list of conditions and the following disclaimer.\r
25 // 2. Redistributions in binary form must reproduce the above copyright\r
26 //    notice, this list of conditions and the following disclaimer in the\r
27 //    documentation and/or other materials provided with the distribution.\r
28 // 3. The name of the author may not be used to endorse or promote products\r
29 //    derived from this software without specific prior written permission.\r
30 //\r
31 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\r
32 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\r
33 // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\r
34 // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\r
35 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r
36 // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
37 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
38 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
39 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\r
40 // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
41 \r
42 /* -----------------------------------------\r
43  * Include the ANTLR3 generated header file.\r
44  */\r
45 #include    "LangLexer.h"\r
46 /* ----------------------------------------- */\r
47 \r
48 \r
49 /** String literals used by LangLexer that we must do things like MATCHS() with.\r
50  *  C will normally just lay down 8 bit characters, and you can use L"xxx" to\r
51  *  get wchar_t, but wchar_t is 16 bits on Windows, which is not UTF32 and so\r
52  *  we perform this little trick of defining the literals as arrays of UINT32\r
53  *  and passing in the address of these.\r
54  */\r
55 static ANTLR3_UCHAR     lit_1[]  = { 0x69, 0x6E, 0x74,  ANTLR3_STRING_TERMINATOR};\r
56 static ANTLR3_UCHAR     lit_2[]  = { 0x66, 0x6C, 0x6F, 0x61, 0x74,  ANTLR3_STRING_TERMINATOR};\r
57 \r
58 \r
59 \r
60 \r
61 /* MACROS that hide the C interface implementations from the\r
62  * generated code, which makes it a little more understandable to the human eye.\r
63  * I am very much against using C pre-processor macros for function calls and bits\r
64  * of code as you cannot see what is happening when single stepping in debuggers\r
65  * and so on. The exception (in my book at least) is for generated code, where you are\r
66  * not maintaining it, but may wish to read and understand it. If you single step it, you know that input()\r
67  * hides some indirect calls, but is always referring to the input stream. This is\r
68  * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig\r
69  * the runtime interfaces without changing the generated code too often, without\r
70  * confusing the reader of the generated output, who may not wish to know the gory\r
71  * details of the interface inheritance.\r
72  */\r
73  \r
74 #define         CTX     ctx\r
75 \r
76 /* Aids in accessing scopes for grammar programmers\r
77  */\r
78 #undef  SCOPE_TYPE\r
79 #undef  SCOPE_STACK\r
80 #undef  SCOPE_TOP\r
81 #define SCOPE_TYPE(scope)   pLangLexer_##scope##_SCOPE\r
82 #define SCOPE_STACK(scope)  pLangLexer_##scope##Stack\r
83 #define SCOPE_TOP(scope)    ctx->pLangLexer_##scope##Top\r
84 #define SCOPE_SIZE(scope)               ctx->pLangLexer_##scope##Stack_limit\r
85 #define SCOPE_INSTANCE(scope, i)        (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i))\r
86 \r
87  \r
88 /* Macros for accessing things in a lexer\r
89  */\r
90 #undef      LEXER\r
91 #undef      RECOGNIZER              \r
92 #undef      RULEMEMO                \r
93 #undef      GETCHARINDEX\r
94 #undef      GETLINE\r
95 #undef      GETCHARPOSITIONINLINE\r
96 #undef      EMIT\r
97 #undef      EMITNEW\r
98 #undef      MATCHC\r
99 #undef      MATCHS\r
100 #undef      MATCHRANGE\r
101 #undef      LTOKEN\r
102 #undef      HASFAILED\r
103 #undef      FAILEDFLAG\r
104 #undef      INPUT\r
105 #undef      STRSTREAM\r
106 #undef      LA\r
107 #undef      HASEXCEPTION\r
108 #undef      EXCEPTION\r
109 #undef      CONSTRUCTEX\r
110 #undef      CONSUME\r
111 #undef      LRECOVER\r
112 #undef      MARK\r
113 #undef      REWIND\r
114 #undef      REWINDLAST\r
115 #undef      BACKTRACKING\r
116 #undef          MATCHANY\r
117 #undef          MEMOIZE\r
118 #undef          HAVEPARSEDRULE\r
119 #undef          GETTEXT\r
120 #undef          INDEX\r
121 #undef          SEEK\r
122 #undef          PUSHSTREAM\r
123 #undef          POPSTREAM\r
124 #undef          SETTEXT\r
125 #undef          SETTEXT8\r
126 \r
127 #define     LEXER                                       ctx->pLexer\r
128 #define     RECOGNIZER                      LEXER->rec\r
129 #define         LEXSTATE                                RECOGNIZER->state\r
130 #define         TOKSOURCE                               LEXSTATE->tokSource\r
131 #define     GETCHARINDEX()                      LEXER->getCharIndex(LEXER)\r
132 #define     GETLINE()                           LEXER->getLine(LEXER)\r
133 #define     GETTEXT()                           LEXER->getText(LEXER)\r
134 #define     GETCHARPOSITIONINLINE() LEXER->getCharPositionInLine(LEXER)\r
135 #define     EMIT()                                      LEXSTATE->type = _type; LEXER->emit(LEXER)\r
136 #define     EMITNEW(t)                          LEXER->emitNew(LEXER, t)\r
137 #define     MATCHC(c)                           LEXER->matchc(LEXER, c)\r
138 #define     MATCHS(s)                           LEXER->matchs(LEXER, s)\r
139 #define     MATCHRANGE(c1,c2)       LEXER->matchRange(LEXER, c1, c2)\r
140 #define     MATCHANY()                          LEXER->matchAny(LEXER)\r
141 #define     LTOKEN                              LEXSTATE->token\r
142 #define     HASFAILED()                         (LEXSTATE->failed == ANTLR3_TRUE)\r
143 #define     BACKTRACKING                        LEXSTATE->backtracking\r
144 #define     FAILEDFLAG                          LEXSTATE->failed\r
145 #define     INPUT                                       LEXER->input\r
146 #define     STRSTREAM                           INPUT\r
147 #define         ISTREAM                                 INPUT->istream\r
148 #define         INDEX()                                 ISTREAM->index(ISTREAM)\r
149 #define         SEEK(n)                                 ISTREAM->seek(ISTREAM, n)\r
150 #define     EOF_TOKEN                           &(LEXSTATE->tokSource->eofToken)\r
151 #define     HASEXCEPTION()                      (LEXSTATE->error == ANTLR3_TRUE)\r
152 #define     EXCEPTION                           LEXSTATE->exception\r
153 #define     CONSTRUCTEX()                       RECOGNIZER->exConstruct(RECOGNIZER)\r
154 #define     LRECOVER()                          LEXER->recover(LEXER)\r
155 #define     MARK()                                      ISTREAM->mark(ISTREAM)\r
156 #define     REWIND(m)                           ISTREAM->rewind(ISTREAM, m)\r
157 #define     REWINDLAST()                        ISTREAM->rewindLast(ISTREAM)\r
158 #define         MEMOIZE(ri,si)                  RECOGNIZER->memoize(RECOGNIZER, ri, si)\r
159 #define         HAVEPARSEDRULE(r)               RECOGNIZER->alreadyParsedRule(RECOGNIZER, r)\r
160 #define         PUSHSTREAM(str)                 LEXER->pushCharStream(LEXER, str)\r
161 #define         POPSTREAM()                             LEXER->popCharStream(LEXER)\r
162 #define         SETTEXT(str)                    LEXSTATE->text = str\r
163 #define         SKIP()                                  LEXSTATE->token = &(TOKSOURCE->skipToken)\r
164 #define         USER1                                   LEXSTATE->user1\r
165 #define         USER2                                   LEXSTATE->user2\r
166 #define         USER3                                   LEXSTATE->user3\r
167 #define         CUSTOM                                  LEXSTATE->custom\r
168 #define         RULEMEMO                                LEXSTATE->ruleMemo\r
169 #define         DBG                                             RECOGNIZER->debugger\r
170 \r
171 /* If we have been told we can rely on the standard 8 bit or 16 bit input\r
172  * stream, then we can define our macros to use the direct pointers\r
173  * in the input object, which is much faster than indirect calls. This\r
174  * is really only significant to lexers with a lot of fragment rules (which\r
175  * do not place LA(1) in a temporary at the moment) and even then\r
176  * only if there is a lot of input (order of say 1M or so).\r
177  */\r
178 #if     defined(ANTLR3_INLINE_INPUT_ASCII) || defined(ANTLR3_INLINE_INPUT_UTF16)\r
179 \r
180 # ifdef ANTLR3_INLINE_INPUT_ASCII\r
181 \r
182 /* 8 bit "ASCII" (actually any 8 bit character set) */\r
183 \r
184 #  define           NEXTCHAR                    ((pANTLR3_UINT8)(INPUT->nextChar))\r
185 #  define           DATAP                               ((pANTLR3_UINT8)(INPUT->data))\r
186 \r
187 # else\r
188 \r
189 #  define           NEXTCHAR                    ((pANTLR3_UINT16)(INPUT->nextChar)) \r
190 #  define           DATAP                               ((pANTLR3_UINT16)(INPUT->data))\r
191 \r
192 # endif\r
193 \r
194 # define            LA(n) ((NEXTCHAR + n) > (DATAP + INPUT->sizeBuf) ? ANTLR3_CHARSTREAM_EOF : (ANTLR3_UCHAR)(*(NEXTCHAR + n - 1)))\r
195 # define            CONSUME()                                                                                   \\r
196 {                                                                                                                                       \\r
197     if  (NEXTCHAR < (DATAP + INPUT->sizeBuf))                                           \\r
198     {                                                                                                                           \\r
199                 INPUT->charPositionInLine++;                                                            \\r
200                 if  ((ANTLR3_UCHAR)(*NEXTCHAR) == INPUT->newlineChar)           \\r
201                 {                                                                                                                       \\r
202                         INPUT->line++;                                                                                  \\r
203                         INPUT->charPositionInLine       = 0;                                            \\r
204                         INPUT->currentLine              = (void *)(NEXTCHAR + 1);               \\r
205                 }                                                                                                                       \\r
206                 INPUT->nextChar = (void *)(NEXTCHAR + 1);                                       \\r
207     }                                                                                                                           \\r
208 }\r
209 \r
210 #else\r
211 \r
212 // Pick up the input character by calling the input stream implementation.\r
213 //\r
214 #define     CONSUME()                           INPUT->istream->consume(INPUT->istream)\r
215 #define     LA(n)                                       INPUT->istream->_LA(INPUT->istream, n)\r
216 \r
217 #endif\r
218 #define         TOKTEXT(tok, txt)                               tok, (pANTLR3_UINT8)txt\r
219 \r
220 /* The 4 tokens defined below may well clash with your own #defines or token types. If so\r
221  * then for the present you must use different names for your defines as these are hard coded\r
222  * in the code generator. It would be better not to use such names internally, and maybe\r
223  * we can change this in a forthcoming release. I deliberately do not #undef these\r
224  * here as this will at least give you a redefined error somewhere if they clash.\r
225  */\r
226 #define     UP      ANTLR3_TOKEN_UP\r
227 #define     DOWN    ANTLR3_TOKEN_DOWN\r
228 #define     EOR     ANTLR3_TOKEN_EOR\r
229 #define     INVALID ANTLR3_TOKEN_INVALID\r
230 \r
231 \r
232 /* =============================================================================\r
233  * Functions to create and destroy scopes. First come the rule scopes, followed\r
234  * by the global declared scopes.\r
235  */\r
236 \r
237 \r
238 \r
239 /* ============================================================================= */\r
240 \r
241 /* =============================================================================\r
242  * Start of recognizer\r
243  */\r
244 \r
245 \r
246 /* Forward declare the locally static matching functions we have generated and any predicate functions.\r
247  */\r
248 static ANTLR3_INLINE  void      mT__10    (pLangLexer ctx);\r
249 static ANTLR3_INLINE  void      mINTTYPE    (pLangLexer ctx);\r
250 static ANTLR3_INLINE  void      mFLOATTYPE    (pLangLexer ctx);\r
251 static ANTLR3_INLINE  void      mID    (pLangLexer ctx);\r
252 static ANTLR3_INLINE  void      mINT    (pLangLexer ctx);\r
253 static ANTLR3_INLINE  void      mWS    (pLangLexer ctx);\r
254 static ANTLR3_INLINE  void      mTokens    (pLangLexer ctx);\r
255 static void     LangLexerFree(pLangLexer ctx);\r
256 \r
257 /* =========================================================================\r
258  * Lexer matching rules end.\r
259  * =========================================================================\r
260  */\r
261 \r
262 \r
263 \r
264 static void\r
265 LangLexerFree  (pLangLexer ctx)\r
266 {\r
267     LEXER->free(LEXER);\r
268     \r
269     ANTLR3_FREE(ctx);\r
270 }\r
271 \r
272 /** \brief Name of the grammar file that generated this code\r
273  */\r
274 static const char fileName[] = "Lang.g";\r
275 \r
276 /** \brief Return the name of the grammar file that generated this code.\r
277  */\r
278 static const char * getGrammarFileName()\r
279 {\r
280         return fileName;\r
281 }\r
282 \r
283 /** \brief Create a new lexer called LangLexer\r
284  *\r
285  * \param[in]    instream Pointer to an initialized input stream\r
286  * \return \r
287  *     - Success pLangLexer initialized for the lex start\r
288  *     - Fail NULL\r
289  */\r
290 ANTLR3_API pLangLexer LangLexerNew         \r
291 (pANTLR3_INPUT_STREAM instream)\r
292 {\r
293         // See if we can create a new lexer with the standard constructor\r
294         //\r
295         return LangLexerNewSSD(instream, NULL);\r
296 }\r
297 \r
298 /** \brief Create a new lexer called LangLexer\r
299  *\r
300  * \param[in]    instream Pointer to an initialized input stream\r
301  * \param[state] state Previously created shared recognizer stat\r
302  * \return \r
303  *     - Success pLangLexer initialized for the lex start\r
304  *     - Fail NULL\r
305  */\r
306 ANTLR3_API pLangLexer LangLexerNewSSD         \r
307 (pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)\r
308 {\r
309     pLangLexer ctx; // Context structure we will build and return\r
310 \r
311     ctx = (pLangLexer) ANTLR3_CALLOC(1, sizeof(LangLexer));\r
312 \r
313     if  (ctx == NULL)\r
314     {\r
315         // Failed to allocate memory for lexer context\r
316         return  NULL;\r
317     }\r
318 \r
319     /* -------------------------------------------------------------------\r
320      * Memory for basic structure is allocated, now to fill in\r
321      * in base ANTLR3 structures. We initialize the function pointers\r
322      * for the standard ANTLR3 lexer function set, but upon return\r
323      * from here, the programmer may set the pointers to provide custom\r
324      * implementations of each function. \r
325      *\r
326      * We don't use the macros defined in LangLexer.h here so you can get a sense\r
327      * of what goes where.\r
328      */\r
329     \r
330     /* Create a base lexer, using the supplied input stream\r
331      */\r
332     ctx->pLexer = antlr3LexerNewStream(ANTLR3_SIZE_HINT, instream, state);\r
333     \r
334     /* Check that we allocated the memory correctly\r
335      */\r
336     if  (ctx->pLexer == NULL)\r
337     {\r
338                 ANTLR3_FREE(ctx);\r
339                 return  NULL;\r
340     }\r
341     /* Install the implementation of our LangLexer interface\r
342      */\r
343     ctx->mT__10 = mT__10;\r
344     ctx->mINTTYPE       = mINTTYPE;\r
345     ctx->mFLOATTYPE     = mFLOATTYPE;\r
346     ctx->mID    = mID;\r
347     ctx->mINT   = mINT;\r
348     ctx->mWS    = mWS;\r
349     ctx->mTokens        = mTokens;\r
350     \r
351     /** When the nextToken() call is made to this lexer's pANTLR3_TOKEN_SOURCE\r
352      *  it will call mTokens() in this generated code, and will pass it the ctx\r
353      * pointer of this lexer, not the context of the base lexer, so store that now.\r
354      */\r
355     ctx->pLexer->ctx        = ctx;\r
356     \r
357     /**Install the token matching function\r
358      */\r
359     ctx->pLexer->mTokens = (void (*) (void *))(mTokens);\r
360     \r
361     ctx->getGrammarFileName     = getGrammarFileName;\r
362     ctx->free           = LangLexerFree;\r
363 \r
364     \r
365     \r
366 \r
367 \r
368     /* Return the newly built lexer to the caller\r
369      */\r
370     return  ctx;\r
371 }\r
372  \r
373 \r
374 /* =========================================================================\r
375  * Functions to match the lexer grammar defined tokens from the input stream\r
376  */\r
377 \r
378 //   Comes from: 7:7: ( ';' )\r
379 /** \brief Lexer rule generated by ANTLR3\r
380  *\r
381  * $ANTLR start T__10\r
382  *\r
383  * Looks to match the characters the constitute the token T__10\r
384  * from the attached input stream.\r
385  *\r
386  *\r
387  * \remark\r
388  *  - lexer->error == ANTLR3_TRUE if an exception was thrown.\r
389  */\r
390 static ANTLR3_INLINE\r
391 void mT__10(pLangLexer ctx)\r
392 {\r
393         ANTLR3_UINT32   _type;\r
394 \r
395     _type           = T__10;\r
396        \r
397     \r
398     // Lang.g:7:7: ( ';' )\r
399     // Lang.g:7:9: ';'\r
400     {\r
401         MATCHC(';'); \r
402         if  (HASEXCEPTION())\r
403         {\r
404             goto ruleT__10Ex;\r
405         }\r
406 \r
407 \r
408     }\r
409 \r
410         LEXSTATE->type = _type;\r
411 \r
412     // This is where rules clean up and exit\r
413     //\r
414     goto ruleT__10Ex; /* Prevent compiler warnings */\r
415     ruleT__10Ex: ;\r
416 \r
417 }\r
418 // $ANTLR end T__10\r
419 \r
420 //   Comes from: 30:13: ( 'int' )\r
421 /** \brief Lexer rule generated by ANTLR3\r
422  *\r
423  * $ANTLR start INTTYPE\r
424  *\r
425  * Looks to match the characters the constitute the token INTTYPE\r
426  * from the attached input stream.\r
427  *\r
428  *\r
429  * \remark\r
430  *  - lexer->error == ANTLR3_TRUE if an exception was thrown.\r
431  */\r
432 static ANTLR3_INLINE\r
433 void mINTTYPE(pLangLexer ctx)\r
434 {\r
435         ANTLR3_UINT32   _type;\r
436 \r
437     _type           = INTTYPE;\r
438        \r
439     \r
440     // Lang.g:30:13: ( 'int' )\r
441     // Lang.g:30:15: 'int'\r
442     {\r
443         MATCHS(lit_1); \r
444         if  (HASEXCEPTION())\r
445         {\r
446             goto ruleINTTYPEEx;\r
447         }\r
448 \r
449 \r
450 \r
451     }\r
452 \r
453         LEXSTATE->type = _type;\r
454 \r
455     // This is where rules clean up and exit\r
456     //\r
457     goto ruleINTTYPEEx; /* Prevent compiler warnings */\r
458     ruleINTTYPEEx: ;\r
459 \r
460 }\r
461 // $ANTLR end INTTYPE\r
462 \r
463 //   Comes from: 31:13: ( 'float' )\r
464 /** \brief Lexer rule generated by ANTLR3\r
465  *\r
466  * $ANTLR start FLOATTYPE\r
467  *\r
468  * Looks to match the characters the constitute the token FLOATTYPE\r
469  * from the attached input stream.\r
470  *\r
471  *\r
472  * \remark\r
473  *  - lexer->error == ANTLR3_TRUE if an exception was thrown.\r
474  */\r
475 static ANTLR3_INLINE\r
476 void mFLOATTYPE(pLangLexer ctx)\r
477 {\r
478         ANTLR3_UINT32   _type;\r
479 \r
480     _type           = FLOATTYPE;\r
481        \r
482     \r
483     // Lang.g:31:13: ( 'float' )\r
484     // Lang.g:31:15: 'float'\r
485     {\r
486         MATCHS(lit_2); \r
487         if  (HASEXCEPTION())\r
488         {\r
489             goto ruleFLOATTYPEEx;\r
490         }\r
491 \r
492 \r
493 \r
494     }\r
495 \r
496         LEXSTATE->type = _type;\r
497 \r
498     // This is where rules clean up and exit\r
499     //\r
500     goto ruleFLOATTYPEEx; /* Prevent compiler warnings */\r
501     ruleFLOATTYPEEx: ;\r
502 \r
503 }\r
504 // $ANTLR end FLOATTYPE\r
505 \r
506 //   Comes from: 32:8: ( ( 'a' .. 'z' )+ )\r
507 /** \brief Lexer rule generated by ANTLR3\r
508  *\r
509  * $ANTLR start ID\r
510  *\r
511  * Looks to match the characters the constitute the token ID\r
512  * from the attached input stream.\r
513  *\r
514  *\r
515  * \remark\r
516  *  - lexer->error == ANTLR3_TRUE if an exception was thrown.\r
517  */\r
518 static ANTLR3_INLINE\r
519 void mID(pLangLexer ctx)\r
520 {\r
521         ANTLR3_UINT32   _type;\r
522 \r
523     _type           = ID;\r
524        \r
525     \r
526     // Lang.g:32:8: ( ( 'a' .. 'z' )+ )\r
527     // Lang.g:32:10: ( 'a' .. 'z' )+\r
528     {\r
529         // Lang.g:32:10: ( 'a' .. 'z' )+\r
530         {\r
531             int cnt1=0;\r
532 \r
533             for (;;)\r
534             {\r
535                 int alt1=2;\r
536                 switch ( LA(1) ) \r
537                 {\r
538                 case 'a':\r
539                 case 'b':\r
540                 case 'c':\r
541                 case 'd':\r
542                 case 'e':\r
543                 case 'f':\r
544                 case 'g':\r
545                 case 'h':\r
546                 case 'i':\r
547                 case 'j':\r
548                 case 'k':\r
549                 case 'l':\r
550                 case 'm':\r
551                 case 'n':\r
552                 case 'o':\r
553                 case 'p':\r
554                 case 'q':\r
555                 case 'r':\r
556                 case 's':\r
557                 case 't':\r
558                 case 'u':\r
559                 case 'v':\r
560                 case 'w':\r
561                 case 'x':\r
562                 case 'y':\r
563                 case 'z':\r
564                         {\r
565                                 alt1=1;\r
566                         }\r
567                     break;\r
568 \r
569                 }\r
570 \r
571                 switch (alt1) \r
572                 {\r
573                     case 1:\r
574                         // Lang.g:32:10: 'a' .. 'z'\r
575                         {\r
576                             MATCHRANGE('a', 'z'); \r
577                             if  (HASEXCEPTION())\r
578                             {\r
579                                 goto ruleIDEx;\r
580                             }\r
581 \r
582 \r
583                         }\r
584                         break;\r
585 \r
586                     default:\r
587                     \r
588                         if ( cnt1 >= 1 )\r
589                         {\r
590                             goto loop1;\r
591                         }\r
592                         /* mismatchedSetEx()\r
593                          */\r
594                         CONSTRUCTEX();\r
595                         EXCEPTION->type = ANTLR3_EARLY_EXIT_EXCEPTION;\r
596                         EXCEPTION->name = (void *)ANTLR3_EARLY_EXIT_NAME;\r
597 \r
598 \r
599                         goto ruleIDEx;\r
600                 }\r
601                 cnt1++;\r
602             }\r
603             loop1: ;    /* Jump to here if this rule does not match */\r
604         }\r
605 \r
606     }\r
607 \r
608         LEXSTATE->type = _type;\r
609 \r
610     // This is where rules clean up and exit\r
611     //\r
612     goto ruleIDEx; /* Prevent compiler warnings */\r
613     ruleIDEx: ;\r
614 \r
615 }\r
616 // $ANTLR end ID\r
617 \r
618 //   Comes from: 33:9: ( ( '0' .. '9' )+ )\r
619 /** \brief Lexer rule generated by ANTLR3\r
620  *\r
621  * $ANTLR start INT\r
622  *\r
623  * Looks to match the characters the constitute the token INT\r
624  * from the attached input stream.\r
625  *\r
626  *\r
627  * \remark\r
628  *  - lexer->error == ANTLR3_TRUE if an exception was thrown.\r
629  */\r
630 static ANTLR3_INLINE\r
631 void mINT(pLangLexer ctx)\r
632 {\r
633         ANTLR3_UINT32   _type;\r
634 \r
635     _type           = INT;\r
636        \r
637     \r
638     // Lang.g:33:9: ( ( '0' .. '9' )+ )\r
639     // Lang.g:33:11: ( '0' .. '9' )+\r
640     {\r
641         // Lang.g:33:11: ( '0' .. '9' )+\r
642         {\r
643             int cnt2=0;\r
644 \r
645             for (;;)\r
646             {\r
647                 int alt2=2;\r
648                 switch ( LA(1) ) \r
649                 {\r
650                 case '0':\r
651                 case '1':\r
652                 case '2':\r
653                 case '3':\r
654                 case '4':\r
655                 case '5':\r
656                 case '6':\r
657                 case '7':\r
658                 case '8':\r
659                 case '9':\r
660                         {\r
661                                 alt2=1;\r
662                         }\r
663                     break;\r
664 \r
665                 }\r
666 \r
667                 switch (alt2) \r
668                 {\r
669                     case 1:\r
670                         // Lang.g:33:11: '0' .. '9'\r
671                         {\r
672                             MATCHRANGE('0', '9'); \r
673                             if  (HASEXCEPTION())\r
674                             {\r
675                                 goto ruleINTEx;\r
676                             }\r
677 \r
678 \r
679                         }\r
680                         break;\r
681 \r
682                     default:\r
683                     \r
684                         if ( cnt2 >= 1 )\r
685                         {\r
686                             goto loop2;\r
687                         }\r
688                         /* mismatchedSetEx()\r
689                          */\r
690                         CONSTRUCTEX();\r
691                         EXCEPTION->type = ANTLR3_EARLY_EXIT_EXCEPTION;\r
692                         EXCEPTION->name = (void *)ANTLR3_EARLY_EXIT_NAME;\r
693 \r
694 \r
695                         goto ruleINTEx;\r
696                 }\r
697                 cnt2++;\r
698             }\r
699             loop2: ;    /* Jump to here if this rule does not match */\r
700         }\r
701 \r
702     }\r
703 \r
704         LEXSTATE->type = _type;\r
705 \r
706     // This is where rules clean up and exit\r
707     //\r
708     goto ruleINTEx; /* Prevent compiler warnings */\r
709     ruleINTEx: ;\r
710 \r
711 }\r
712 // $ANTLR end INT\r
713 \r
714 //   Comes from: 34:8: ( ( ' ' | '\\n' | '\\r' ) )\r
715 /** \brief Lexer rule generated by ANTLR3\r
716  *\r
717  * $ANTLR start WS\r
718  *\r
719  * Looks to match the characters the constitute the token WS\r
720  * from the attached input stream.\r
721  *\r
722  *\r
723  * \remark\r
724  *  - lexer->error == ANTLR3_TRUE if an exception was thrown.\r
725  */\r
726 static ANTLR3_INLINE\r
727 void mWS(pLangLexer ctx)\r
728 {\r
729         ANTLR3_UINT32   _type;\r
730 \r
731     _type           = WS;\r
732        \r
733     \r
734     // Lang.g:34:8: ( ( ' ' | '\\n' | '\\r' ) )\r
735     // Lang.g:34:10: ( ' ' | '\\n' | '\\r' )\r
736     {\r
737         if ( LA(1) == '\n' || LA(1) == '\r' || LA(1) == ' ' )\r
738         {\r
739             CONSUME();\r
740 \r
741         }\r
742         else \r
743         {\r
744             CONSTRUCTEX();\r
745             EXCEPTION->type         = ANTLR3_MISMATCHED_SET_EXCEPTION;\r
746             EXCEPTION->name         = (void *)ANTLR3_MISMATCHED_SET_NAME;\r
747 \r
748             LRECOVER();    goto ruleWSEx;\r
749         }\r
750 \r
751         {\r
752             LEXSTATE->channel=HIDDEN;\r
753         }\r
754 \r
755     }\r
756 \r
757         LEXSTATE->type = _type;\r
758 \r
759     // This is where rules clean up and exit\r
760     //\r
761     goto ruleWSEx; /* Prevent compiler warnings */\r
762     ruleWSEx: ;\r
763 \r
764 }\r
765 // $ANTLR end WS\r
766 \r
767 /** This is the entry point in to the lexer from an object that\r
768  *  wants to generate the next token, such as a pCOMMON_TOKEN_STREAM\r
769  */\r
770 static void \r
771 mTokens(pLangLexer ctx)\r
772 {\r
773     {\r
774         //  Lang.g:1:8: ( T__10 | INTTYPE | FLOATTYPE | ID | INT | WS )\r
775         \r
776         ANTLR3_UINT32 alt3;\r
777 \r
778         alt3=6;\r
779 \r
780         switch ( LA(1) ) \r
781         {\r
782         case ';':\r
783                 {\r
784                         alt3=1;\r
785                 }\r
786             break;\r
787         case 'i':\r
788                 {\r
789                         switch ( LA(2) ) \r
790                         {\r
791                         case 'n':\r
792                                 {\r
793                                         switch ( LA(3) ) \r
794                                         {\r
795                                         case 't':\r
796                                                 {\r
797                                                         switch ( LA(4) ) \r
798                                                         {\r
799                                                         case 'a':\r
800                                                         case 'b':\r
801                                                         case 'c':\r
802                                                         case 'd':\r
803                                                         case 'e':\r
804                                                         case 'f':\r
805                                                         case 'g':\r
806                                                         case 'h':\r
807                                                         case 'i':\r
808                                                         case 'j':\r
809                                                         case 'k':\r
810                                                         case 'l':\r
811                                                         case 'm':\r
812                                                         case 'n':\r
813                                                         case 'o':\r
814                                                         case 'p':\r
815                                                         case 'q':\r
816                                                         case 'r':\r
817                                                         case 's':\r
818                                                         case 't':\r
819                                                         case 'u':\r
820                                                         case 'v':\r
821                                                         case 'w':\r
822                                                         case 'x':\r
823                                                         case 'y':\r
824                                                         case 'z':\r
825                                                                 {\r
826                                                                         alt3=4;\r
827                                                                 }\r
828                                                             break;\r
829 \r
830                                                         default:\r
831                                                             alt3=2;}\r
832 \r
833                                                 }\r
834                                             break;\r
835 \r
836                                         default:\r
837                                             alt3=4;}\r
838 \r
839                                 }\r
840                             break;\r
841 \r
842                         default:\r
843                             alt3=4;}\r
844 \r
845                 }\r
846             break;\r
847         case 'f':\r
848                 {\r
849                         switch ( LA(2) ) \r
850                         {\r
851                         case 'l':\r
852                                 {\r
853                                         switch ( LA(3) ) \r
854                                         {\r
855                                         case 'o':\r
856                                                 {\r
857                                                         switch ( LA(4) ) \r
858                                                         {\r
859                                                         case 'a':\r
860                                                                 {\r
861                                                                         switch ( LA(5) ) \r
862                                                                         {\r
863                                                                         case 't':\r
864                                                                                 {\r
865                                                                                         switch ( LA(6) ) \r
866                                                                                         {\r
867                                                                                         case 'a':\r
868                                                                                         case 'b':\r
869                                                                                         case 'c':\r
870                                                                                         case 'd':\r
871                                                                                         case 'e':\r
872                                                                                         case 'f':\r
873                                                                                         case 'g':\r
874                                                                                         case 'h':\r
875                                                                                         case 'i':\r
876                                                                                         case 'j':\r
877                                                                                         case 'k':\r
878                                                                                         case 'l':\r
879                                                                                         case 'm':\r
880                                                                                         case 'n':\r
881                                                                                         case 'o':\r
882                                                                                         case 'p':\r
883                                                                                         case 'q':\r
884                                                                                         case 'r':\r
885                                                                                         case 's':\r
886                                                                                         case 't':\r
887                                                                                         case 'u':\r
888                                                                                         case 'v':\r
889                                                                                         case 'w':\r
890                                                                                         case 'x':\r
891                                                                                         case 'y':\r
892                                                                                         case 'z':\r
893                                                                                                 {\r
894                                                                                                         alt3=4;\r
895                                                                                                 }\r
896                                                                                             break;\r
897 \r
898                                                                                         default:\r
899                                                                                             alt3=3;}\r
900 \r
901                                                                                 }\r
902                                                                             break;\r
903 \r
904                                                                         default:\r
905                                                                             alt3=4;}\r
906 \r
907                                                                 }\r
908                                                             break;\r
909 \r
910                                                         default:\r
911                                                             alt3=4;}\r
912 \r
913                                                 }\r
914                                             break;\r
915 \r
916                                         default:\r
917                                             alt3=4;}\r
918 \r
919                                 }\r
920                             break;\r
921 \r
922                         default:\r
923                             alt3=4;}\r
924 \r
925                 }\r
926             break;\r
927         case 'a':\r
928         case 'b':\r
929         case 'c':\r
930         case 'd':\r
931         case 'e':\r
932         case 'g':\r
933         case 'h':\r
934         case 'j':\r
935         case 'k':\r
936         case 'l':\r
937         case 'm':\r
938         case 'n':\r
939         case 'o':\r
940         case 'p':\r
941         case 'q':\r
942         case 'r':\r
943         case 's':\r
944         case 't':\r
945         case 'u':\r
946         case 'v':\r
947         case 'w':\r
948         case 'x':\r
949         case 'y':\r
950         case 'z':\r
951                 {\r
952                         alt3=4;\r
953                 }\r
954             break;\r
955         case '0':\r
956         case '1':\r
957         case '2':\r
958         case '3':\r
959         case '4':\r
960         case '5':\r
961         case '6':\r
962         case '7':\r
963         case '8':\r
964         case '9':\r
965                 {\r
966                         alt3=5;\r
967                 }\r
968             break;\r
969         case '\n':\r
970         case '\r':\r
971         case ' ':\r
972                 {\r
973                         alt3=6;\r
974                 }\r
975             break;\r
976 \r
977         default:\r
978             CONSTRUCTEX();\r
979             EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;\r
980             EXCEPTION->message      = (void *)"";\r
981             EXCEPTION->decisionNum  = 3;\r
982             EXCEPTION->state        = 0;\r
983 \r
984 \r
985             goto ruleTokensEx;\r
986         }\r
987 \r
988         switch (alt3) \r
989         {\r
990         case 1:\r
991             // Lang.g:1:10: T__10\r
992             {\r
993                 /* 1:10: T__10 */\r
994                 mT__10(ctx ); \r
995                 if  (HASEXCEPTION())\r
996                 {\r
997                     goto ruleTokensEx;\r
998                 }\r
999 \r
1000 \r
1001             }\r
1002             break;\r
1003         case 2:\r
1004             // Lang.g:1:16: INTTYPE\r
1005             {\r
1006                 /* 1:16: INTTYPE */\r
1007                 mINTTYPE(ctx ); \r
1008                 if  (HASEXCEPTION())\r
1009                 {\r
1010                     goto ruleTokensEx;\r
1011                 }\r
1012 \r
1013 \r
1014             }\r
1015             break;\r
1016         case 3:\r
1017             // Lang.g:1:24: FLOATTYPE\r
1018             {\r
1019                 /* 1:24: FLOATTYPE */\r
1020                 mFLOATTYPE(ctx ); \r
1021                 if  (HASEXCEPTION())\r
1022                 {\r
1023                     goto ruleTokensEx;\r
1024                 }\r
1025 \r
1026 \r
1027             }\r
1028             break;\r
1029         case 4:\r
1030             // Lang.g:1:34: ID\r
1031             {\r
1032                 /* 1:34: ID */\r
1033                 mID(ctx ); \r
1034                 if  (HASEXCEPTION())\r
1035                 {\r
1036                     goto ruleTokensEx;\r
1037                 }\r
1038 \r
1039 \r
1040             }\r
1041             break;\r
1042         case 5:\r
1043             // Lang.g:1:37: INT\r
1044             {\r
1045                 /* 1:37: INT */\r
1046                 mINT(ctx ); \r
1047                 if  (HASEXCEPTION())\r
1048                 {\r
1049                     goto ruleTokensEx;\r
1050                 }\r
1051 \r
1052 \r
1053             }\r
1054             break;\r
1055         case 6:\r
1056             // Lang.g:1:41: WS\r
1057             {\r
1058                 /* 1:41: WS */\r
1059                 mWS(ctx ); \r
1060                 if  (HASEXCEPTION())\r
1061                 {\r
1062                     goto ruleTokensEx;\r
1063                 }\r
1064 \r
1065 \r
1066             }\r
1067             break;\r
1068 \r
1069         }\r
1070     }\r
1071 \r
1072     \r
1073     goto ruleTokensEx; /* Prevent compiler warnings */\r
1074 ruleTokensEx: ;\r
1075 }\r
1076 \r
1077 /* =========================================================================\r
1078  * Lexer matching rules end.\r
1079  * =========================================================================\r
1080  */\r
1081 /* End of Lexer code\r
1082  * ================================================\r
1083  * ================================================\r
1084  */ \r
1085 \r
1086 \r
1087 /* End of code\r
1088  * =============================================================================\r
1089  */\r