GrammaTech / sel

Programmatic modification and evaluation of software
https://grammatech.github.io/sel/#Top
Other
166 stars 21 forks source link

`asts.ASTLanguage.Python`: invalid resulting indentation for class' docstring #23

Closed vfoltsgt closed 2 years ago

vfoltsgt commented 2 years ago

Have "test.py" python file:

class TestIndent:
    """\\ 
    """

Parse it:

import asts

with open("test.py") as f:
    text = f.read()

ast = asts.AST.from_string(text, language=asts.ASTLanguage.Python)
with open("test.parsed.py", "w") as f:
    f.write(ast.source_text)

The resulting "test.parsed.py" will have invalid indentation:

class TestIndent:
"""\\ 
    """
jaruchti commented 2 years ago

Moving to the internal issue tracker; thanks for the report!