Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Retrieving STRING terminals in Xtend?
Retrieving STRING terminals in Xtend? [message #1743674] Sun, 18 September 2016 18:44 Go to next message
Sam Patterson is currently offline Sam PattersonFriend
Messages: 18
Registered: June 2016
Junior Member
Hello,

I'm currently working on a project which generates Java code using xtend, from a model which is created using a DSL I've produced in xtext. However I was wondering if it's possible to retrieve STRINGS from a resource, what I'm doing at the moment is using a tree iterator to get all the contents of a resource and looping through that list of objects. It's worked well so far but I have a rule in the grammar that looks like this,

Feature:
Feat | STRING;

Feat:
name = ID;


Now in another rule I have the following feature += Feature*

However when using the STRING option for the Feature rule, it doesn't get stored in the collection of Features when I attempt to retrieve it through the resource and I'm only able to access the Features which use the Feat option.

Is there a different way I have to go about accessing this information or is it just not possible?

Thank you.

Re: Retrieving STRING terminals in Xtend? [message #1743696 is a reply to message #1743674] Mon, 19 September 2016 06:00 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13888
Registered: July 2009
Senior Member
You can use NodeModelUtils to access. The node model and iterate there as well.

BTW if the STRING. Is relevant why don't you asssign it?


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Retrieving STRING terminals in Xtend? [message #1743733 is a reply to message #1743696] Mon, 19 September 2016 10:18 Go to previous message
Sam Patterson is currently offline Sam PattersonFriend
Messages: 18
Registered: June 2016
Junior Member
Thank you Christian I will look into using NodeModeUtils.

The grammar was actually created by a colleague of mine so I will advise them to assign the STRING value.

Previous Topic:Decision tables in Xtext
Next Topic:Can I get an EMF model of an existing Xtend class ?
Goto Forum:
  


Current Time: Fri Apr 23 03:13:17 GMT 2021

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

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

Back to the top