Reputation: 615
I have two grammars A and B and two files a and b (using grammars A and B respectively). The file a specify variables names, b specify the filename of a.
In b using the the file a want to:
How can this be done in xtext?
Update 1
Example grammar B
Model:
ref_model=RefModel
ref_vars+=[Vars]+
;
RefModel:
'reference' 'file' name=ID
;
Where RefModel
define where the file a can be located and Vars
are defined in a.
Upvotes: 0
Views: 147
Reputation: 3095
In the past we used to use importURI for that, but you can do that through scoping on your own also.
If you for instance want to use the simple name of the file, you should make the name in B a reference to the root element of A.
Model:
ref_model=RefModel
ref_vars+=[Vars]+
;
RefModel:
'reference' 'file' name=[ModelA]
;
Then you need to index the root element of A models using the simple file name of the resource URI.
Upvotes: 1