Using Names from a text file inside the DSL [message #1733233] |
Wed, 25 May 2016 15:29 |
Vinicius Pereira Messages: 50 Registered: March 2014 |
Member |
|
|
Hi everyone,
I have a text file with some pairs, for example:
ABC, 123
DEF, 456
GHI, 789
I want to write a DSL more or less like this:
"given the element ABC I want to go to element 123"
So, I want that the DSL give the left option from my text file (ABC, DEF, GHI), then if I use the ABC then the DSL should show the correct right option 123 is the element to be chosen.
Is there a way to do this?? The text file will not change when the DSL is executed.
Best regards
|
|
|
|
|
|
|
Re: Using Names from a text file inside the DSL [message #1733346 is a reply to message #1733256] |
Thu, 26 May 2016 17:11 |
Vinicius Pereira Messages: 50 Registered: March 2014 |
Member |
|
|
Hi Christian,
I tested and everything works fine.
But when I tried to put the Mapping DSL (the one that was a txt file) into the Main DSL I have this situation: I already have a referencedResource (a EMF model that I created to be the scaffold for my DSL). How can I put a second referencedResource?
UPDATE:
I already repeat the referencedResource.
So I have
referencedResource="myEMFModel/model.genmodel"
referencedResource="MyMappingDSL/mapping.genmodel"
No error message here.
The problem is when I try to use an element from Mapping DSL into Main DSL
grammar br.traceability.dsl.MyTrace with org.eclipse.xtext.common.Terminals
import "platform:/resource/br.traceability.model/model/model.ecore"
import "http://www.traceability.br/mapping/dsl/Mapping" as map
FormalResults:
'FormalResults' name=ID '{'
timenodes+=TimeNode (',' timenodes+=TimeNode)*
'}'
;
TimeNode:
'TimeNode' name=ID '{'
formalelement+=FormalElement (',' formalelement+=FormalElement)*
'}'
;
FormalElement:
'FormalElement' formalElement=[map::FormalElement] '{'
// element=Element
'}'
;
Error message at formalElement=[map::FormalElement]: "Cannot find compatible feature formalElement in sealed EClass FormalElement from imported package http://www.example.org/model: The type 'FormalElement' does not have a feature 'formalElement'."
In the EMF Model, the FormalElement is a EClass without attributes.
[Updated on: Thu, 26 May 2016 17:40] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03290 seconds