bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#67529: 29.1; Python: syntax category of code in f-strings marked as


From: Daniel Fleischer
Subject: bug#67529: 29.1; Python: syntax category of code in f-strings marked as string
Date: Wed, 29 Nov 2023 18:10:23 +0200
User-agent: mu4e 1.11.22; emacs 29.1


Hi, in python f-strings can have python code inside them:

f"Two plus two is {2+2}"
f"The value of a is {a}"
f"The first item in arr is {arr[0]}"

The function `python--font-lock-f-strings` correctly fontify what's inside the {} as code.
However syntax analysis show the content inside {} as string; run
`(syntax-ppss-context (syntax-ppss (point)))` to see. This has semantic implications, for example the package `smart-scan` can jump between occurrences of a symbol but it won't identify the symbol in a string/comment. Maybe there are other packages which use this syntax information.
Daniel





reply via email to

[Prev in Thread] Current Thread [Next in Thread]