Split Grammar into two files [message #869839] |
Fri, 04 May 2012 13:31 |
kon f Messages: 152 Registered: March 2012 |
Senior Member |
|
|
Hey,
I would like to split my grammar into two separate file - the current grammar file is getting to long. So I just want to have a physical separation of the grammar file, the behaviour should remain the same.
I had a look into the source of Xbase. There are two grammar files (Xtype.xtext and Xbase.xtext).
The header of Xtype starts:
grammar org.eclipse.xtext.xbase.Xtype with org.eclipse.xtext.common.Terminals
and the header for Xbase references Xtype:
grammar org.eclipse.xtext.xbase.Xbase with org.eclipse.xtext.xbase.Xtype
also the mwe2 file contains an additional language property for Xtype.
I performed this steps as well as for my grammar files, but I get an exception while the mwe2 file is executed.
7792 [main] ERROR org.eclipse.xtext.generator.CompositeGeneratorFragment - Could not find a GenModel for EPackage 'h_t_t_p://_w_w_w_mydsl.org/base' from h_t_t_p://_w_w_w_mydsl.org/base
If the missing GenModel has been generated via EcoreGeneratorFragment make sure to run it first in the workflow.
If you have a *.genmodel-file, make sure to register it via StandaloneSetup.registerGenModelFile(String)
java.lang.RuntimeException: Could not find a GenModel for EPackage 'h_t_t_p://_w_w_w_mydsl.org/base' from h_t_t_p://_w_w_w_mydsl.org/base
If the missing GenModel has been generated via EcoreGeneratorFragment make sure to run it first in the workflow.
If you have a *.genmodel-file, make sure to register it via StandaloneSetup.registerGenModelFile(String)
Apparently, my mwe2 file is not correct, since I can use all types that are defined in the Base.xtext with my inheriting grammar. Here is the part that I added to my mwe2 file(as well as the missing import):
language = {
uri = "classpath:/org/mydsl/Base.xtext"
fileExtensions="___xtype"
fragment = grammarAccess.GrammarAccessFragment {}
fragment = serializer.SerializerFragment {
// generateDebugData = true
}
fragment = formatting.FormatterFragment {}
fragment = contentAssist.JavaBasedContentAssistFragment {}
fragment = XtextAntlrGeneratorFragment {
options = auto-inject {}
}
}
I don't know what I'm doing wrong. Are there any further adjustments to make, that mwe2 can wire up both grammar files (Base.xtext and MyDSL.xtext).
Any help is appreciated!
Thank you!
Kon
Edit:
I had to adjust the links being able to post my question. I need to reach the 25 post limit
[Updated on: Fri, 04 May 2012 13:32] Report message to a moderator
|
|
|
Re: Split Grammar into two files [message #869923 is a reply to message #869839] |
Fri, 04 May 2012 20:08 |
|
Hi,
if you have a look at the workflow xtext generates for you you might get an idea what todo
(simply replace xbase with your base language)
bean = StandaloneSetup {
scanClassPath = true
platformUri = "${runtimeProject}/.."
// The following two lines can be removed, if Xbase is not used.
registerGeneratedEPackage = "org.eclipse.xtext.xbase.XbasePackage"
registerGenModelFile = "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel"
}
~Christian
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
Powered by
FUDForum. Page generated in 0.03140 seconds