I have written an extensive grammar for SQL and use the transformer to format SQL code.
I had two issues with which I need help:
1) Used the %ignore directive for matching and ignoring comments, so when I reconstruct the AST, I lose info on comments. Is there a way to incorporate that into the AST that is generated so that when I reconstruct the AST, I can put the comments alongside the text maybe via using some callback_function or developing custom Tokens.
2) This is only a slight issue but after transforming the entire tree and reconstructing it, is there a way to fix slight indentation issues present?
I'll be happy to share snippets from my code when I'm completely done
I have written an extensive grammar for SQL and use the transformer to format SQL code. I had two issues with which I need help:
1) Used the %ignore directive for matching and ignoring comments, so when I reconstruct the AST, I lose info on comments. Is there a way to incorporate that into the AST that is generated so that when I reconstruct the AST, I can put the comments alongside the text maybe via using some callback_function or developing custom Tokens. 2) This is only a slight issue but after transforming the entire tree and reconstructing it, is there a way to fix slight indentation issues present?
I'll be happy to share snippets from my code when I'm completely done