Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Comma separated Unordered group
Comma separated Unordered group [message #1095579] Tue, 27 August 2013 08:36 Go to next message
georges.chaudyskyscanner.net Georges is currently offline georges.chaudyskyscanner.net GeorgesFriend
Messages: 5
Registered: August 2013
Junior Member
Hi guys,

I am trying to right a a rule that handle a comma separated unordere group.

For example, I like to be able to write :
a, b, c
b, a, c
...
c, b, a

But not
a, a (twice a)
c, b, c (twice c)

The following rule gives me the unordered group but not the commas

Model : a?='a' & b?='b' & c?='c'

The following gives me both the unodreded part and the commas, but not the uniqueness:

Model : elems+=Elem (',' elems+=Elem)*
Elem : a?='a' | b?='b' | c?='c'

thus i can have a, b, a, b

Is there a way to have both?
Regards

Georges
Re: Comma separated Unordered group [message #1096316 is a reply to message #1095579] Wed, 28 August 2013 08:16 Go to previous messageGo to next message
Claudio Heeg is currently offline Claudio HeegFriend
Messages: 75
Registered: April 2013
Member
Model: (a?='a'','|a?='a') & (b?='b'','|b?='b') & (c?='c'','|c?='c');


Was my first idea, the commas are optional in that case, which is...close to what you might need. If the sequence could end with a comma it would actually already work.
Explicitly stating the combinations wouldn't be workable either past three elements, I guess.

You could also take a different approach and take the second option, go with that and check for uniqueness in the validator. That might be the best solution.

[Updated on: Wed, 28 August 2013 08:21]

Report message to a moderator

Re: Comma separated Unordered group [message #1096318 is a reply to message #1096316] Wed, 28 August 2013 08:20 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
hi,

i dont know of grammar means => you have to handle it with a check.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Comma separated Unordered group [message #1097125 is a reply to message #1096316] Thu, 29 August 2013 09:05 Go to previous message
georges.chaudyskyscanner.net Georges is currently offline georges.chaudyskyscanner.net GeorgesFriend
Messages: 5
Registered: August 2013
Junior Member
Thanks for your answer,

I will try to write a check then.

Thx
Previous Topic:Wrong parent type when computing type of child expressions
Next Topic:Xtext project from existing ecore models
Goto Forum:
  


Current Time: Thu Mar 28 23:08:33 GMT 2024

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

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

Back to the top