Lysandros Nikolaou <lisandros...@gmail.com> added the comment:

> I still see this problem with 3.10, which I thought might have fixed this.
Nope, that's still true in 3.10.

>I'm working on overhauling how these are calculated. But it's complex, and is 
>taking a while.
In short, the FormattedValue nodes all have the exact same lineno's and 
col_offset's, which are also identical to those of the enclosing JoinedStr 
node. These values are equal to lineno and col_offset of the first STRING token 
and end_lineno and end_col_offset of the last STRING token (note that the 
grammar accepts a STRING+ node).

> any ideas on this?
Moving f-string parsing to the parser, which we've been talking about lately, 
would solve this. But this will probably take some time, since I currently do 
not have the time. It's probably going to be a good project for this coming 
fall.

Another alternative, in case we don't want to wait until then, would be for the 
handwritten f-string parser to have its own instances of a lineno and 
col_offset, so that they can be used when the FormattedValue nodes are created. 
This would probably also require some effort though, so I'm not sure we want to 
do it, before we really know if we're gonnna proceed with the "moving f-string 
parsing to PEG" project.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37458>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to