Reputation: 3918
Ive been looking at the Arithmetics example that comes with xtext and I stumbled upon the Calculator.java class under the org.eclipse.xtext.example.arithmetics.interpreter package but I cannot find any reference to it.
I understand that this class is used to walk the AST and evaluate the expressions but who is calling it and how is it registered?
I have a similar example which I am setting up from scratch and using the arithmetics as an example, however I dont know how to register the AST walker so that each time a tree is visited the particular method is triggered as in the Calculator class.
Upvotes: 0
Views: 773
Reputation: 3122
If you right-click the Calculator
class (either directly within the Java Editor or in the Package Explorer) and select References -> Workspace you will get listed all occurrences of the Calculator
type. You'll see that it is used in the ArthimeticsValidator
and InterpreterAutoEdit
types, where the latter is responsible for actually evaluating an expression within its evaluate
method. From the InterpreterAutoEdit
class, you can work your way up and see that it is registered via the ArthimeticsUiModule
.
Upvotes: 1