Skip to content

Commit 00b0196

Browse files
committed
fixed highlighting of prefixed strings
1 parent a25fc44 commit 00b0196

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

bpython/cli.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,13 @@ def next_token_inside_string(s, inside_string):
168168
"""Given a code string s and an initial state inside_string, return
169169
whether the next token will be inside a string or not."""
170170
for token, value in PythonLexer().get_tokens(s):
171-
if token is Token.String and value in ['"""', "'''", '"', "'"]:
172-
if not inside_string:
173-
inside_string = value
174-
elif value == inside_string:
175-
inside_string = False
171+
if token is Token.String:
172+
value = value.lstrip('bBrRuU')
173+
if value in ['"""', "'''", '"', "'"]:
174+
if not inside_string:
175+
inside_string = value
176+
elif value == inside_string:
177+
inside_string = False
176178
return inside_string
177179

178180

0 commit comments

Comments
 (0)