Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Xtext] syntax errors while running the generator workflow
[Xtext] syntax errors while running the generator workflow [message #664317] Fri, 08 April 2011 11:32 Go to next message
Matthias B. is currently offline Matthias B.Friend
Messages: 9
Registered: April 2011
Junior Member
Hey,

I am new to xtext and i am stuck at this problem for a while now.
I have an ecore-model of my langage (.a2l) generated with x-text.
I import this model into a second xtext project to generate a new langage (.gtex) were i am using the parser of the first model. this works perfekt.
in the eclipse-editor, which i get after running the workflow of the gtex-langage, i can use everything of both langages like i want it.

If i try to generate code from that ecore model i get some problems. I use the generator project of the gtex-langage. but if i try to run the workflow i get a "syntax check fail" even if use the same model which was fine in the eclipse-editor.
So my question is, do i have to tell the workflow somehow to import the ecore model of the a2l-langage in the workflow? I thought this is done by the ExperimentStandaloneSetup{}, or do i have to modify that so he loads both langages? because everything he is complaining about is in the a2l-file which is read by the parser i imported into my gtex-project.

would be great if someone could help me!

the part were i import the first ecore model of the a2l-langage into the x-text project of the gtex-langage looks like followed:

...
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
import "platform:/resource/gt.asap2/src-gen/gt/asap2/Asap2.ecore" as asap2
...


my next task is to write a code generator to get code out of my model. my mwe2-file for that looks as followed:

module workflow.ExperimentGenerator

import org.eclipse.emf.mwe.utils.*
import org.eclipse.xtext.generator.*


var targetDir = "src-gen"
var fileEncoding = "Cp1252"
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 = gt.gtex.ExperimentStandaloneSetup {}
		load = {
			slot = "devices"
			type = "Device"
		}
	}
	component = org.eclipse.xpand2.Generator {
expand = "templates::Template::main FOREACH devices"
outlet = {
path = targetDir
}
fileEncoding = fileEncoding
}
}


if i try to run the workflow if get the following output:

0 [main] DEBUG org.eclipse.xtext.mwe.Reader - Resource Pathes : [src/model]
0 [main] INFO org.eclipse.xpand2.Generator - No meta models configured, using JavaBeans as default.
125 [main] DEBUG xt.validation.ResourceValidatorImpl - Syntax check FAIL! Resource: file:/C:/Dokumente%20und%20Einstellungen/becma/workspace/gt. gtex.generator/src/model/Example.gtex
204 [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher - Problems running workflow workflow.ExperimentGenerator: Validation problems:
4 errors:
Example.gtex - C:\Dokumente und Einstellungen\becma\workspace\gt.gtex.generator\src\model\Ex ample.gtex
5: Couldn't resolve reference to Module 'CPP'.
12: Couldn't resolve reference to Measurement 'ctr100ms'.
13: Couldn't resolve reference to Measurement 'ctr10ms'.
14: Couldn't resolve reference to Measurement 'ctr1ms'.

All things he can't find are defined trough the langage i imported to my second langage.
Re: [Xtext] syntax errors while running the generator workflow [message #664323 is a reply to message #664317] Fri, 08 April 2011 11:47 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14723
Registered: July 2009
Senior Member
Hi, you may have to add a

 register = path.LanguageStandaloneSetup {}


foreach of your dsls.

Btw Questions regarding Xtext should be asked in the TMF forum.

~Christian.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: [Xtext] syntax errors while running the generator workflow [message #664325 is a reply to message #664323] Fri, 08 April 2011 11:52 Go to previous message
Matthias B. is currently offline Matthias B.Friend
Messages: 9
Registered: April 2011
Junior Member
perfekt, it works Smile haven't thought about that before...

thank you a lot!!!

[Updated on: Fri, 08 April 2011 11:52]

Report message to a moderator

Previous Topic:[Acceleo] Support for generate once
Next Topic:List or something
Goto Forum:
  


Current Time: Sat Oct 12 14:06:06 GMT 2024

Powered by FUDForum. Page generated in 0.04033 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top