mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 06:44:46 +08:00
Strange unicode characters are error tokens. Fixes #587.
This commit is contained in:
@@ -303,8 +303,14 @@ def generate_tokens(readline, use_exact_op_types=False):
|
|||||||
elif token in ')]}':
|
elif token in ')]}':
|
||||||
paren_level -= 1
|
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:
|
if use_exact_op_types:
|
||||||
typ = opmap[token]
|
typ = exact_type
|
||||||
else:
|
else:
|
||||||
typ = OP
|
typ = OP
|
||||||
yield TokenInfo(typ, token, spos, prefix)
|
yield TokenInfo(typ, token, spos, prefix)
|
||||||
|
|||||||
@@ -215,6 +215,9 @@ if 1:
|
|||||||
#? str()
|
#? str()
|
||||||
xyz
|
xyz
|
||||||
|
|
||||||
|
#?
|
||||||
|
¹.
|
||||||
|
|
||||||
# -----------------
|
# -----------------
|
||||||
# exceptions
|
# exceptions
|
||||||
# -----------------
|
# -----------------
|
||||||
|
|||||||
Reference in New Issue
Block a user