]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.databoard/cpp/DataBoardTest/libantlr3c-3.2/include/antlr3basetree.h
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.databoard / cpp / DataBoardTest / libantlr3c-3.2 / include / antlr3basetree.h
diff --git a/bundles/org.simantics.databoard/cpp/DataBoardTest/libantlr3c-3.2/include/antlr3basetree.h b/bundles/org.simantics.databoard/cpp/DataBoardTest/libantlr3c-3.2/include/antlr3basetree.h
new file mode 100644 (file)
index 0000000..3bf10d4
--- /dev/null
@@ -0,0 +1,143 @@
+/// \file\r
+/// Definition of the ANTLR3 base tree.\r
+///\r
+\r
+#ifndef        _ANTLR3_BASE_TREE_H\r
+#define        _ANTLR3_BASE_TREE_H\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
+#include    <antlr3defs.h>\r
+#include    <antlr3collections.h>\r
+#include    <antlr3string.h>\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+/// A generic tree implementation with no payload.  You must subclass to\r
+/// actually have any user data.  ANTLR v3 uses a list of children approach\r
+/// instead of the child-sibling approach in v2.  A flat tree (a list) is\r
+/// an empty node whose children represent the list.  An empty (as in it does not\r
+/// have payload itself), but non-null node is called "nil".\r
+///\r
+typedef        struct ANTLR3_BASE_TREE_struct\r
+{\r
+\r
+    /// Implementers of this interface sometimes require a pointer to their selves.\r
+    ///\r
+    void    *      super;\r
+\r
+    /// Generic void pointer allows the grammar programmer to attach any structure they\r
+    /// like to a tree node, in many cases saving the need to create their own tree\r
+    /// and tree adaptors. ANTLR does not use this pointer, but will copy it for you and so on.\r
+    ///\r
+    void    *      u;\r
+\r
+    /// The list of all the children that belong to this node. They are not part of the node\r
+    /// as they belong to the common tree node that implements this.\r
+    ///\r
+    pANTLR3_VECTOR  children;\r
+\r
+    /// This is used to store the current child index position while descending\r
+    /// and ascending trees as the tree walk progresses.\r
+    ///\r
+    ANTLR3_MARKER   savedIndex;\r
+\r
+    /// A string factory to produce strings for toString etc\r
+    ///\r
+    pANTLR3_STRING_FACTORY strFactory;\r
+\r
+    /// A pointer to a function that returns the common token pointer\r
+    /// for the payload in the supplied tree.\r
+    ///\r
+    pANTLR3_COMMON_TOKEN                (*getToken)                    (struct ANTLR3_BASE_TREE_struct * tree);\r
+\r
+    void                               (*addChild)                     (struct ANTLR3_BASE_TREE_struct * tree, void * child);\r
+\r
+    void                               (*addChildren)                  (struct ANTLR3_BASE_TREE_struct * tree, pANTLR3_LIST kids);\r
+\r
+    void                               (*createChildrenList)           (struct ANTLR3_BASE_TREE_struct * tree);\r
+\r
+    void    *                          (*deleteChild)                  (struct ANTLR3_BASE_TREE_struct * tree, ANTLR3_UINT32 i);\r
+\r
+    void                               (*replaceChildren)              (struct ANTLR3_BASE_TREE_struct * parent, ANTLR3_INT32 startChildIndex, ANTLR3_INT32 stopChildIndex, struct ANTLR3_BASE_TREE_struct * t);\r
+\r
+    void    *                          (*dupNode)                      (struct ANTLR3_BASE_TREE_struct * dupNode);\r
+\r
+    void    *                          (*dupTree)                      (struct ANTLR3_BASE_TREE_struct * tree);\r
+\r
+    ANTLR3_UINT32                      (*getCharPositionInLine)        (struct ANTLR3_BASE_TREE_struct * tree);\r
+\r
+    void    *                          (*getChild)                     (struct ANTLR3_BASE_TREE_struct * tree, ANTLR3_UINT32 i);\r
+\r
+    void                               (*setChildIndex)                (struct ANTLR3_BASE_TREE_struct * tree, ANTLR3_INT32 );\r
+\r
+    ANTLR3_INT32                       (*getChildIndex)                (struct ANTLR3_BASE_TREE_struct * tree );\r
+\r
+    ANTLR3_UINT32                      (*getChildCount)                (struct ANTLR3_BASE_TREE_struct * tree);\r
+\r
+    struct ANTLR3_BASE_TREE_struct *    (*getParent)                   (struct ANTLR3_BASE_TREE_struct * tree);\r
+\r
+    void                               (*setParent)                    (struct ANTLR3_BASE_TREE_struct * tree, struct ANTLR3_BASE_TREE_struct * parent);\r
+\r
+    ANTLR3_UINT32                      (*getType)                      (struct ANTLR3_BASE_TREE_struct * tree);\r
+\r
+    void    *                          (*getFirstChildWithType)        (struct ANTLR3_BASE_TREE_struct * tree, ANTLR3_UINT32 type);\r
+\r
+    ANTLR3_UINT32                      (*getLine)                      (struct ANTLR3_BASE_TREE_struct * tree);\r
+\r
+    pANTLR3_STRING                     (*getText)                      (struct ANTLR3_BASE_TREE_struct * tree);\r
+\r
+    ANTLR3_BOOLEAN                     (*isNilNode)                    (struct ANTLR3_BASE_TREE_struct * tree);\r
+\r
+    void                               (*setChild)                     (struct ANTLR3_BASE_TREE_struct * tree, ANTLR3_UINT32 i, void * child);\r
+\r
+    pANTLR3_STRING                     (*toStringTree)                 (struct ANTLR3_BASE_TREE_struct * tree);\r
+\r
+    pANTLR3_STRING                     (*toString)                     (struct ANTLR3_BASE_TREE_struct * tree);\r
+\r
+    void                               (*freshenPACIndexesAll)         (struct ANTLR3_BASE_TREE_struct * tree);\r
+\r
+    void                               (*freshenPACIndexes)            (struct ANTLR3_BASE_TREE_struct * tree, ANTLR3_UINT32 offset);\r
+\r
+    void                                (*reuse)                        (struct ANTLR3_BASE_TREE_struct * tree);\r
+\r
+    void                               (*free)                         (struct ANTLR3_BASE_TREE_struct * tree);\r
+\r
+}\r
+    ANTLR3_BASE_TREE;\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+\r
+#endif\r