Chapter 4. Validation

In this chapter, we will introduce the concept of validation, and in particular, the Xtext mechanism to implement validation: the validator. With validation, you can implement additional constraint checks of a DSL, which cannot be done at parsing time. Xtext allows you to implement such constraint checks in an easy and declarative way. You only need to communicate to Xtext the possible errors or warnings, and it will take care of generating the error markers accordingly in the IDE. The validation will take place in the background while the user of the DSL is typing in the editor so that an immediate feedback is provided. We will also show how to implement quickfixes corresponding to the errors and warnings generated during ...

Get Implementing Domain-Specific Languages with Xtext and Xtend - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.