Custom Language for Queries [message #1255977] |
Tue, 25 February 2014 01:38 |
|
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 to accept my grammar only. Any documentation for this kind of extension?
3. Other solution?
Which option would be more appropriate and easy to implement?
Regards and thanks in advance,
Ioan
|
|
|
Re: Custom Language for Queries [message #1256279 is a reply to message #1255977] |
Tue, 25 February 2014 09:10 |
|
Hi.
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
org.eclipse.sirius.common.tools.internal.interpreter.VariableInterpreter
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
corresponding
org.eclipse.sirius.common.ui.tools.internal.interpreter.VariableProposalProvider.
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
org.eclipse.sirius.common.tools.api.interpreter.IInterpreter.provides(String)
is used to evaluate the expression.
Hope this helps.
Regards,
Pierre-Charles David
Pierre-Charles David - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Re: Custom Language for Queries [message #1256567 is a reply to message #1256279] |
Tue, 25 February 2014 15:15 |
|
Thanks Pierre-Charles for your answer. My language has a strict grammar which I can't change it. The grammar is very close with OCL grammar, but slightly different.
I was hoping that the "simple text field in the VSM editor (with optional support for code completion)." can be replaced with an XText editor in order to help the user to define Queries which are valid against my grammar and have context assist based on my grammar, syntax color, real time validation and so on. When I wrote "Sirius Text Editor", I was was referring to this simple text editor which currently supports only optional code completion.
Regards,
Ioan
|
|
|
Powered by
FUDForum. Page generated in 0.03376 seconds