Closed gvariable closed 1 year ago
Hi @gvariable. I'm afraid I won't be able to fix this.
See, ast_comments inherits all the basic parsing logic from the original ast. From the ast perspective, any logical block ends with the last "real" ast-statement:
if a: # <- If starts
# c1
do_something_1() # <- If.body starts
# c2
do_something_2() # <- If.body ends. If ends
# c3 # <- not If
# c4 # <- same as c3
There's no difference between c3 and c4. Except for the indentation which doesn't follow any particular language rules. Current behavior is the expected behavior. That's why I'll skip this issue and mark it as "won't fix". At least for now
Current I have this demand, I want to base ast_comment for developing my own version, but I'm not very familiar with it. Do you have any suggestions?
Hi. After #20 current behavior matches expected
Say here is the source code I want to do some transformation like replace codes between
#### Your solution ####
and "#### End of solution ####" withpass
. Compared with the source code, I got the wrong indention structure.Expected Behavior
The code generated will have the identical indentation format as the original source code.
Current Behavior