#ifndef AST_NODE_H #define AST_NODE_H #include class AstNode { friend Bu::Formatter &operator<<( Bu::Formatter &f, const AstNode &n ); public: enum Type { tLeaf = 0x01000000, tNot = 0x01000001, tComp = 0x01000002, tCompGt = 0x01000003, tCompLt = 0x01000004, tCompGtEq = 0x01000005, tCompLtEq = 0x01000006, tStore = 0x01000007, tAnd = 0x01000008, tOr = 0x01000009, tPlus = 0x0100000A, tMinus = 0x0100000B, tDivide = 0x0100000C, tMultiply = 0x0100000D, tPlusStore = 0x0100000E, tMinusStore = 0x0100000F, tDivideStore = 0x01000010, tMultiplyStore = 0x01000011, tNegate = 0x01000012, tIn = 0x01000013, tGoto = 0x01000014, tSwap = 0x01000015, tLeafLiteral = 0x02000000, tVarName = 0x02000001, tLiteral = 0x02000002, tFuncCall = 0x02000003, tBranch = 0x04000000, tScope = 0x04000001, tIf = 0x04000002, tForEach = 0x04000003, tWhile = 0x04000004, tTypeMask = 0x07000000, }; AstNode( Type eType ); virtual ~AstNode(); Type getType() const { return eType; } private: Type eType; }; Bu::Formatter &operator<<( Bu::Formatter &f, AstNode::Type t ); Bu::Formatter &operator<<( Bu::Formatter &f, const AstNode &n ); #endif