#include "astnode.h" #include #include "astleaf.h" #include "astleafliteral.h" #include "astbranch.h" AstNode::AstNode( AstNode::Type eType ) : eType( eType ) { } AstNode::~AstNode() { } Bu::Formatter &operator<<( Bu::Formatter &f, AstNode::Type t ) { switch( t ) { case AstNode::tLeaf: return f << "!tLeaf!"; case AstNode::tNot: return f << "tNot"; case AstNode::tComp: return f << "tComp"; case AstNode::tCompGt: return f << "tCompGt"; case AstNode::tCompLt: return f << "tCompLt"; case AstNode::tCompGtEq: return f << "tCompGtEq"; case AstNode::tCompLtEq: return f << "tCompLtEq"; case AstNode::tStore: return f << "tStore"; case AstNode::tAnd: return f << "tAnd"; case AstNode::tOr: return f << "tOr"; case AstNode::tLeafLiteral: return f << "!tLeafLiteral!"; case AstNode::tVarName: return f << "tVarName"; case AstNode::tLiteral: return f << "tLiteral"; case AstNode::tFuncName: return f << "tFuncName"; case AstNode::tBranch: return f << "!tBranch!"; case AstNode::tScope: return f << "tScope"; case AstNode::tIf: return f << "tIf"; case AstNode::tForEach: return f << "tForEach"; case AstNode::tWhile: return f << "tWhile"; case AstNode::tTypeMask: return f << "!tTypeMask!"; } return f << "???"; } Bu::Formatter &operator<<( Bu::Formatter &f, const AstNode &n ) { switch( n.eType & AstNode::tTypeMask ) { case AstNode::tLeaf: return f << dynamic_cast(n); case AstNode::tLeafLiteral: return f << dynamic_cast(n); case AstNode::tBranch: return f << dynamic_cast(n); } return f << "!!!ERROR!!!"; }