]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - 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
diff --git a/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/LangParser.h b/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/LangParser.h
new file mode 100644 (file)
index 0000000..2cda8d5
--- /dev/null
@@ -0,0 +1,212 @@
+/** \file\r
+ *  This C header file was generated by $ANTLR version 3.2 Sep 23, 2009 12:02:23\r
+ *\r
+ *     -  From the grammar source file : Lang.g\r
+ *     -                            On : 2010-02-24 13:27:52\r
+ *     -                for the parser : LangParserParser *\r
+ * Editing it, at least manually, is not wise. \r
+ *\r
+ * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.\r
+ *\r
+ *\r
+ * The parser LangParser has the callable functions (rules) shown below,\r
+ * which will invoke the code for the associated rule in the source grammar\r
+ * assuming that the input stream is pointing to a token/text stream that could begin\r
+ * this rule.\r
+ * \r
+ * For instance if you call the first (topmost) rule in a parser grammar, you will\r
+ * get the results of a full parse, but calling a rule half way through the grammar will\r
+ * allow you to pass part of a full token stream to the parser, such as for syntax checking\r
+ * in editors and so on.\r
+ *\r
+ * The parser entry points are called indirectly (by function pointer to function) via\r
+ * a parser context typedef pLangParser, which is returned from a call to LangParserNew().\r
+ *\r
+ * The methods in pLangParser are  as follows:\r
+ *\r
+ *  - LangParser_start_return      pLangParser->start(pLangParser)\r
+ *  - LangParser_decl_return      pLangParser->decl(pLangParser)\r
+ *  - LangParser_type_return      pLangParser->type(pLangParser)\r
+ *\r
+ * The return type for any particular rule is of course determined by the source\r
+ * grammar file.\r
+ */\r
+// [The "BSD licence"]\r
+// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC\r
+// http://www.temporal-wave.com\r
+// http://www.linkedin.com/in/jimidle\r
+//\r
+// All rights reserved.\r
+//\r
+// Redistribution and use in source and binary forms, with or without\r
+// modification, are permitted provided that the following conditions\r
+// are met:\r
+// 1. Redistributions of source code must retain the above copyright\r
+//    notice, this list of conditions and the following disclaimer.\r
+// 2. Redistributions in binary form must reproduce the above copyright\r
+//    notice, this list of conditions and the following disclaimer in the\r
+//    documentation and/or other materials provided with the distribution.\r
+// 3. The name of the author may not be used to endorse or promote products\r
+//    derived from this software without specific prior written permission.\r
+//\r
+// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\r
+// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\r
+// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\r
+// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\r
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r
+// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\r
+// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\r
+#ifndef        _LangParser_H\r
+#define _LangParser_H\r
+/* =============================================================================\r
+ * Standard antlr3 C runtime definitions\r
+ */\r
+#include    <antlr3.h>\r
+\r
+/* End of standard antlr 3 runtime definitions\r
+ * =============================================================================\r
+ */\r
\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+// Forward declare the context typedef so that we can use it before it is\r
+// properly defined. Delegators and delegates (from import statements) are\r
+// interdependent and their context structures contain pointers to each other\r
+// C only allows such things to be declared if you pre-declare the typedef.\r
+//\r
+typedef struct LangParser_Ctx_struct LangParser, * pLangParser;\r
+\r
+\r
+\r
+#ifdef ANTLR3_WINDOWS\r
+// Disable: Unreferenced parameter,                                                    - Rules with parameters that are not used\r
+//          constant conditional,                                                      - ANTLR realizes that a prediction is always true (synpred usually)\r
+//          initialized but unused variable                                    - tree rewrite variables declared but not needed\r
+//          Unreferenced local variable                                                - lexer rule declares but does not always use _type\r
+//          potentially unitialized variable used                      - retval always returned from a rule \r
+//                     unreferenced local function has been removed    - susually getTokenNames or freeScope, they can go without warnigns\r
+//\r
+// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at\r
+// and the codegen must generate some of these warnings by necessity, apart from 4100, which is\r
+// usually generated when a parser rule is given a parameter that it does not use. Mostly though\r
+// this is a matter of orthogonality hence I disable that one.\r
+//\r
+#pragma warning( disable : 4100 )\r
+#pragma warning( disable : 4101 )\r
+#pragma warning( disable : 4127 )\r
+#pragma warning( disable : 4189 )\r
+#pragma warning( disable : 4505 )\r
+#pragma warning( disable : 4701 )\r
+#endif\r
+typedef struct LangParser_start_return_struct\r
+{\r
+    /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees\r
+     */\r
+    pANTLR3_COMMON_TOKEN    start;\r
+    pANTLR3_COMMON_TOKEN    stop;\r
+    pANTLR3_BASE_TREE  tree;\r
+   \r
+}\r
+    LangParser_start_return;\r
+\r
+typedef struct LangParser_decl_return_struct\r
+{\r
+    /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees\r
+     */\r
+    pANTLR3_COMMON_TOKEN    start;\r
+    pANTLR3_COMMON_TOKEN    stop;\r
+    pANTLR3_BASE_TREE  tree;\r
+   \r
+}\r
+    LangParser_decl_return;\r
+\r
+typedef struct LangParser_type_return_struct\r
+{\r
+    /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees\r
+     */\r
+    pANTLR3_COMMON_TOKEN    start;\r
+    pANTLR3_COMMON_TOKEN    stop;\r
+    pANTLR3_BASE_TREE  tree;\r
+   \r
+}\r
+    LangParser_type_return;\r
+\r
+\r
+\r
+/** Context tracking structure for LangParser\r
+ */\r
+struct LangParser_Ctx_struct\r
+{\r
+    /** Built in ANTLR3 context tracker contains all the generic elements\r
+     *  required for context tracking.\r
+     */\r
+    pANTLR3_PARSER   pParser;\r
+\r
+\r
+     LangParser_start_return (*start)  (struct LangParser_Ctx_struct * ctx);\r
+     LangParser_decl_return (*decl)    (struct LangParser_Ctx_struct * ctx);\r
+     LangParser_type_return (*type)    (struct LangParser_Ctx_struct * ctx);\r
+    // Delegated rules\r
+    const char * (*getGrammarFileName)();\r
+    void           (*free)   (struct LangParser_Ctx_struct * ctx);\r
+    /* @headerFile.members() */\r
+    pANTLR3_BASE_TREE_ADAPTOR  adaptor;\r
+    pANTLR3_VECTOR_FACTORY             vectors;\r
+    /* End @headerFile.members() */\r
+};\r
+\r
+// Function protoypes for the constructor functions that external translation units\r
+// such as delegators and delegates may wish to call.\r
+//\r
+ANTLR3_API pLangParser LangParserNew         (pANTLR3_COMMON_TOKEN_STREAM instream);\r
+ANTLR3_API pLangParser LangParserNewSSD      (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);\r
+\r
+/** Symbolic definitions of all the tokens that the parser will work with.\r
+ * \{\r
+ *\r
+ * Antlr will define EOF, but we can't use that as it it is too common in\r
+ * in C header files and that would be confusing. There is no way to filter this out at the moment\r
+ * so we just undef it here for now. That isn't the value we get back from C recognizers\r
+ * anyway. We are looking for ANTLR3_TOKEN_EOF.\r
+ */\r
+#ifdef EOF\r
+#undef EOF\r
+#endif\r
+#ifdef Tokens\r
+#undef Tokens\r
+#endif \r
+#define WS      9\r
+#define FLOATTYPE      7\r
+#define DECL      4\r
+#define T__10      10\r
+#define INT      8\r
+#define ID      5\r
+#define EOF      -1\r
+#define INTTYPE      6\r
+#ifdef EOF\r
+#undef EOF\r
+#define        EOF     ANTLR3_TOKEN_EOF\r
+#endif\r
+\r
+#ifndef TOKENSOURCE\r
+#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource\r
+#endif\r
+\r
+/* End of token definitions for LangParser\r
+ * =============================================================================\r
+ */\r
+/** \} */\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif\r
+\r
+/* END - Note:Keep extra line feed to satisfy UNIX systems */\r