Message361535
> 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. |
|
Date |
User |
Action |
Args |
2020-02-07 03:32:04 | lys.nikolaou | set | recipients:
+ lys.nikolaou, gvanrossum, eric.smith, pablogsal |
2020-02-07 03:32:04 | lys.nikolaou | set | messageid: <1581046324.33.0.339573877878.issue39564@roundup.psfhosted.org> |
2020-02-07 03:32:04 | lys.nikolaou | link | issue39564 messages |
2020-02-07 03:32:04 | lys.nikolaou | create | |
|