Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Accessing enum literals in Generator
Accessing enum literals in Generator [message #1063971] Mon, 17 June 2013 04:02 Go to next message
chris yo is currently offline chris yoFriend
Messages: 38
Registered: February 2013
Member
I have the following grammar:

Model:
	greetings+=Greeting*;
	
enum Boolean:
	True = 'not' |
	False = 'real'
;

Greeting:
	'Hello' name=ID state=Boolean 'human' '!';


In my generator file, I want to compare the value of "state" to the literal value of the Boolean enum. Basically, I was looking for something like this:

if (state.compareTo(Boolean.True))

What is the equivalent for it in Xtend?
Re: Accessing enum literals in Generator [message #1063974 is a reply to message #1063971] Mon, 17 June 2013 05:33 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 6489
Registered: July 2009
Senior Member
Boolean::True (may be upper case)

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de
Re: Accessing enum literals in Generator [message #1063978 is a reply to message #1063971] Mon, 17 June 2013 06:12 Go to previous message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1159
Registered: July 2009
Senior Member
Hi,

is there a reason to use an enum?

Greeting:'Hello' name=ID ('real' | state?='not') 'human' '!';

Alex


Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de
Previous Topic:bind scoping class
Next Topic:CTRL+SPACE action
Goto Forum:
  


Current Time: Mon Nov 24 12:29:30 GMT 2014

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

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