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