aboutsummaryrefslogtreecommitdiff
path: root/src/astbranch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/astbranch.cpp')
-rw-r--r--src/astbranch.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/astbranch.cpp b/src/astbranch.cpp
new file mode 100644
index 0000000..a6aa21c
--- /dev/null
+++ b/src/astbranch.cpp
@@ -0,0 +1,44 @@
1#include "astbranch.h"
2
3AstBranch::AstBranch( Type eType ) :
4 AstNode( eType )
5{
6}
7
8AstBranch::~AstBranch()
9{
10}
11
12void AstBranch::addBranch()
13{
14 lBranch.append( NodeList() );
15}
16
17void AstBranch::addNode( AstNode *pNode )
18{
19 lBranch.last().append( pNode );
20}
21
22AstBranch::BranchList::const_iterator AstBranch::getBranchBegin() const
23{
24 return lBranch.begin();
25}
26
27Bu::Formatter &operator<<( Bu::Formatter &f, const AstBranch &l )
28{
29 f.incIndent();
30 f << ":";
31 for( AstBranch::BranchList::const_iterator i = l.getBranchBegin(); i; i++ )
32 {
33 f << f.nl << "Branch:";
34 f.incIndent();
35 for( AstBranch::NodeList::const_iterator j = i->begin(); j; j++ )
36 {
37 f << f.nl << **j;
38 }
39 f.decIndent();
40 }
41 f.decIndent();
42 return f;
43}
44