This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lys.nikolaou
Recipients eric.smith, gvanrossum, lys.nikolaou, pablogsal
Date 2020-02-07.03:32:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1581046324.33.0.339573877878.issue39564@roundup.psfhosted.org>
In-reply-to
Content
> Can I ask how pegen solved this problem? Did you move parsing of f-strings into the grammar?

No, we actually do a very similar thing to what ast.c does.

I think there is only one major difference between what pegen does and what ast.c does. If I understand correctly, fstring_compile_expr calls fstring_fix_node_location with parent set to the whole STRING+ node. We OTOH only pass as parent the current STRING token (we work with tokens returned by the tokenizer) and then walk the AST tree and adjust the line/col_offset based on that. I'm not sure that this is bug-free, but after some testing, I could find any obvious errors.

If you want, you can take a loot at the code on https://github.com/gvanrossum/pegen/pull/183.
History
Date User Action Args
2020-02-07 03:32:04lys.nikolaousetrecipients: + lys.nikolaou, gvanrossum, eric.smith, pablogsal
2020-02-07 03:32:04lys.nikolaousetmessageid: <1581046324.33.0.339573877878.issue39564@roundup.psfhosted.org>
2020-02-07 03:32:04lys.nikolaoulinkissue39564 messages
2020-02-07 03:32:04lys.nikolaoucreate