cenotelie / hime

Apache License 2.0
27 stars 4 forks source link

How do you get AST nodes from an action visitor? #77

Open myblindy opened 2 years ago

myblindy commented 2 years ago

As the question says, inside an action visitor I have method overloads of the type:

public override void OnVariableDefinition(Symbol head, SemanticBody body)

But neither head or body[i] where i is an integer seem to link to the AST nodes, only to the symbols (ie what kind of node it is). That's not useful for me, because I'm trying to parse something like:

var a = 10;

And all this tells me is that there is an expression, but not what the expression actually is. The expression is actually parsed correctly after the parser finishes and I inspect the AST, but I don't see how to get the AST nodes from my action while it's still parsing.