| [news.eclipse.modeling.tmf] Re: looking for a xtext C/Java like expression language |
Achim,
Michael,
We're embedding Xtend expressions in our grammar to do that. The major drawback is that the expressions themselves are not captured by grammar rules, but are instead defined within a String literal. So to the user of the language, it looks a bit like this:
define template 'ClassDescription' for ecore::EClass
if '!this.isAbstract && this.eAttributes.size() > 0'
heading '"EClass " + this.name'
body
...
end body
end template
But using Xtend has to nice advantages:
1) We can reuse the Xtend content assist facility. So at the right places, we just delegate from our Xtext language content assist code to Xtend content assist. Works like a charm.
Regards,
--knut