2 * This C header file was generated by $ANTLR version 3.2 Sep 23, 2009 12:02:23
\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
9 * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
\r
12 * The lexer LangLexer has the callable functions (rules) shown below,
\r
13 * which will invoke the code for the associated rule in the source grammar
\r
14 * assuming that the input stream is pointing to a token/text stream that could begin
\r
17 * For instance if you call the first (topmost) rule in a parser grammar, you will
\r
18 * get the results of a full parse, but calling a rule half way through the grammar will
\r
19 * allow you to pass part of a full token stream to the parser, such as for syntax checking
\r
20 * in editors and so on.
\r
22 * The parser entry points are called indirectly (by function pointer to function) via
\r
23 * a parser context typedef pLangLexer, which is returned from a call to LangLexerNew().
\r
25 * As this is a generated lexer, it is unlikely you will call it 'manually'. However
\r
26 * the methods are provided anyway.
\r
27 * * The methods in pLangLexer are as follows:
\r
29 * - void pLangLexer->T__10(pLangLexer)
\r
30 * - void pLangLexer->INTTYPE(pLangLexer)
\r
31 * - void pLangLexer->FLOATTYPE(pLangLexer)
\r
32 * - void pLangLexer->ID(pLangLexer)
\r
33 * - void pLangLexer->INT(pLangLexer)
\r
34 * - void pLangLexer->WS(pLangLexer)
\r
35 * - void pLangLexer->Tokens(pLangLexer)
\r
37 * The return type for any particular rule is of course determined by the source
\r
40 // [The "BSD licence"]
\r
41 // Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
\r
42 // http://www.temporal-wave.com
\r
43 // http://www.linkedin.com/in/jimidle
\r
45 // All rights reserved.
\r
47 // Redistribution and use in source and binary forms, with or without
\r
48 // modification, are permitted provided that the following conditions
\r
50 // 1. Redistributions of source code must retain the above copyright
\r
51 // notice, this list of conditions and the following disclaimer.
\r
52 // 2. Redistributions in binary form must reproduce the above copyright
\r
53 // notice, this list of conditions and the following disclaimer in the
\r
54 // documentation and/or other materials provided with the distribution.
\r
55 // 3. The name of the author may not be used to endorse or promote products
\r
56 // derived from this software without specific prior written permission.
\r
58 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
\r
59 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
\r
60 // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
\r
61 // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
\r
62 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
\r
63 // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
\r
64 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
\r
65 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
\r
66 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
\r
67 // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
69 #ifndef _LangLexer_H
\r
70 #define _LangLexer_H
\r
71 /* =============================================================================
\r
72 * Standard antlr3 C runtime definitions
\r
76 /* End of standard antlr 3 runtime definitions
\r
77 * =============================================================================
\r
84 // Forward declare the context typedef so that we can use it before it is
\r
85 // properly defined. Delegators and delegates (from import statements) are
\r
86 // interdependent and their context structures contain pointers to each other
\r
87 // C only allows such things to be declared if you pre-declare the typedef.
\r
89 typedef struct LangLexer_Ctx_struct LangLexer, * pLangLexer;
\r
93 #ifdef ANTLR3_WINDOWS
\r
94 // Disable: Unreferenced parameter, - Rules with parameters that are not used
\r
95 // constant conditional, - ANTLR realizes that a prediction is always true (synpred usually)
\r
96 // initialized but unused variable - tree rewrite variables declared but not needed
\r
97 // Unreferenced local variable - lexer rule declares but does not always use _type
\r
98 // potentially unitialized variable used - retval always returned from a rule
\r
99 // unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns
\r
101 // These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
\r
102 // and the codegen must generate some of these warnings by necessity, apart from 4100, which is
\r
103 // usually generated when a parser rule is given a parameter that it does not use. Mostly though
\r
104 // this is a matter of orthogonality hence I disable that one.
\r
106 #pragma warning( disable : 4100 )
\r
107 #pragma warning( disable : 4101 )
\r
108 #pragma warning( disable : 4127 )
\r
109 #pragma warning( disable : 4189 )
\r
110 #pragma warning( disable : 4505 )
\r
111 #pragma warning( disable : 4701 )
\r
114 /** Context tracking structure for LangLexer
\r
116 struct LangLexer_Ctx_struct
\r
118 /** Built in ANTLR3 context tracker contains all the generic elements
\r
119 * required for context tracking.
\r
121 pANTLR3_LEXER pLexer;
\r
124 void (*mT__10) (struct LangLexer_Ctx_struct * ctx);
\r
125 void (*mINTTYPE) (struct LangLexer_Ctx_struct * ctx);
\r
126 void (*mFLOATTYPE) (struct LangLexer_Ctx_struct * ctx);
\r
127 void (*mID) (struct LangLexer_Ctx_struct * ctx);
\r
128 void (*mINT) (struct LangLexer_Ctx_struct * ctx);
\r
129 void (*mWS) (struct LangLexer_Ctx_struct * ctx);
\r
130 void (*mTokens) (struct LangLexer_Ctx_struct * ctx); const char * (*getGrammarFileName)();
\r
131 void (*free) (struct LangLexer_Ctx_struct * ctx);
\r
135 // Function protoypes for the constructor functions that external translation units
\r
136 // such as delegators and delegates may wish to call.
\r
138 ANTLR3_API pLangLexer LangLexerNew (pANTLR3_INPUT_STREAM instream);
\r
139 ANTLR3_API pLangLexer LangLexerNewSSD (pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
\r
141 /** Symbolic definitions of all the tokens that the lexer will work with.
\r
144 * Antlr will define EOF, but we can't use that as it it is too common in
\r
145 * in C header files and that would be confusing. There is no way to filter this out at the moment
\r
146 * so we just undef it here for now. That isn't the value we get back from C recognizers
\r
147 * anyway. We are looking for ANTLR3_TOKEN_EOF.
\r
156 #define FLOATTYPE 7
\r
165 #define EOF ANTLR3_TOKEN_EOF
\r
168 #ifndef TOKENSOURCE
\r
169 #define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
\r
172 /* End of token definitions for LangLexer
\r
173 * =============================================================================
\r
183 /* END - Note:Keep extra line feed to satisfy UNIX systems */
\r