Strange unicode characters are error tokens. Fixes #587.

This commit is contained in:
Dave Halter
2016-07-13 08:53:08 +02:00
parent c26f740dcd
commit 927534a8d5
2 changed files with 10 additions and 1 deletions

View File

@@ -303,8 +303,14 @@ def generate_tokens(readline, use_exact_op_types=False):
elif token in ')]}':
paren_level -= 1
try:
# This check is needed in any case to check if it's a valid
# operator or just some random unicode character.
exact_type = opmap[token]
except KeyError:
exact_type = typ = ERRORTOKEN
if use_exact_op_types:
typ = opmap[token]
typ = exact_type
else:
typ = OP
yield TokenInfo(typ, token, spos, prefix)

View File

@@ -215,6 +215,9 @@ if 1:
#? str()
xyz
#?
¹.
# -----------------
# exceptions
# -----------------