Customizing semantic analysis for AST nodes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Customizing semantic analysis for AST nodes

Uko2
Hi, I have two questions about semantic analysis.

I’m working with expressions a lot now. And I want to highlight them, but I don’t want to pay attention for undeclared variables. So in terms of analysis it would be nice to know global variables, but I don’t care about having marked others as undeclared.

Second thing is more of a disturbing functionality. If you have `ast` variable which is an RBPatternVariableNode and you do `ast doSemanticAnalysis` after that ast may end up being a RBVariableNode. I find this annoying because I don’t expect my object to change just because of an analysis.

Uko
Reply | Threaded
Open this post in threaded view
|

Re: Customizing semantic analysis for AST nodes

Nicolai Hess-3-2


2016-07-27 15:16 GMT+02:00 Yuriy Tymchuk <[hidden email]>:
Hi, I have two questions about semantic analysis.

I’m working with expressions a lot now. And I want to highlight them, but I don’t want to pay attention for undeclared variables. So in terms of analysis it would be nice to know global variables, but I don’t care about having marked others as undeclared.

Second thing is more of a disturbing functionality. If you have `ast` variable which is an RBPatternVariableNode and you do `ast doSemanticAnalysis` after that ast may end up being a RBVariableNode. I find this annoying because I don’t expect my object to change just because of an analysis.

But it is the same that happens with any global variable. After parsing an expression like
RBPatternParser parseExpression:'Morph draw:`arg'
Morph is just a RBVariableNode and you need to call #doSemanticAnalysis to get a RBGlobalNode instead.

But I guess #doSemanticAnalysis is just not supposed to work with pattern nodes.


 

Uko