restructure token breaks in statement parser

This commit is contained in:
Dave Halter
2014-03-05 14:39:21 +01:00
parent 7d7a86239c
commit 7222d70ecb
2 changed files with 6 additions and 9 deletions

View File

@@ -1013,14 +1013,11 @@ isinstance(c, (tokenize.Token, Operator)) else unicode(c)
elif tok in brackets.keys():
level += 1
if level == -1 and tok in closing_brackets \
or tok in added_breaks \
or level == 0 and (
if level == -1 or level == 0 and (
tok == ','
or tok in added_breaks
or maybe_dict and tok == ':'
or is_assignment(tok)
and break_on_assignment
):
or is_assignment(tok) and break_on_assignment):
end_pos = end_pos[0], end_pos[1] - 1
break

View File

@@ -131,7 +131,7 @@ a = [a if 1.0 else '' for a in [1] if [1.0]]
#? int() str()
a[0]
# with a dict in between
# with a dict literal
#? int()
[a for a,b in {1:2}.items()][0]