Commit 78227c82 authored by Taddeus Kroes's avatar Taddeus Kroes

Improved some boolean test methods for nodes.

- Removed useless is_leaf check, since that is implicit in type checking.
parent 6b90f930
......@@ -110,16 +110,16 @@ class ExpressionBase(object):
return not self.is_leaf() and self.op in [OP_ADD, OP_SUB, OP_MUL]
def is_identifier(self):
return self.is_leaf() and self.type & TYPE_IDENTIFIER
return self.type == TYPE_IDENTIFIER
def is_int(self):
return self.is_leaf() and self.type & TYPE_INTEGER
return self.type == TYPE_INTEGER
def is_float(self):
return self.is_leaf() and self.type & TYPE_FLOAT
return self.type == TYPE_FLOAT
def is_numeric(self):
return self.is_leaf() and self.type & (TYPE_FLOAT | TYPE_INTEGER)
return self.type & (TYPE_FLOAT | TYPE_INTEGER)
def __add__(self, other):
return ExpressionNode('+', self, to_expression(other))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment