Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python 3.6 f-string prefix not recognized #1156

Closed
Anteru opened this issue Aug 31, 2019 · 1 comment
Closed

python 3.6 f-string prefix not recognized #1156

Anteru opened this issue Aug 31, 2019 · 1 comment
Labels
S-minor severity: minor T-bug type: a bug X-imported imported from Bitbucket

Comments

@Anteru
Copy link
Collaborator

Anteru commented Aug 31, 2019

(Original issue 1452 created by t-makaro on 2018-06-24T01:46:34.574468+00:00)

'u','b','r','rb','br' (and their capitalized variants) are parsed by the Python 3 lexer as Token.Literal.String.Affix.

'f','rf','fr' (and their capitalized variants) are parsed as Token.Name.

To reproduce:

from pygments.lexer.python import Python3Lexer
lexer = Python3Lexer()

code1 = 'f"str"'
code2 = 'r"str"'
print(list(lexer.get_tokens(code1)))
print(list(lexer.get_tokens(code2)))

code2 tokenizes fine, but code 1 tokenizes wrongly.

@Anteru Anteru added T-bug type: a bug X-imported imported from Bitbucket S-minor severity: minor labels Aug 31, 2019
@Anteru
Copy link
Collaborator Author

Anteru commented Aug 31, 2019

(Original comment by takluyver on 2018-06-24T07:29:32.831114+00:00)

Looks like there's a PR for it here: https://bitbucket.org/birkenfeld/pygments-main/pull-requests/702/added-lexing-for-the-f-prefix-for-f/diff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-minor severity: minor T-bug type: a bug X-imported imported from Bitbucket
Projects
None yet
Development

No branches or pull requests

1 participant