Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Embedded Xtext editor with only a sub part of the Grammar of my DSL
Embedded Xtext editor with only a sub part of the Grammar of my DSL [message #1746939] Mon, 07 November 2016 21:22 Go to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 397
Registered: January 2014
Senior Member
Hi,

I have a rather complex DSL which is used in several places of my RCP 4diac. Now I have the task that I would like to have an editor which allows to edit only a sub part of my language.

Therefore my question would be if it is possible to set for an xtext editor (in my case an embedded editor) the root parser rule for the allowed grammar?

One solution I had in mind is to extract the grammar parts in questions into a separate xtext project and reference this new xtext project from the old. The drawback for this is that for the user it would look like to languages in the preferences. This is not really intuitive therefore I would prefer a single language solution.

Thanks in advance for any support.

BR,
Alois
Re: Embedded Xtext editor with only a sub part of the Grammar of my DSL [message #1746945 is a reply to message #1746939] Mon, 07 November 2016 23:28 Go to previous messageGo to next message
Jason Pell is currently offline Jason PellFriend
Messages: 55
Registered: February 2011
Member
eagerly awaiting any responses as I have this same need.
Re: Embedded Xtext editor with only a sub part of the Grammar of my DSL [message #1746958 is a reply to message #1746945] Tue, 08 November 2016 03:46 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11315
Registered: July 2009
Senior Member
There is the ability to set the parser rule in Xtext 2.11 coming in Jan.
I don't know if this feature is exposed enough to use it in this case
You can try the first beta from the milestones update site
The Xtext resource should have a setter for the entry rule with that version (setEnrtyPoint)


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Embedded Xtext editor with only a sub part of the Grammar of my DSL [message #1747034 is a reply to message #1746958] Tue, 08 November 2016 17:20 Go to previous message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 397
Registered: January 2014
Senior Member
After a colleague and I spent some time today to better understand how parsers and editors are setup in current Xtext we came to a solution which is also working with the current Xtext 2.10. You can overwrite the parser and the ui parser generated by xtext and let it inject the new parser in the module of your sublanguage. Furthermore you need to set an own file extension and configure resource providers in the ui plugin.xml. You can see the required changes in this commit [1] of 4diac-ide. I think it is easier to look at the code then that I explain here all the steps.

For me this seams also pretty maintainable as with the injections and the inheritance that we applied the generated code would just be updated and be available for both languages.


[1] https://sourceforge.net/p/fordiac/fordiac-ide/ci/ab0b1ed84057c2c3a26716bbe88412e1e965fbc9/tree/
Previous Topic:problem string concat operation OclUndefined ?
Next Topic:Import File
Goto Forum:
  


Current Time: Mon Oct 23 21:10:45 GMT 2017

Powered by FUDForum. Page generated in 0.04259 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software