-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refine the formatting of generated Python3 code #4708
base: dev
Are you sure you want to change the base?
Conversation
@@ -829,7 +874,7 @@ class <lexer.name>(<if(superClass)><superClass><else>Lexer<endif>): | |||
SerializedATN(model) ::= << | |||
def serializedATN(): | |||
return [ | |||
<model.serialized: {s | <s>}; separator=",", wrap> | |||
<model.serialized: {s | <s>}; separator=", ", wrap> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found this rule to be close to what I wanted, except that there remains a trailing whitespace when a line is wrapped. I didn't know how to fix this, and figured it was good enough for now.
2da4d34
to
7a89e15
Compare
Thanks for this but it breaks the build |
30218cd
to
b5e3997
Compare
Hi, looks like you need to rebase this PR ? |
Signed-off-by: Phil Elson <[email protected]>
Signed-off-by: Phil Elson <[email protected]>
b5e3997
to
bb10cd6
Compare
Yes, it was related to #4726 which touched some code that got removed in this PR. Should be all fixed. |
Signed-off-by: Phil Elson <[email protected]>
9b484f6
to
ac3fe8b
Compare
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 thecheckVersion
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.