Possible to convert part of STRING to an object's ID using a value converter? [message #1830812] |
Tue, 04 August 2020 12:37  |
Eclipse User |
|
|
|
Is it possible to declare a variable within a STRING and then use a substring of that string as an cross reference later for the declaration (with the help of a value converter)?
Use case:
field "injected*PART_REMOVED_OR_MANIPULATED_IN_A_VALUE_CONVERTER";
class TestObject
injected {
}
;
(Where the 'injected' field in TestObject is a cross reference to the earlier declared TemplateField declaration above the TestObject)
I'm thinking something along the following pseudo grammar here, but not sure how to do it since the TemplateField would require an ID but I still only want to provide a STRING for it to be able to use the pseudo code above:
TemplateField:
'field' name=STRING '{' '}'
;
ObjectDeclaration:
'class' name=ID '{'
field+=[TemplateField|ID]*
'}'
;
I have seen how to convert a STRING to an Integer using a value converter, but I'm not sure how to convert that into an ID if that field is missing in the EObject. Can perhaps an additional invisible ID be declared on the TemplateField that can be pick up cross references later?
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05215 seconds