Loading file-based ecore files from xText DSML [message #1776443] |
Thu, 16 November 2017 13:33 |
Steffen Zschaler Messages: 266 Registered: July 2009 |
Senior Member |
|
|
Hi all,
I'm trying to do something similar to the core xtext grammar where it allows referencing an external Ecore package through a URL and then use the imported classifiers etc. within the remaining model.
So, I have something like this in my grammar:
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
...
A:
s = [ecore::EPackage | STRING] t = [ecore::EPackage | STRING] "{"
bs += B+
"}"
;
B:
s = [ecore::EClassifier | QualifiedName] "=>" t = [ecore::EClassifier | QualifiedName]
;
Eventually, I want to define a scope such that B.s can be filled with classifiers from the containing A.s and B.t can be filled with classifiers from the containing A.t.
I have been googling about, reading documentation on scoping etc and scanning through the XText sources, too. I think I understand how to define the local scope for B.s and B.t. However, at the moment, I cannot figure out how to get A.s and A.t to load the correct .ecore file. Note that in my case these Ecore models are not registered, so I need to provide a file path. However, in my test, even when I provide a platform URL for it, Xtext doesn't load it.
My test example parses OK and does not produce any errors. However, in the model created, all I get is proxies for all the Ecore bits, with strange IDs such as "eProxyURI: __synthetic0.lang_compose#|0".
I'm clearly missing something here, but cannot figure out what. Any thoughts? I know about global scope providers, but given that Xtext can already do this when parsing grammars, I assume that this would either work out of the box or that there would be a GlobalScopeProvider I can reuse for this. Unfortunately, I couldn't find one.
Many thanks,
Steffen
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02686 seconds