-
Notifications
You must be signed in to change notification settings - Fork 608
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
Beautify Node.show() for parse tree printing #518
Conversation
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.
This file is auto-generated -- see comment at the top. This change should be made in the generator -- _ast_gen.py
My mistake. Change has now been made in the _ast_gen.py file. |
Tests are failing |
pycparser/c_ast.py
Outdated
|
||
children = self.children() | ||
if len(children) > 0: | ||
_, lastChild = children[-1] |
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 think you should be able to accomplish this in a cleaner way using enumerate
in the for
loop below. Then you can trivially find if the index is the one before last and you won't need this condition and lastChild
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 think I understood what you meant but if not let me know. Its been changed now.
Added some more minor comments; also - all the tests fail on CI, please fix |
Rather than just indents, use an actual tree structure for better displaying syntax trees.
Before
After: