invalid code testing

This commit is contained in:
David Halter
2012-04-25 10:21:20 +02:00
parent e466508b4d
commit 0d083782ab
3 changed files with 20 additions and 3 deletions

View File

@@ -157,4 +157,4 @@ def globalfunc():
c1().c3(1). c1().c3(1)

View File

@@ -585,6 +585,10 @@ class Statement(Simple):
# the token is a Name, which has already been parsed # the token is a Name, which has already been parsed
tok = tok_temp tok = tok_temp
token_type = None token_type = None
except ValueError:
debug.warning("unkown value, shouldn't happen",
tok_temp, type(tok_temp))
raise
else: else:
if tok in ['return', 'yield'] or level == 0 and \ if tok in ['return', 'yield'] or level == 0 and \
'=' in tok and not tok in ['>=', '<=', '==', '!=']: '=' in tok and not tok in ['>=', '<=', '==', '!=']:
@@ -1137,9 +1141,9 @@ class PyFuzzyParser(object):
# statement. This is a hack, but I could not come up # statement. This is a hack, but I could not come up
# with a better solution. # with a better solution.
# This is basically a reset of the statement. # This is basically a reset of the statement.
debug.warning('return in statement @%s', tok_list, debug.warning('keyword in statement @%s', tok_list,
self.line_nr) self.line_nr)
tok_list = [tok] tok_list = [self.current]
set_vars = [] set_vars = []
used_funcs = [] used_funcs = []
used_vars = [] used_vars = []

View File

@@ -0,0 +1,13 @@
def openbrace():
asdf = 3
asdf
asdf(
return 1
#? ['real']
openbrace().real
blub([
#? ['real']
openbrace().real