| Errors in XPAND [message #798269] |
Tue, 14 February 2012 08:10  |
terry tonery Messages: 34 Registered: February 2012 |
Member |
|
|
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.
|
|
|
|
| Re: Errors in XPAND [message #798312 is a reply to message #798285] |
Tue, 14 February 2012 09:19   |
terry tonery Messages: 34 Registered: February 2012 |
Member |
|
|
Thank you,
I tried the solution but this time I received:
Multiple markers at this line
- Collection type expected!
- Unknown org::xtext::example::mydsl::myDsl::Entity1
property, variable, type or enumeration literal 'eContainer'
- Template.xpt [line: 25] - EXPAND
error.
[Updated on: Tue, 14 February 2012 09:24] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06393 seconds