diff options
author | Mike Buland <eichlan@xagasoft.com> | 2009-12-21 18:04:02 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2009-12-21 18:04:02 +0000 |
commit | fb28f6800864176be2ffca29e8e664b641f33170 (patch) | |
tree | ba9180ac442939edc4eacbe1fdae93c5a7f87cee /src/ast.h | |
parent | 51e21a316be6e052251b3dfc7d671061ebd67cee (diff) | |
download | build-fb28f6800864176be2ffca29e8e664b641f33170.tar.gz build-fb28f6800864176be2ffca29e8e664b641f33170.tar.bz2 build-fb28f6800864176be2ffca29e8e664b641f33170.tar.xz build-fb28f6800864176be2ffca29e8e664b641f33170.zip |
m3 is copied into trunk, we should be good to go, now.
Diffstat (limited to '')
-rw-r--r-- | src/ast.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/ast.h b/src/ast.h new file mode 100644 index 0000000..a4f9361 --- /dev/null +++ b/src/ast.h | |||
@@ -0,0 +1,44 @@ | |||
1 | #ifndef AST_H | ||
2 | #define AST_H | ||
3 | |||
4 | #include "bu/list.h" | ||
5 | #include "bu/stack.h" | ||
6 | #include "bu/fstring.h" | ||
7 | #include "bu/formatter.h" | ||
8 | |||
9 | #include "astnode.h" | ||
10 | |||
11 | /** | ||
12 | * Abstract Symbol Tree. This is the thing that the parser builds for us. In | ||
13 | * the end, this is also what we "run" when we run build files. | ||
14 | */ | ||
15 | class Ast | ||
16 | { | ||
17 | public: | ||
18 | typedef Bu::List<AstNode *> NodeList; | ||
19 | Ast(); | ||
20 | virtual ~Ast(); | ||
21 | |||
22 | void addNode( AstNode::Type eType ); | ||
23 | void addNode( AstNode::Type eType, int iVal ); | ||
24 | void addNode( AstNode::Type eType, float fVal ); | ||
25 | void addNode( AstNode::Type eType, bool bVal ); | ||
26 | void addNode( AstNode::Type eType, const Bu::FString &sVal ); | ||
27 | void addNode( AstNode::Type eType, const char *sVal ); | ||
28 | void addNode( AstNode *pNode ); | ||
29 | |||
30 | void openBranch(); | ||
31 | |||
32 | void closeNode(); | ||
33 | |||
34 | NodeList::const_iterator getNodeBegin() const; | ||
35 | |||
36 | private: | ||
37 | NodeList lNode; | ||
38 | typedef Bu::Stack<class AstBranch *> BranchStack; | ||
39 | BranchStack sBranch; | ||
40 | }; | ||
41 | |||
42 | Bu::Formatter &operator<<( Bu::Formatter &f, const Ast &a ); | ||
43 | |||
44 | #endif | ||