0
votes

I am a baby in using Xtext and I am stuck in finding a solution to my problem. I have built the Xtext grammar of my DSL and also created a web-based editor using Ace. I would like to inject my Xtext Validator module as a dependency in my REST project and make it validating the DSL typed by the user on the web interface. After validating it, I want to display the error messages on the web if there's any. Otherwise, I would execute the corresponding operations.

What I know is that I need to build a DSL interpreter and export my Xtext project to a jar file. But, I don't have any idea which interface of Xtext that allows me to make use the grammar rules to validate the inbound string? Should I translate the string to EMF model first and use the IConcreteSyntaxValidator.validateObject() function? If yes, could you give me any example of how to do that?

Thanks in advance! Any help would be really appreciated!

1

1 Answers

0
votes

Please check the IResourceValidator and its validate method. That'll provide the correct answer. The IConcreteSyntaxValidator is for a very narrow usecase where you create objects in-memory by means of constructor calls and setter invocation and want to write these objects back to your language syntax. Probably not what you're doing there.