Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext Enums(Workaround for unset Enums)
Xtext Enums [message #1385207] Thu, 05 June 2014 01:49 Go to next message
Fernando Costa is currently offline Fernando CostaFriend
Messages: 5
Registered: June 2014
Location: Brazil
Junior Member
The Xtext documentation states the Ecore meta model doesn't support unset Enums. So if you type a rule like

Element: "element" name=ID (value=SomeEnum)?;

And try to process the input

element foo

The feature named 'value' will store '0'

As a workaround it suggests to use a dedicated none-value or order the enums accordingly. I didn't understand. Anyone could give me examples of how to apply such workarounds.
Re: Xtext Enums [message #1385229 is a reply to message #1385207] Thu, 05 June 2014 05:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Somerule: someattr=MyEnum;

enum MyEnum returns MyEnumWithDefault:
a | b;

enum MyEnumWithDefault:
undefined | a | b;



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext Enums [message #1385283 is a reply to message #1385229] Thu, 05 June 2014 11:36 Go to previous message
Fernando Costa is currently offline Fernando CostaFriend
Messages: 5
Registered: June 2014
Location: Brazil
Junior Member
Thanks Dietrich
Previous Topic:JUnit tests for content assist needing classpath context
Next Topic:[Xbase] How to append left operand of XAssignment to XMemberFeatureCall
Goto Forum:
  


Current Time: Fri Apr 19 21:22:04 GMT 2024

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

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

Back to the top