we-like-parsers / cpython

Here we work on integrating pegen into CPython; use branch 'pegen'
https://github.com/gvanrossum/pegen
Other
1 stars 0 forks source link

allow multiline debug expresisons #165

Closed isidentical closed 2 years ago

isidentical commented 2 years ago

Resolves #151. WIP (might worth to give it a shot at adapting this to use interactive_src, not sure).

pablogsal commented 2 years ago

I think something is wrong when we have nested expressions. For example, this seems to work correctly:

>>> f"sdfsdf { 1+2
...  +3=:2f} ioij"
'sdfsdf  1+2\n +3=6.000000 ioij'

but this does not:

>>> f"sdfsdf { 1+2
...  +3=:{1+1}f} ioij"
'sdfsdf 1+16.000000 ioij'

We are incorrectly resetting the buffer when we see the second pair of "{". I think the solution may be that if we already have the buffer set and we see a relevant "{" we don't do anything. But I don't know if there are more rules in the current parser regarding debug expressions and nested f-string expressions.