baron icon indicating copy to clipboard operation
baron copied to clipboard

unindented comment breaks parsing

Open Psycojoker opened this issue 6 years ago • 2 comments

This isolated situation broke baron parsing, if the comment is indented everything is fine.

def a():
#   stuff
    pass

if __name__ == '__main__':
    pass

Psycojoker avatar Aug 11 '18 20:08 Psycojoker

Another case

try:
    pass
except:
# 
    def a():
        pass

Psycojoker avatar Aug 11 '18 21:08 Psycojoker

I am still forced to remove all comments from code before parsing because wrongly indented comments break the parser. Could comment-only lines be tokenized as a whole, together with their initial space? This would probably fix the wrong indentation entirely.

asterbini avatar Jul 26 '20 18:07 asterbini