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

{{ at the end of an f-string string doesn't parse #73

Closed
verhovsky opened this issue Sep 20, 2021 · 2 comments
Closed

{{ at the end of an f-string string doesn't parse #73

verhovsky opened this issue Sep 20, 2021 · 2 comments

Comments

@verhovsky
Copy link

{{ is used to write a literal "{" in an f-string, but it's not parsed correctly if it's at the end of the string

f"{my_var} {{"
module [0, 0] - [1, 0]
  ERROR [0, 0] - [0, 14]
    interpolation [0, 2] - [0, 10]
      identifier [0, 3] - [0, 9]

Adding a space after the {{ causes it to parses correctly:

f"{my_var} {{ "
module [0, 0] - [1, 0]
  expression_statement [0, 0] - [0, 15]
    string [0, 0] - [0, 15]
      interpolation [0, 2] - [0, 10]
        identifier [0, 3] - [0, 9]
@verhovsky verhovsky changed the title {{ at the end of an f-string string doesn't parse correctly {{ at the end of an f-string string doesn't parse Sep 20, 2021
@lunixbochs
Copy link
Collaborator

These are the Python bindings. Are you looking for the Python grammar? https://github.com/tree-sitter/tree-sitter-python

@verhovsky
Copy link
Author

verhovsky commented Sep 20, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants