]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkCompatibilityPkg/Other/Maintained/Tools/Pccts/h/ASTBase.h
Add in the 1st version of ECP.
[mirror_edk2.git] / EdkCompatibilityPkg / Other / Maintained / Tools / Pccts / h / ASTBase.h
diff --git a/EdkCompatibilityPkg/Other/Maintained/Tools/Pccts/h/ASTBase.h b/EdkCompatibilityPkg/Other/Maintained/Tools/Pccts/h/ASTBase.h
new file mode 100644 (file)
index 0000000..a5b3116
--- /dev/null
@@ -0,0 +1,119 @@
+/* Abstract syntax tree\r
+ *\r
+ * SOFTWARE RIGHTS\r
+ *\r
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool\r
+ * Set (PCCTS) -- PCCTS is in the public domain.  An individual or\r
+ * company may do whatever they wish with source code distributed with\r
+ * PCCTS or the code generated by PCCTS, including the incorporation of\r
+ * PCCTS, or its output, into commerical software.\r
+ *\r
+ * We encourage users to develop software with PCCTS.  However, we do ask\r
+ * that credit is given to us for developing PCCTS.  By "credit",\r
+ * we mean that if you incorporate our source code into one of your\r
+ * programs (commercial product, research project, or otherwise) that you\r
+ * acknowledge this fact somewhere in the documentation, research report,\r
+ * etc...  If you like PCCTS and have developed a nice tool with the\r
+ * output, please mention that you developed it using PCCTS.  In\r
+ * addition, we ask that this header remain intact in our source code.\r
+ * As long as these guidelines are kept, we expect to continue enhancing\r
+ * this system and expect to make other tools available as they are\r
+ * completed.\r
+ *\r
+ * ANTLR 1.33\r
+ * Terence Parr\r
+ * Parr Research Corporation\r
+ * with Purdue University and AHPCRC, University of Minnesota\r
+ * 1989-1998\r
+ */\r
+\r
+#ifndef ASTBase_H\r
+#define ASTBase_H\r
+\r
+#include "pcctscfg.h"\r
+\r
+#include "pccts_stdio.h"\r
+#include "pccts_stdlib.h"\r
+\r
+PCCTS_NAMESPACE_STD\r
+\r
+#ifndef PCCTS_NOT_USING_SOR\r
+#include "PCCTSAST.h"\r
+#endif\r
+\r
+/*\r
+ * Notes:\r
+ *\r
+ * To specify a copy constructor, subclass one of these classes and\r
+ * give the copy constructor.  To use dup(), you must define shallowCopy().\r
+ * shallowCopy() can use either a copy constructor or just copy the node\r
+ * itself.\r
+ */\r
+\r
+#ifdef PCCTS_NOT_USING_SOR\r
+class DllExportPCCTS ASTBase {\r
+#else\r
+class DllExportPCCTS ASTBase : public PCCTS_AST {\r
+#endif\r
+\r
+protected:\r
+  ASTBase *_right, *_down;\r
+\r
+public:\r
+\r
+#ifdef PCCTS_NOT_USING_SOR\r
+  ASTBase *right()  { return _right; }\r
+  ASTBase *down()      { return _down; }\r
+  void setRight(ASTBase *t)  { _right = (ASTBase *)t; }\r
+  void setDown(ASTBase *t)  { _down = (ASTBase *)t; }\r
+#else\r
+  PCCTS_AST *right()  { return _right; }  // define the SORCERER interface\r
+  PCCTS_AST *down()  { return _down; }\r
+  void setRight(PCCTS_AST *t)  { _right = (ASTBase *)t; }\r
+  void setDown(PCCTS_AST *t)  { _down = (ASTBase *)t; }\r
+#endif\r
+  ASTBase() { _right = _down = NULL; }\r
+  virtual ~ASTBase() { ; }\r
+#ifndef PCCTS_NOT_USING_SOR\r
+  virtual ASTBase *dup();\r
+#endif\r
+  void destroy();\r
+  void preorder();\r
+  static ASTBase *tmake(ASTBase *, ...);\r
+  static void link(ASTBase **, ASTBase **, ASTBase **);\r
+  void subchild(ASTBase **, ASTBase **, ASTBase **);\r
+  void subroot(ASTBase **, ASTBase **, ASTBase **);\r
+  virtual void preorder_action() { ; }\r
+  virtual void preorder_before_action() { printf(" ("); }\r
+  virtual void preorder_after_action() { printf(" )"); }\r
+    virtual void panic(const char *msg);         /* MR21 */\r
+    virtual void reportOverwriteOfDownPointer(); /* MR21 */\r
+};\r
+\r
+class DllExportPCCTS ASTDoublyLinkedBase : public ASTBase {\r
+protected:\r
+    ASTDoublyLinkedBase *_left, *_up;\r
+\r
+public:\r
+  void double_link(ASTBase *left, ASTBase *up);\r
+\r
+#ifndef PCCTS_NOT_USING_SOR\r
+  virtual ASTBase *dup();\r
+#endif\r
+\r
+#ifdef PCCTS_NOT_USING_SOR\r
+  ASTBase *left() { return _left; }\r
+  ASTBase *up() { return _up; }\r
+  void setLeft(ASTBase *t) { _left = (ASTDoublyLinkedBase *)t; }    // MR6\r
+  void setUp(ASTBase *t)   { _up = (ASTDoublyLinkedBase *)t; }      // MR6\r
+#else\r
+  PCCTS_AST *left() { return _left; }\r
+  PCCTS_AST *up() { return _up; }\r
+  void setLeft(PCCTS_AST *t) { _left = (ASTDoublyLinkedBase *)t; }  // MR6\r
+  void setUp(PCCTS_AST *t)   { _up = (ASTDoublyLinkedBase *)t; }  // MR6\r
+#endif\r
+\r
+};\r
+\r
+class AST;  // announce that this class will be coming along shortly\r
+#endif\r