Re: extending ast.parse with some lib2to3.pytree features

Neil Girdhar wrote:
I wish this had gotten more attention! :)
I wonder what the various projects are doing to handle the latest version of Python, if they need a parse tree with whitespace information. (The projects I know of are yapf, black, mypy, pytype, kythe -- are there others?) ast.parse() has an option `type_comments`, so certain kinds of comments are handled -- I wonder how much work it would be to extend this to handle all whitespace?

El dom, 21 nov 2021 a las 14:35, Peter Ludemann (<peter.ludemann@gmail.com>) escribió:
mypy just uses the ast module; it doesn't care about whitespace. For Black, we're using a patched version of lib2to3. Batuhan kindly contributed a patch that extends our version of lib2to3 to mostly parse the match statement (https://github.com/psf/black/pull/2586). And I had never heard of kythe, so I am going to look that up now.

Neil Girdhar wrote:
I wish this had gotten more attention! :)
I wonder what the various projects are doing to handle the latest version of Python, if they need a parse tree with whitespace information. (The projects I know of are yapf, black, mypy, pytype, kythe -- are there others?) ast.parse() has an option `type_comments`, so certain kinds of comments are handled -- I wonder how much work it would be to extend this to handle all whitespace?

El dom, 21 nov 2021 a las 14:35, Peter Ludemann (<peter.ludemann@gmail.com>) escribió:
mypy just uses the ast module; it doesn't care about whitespace. For Black, we're using a patched version of lib2to3. Batuhan kindly contributed a patch that extends our version of lib2to3 to mostly parse the match statement (https://github.com/psf/black/pull/2586). And I had never heard of kythe, so I am going to look that up now.
participants (3)
-
Jelle Zijlstra
-
Neil Girdhar
-
Peter Ludemann