check for invertability in parser
This commit is contained in:
parent
bbe76b714c
commit
0367760f1b
3 changed files with 38 additions and 36 deletions
14
stl/ast.py
14
stl/ast.py
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue