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