aboutsummaryrefslogtreecommitdiff
path: root/src/astbranch.cpp
blob: 83ecdd7a0307907ce5bedbae9c3ecadde4b52e56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "astbranch.h"

AstBranch::AstBranch( const Location &loc, Type eType ) :
    AstNode( loc, eType )
{
}

AstBranch::~AstBranch()
{
}

void AstBranch::addBranch()
{
    lBranch.append( NodeList() );
}

void AstBranch::addNode( AstNode *pNode )
{
    lBranch.last().append( pNode );
}

AstBranch::BranchList::const_iterator AstBranch::getBranchBegin() const
{
    return lBranch.begin();
}

Bu::Formatter &operator<<( Bu::Formatter &f, const AstBranch &l )
{
    f.incIndent();
    f << ":";
    for( AstBranch::BranchList::const_iterator i = l.getBranchBegin(); i; i++ )
    {
        f << f.nl << "Branch:";
        f.incIndent();
        for( AstBranch::NodeList::const_iterator j = i->begin(); j; j++ )
        {
            f << f.nl << **j;
        }
        f.decIndent();
    }
    f.decIndent();
    return f;
}