|
|
|
Re: Translate Template Proposal Pattern into Xtext Model [message #1820594 is a reply to message #1820592] |
Thu, 23 January 2020 16:17 |
Marie-Saphira Flug Messages: 21 Registered: January 2019 |
Junior Member |
|
|
Hi, thanks for the quick reply.
I want to
[x] Load the templates
[ ] Translate the template pattern into a model consisting of model entities (here: LastName and Greeting)
[ ] Change the model (here: change the "name" of the extracted Greeting)
Sorry for not being clear enough. By model entity I mean an EObject like I get with this:
MyDSLFactory.eINSTANCE.createGreeting()
Thanks @Tamas, I will have a look
[Updated on: Thu, 23 January 2020 16:18] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Translate Template Proposal Pattern into Xtext Model [message #1821103 is a reply to message #1821012] |
Wed, 05 February 2020 16:08 |
Marie-Saphira Flug Messages: 21 Registered: January 2019 |
Junior Member |
|
|
So I resolved the variables with
TemplateTranslator templateTranslator = new TemplateTranslator();
TemplateBuffer buffer = null;
try {
buffer = templateTranslator.translate(template);
} catch (TemplateException e) {
e.printStackTrace();
}
The buffer contains the template pattern as a String where all variables (e.g. ${name}) are replaced by their names (here: name) and a TemplateVariable array. The String can be parsed as above.
The crossreference to the dbtype (which will never exist) is resolved by hand (buffer.getString().contains(dbTypeName)), a dbType is created and added to the parsed model. It's not perfect but sufficient.
Thanks for your help!
[Updated on: Wed, 05 February 2020 16:13] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.08935 seconds