Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext Parser - Enhance parsed model
Xtext Parser - Enhance parsed model [message #1229117] Wed, 08 January 2014 19:03 Go to next message
Florian Pirchner is currently offline Florian PirchnerFriend
Messages: 94
Registered: July 2009
Member

Hi,

i am trying to enhance the parsed model, but i am not sure what is the best place for.

In my DSL i have an semantic element called "versioned" with type boolean.
If versioned == true in Xtext model, i would like to add semantic model elements to the parse result. A feature for fromDate and one for untilDate.

So the user only has to define:

versioned entity {
   int id;
   String name;
   ...
}


and the parser adds the

...
   Date validFrom;
   Date validUntil;
...


under the hood.


So i can use these features in the model inferrer to create java fields and accessor for them.


Is there a common way to enhance the parser result that way?


Thanks Florian

[Updated on: Wed, 08 January 2014 19:04]

Report message to a moderator

Re: Xtext Parser - Enhance parsed model [message #1229119 is a reply to message #1229117] Wed, 08 January 2014 19:09 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

i am not sure if i got you but why dont you do it completely in the inferrer?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext Parser - Enhance parsed model [message #1229123 is a reply to message #1229119] Wed, 08 January 2014 19:16 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
P.S.

this is usually (in non jvmmodelinferrer languages) done by a IDerivedStateComputer but
JvmModelAssociator is such a IDerivedStateComputer and delegates to the inferrer.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext Parser - Enhance parsed model [message #1230342 is a reply to message #1229117] Sat, 11 January 2014 18:26 Go to previous message
Florian Pirchner is currently offline Florian PirchnerFriend
Messages: 94
Registered: July 2009
Member

Hi,

i can not do in the inferrer since i need the semantic element for further processing in the semantic model.

But i extended the Linker and added stuff there. It works pretty fine.

Adding attributes is simple since no resolving has to be done.
Adding crossreferences was bit harder, but using proxies it also work pretty good.

Thanks for input...

Best Florian
Previous Topic:Population of emf model data values in content assist
Next Topic:Xtext (Xbase) QualifiedName not parsed completely
Goto Forum:
  


Current Time: Fri Mar 29 05:48:25 GMT 2024

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

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

Back to the top