Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

empty tuples are not added any more to the AST after validation.

That is, a validation method can return tuple() to indicate valid AST
node yet not add it to the tree.
  • Loading branch information...
commit b2ac0d5088f88494077d97df1ea9d12166ecb32d 1 parent dda792f
Damien Leroux authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 jupyLR/stack.py
4 jupyLR/stack.py
View
@@ -9,6 +9,7 @@ def printlist(l, pfx):
class stack_item(object):
+
def __init__(self, prev, x):
self.prev = prev
self.data = x
@@ -26,6 +27,7 @@ def __str__(self):
class stack(object):
+
def __init__(self, A):
self.active = []
self.A = A
@@ -82,7 +84,7 @@ def reduce(self, node, ruleidx):
ast = tuple(chain([name], tokens))
ok = self.A.validate_ast(ast)
if ok is not None:
- ok = (ok,)
+ ok = (ok != tuple()) and (ok,) or tuple()
else:
ast = tokens
ok = ast
Please sign in to comment.
Something went wrong with that request. Please try again.