Use one grammar within another grammar [message #1010228] |
Sat, 16 February 2013 18:42  |
Eclipse User |
|
|
|
Hi guys.
I have a problem with combining two languages with Xtext. I already have two grammars. The first one is the Java Expression Language and allows me to write expressions like
${aaa + 1}
${obj.method().getMe()}
That is working fine. Now I want to use that grammar within another grammer so that I am able to do things like that:
The left site of the equals sign is my first grammer, the rest is my second grammar. How can I do that? I tried to do it with grammar mixin. So I added the following to my second grammar:
import "http://www.mystuff.eclipse.org/el/text/ElDef" as elDef
...
SetStatement:
'SET' name=ID '=' el=[elDef::ElStatement];
I also adopted my MANIFEST.MF and registered the first grammer in my .mwe2 file:
registerGeneratedEPackage = "org.eclipse.mystuff.el.text.elDef.ElDefPackage"
registerGenModelFile = "platform:/resource/org.eclipse.mystuff.el.text/src-gen/org/eclipse/mystuff/el/text/ElDef.genmodel"
Everything is generated without an error and I am able to edit files with the editor of my second grammar. But I can not use the first grammar within the second one. When i write the line
in my editor of the second grammar, I get the error message "Couldn't resolve reference to ElStatement 'aaa'". Any idea what I am doing wrong here?
Regards
Christian
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03229 seconds