Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Custom Language for Queries(Integrate with full text editor as XText)
Custom Language for Queries [message #1255977] Mon, 24 February 2014 20:38 Go to next message
Ioan Salau is currently offline Ioan Salau
Messages: 64
Registered: July 2009
Location: Toronto
Member

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 04:10 Go to previous messageGo to next message
Pierre-Charles David is currently offline Pierre-Charles David
Messages: 127
Registered: July 2009
Senior Member
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
Re: Custom Language for Queries [message #1256567 is a reply to message #1256279] Tue, 25 February 2014 10:15 Go to previous message
Ioan Salau is currently offline Ioan Salau
Messages: 64
Registered: July 2009
Location: Toronto
Member

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
Previous Topic:Finding the target of the edge for setting the label
Next Topic:Display subset of model elements
Goto Forum:
  


Current Time: Thu Aug 28 05:26:18 EDT 2014

Powered by FUDForum. Page generated in 0.01542 seconds