Add exception for invalid expression

This commit is contained in:
Lafrite 2014-12-21 16:03:53 +01:00
parent 027a3ac57a
commit e3d1870d33
1 changed files with 4 additions and 1 deletions

View File

@ -40,7 +40,10 @@ class Render(object):
else: else:
operandeStack.push(self.render(token)()) operandeStack.push(self.render(token)())
return operandeStack.pop() if len(operandeStack) > 1:
raise ValueError("This postfix_tokens is not a valid expression")
else:
return operandeStack.pop()
def txt_render(token): def txt_render(token):
def render(*args): def render(*args):