check for invertability in parser

This commit is contained in:
Marcell Vazquez-Chanlatte 2017-09-27 21:31:46 -07:00
parent bbe76b714c
commit 0367760f1b
3 changed files with 38 additions and 36 deletions

View file

@ -194,3 +194,17 @@ class Neg(namedtuple('Neg', ['arg']), AST):
def __hash__(self):
# TODO: compute hash based on contents
return hash(repr(self))
class Next(namedtuple('Next', ['arg']), AST):
__slots__ = ()
def __repr__(self):
return f"X({self.arg})"
def children(self):
return [self.arg]
def __hash__(self):
# TODO: compute hash based on contents
return hash(repr(self))