Errors in XPAND [message #798269] |
Tue, 14 February 2012 08:10  |
Eclipse User |
|
|
|
Hi,
I have an Xtext grammer like:
Model: entity1+=Entity1
entity2+=Entity2
Entity1: 'Entity1' prop=ID ';'
Entity2: 'Entity2' prop1=ID prop2=ID ';'
I want to generate codes for each Entity1 and I want to each Entity2 in Entity1.
Example:
public class name
{
This is Entity1
prop1 prop2 //These are properties of an instance Entity2
prop1 prop2 //These are properties of an instance Entity2
}
template.xpt file is:
«DEFINE main FOR Entity1»
«FILE name+".java"»
This is Entity1
«EXPAND test FOREACH Entity2»
«ENDFILE-»
«ENDDEFINE»
«DEFINE test FOR Entity2»
«prop1» «prop2»
«ENDDEFINE»
mw2 file is :
module workflow.MyDslGenerator
import org.eclipse.emf.mwe.utils.*
var targetDir = "src-gen"
var fileEncoding = "Cp1254"
var modelPath = "src/model"
Workflow {
component = org.eclipse.xtext.mwe.Reader {
// lookup all resources on the classpath
// useJavaClassPath = true
// or define search scope explicitly
path = modelPath
// this class will be generated by the xtext generator
register = org.xtext.example.mydsl.MyDslStandaloneSetup {}
load = {
slot = "entity1"
type = "Entity1"
}
}
component = org.eclipse.xpand2.Generator {
expand = "templates::Template::main FOREACH entity1"
outlet = {
path = targetDir
}
fileEncoding = fileEncoding
}
}
When I run the project, I received lots of errors on the Console. And a "Collection type expected!" error on the editor.
What can I do? If somebody can help me, I will be very glad.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.28011 seconds