|Re: Custom Language for Queries [message #1256279 is a reply to message #1255977]
||Tue, 25 February 2014 09:10
|| Pierre-Charles David
Registered: July 2009
Le 25/02/2014 02:38, Ioan Salau a écrit :
> I found Eclipse Sirius project very interesting for my research. I am
> looking for some pointers regarding implementing Custom Language for
> Queries Interpreter. My language is very close with OCL. Based on Sirius
> documentation the Raw OCL is deprecated and is recommended to use
> Acceleo which is a super-set of raw OCL. I am wondering what is the best
> approach to implement my Custom Language and integrate into Sirius:
> 1. Use XText to define the grammar and generate the text editor.
> Since my language is closed enough with OCL and Acceleo is a super-set,
> I should be able to reuse the Acceleo Query/Interpreter. Basically,
> XText will be used to enforce only the syntax allowed by my language and
> other out of the box features from XText.
> 2. Customize Sirius Text Editor
What do you mean by "Sirius Text Editor"?
Queries specified in Viewpoint Specification Models (i.e. *.odesign
files) are stored as unstructured strings, and edited through a simple
text field in the VSM editor (with optional support for code completion).
It is only at runtime, when the evaluation of such an expression is
needed, that the strings are passed to the registered languages'
interpreters. You can define your own language using the
org.eclipse.sirius.common.expressionInterpreter extension point. A good
starting point to this how to do that is the
class, which gives raw access to Sirius variables through a simple
"var:foo" syntax. It is trivial enough that you can see how the
mechanics of plugging a custom interpreter works.
Support for code completion is provided through the
org.eclipse.sirius.common.proposalProvider extension point; see the
I'm not sure this answers your question, but that is how queries
currently work in Sirius: strings stored in VSMs, which are dispatched
at runtime to all the registered language interpreters, and the first
one which responds true to
is used to evaluate the expression.
Hope this helps.
Powered by FUDForum
. Page generated in 0.02065 seconds