lark-parser / lark

Lark is a parsing toolkit for Python, built with a focus on ergonomics, performance and modularity.
MIT License
4.88k stars 414 forks source link

Updated Python grammar list literal to support `[*x]` #1232

Closed evtn closed 1 year ago

evtn commented 1 year ago

Previous version used _testlist_comp which allowed for either one test or 2 and more test_or_star_expr. This version also allows a list with one star_expr which is valid both in Python and in official Python grammar. Moreover it merges rules used in set and list (since those terminals differ only in that set literal cannot be empty)

evtn commented 1 year ago

Well, there is a suite that is used by PyPy, which is MIT-licensed and probably will be a good place to start https://github.com/mozillazg/pypy/tree/master/pypy/interpreter/pyparser/test (this is a mirror, but still)

I probably could spend some time on this, since my current project requires a fully working Python grammar anyways

erezsh commented 1 year ago

Thank you, @evtn ! If you would like to set up tests for the Python grammar, we'll be happy to include them in our test suite!