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
I was wondering if there is any plan to support parse tree visitors that return something as in the Java implementation of antlr. I find this is a convenient way to write a visitor that constructs AST node objects. Concretely, the current implementation of visit_terminal has signature: fn visit_terminal(self, TerminalNode<...>) {},
but if it were instead
fn visit_terminal<T>(self, TerminalNode<...>) -> T {}
(and similar for the other functions in the ParseTreeVisitor trait)
then it would be possible to write a visitor that builds an AST by returning the AST nodes with each of these calls.
The text was updated successfully, but these errors were encountered:
I was wondering if there is any plan to support parse tree visitors that return something as in the Java implementation of antlr. I find this is a convenient way to write a visitor that constructs AST node objects. Concretely, the current implementation of visit_terminal has signature:
fn visit_terminal(self, TerminalNode<...>) {}
,but if it were instead
fn visit_terminal<T>(self, TerminalNode<...>) -> T {}
(and similar for the other functions in the ParseTreeVisitor trait)
then it would be possible to write a visitor that builds an AST by returning the AST nodes with each of these calls.
The text was updated successfully, but these errors were encountered: