Implicit Model Elements [message #1844565] |
Thu, 16 September 2021 11:30  |
Eclipse User |
|
|
|
I would like to add some elements implicitely to the resulting parsed EMF model.
step Provision {
input X
}
e.g. add an "input Name" to every step.
Is there a way to pre process the parsed EMF model before it is passed to the Xtext infrastructure e.g. for indexing, linking, ...?
Step:
'step' name=ID '{'
inputs+=Input*
'}';
Input:
'input' name=ID
;
|
|
|
|
|
|
|
|
Re: Implicit Model Elements [message #1844607 is a reply to message #1844604] |
Fri, 17 September 2021 10:03  |
Eclipse User |
|
|
|
in installDerivedState I add some state (Input elements, see in initial example) to the Step. If I understand correctly, I have to discard this state in discardDerivedState. However, there is no way for me to know, whether a given Input is "derived" or was added by the user. So, I need to store this information somewhere.
Option one was adding it as instance variables of the derived state computer, which seems to be a bad idea (no Javadoc warns me about that).
Option two was using an EMF adapter.
Option three would be to extend the EMF model with a property "derived" on the "Input" element. Option two seems be cleaner to me and is also the one used in JvmModelAssociator.
|
|
|
Powered by
FUDForum. Page generated in 0.03608 seconds