Skip to content

python 3.6 f-string prefix not recognized #1156

@Anteru

Description

@Anteru

(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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    S-minorseverity: minorT-bugtype: a bugX-importedimported from Bitbucket

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions