Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Allow keywords in any order
Allow keywords in any order [message #984412] Wed, 14 November 2012 12:26 Go to next message
Aaron Digulla is currently offline Aaron Digulla
Messages: 258
Registered: July 2009
Location: Switzerland
Senior Member
I need this feature in my grammar:

ClassDefinition : ('opt1'|'opt2'|'opt3')*? name=ID ";" ;

where "*?" means "any of them in any order but each one only once".

How can I do something like that?

Background: I have some places where a rule has 5-10 options and I want to enable users to give them in any order.

Regards,

A. Digulla
Re: Allow keywords in any order [message #984457 is a reply to message #984412] Wed, 14 November 2012 13:11 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 5856
Registered: July 2009
Senior Member
Hi an unordered group doesnt work?
Re: Allow keywords in any order [message #985386 is a reply to message #984412] Thu, 15 November 2012 06:03 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten Thoms
Messages: 353
Registered: July 2009
Location: Dortmund
Senior Member

Aaron,

I see you are familiar with unordered groups, this solves the "any of them in any order" part.

Solve the "each of them only once" by a validation rule.

Regards,
~Karsten


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
Re: Allow keywords in any order [message #985529 is a reply to message #985386] Thu, 15 November 2012 08:21 Go to previous message
Aaron Digulla is currently offline Aaron Digulla
Messages: 258
Registered: July 2009
Location: Switzerland
Senior Member
Thanks, "unordered group" was the keyword I was looking for.

For all the people who have the same problem, you can find an explanation and example here: http://www.eclipse.org/Xtext/documentation.html#syntax

Search for "Unordered Groups" in the page.

Regards,

A. Digulla
Previous Topic:Xtext and left recursive
Next Topic:Creating Proxies from JvmType
Goto Forum:
  


Current Time: Wed Apr 23 17:51:09 EDT 2014

Powered by FUDForum. Page generated in 0.08369 seconds