add tree builder, fix multiple bugs
This commit is contained in:
+11
-13
@@ -7,18 +7,6 @@
|
||||
|
||||
namespace Expression {
|
||||
|
||||
#if 0
|
||||
namespace TokenType {
|
||||
|
||||
enum TokenType {
|
||||
VAR,
|
||||
CONST,
|
||||
OPERATOR
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
class Token {
|
||||
public:
|
||||
enum TokenType {
|
||||
@@ -310,7 +298,17 @@ class TreeNode {
|
||||
public:
|
||||
TreeNode *l; // left hand
|
||||
TreeNode *r; // right hand
|
||||
Token o; // operator
|
||||
Token o; // if operator, left and right hands are valid
|
||||
// if value, left and right hands should be null
|
||||
|
||||
explicit TreeNode(void)
|
||||
{
|
||||
}
|
||||
|
||||
explicit TreeNode(const Token t)
|
||||
: o(t)
|
||||
{
|
||||
}
|
||||
|
||||
~TreeNode()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user