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