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): ...@@ -110,16 +110,16 @@ class ExpressionBase(object):
return not self.is_leaf() and self.op in [OP_ADD, OP_SUB, OP_MUL] return not self.is_leaf() and self.op in [OP_ADD, OP_SUB, OP_MUL]
def is_identifier(self): def is_identifier(self):
return self.is_leaf() and self.type & TYPE_IDENTIFIER return self.type == TYPE_IDENTIFIER
def is_int(self): def is_int(self):
return self.is_leaf() and self.type & TYPE_INTEGER return self.type == TYPE_INTEGER
def is_float(self): def is_float(self):
return self.is_leaf() and self.type & TYPE_FLOAT return self.type == TYPE_FLOAT
def is_numeric(self): 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): def __add__(self, other):
return ExpressionNode('+', self, to_expression(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