Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Navigating the model tree with xtend
Navigating the model tree with xtend [message #778192] Wed, 11 January 2012 15:25 Go to next message
Stefan Missing name is currently offline Stefan Missing nameFriend
Messages: 13
Registered: May 2010
Junior Member
Hi,

I have to convert an Xtext code generator from version 1 to 2 and I'm having some conversion issues. It's been a while since I last used Xtext.

With my model looking something like
MyModel:
(variables += MyVariable)*;

MyVariable:
value = MyValue;


I used to write "model.variables.value" to get the values of all variables in the model. However, this does not seem to work anymore.
Do I need to iterate over the variables, like

«FOR v:variables»
«v.value»
«ENDFOR»


to access the variable values? This seems rather cumbersome, even more so if value were to be another list of subvalues.
On a related note, am I right that the FOREACH statement has vanished as well?

Thanks
Re: Navigating the model tree with xtend [message #778204 is a reply to message #778192] Wed, 11 January 2012 16:32 Go to previous message
Meinte Boersma is currently offline Meinte BoersmaFriend
Messages: 434
Registered: July 2009
Location: Leiden, Netherlands
Senior Member
Have a look at the following blog post and its comments: http://dslmeinte.wordpress.com/2011/09/19/using-xtexts-xtend2-language/
In short: "model.variables.map[value]" should do the trick.


Previous Topic: Xtext grammar generated from ECORE
Next Topic:outline
Goto Forum:
  


Current Time: Fri Sep 20 10:29:15 GMT 2024

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

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

Back to the top