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:52
\r
6 * - for the parser : LangParserParser *
\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 parser LangParser 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 pLangParser, which is returned from a call to LangParserNew().
\r
25 * The methods in pLangParser are as follows:
\r
27 * - LangParser_start_return pLangParser->start(pLangParser)
\r
28 * - LangParser_decl_return pLangParser->decl(pLangParser)
\r
29 * - LangParser_type_return pLangParser->type(pLangParser)
\r
31 * The return type for any particular rule is of course determined by the source
\r
34 // [The "BSD licence"]
\r
35 // Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
\r
36 // http://www.temporal-wave.com
\r
37 // http://www.linkedin.com/in/jimidle
\r
39 // All rights reserved.
\r
41 // Redistribution and use in source and binary forms, with or without
\r
42 // modification, are permitted provided that the following conditions
\r
44 // 1. Redistributions of source code must retain the above copyright
\r
45 // notice, this list of conditions and the following disclaimer.
\r
46 // 2. Redistributions in binary form must reproduce the above copyright
\r
47 // notice, this list of conditions and the following disclaimer in the
\r
48 // documentation and/or other materials provided with the distribution.
\r
49 // 3. The name of the author may not be used to endorse or promote products
\r
50 // derived from this software without specific prior written permission.
\r
52 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
\r
53 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
\r
54 // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
\r
55 // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
\r
56 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
\r
57 // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
\r
58 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
\r
59 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
\r
60 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
\r
61 // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
63 #ifndef _LangParser_H
\r
64 #define _LangParser_H
\r
65 /* =============================================================================
\r
66 * Standard antlr3 C runtime definitions
\r
70 /* End of standard antlr 3 runtime definitions
\r
71 * =============================================================================
\r
78 // Forward declare the context typedef so that we can use it before it is
\r
79 // properly defined. Delegators and delegates (from import statements) are
\r
80 // interdependent and their context structures contain pointers to each other
\r
81 // C only allows such things to be declared if you pre-declare the typedef.
\r
83 typedef struct LangParser_Ctx_struct LangParser, * pLangParser;
\r
87 #ifdef ANTLR3_WINDOWS
\r
88 // Disable: Unreferenced parameter, - Rules with parameters that are not used
\r
89 // constant conditional, - ANTLR realizes that a prediction is always true (synpred usually)
\r
90 // initialized but unused variable - tree rewrite variables declared but not needed
\r
91 // Unreferenced local variable - lexer rule declares but does not always use _type
\r
92 // potentially unitialized variable used - retval always returned from a rule
\r
93 // unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns
\r
95 // These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
\r
96 // and the codegen must generate some of these warnings by necessity, apart from 4100, which is
\r
97 // usually generated when a parser rule is given a parameter that it does not use. Mostly though
\r
98 // this is a matter of orthogonality hence I disable that one.
\r
100 #pragma warning( disable : 4100 )
\r
101 #pragma warning( disable : 4101 )
\r
102 #pragma warning( disable : 4127 )
\r
103 #pragma warning( disable : 4189 )
\r
104 #pragma warning( disable : 4505 )
\r
105 #pragma warning( disable : 4701 )
\r
107 typedef struct LangParser_start_return_struct
\r
109 /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
\r
111 pANTLR3_COMMON_TOKEN start;
\r
112 pANTLR3_COMMON_TOKEN stop;
\r
113 pANTLR3_BASE_TREE tree;
\r
116 LangParser_start_return;
\r
118 typedef struct LangParser_decl_return_struct
\r
120 /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
\r
122 pANTLR3_COMMON_TOKEN start;
\r
123 pANTLR3_COMMON_TOKEN stop;
\r
124 pANTLR3_BASE_TREE tree;
\r
127 LangParser_decl_return;
\r
129 typedef struct LangParser_type_return_struct
\r
131 /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
\r
133 pANTLR3_COMMON_TOKEN start;
\r
134 pANTLR3_COMMON_TOKEN stop;
\r
135 pANTLR3_BASE_TREE tree;
\r
138 LangParser_type_return;
\r
142 /** Context tracking structure for LangParser
\r
144 struct LangParser_Ctx_struct
\r
146 /** Built in ANTLR3 context tracker contains all the generic elements
\r
147 * required for context tracking.
\r
149 pANTLR3_PARSER pParser;
\r
152 LangParser_start_return (*start) (struct LangParser_Ctx_struct * ctx);
\r
153 LangParser_decl_return (*decl) (struct LangParser_Ctx_struct * ctx);
\r
154 LangParser_type_return (*type) (struct LangParser_Ctx_struct * ctx);
\r
156 const char * (*getGrammarFileName)();
\r
157 void (*free) (struct LangParser_Ctx_struct * ctx);
\r
158 /* @headerFile.members() */
\r
159 pANTLR3_BASE_TREE_ADAPTOR adaptor;
\r
160 pANTLR3_VECTOR_FACTORY vectors;
\r
161 /* End @headerFile.members() */
\r
164 // Function protoypes for the constructor functions that external translation units
\r
165 // such as delegators and delegates may wish to call.
\r
167 ANTLR3_API pLangParser LangParserNew (pANTLR3_COMMON_TOKEN_STREAM instream);
\r
168 ANTLR3_API pLangParser LangParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
\r
170 /** Symbolic definitions of all the tokens that the parser will work with.
\r
173 * Antlr will define EOF, but we can't use that as it it is too common in
\r
174 * in C header files and that would be confusing. There is no way to filter this out at the moment
\r
175 * so we just undef it here for now. That isn't the value we get back from C recognizers
\r
176 * anyway. We are looking for ANTLR3_TOKEN_EOF.
\r
185 #define FLOATTYPE 7
\r
194 #define EOF ANTLR3_TOKEN_EOF
\r
197 #ifndef TOKENSOURCE
\r
198 #define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
\r
201 /* End of token definitions for LangParser
\r
202 * =============================================================================
\r
212 /* END - Note:Keep extra line feed to satisfy UNIX systems */
\r