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?
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?