]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/CodeTools/Source/Pccts/h/ASTBase.h
More renames for Tool Packages
[mirror_edk2.git] / Tools / CodeTools / Source / Pccts / h / ASTBase.h
1 /* Abstract syntax tree
2 *
3 * SOFTWARE RIGHTS
4 *
5 * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
6 * Set (PCCTS) -- PCCTS is in the public domain. An individual or
7 * company may do whatever they wish with source code distributed with
8 * PCCTS or the code generated by PCCTS, including the incorporation of
9 * PCCTS, or its output, into commerical software.
10 *
11 * We encourage users to develop software with PCCTS. However, we do ask
12 * that credit is given to us for developing PCCTS. By "credit",
13 * we mean that if you incorporate our source code into one of your
14 * programs (commercial product, research project, or otherwise) that you
15 * acknowledge this fact somewhere in the documentation, research report,
16 * etc... If you like PCCTS and have developed a nice tool with the
17 * output, please mention that you developed it using PCCTS. In
18 * addition, we ask that this header remain intact in our source code.
19 * As long as these guidelines are kept, we expect to continue enhancing
20 * this system and expect to make other tools available as they are
21 * completed.
22 *
23 * ANTLR 1.33
24 * Terence Parr
25 * Parr Research Corporation
26 * with Purdue University and AHPCRC, University of Minnesota
27 * 1989-2000
28 */
29
30 #ifndef ASTBase_H
31 #define ASTBase_H
32
33 #include "pcctscfg.h"
34
35 #include "pccts_stdio.h"
36 #include "pccts_stdlib.h"
37
38 PCCTS_NAMESPACE_STD
39
40 #ifndef PCCTS_NOT_USING_SOR
41 #include "PCCTSAST.h"
42 #endif
43
44 /*
45 * Notes:
46 *
47 * To specify a copy constructor, subclass one of these classes and
48 * give the copy constructor. To use dup(), you must define shallowCopy().
49 * shallowCopy() can use either a copy constructor or just copy the node
50 * itself.
51 */
52
53 #ifdef PCCTS_NOT_USING_SOR
54 class DllExportPCCTS ASTBase {
55 #else
56 class DllExportPCCTS ASTBase : public PCCTS_AST {
57 #endif
58
59 protected:
60 ASTBase *_right, *_down;
61
62 public:
63
64 #ifdef PCCTS_NOT_USING_SOR
65 ASTBase *right() { return _right; }
66 ASTBase *down() { return _down; }
67 void setRight(ASTBase *t) { _right = (ASTBase *)t; }
68 void setDown(ASTBase *t) { _down = (ASTBase *)t; }
69 #else
70 PCCTS_AST *right() { return _right; } // define the SORCERER interface
71 PCCTS_AST *down() { return _down; }
72 void setRight(PCCTS_AST *t) { _right = (ASTBase *)t; }
73 void setDown(PCCTS_AST *t) { _down = (ASTBase *)t; }
74 #endif
75 ASTBase() { _right = _down = NULL; }
76 virtual ~ASTBase() { ; }
77 #ifndef PCCTS_NOT_USING_SOR
78 virtual ASTBase *dup();
79 #endif
80 void destroy();
81 void preorder(void* pData = NULL /* MR23 */);
82 static ASTBase *tmake(ASTBase *, ...);
83 static void link(ASTBase **, ASTBase **, ASTBase **);
84 void subchild(ASTBase **, ASTBase **, ASTBase **);
85 void subroot(ASTBase **, ASTBase **, ASTBase **);
86 virtual void preorder_action(void* /*pData*/ = NULL /* MR23 */) { ; }
87 virtual void preorder_before_action(void* /*pData*/ = NULL /* MR23 */) { /* MR23 */ printMessage(stdout, " ("); }
88 virtual void preorder_after_action(void* /*pData*/ = NULL /* MR23 */) { /* MR23 */ printMessage(stdout, " )"); }
89 virtual void panic(const char *msg); /* MR21 */
90 virtual void reportOverwriteOfDownPointer(); /* MR21 */
91 #ifdef PCCTS_NOT_USING_SOR
92 virtual int printMessage(FILE* pFile, const char* pFormat, ...); // MR23
93 #endif
94 };
95
96 class DllExportPCCTS ASTDoublyLinkedBase : public ASTBase {
97 protected:
98 ASTDoublyLinkedBase *_left, *_up;
99
100 public:
101 void double_link(ASTBase *left, ASTBase *up);
102
103 #ifndef PCCTS_NOT_USING_SOR
104 virtual ASTBase *dup();
105 #endif
106
107 #ifdef PCCTS_NOT_USING_SOR
108 ASTBase *left() { return _left; }
109 ASTBase *up() { return _up; }
110 void setLeft(ASTBase *t) { _left = (ASTDoublyLinkedBase *)t; } // MR6
111 void setUp(ASTBase *t) { _up = (ASTDoublyLinkedBase *)t; } // MR6
112 #else
113 PCCTS_AST *left() { return _left; }
114 PCCTS_AST *up() { return _up; }
115 void setLeft(PCCTS_AST *t) { _left = (ASTDoublyLinkedBase *)t; } // MR6
116 void setUp(PCCTS_AST *t) { _up = (ASTDoublyLinkedBase *)t; } // MR6
117 #endif
118
119 };
120
121 class AST; // announce that this class will be coming along shortly
122 #endif