I would like to parse a Xtext grammar with Xtext. Therefore I took the grammar from GitHub and adapted it a little bit. Everything works fine except the import of grammars and the defining of reused grammars with "with".
So when I create a Xtext-file that should be parsed, e.g.:
grammar org.xtext.example.mydsl.Expression with org.eclipse.xtext.common.Terminals
import "http://www.xtext.org/example/mydsl/MyDsl" as mydsl
generate expression "http://www.xtext.org/example/mydsl/Expression"
I got the following errors:
Line 1: Couldn't resolve reference to Grammar 'org.eclipse.xtext.common.Terminals'. (Even if I change the feature name to importURI or importedNamespace of the root rule and use a grammar defined in the same workspace!)
Line 3/4: Couldn't resolve reference to EPackage 'http://www.xtext.org/example/mydsl/...'.
However, I need the complete grammar for my further work and this includes especially the reused grammar (such like the Terminals, Xbase or any other grammar in the workspace) because the grammar could contain rules that reference rules from the reused one.
Is there a way to resolve the grammar? I thought already about Scoping but failed in understanding how I could use it in my case.
BTW, is there a way to parse the file extension .xtext? I get the warning, that two content parsers are implementing the same file extension and I get my model parsed in the normal Xtext-manner. Is there a way to switch to my content parser?