Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Validation of non-null enum rule
Validation of non-null enum rule [message #1706866] Mon, 31 August 2015 14:19 Go to next message
Moshe Maizels is currently offline Moshe MaizelsFriend
Messages: 20
Registered: August 2015
Junior Member
Hi,
I have a Grammar which includes an enum zero-based value, which i want to validate for non-null.

Lets say my grammar has rules like:

Parent:
'parent' name=ID '{'
'period-age' period=Period
'age' age=INT
'}'

enum Period:
FIRST='1Part' | SECOND='2Part' | LAST='3Part';

I Want to validate if i don't receive the enum-value (Period), which means it is null.
How can i do it?

Note: This is important because I also have rules which the enum-based value is optional (and will then pass the parser but i will want to check them in the validation step)
Re: Validation of non-null enum rule [message #1706875 is a reply to message #1706866] Mon, 31 August 2015 14:41 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
by default this will never happen, since the enum value will always be set (to the first value)
maybe you can play around with unsettable (eIsSet)


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Xtext for Extended C language with Graphiti Editor
Next Topic:How can I get the referencing objects for a certain object
Goto Forum:
  


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

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

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

Back to the top