2 * This C header file was generated by $ANTLR version 3.2 Sep 23, 2009 12:02:23
4 * - From the grammar source file : LangDumpDecl.g
5 * - On : 2010-02-24 13:30:09
6 * - for the tree parser : LangDumpDeclTreeParser *
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 tree parser LangDumpDecl 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 pLangDumpDecl, which is returned from a call to LangDumpDeclNew().
25 * The methods in pLangDumpDecl are as follows:
27 * - void pLangDumpDecl->decl(pLangDumpDecl)
28 * - void pLangDumpDecl->decls(pLangDumpDecl)
29 * - void pLangDumpDecl->type(pLangDumpDecl)
30 * - LangDumpDecl_declarator_return pLangDumpDecl->declarator(pLangDumpDecl)
32 * The return type for any particular rule is of course determined by the source
35 // [The "BSD licence"]
36 // Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
37 // http://www.temporal-wave.com
38 // http://www.linkedin.com/in/jimidle
40 // All rights reserved.
42 // Redistribution and use in source and binary forms, with or without
43 // modification, are permitted provided that the following conditions
45 // 1. Redistributions of source code must retain the above copyright
46 // notice, this list of conditions and the following disclaimer.
47 // 2. Redistributions in binary form must reproduce the above copyright
48 // notice, this list of conditions and the following disclaimer in the
49 // documentation and/or other materials provided with the distribution.
50 // 3. The name of the author may not be used to endorse or promote products
51 // derived from this software without specific prior written permission.
53 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
54 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
55 // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
56 // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
57 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
58 // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
59 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
60 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
61 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
62 // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
64 #ifndef _LangDumpDecl_H
65 #define _LangDumpDecl_H
66 /* =============================================================================
67 * Standard antlr3 C runtime definitions
71 /* End of standard antlr 3 runtime definitions
72 * =============================================================================
79 // Forward declare the context typedef so that we can use it before it is
80 // properly defined. Delegators and delegates (from import statements) are
81 // interdependent and their context structures contain pointers to each other
82 // C only allows such things to be declared if you pre-declare the typedef.
84 typedef struct LangDumpDecl_Ctx_struct LangDumpDecl, * pLangDumpDecl;
89 // Disable: Unreferenced parameter, - Rules with parameters that are not used
90 // constant conditional, - ANTLR realizes that a prediction is always true (synpred usually)
91 // initialized but unused variable - tree rewrite variables declared but not needed
92 // Unreferenced local variable - lexer rule declares but does not always use _type
93 // potentially unitialized variable used - retval always returned from a rule
94 // unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns
96 // These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
97 // and the codegen must generate some of these warnings by necessity, apart from 4100, which is
98 // usually generated when a parser rule is given a parameter that it does not use. Mostly though
99 // this is a matter of orthogonality hence I disable that one.
101 #pragma warning( disable : 4100 )
102 #pragma warning( disable : 4101 )
103 #pragma warning( disable : 4127 )
104 #pragma warning( disable : 4189 )
105 #pragma warning( disable : 4505 )
106 #pragma warning( disable : 4701 )
108 typedef struct LangDumpDecl_declarator_return_struct
110 pANTLR3_BASE_TREE start;
111 pANTLR3_BASE_TREE stop;
113 LangDumpDecl_declarator_return;
117 /** Context tracking structure for LangDumpDecl
119 struct LangDumpDecl_Ctx_struct
121 /** Built in ANTLR3 context tracker contains all the generic elements
122 * required for context tracking.
124 pANTLR3_TREE_PARSER pTreeParser;
127 void (*decl) (struct LangDumpDecl_Ctx_struct * ctx);
128 void (*decls) (struct LangDumpDecl_Ctx_struct * ctx);
129 void (*type) (struct LangDumpDecl_Ctx_struct * ctx);
130 LangDumpDecl_declarator_return (*declarator) (struct LangDumpDecl_Ctx_struct * ctx);
132 const char * (*getGrammarFileName)();
133 void (*free) (struct LangDumpDecl_Ctx_struct * ctx);
137 // Function protoypes for the constructor functions that external translation units
138 // such as delegators and delegates may wish to call.
140 ANTLR3_API pLangDumpDecl LangDumpDeclNew (pANTLR3_COMMON_TREE_NODE_STREAM instream);
141 ANTLR3_API pLangDumpDecl LangDumpDeclNewSSD (pANTLR3_COMMON_TREE_NODE_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
143 /** Symbolic definitions of all the tokens that the tree parser will work with.
146 * Antlr will define EOF, but we can't use that as it it is too common in
147 * in C header files and that would be confusing. There is no way to filter this out at the moment
148 * so we just undef it here for now. That isn't the value we get back from C recognizers
149 * anyway. We are looking for ANTLR3_TOKEN_EOF.
167 #define EOF ANTLR3_TOKEN_EOF
171 #define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
174 /* End of token definitions for LangDumpDecl
175 * =============================================================================
185 /* END - Note:Keep extra line feed to satisfy UNIX systems */