Skip to content

NEWLINE, INDENT, DEDENT tokens for pretty-printing #136

@baptisteroziere

Description

@baptisteroziere

Hello,
I'm working on something on a project that requires to work with the AST to do some modifications and also to pretty-print the AST (i.e. transform the AST into working source code). Right now, I can print all the tokens easily by searching the tree and printing all the leafs but I'm missing all the newlines, indentations, and dedentations, which are necessary in python. In the python 3 grammar, I can see that NEWLINE, INDENT and DEDENT tokens are defined but I cannot find them in the AST. Is it possible access the indentation and newline tokens in the AST?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions