Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [MWE2] [Xtend] mismatched input '<EOF>' expecting RULE_ID(Workflow issues while using Xtend M2M)
[MWE2] [Xtend] mismatched input '<EOF>' expecting RULE_ID [message #557656] Wed, 08 September 2010 12:58 Go to next message
Thomas Delissen is currently offline Thomas DelissenFriend
Messages: 11
Registered: September 2010
Location: Eindhoven
Junior Member
I'm not sure if this is the right forum to post my question, because I'm doing a project in which I generate an Ecore model with Xtext, create another Ecore model directly in EMF and creating a M2M mapping from the Xtext ecore model to the EMF model using Xtend.

However, my current issue is related to MWE2 and Xtend which seems to be the area of expertise of the people on this forum.

The thing I am trying to do is the following:
- Reading a file called 'example2.act' which is written in my Xtext grammar format
- Applying a M2M transformation by invoking a transform function in my model2model.ext
- Writing to a file outputfile.xmi

I am getting an error when running my MWE2 workflow which looks as follows:

2    ERROR Mwe2Launcher       - Problems running workflow model2model2: Validation problems: 
1 error:
		1: mismatched input '<EOF>' expecting RULE_ID
java.lang.RuntimeException: Problems running workflow model2model2: Validation problems: 
1 error:
		1: mismatched input '<EOF>' expecting RULE_ID
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:82)


Now, I think it is either related to the invoke-function in my workflow, or my Xtend file. At first I thought it was an issue with my example2.act file, but I am sure it is correct and I do not get any errors from the Reader function in the workflow (like 'model-slot is empty').

My workflow file looks as follows:
module model2model2
import org.eclipse.emf.mwe.utils.*
var OutputFile = "../outputfile.xmi"

Workflow {
	component = org.eclipse.xtext.mwe.Reader {
		// lookup all resources on the classpath
		// useJavaClassPath = true

		// or define search scope explicitly
		 path = "../"

		// this class will be generated by the xtext generator 
		register = iterative.ActivitydiagramXtextStandaloneSetup {}
		load = {
		    firstOnly = true
		    name = "example2"
			slot = "model"
			type = "ActivitydiagramXtext::Model"
		}
	}

	component = org.eclipse.xtend.XtendComponent {
		metaModel = org.eclipse.xtend.typesystem.emf.EmfMetaModel {
			metaModelPackage = "iterative.activitydiagramXtext.ActivitydiagramXtextPackage"
		}
		metaModel = org.eclipse.xtend.typesystem.emf.EmfMetaModel {
			metaModelPackage = "activitydiagram.ActivitydiagramPackage"
		}
		invoke = "src/template/model2model::transform(model)"
		outputSlot = "transformed_model"
	}

	component = org.eclipse.emf.mwe.utils.Writer {
		modelSlot = "transformed_model"
		uri = OutputFile
	}
}


And, my (simplified) Xtend template:

import activitydiagramXtext;
import activitydiagram;
import ecore;

create activitydiagram::Model transform(activitydiagramXtext::Model InputModel) :
	this.setName(InputModel.name)
	-> 
	this.setProcess(new activitydiagram::Process)
//	->
//	this.setTasks(null)
	;


I hope someone is able to give me some indication on what the issue could be; I'll continue debugging myself, but I'm not sure whether I should focus on my Xtend file, my MWE2 file or something completely different.

Thanks in advance for any advice.

Thomas


Kind regards,

Thomas
Re: [MWE2] [Xtend] mismatched input '<EOF>' expecting RULE_ID [message #557963 is a reply to message #557656] Thu, 09 September 2010 15:55 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 714
Registered: July 2009
Location: Dortmund, Germany
Senior Member

Hi Thomas,

the error would point me first to the Xtext model file(s). It is expecting more content when finding the end of file.

A little bit strange is the value for 'invoke' of the XtendComponent. Normally you just qualify names relative to the classpath root. Assuming that src/templates is a source folder you could and should omit this. But this has nothing to do with your problem.

Regards,
~Karsten


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
Re: [MWE2] [Xtend] mismatched input '<EOF>' expecting RULE_ID [message #558146 is a reply to message #557963] Fri, 10 September 2010 10:47 Go to previous message
Thomas Delissen is currently offline Thomas DelissenFriend
Messages: 11
Registered: September 2010
Location: Eindhoven
Junior Member
Solved: I have experimented a bit and I recreated my projects and folders and created a fresh workspace. I thought it had something to do with classpaths, NS uris and dependencies in my Manifest file. As Karsten pointed out with my strange Path-value, this is something that is still confusing me. As a test I've created a file in the old workflow style (MWE), and somehow I've got it working. Maybe I will try to fix the MWE2 file sometime, but for now I will work with the old style.

However, I think the main issue was in the Reader of my original workflow and in my examplefile. The name-attribute of the Model slot of my examplefile was 'example', while the file was called 'example2.act' : It seems to matter that the name-ID of the Model is the same as the filename. My theory right now is that since I did not have this, the reader took a different inputfile, which was empty: example.act . Which explains why it found an EOF instead of a Rule-ID. Maybe.

Anyway, thanks for the advice and for completeness sake I've added my revised MWE file. It might be useful as an example for other people who are trying to do a M2M transformation from Xtext grammar file to XMI file.

<workflow>
	<bean class="org.eclipse.emf.mwe.utils.StandaloneSetup" >
	  <platformUri value=".."/>
	 </bean>
	
  <component id="read" class="org.eclipse.xtext.mwe.Reader">
    <path value="../iter2.Model2Model/inputmodel"/>
    <register class="iter2.LanguageStandaloneSetup"/>
    <load>
    <name value="example"/>
      <slot value="model"/>
      <type value="Model"/>
      <firstOnly value="true"/>
    </load>
  </component>

<component id="translate" class="org.eclipse.xtend.XtendComponent">
    <metaModel id="input" class="org.eclipse.xtend.typesystem.emf.EmfMetaModel">
      <metaModelPackage value="iter2.language.LanguagePackage"/>
    </metaModel>
    <metaModel id="output" class="org.eclipse.xtend.typesystem.emf.EmfMetaModel">
      <metaModelPackage value="targetLang.TargetLangPackage"/>
    </metaModel>
    <invoke value="model2model::transform(model)"/>
    <outputSlot value="EcoreModel"/>
  </component>

  <component class="org.eclipse.xtend.typesystem.emf.XmiWriter">
    <modelFile value="src-gen/output.xmi"/>
    <inputSlot value="EcoreModel"/>
  </component>

</workflow>


Kind regards,

Thomas
Previous Topic:[Acceleo 3] Question about debugging templates
Next Topic:[Xpand] 3.4 update site's errors
Goto Forum:
  


Current Time: Sun Jan 19 08:50:32 GMT 2020

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

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

Back to the top