You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When pretty printing some AST nodes, it would be useful to get access to their position in the generated code. The SourcePrinter tracks the position (see getCursor). So one could add an option in the PrettyPrinterConfiguration and when the option is set one could do something like:
@Override
public void visit(final NameExpr n, final Void arg) {
val myStartPos = printer.getCursor();
// current logic
val myEndPos = printer.getCursor();
// store the start and end pos in the node itself, if the option is set
}
This is one case where an approach based on visitors make this work cumbersome as one has to repeat the same logic in all visit methods.
What do you think? Would this be useful? Is there an alternative way to get this result?
The text was updated successfully, but these errors were encountered:
When pretty printing some AST nodes, it would be useful to get access to their position in the generated code. The SourcePrinter tracks the position (see getCursor). So one could add an option in the PrettyPrinterConfiguration and when the option is set one could do something like:
This is one case where an approach based on visitors make this work cumbersome as one has to repeat the same logic in all visit methods.
What do you think? Would this be useful? Is there an alternative way to get this result?
The text was updated successfully, but these errors were encountered: