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

Previous Next

Package: emacs;

Reported by: Daniel Fleischer <danflscr <at> gmail.com>

Date: Wed, 29 Nov 2023 16:27:01 UTC

Severity: normal

Found in version 29.1

To reply to this bug, email your comments to 67529 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#67529; Package emacs. (Wed, 29 Nov 2023 16:27:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Daniel Fleischer <danflscr <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 29 Nov 2023 16:27:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Daniel Fleischer <danflscr <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.1; Python: syntax category of code in f-strings marked as string
Date: Wed, 29 Nov 2023 18:10:23 +0200
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




This bug report was last modified 156 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.