code-generationxtextemfxtendxbase

Xtext Code Generation: Get raw String from XBlockExpression


Currently I am working on code generation based on an Xtext-DSL. Now I am facing the following problem:

I'm generating an .xtend file with my own implementation of the IGenerator interface. Everything works flawless but I can't access the raw String from an XBlockExpression in my DSL. I can only access the EMF-AST with all the attributes but re-generating the raw code from the model seems like a lot of overhead since I really just need all the code from withtin the XBlockExpression.

Does anybody have an idea?


Solution

  • you can always access the textual representation via the so called node model. the class NodeModelUtilsgives you access to it e.g. by calling findActualNodeFor. The resulting INode can be asked for its text