antlr4 icon indicating copy to clipboard operation
antlr4 copied to clipboard

Refine the formatting of generated Python3 code

Open pelson opened this issue 1 year ago • 3 comments
trafficstars

This handles mostly whitespace improvement to be more aligned with PEP-8 by default. It doesn't yet fix a number of the newline issues that crop up.

Additionally, it improves the typing of a number of obvious methods. The typing remains incomplete however.

The changes to XPathLexer.py are fully auto-generated (with the exception of the checkVersion call).

In the future, I would work towards removing the from antlr4 import * and replacing it with named imports.

I have validated this against a mildly complex parser grammar in https://github.com/SciTools/cf-units/blob/main/cf_units/_udunits2_parser/udunits2Parser.g4.

pelson avatar Oct 01 '24 04:10 pelson