-
Book Overview & Buying
-
Table Of Contents
Implementing Domain-Specific Languages with Xtext and Xtend
By :
In this chapter you learned how to implement constraint checks, using the Xtext validator mechanism based on @Check annotated methods. Just by implementing a custom validator and calling the method error or warning with the appropriate information, Xtext produces error and warning markers that result in marking the text regions as well as showing the markers in the various views in Eclipse.
We also showed how to implement quickfixes. Since Xtext automatically synchronizes the DSL editor's contents with the EMF model of the AST, we can simply modify such model without dealing with the textual representation of the program.
In the next chapter we will write a code generator for the Entities DSL implemented in Xtend, relying on its advanced features for code generation: starting from a program written in our Entities DSL, we will generate the corresponding Java code. You will see that Xtext automatically integrates your code generator into the building infrastructure of Eclipse.