[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.tmf] Re: looking for a xtext C/Java like expression language

Achim,

Achim Demelt wrote:
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



We're also embedding the Xtend expression language in some of our DSLs by letting the DSL extend the expression language. As a result the expressions don't need to be parsed as simple tokens. Although we have to make sure the grammars don't interfere.


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.


Interesting. Would you be able to share that code? Although I am not sure it would work quite the same in our case.


Regards,

--knut