]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/LangParser.h
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.databoard / cpp / DataBoardTest / DataBoard / LangParser.h
1 /** \file
2  *  This C header file was generated by $ANTLR version 3.2 Sep 23, 2009 12:02:23
3  *
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. 
8  *
9  * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
10  *
11  *
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
15  * this rule.
16  * 
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.
21  *
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().
24  *
25  * The methods in pLangParser are  as follows:
26  *
27  *  - LangParser_start_return      pLangParser->start(pLangParser)
28  *  - LangParser_decl_return      pLangParser->decl(pLangParser)
29  *  - LangParser_type_return      pLangParser->type(pLangParser)
30  *
31  * The return type for any particular rule is of course determined by the source
32  * grammar file.
33  */
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
38 //
39 // All rights reserved.
40 //
41 // Redistribution and use in source and binary forms, with or without
42 // modification, are permitted provided that the following conditions
43 // are met:
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.
51 //
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.
62
63 #ifndef _LangParser_H
64 #define _LangParser_H
65 /* =============================================================================
66  * Standard antlr3 C runtime definitions
67  */
68 #include    <antlr3.h>
69
70 /* End of standard antlr 3 runtime definitions
71  * =============================================================================
72  */
73  
74 #ifdef __cplusplus
75 extern "C" {
76 #endif
77
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.
82 //
83 typedef struct LangParser_Ctx_struct LangParser, * pLangParser;
84
85
86
87 #ifdef  ANTLR3_WINDOWS
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
94 //
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.
99 //
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 )
106 #endif
107 typedef struct LangParser_start_return_struct
108 {
109     /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
110      */
111     pANTLR3_COMMON_TOKEN    start;
112     pANTLR3_COMMON_TOKEN    stop;
113     pANTLR3_BASE_TREE   tree;
114    
115 }
116     LangParser_start_return;
117
118 typedef struct LangParser_decl_return_struct
119 {
120     /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
121      */
122     pANTLR3_COMMON_TOKEN    start;
123     pANTLR3_COMMON_TOKEN    stop;
124     pANTLR3_BASE_TREE   tree;
125    
126 }
127     LangParser_decl_return;
128
129 typedef struct LangParser_type_return_struct
130 {
131     /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
132      */
133     pANTLR3_COMMON_TOKEN    start;
134     pANTLR3_COMMON_TOKEN    stop;
135     pANTLR3_BASE_TREE   tree;
136    
137 }
138     LangParser_type_return;
139
140
141
142 /** Context tracking structure for LangParser
143  */
144 struct LangParser_Ctx_struct
145 {
146     /** Built in ANTLR3 context tracker contains all the generic elements
147      *  required for context tracking.
148      */
149     pANTLR3_PARSER   pParser;
150
151
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);
155     // Delegated rules
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() */
162 };
163
164 // Function protoypes for the constructor functions that external translation units
165 // such as delegators and delegates may wish to call.
166 //
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);
169
170 /** Symbolic definitions of all the tokens that the parser will work with.
171  * \{
172  *
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.
177  */
178 #ifdef  EOF
179 #undef  EOF
180 #endif
181 #ifdef  Tokens
182 #undef  Tokens
183 #endif 
184 #define WS      9
185 #define FLOATTYPE      7
186 #define DECL      4
187 #define T__10      10
188 #define INT      8
189 #define ID      5
190 #define EOF      -1
191 #define INTTYPE      6
192 #ifdef  EOF
193 #undef  EOF
194 #define EOF     ANTLR3_TOKEN_EOF
195 #endif
196
197 #ifndef TOKENSOURCE
198 #define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
199 #endif
200
201 /* End of token definitions for LangParser
202  * =============================================================================
203  */
204 /** \} */
205
206 #ifdef __cplusplus
207 }
208 #endif
209
210 #endif
211
212 /* END - Note:Keep extra line feed to satisfy UNIX systems */