lark icon indicating copy to clipboard operation
lark copied to clipboard

Fixes to the python grammar

Open MegaIng opened this issue 8 months ago • 0 comments

This PR updates the Python grammar to be a bit more up-to-date and correct, and it suggests a set of tests that could be run, although I am not sure if it's a good idea to include those in the repo.

As I wrote @erezsh on gitter, a big problem is that the with statement can't be done correctly, which is why those tests currently get commented out during downloading of the files from the Cpython github. Not sure if there is a good solution for us. This syntax change is part of the reason CPython switched over the PEG parser away from something in the LR family. The changes to the python grammar are very fine grained since I have had bad experiences with trying to do a monolithic change to that grammar, but this could be squished later.

This is a draft since the grammar changes are incomplete, and the tests definitely aren't ready to be uploaded (if they should exists at all).

Note that the grammar changes are in some sense backwards incompatible. Unsure if we care about that.

MegaIng avatar Oct 07 '23 02:10 MegaIng