Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » XText Attribute Order(Can't define attributes in any order?)
XText Attribute Order [message #652594] Fri, 04 February 2011 16:26 Go to next message
Jesse  is currently offline Jesse Friend
Messages: 10
Registered: January 2011
Junior Member
Hi there,

I'm working on a prototype DSL for Eclipse e4 UIElements. It's looking okay, but one thing that I can't seem to figure out is how to let users define attributes in any order.

eg.

Command returns commands::Command:
{commands::Command}
'Command'
elementId=EString
'{'
('category' category=[commands::Category|EString])?
('commandName' commandName=EString)?
('contributorURI' contributorURI=EString)?
('description' description=EString)?
('parameters' '{' parameters+=CommandParameter ( parameters+=CommandParameter)* '}')?
('tags' '{' tags+=EString ( tags+=EString)* '}')?
'}';


When trying out the DSL, attributes can only be defined in the order that is specified above (eg. if you want to define category, then it MUST be defined first). I'd like to be able to define them in any order. Is there a way to do this? It seemed to be causing a lot of confusion at first, so I sorted all attributes in alphabetical order as a "workaround", but that's not good enough.

Any help would be much appreciated!

Thanks.

- Jesse
Re: XText Attribute Order [message #652598 is a reply to message #652594] Fri, 04 February 2011 16:37 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
Quote:
The Xtext grammar language now offers a new operator '&' to separate elements in a group that can only occur once but in any order, like the modifier keywords 'public', 'static', 'synchronized' in Java.
Re: XText Attribute Order [message #652600 is a reply to message #652594] Fri, 04 February 2011 16:32 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 02/04/2011 05:26 PM, Jesse wrote:
> Hi there,
>
> I'm working on a prototype DSL for Eclipse e4 UIElements. It's looking
> okay, but one thing that I can't seem to figure out is how to let users
> define attributes in any order.
>
> eg.
> Command returns commands::Command:
> {commands::Command}
> 'Command'
> elementId=EString
> '{'
> ('category' category=[commands::Category|EString])?
> ('commandName' commandName=EString)?
> ('contributorURI' contributorURI=EString)?
> ('description' description=EString)?
> ('parameters' '{' parameters+=CommandParameter (
> parameters+=CommandParameter)* '}')?
> ('tags' '{' tags+=EString ( tags+=EString)* '}')?
> '}';
>
>
> When trying out the DSL, attributes can only be defined in the order
> that is specified above (eg. if you want to define category, then it
> MUST be defined first). I'd like to be able to define them in any order.
> Is there a way to do this? It seemed to be causing a lot of confusion at
> first, so I sorted all attributes in alphabetical order as a
> "workaround", but that's not good enough.
> Any help would be much appreciated!
>
> Thanks.
>
> - Jesse
>

could "unordered groups" help you?

see http://www.eclipse.org/Xtext/documentation/1_0_1/xtext.html

cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: XText Attribute Order [message #652613 is a reply to message #652594] Fri, 04 February 2011 17:23 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Jesse,

are you aware of https://github.com/meysholdt/e4dsl ?

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 04.02.11 17:26, schrieb Jesse:
> Hi there,
>
> I'm working on a prototype DSL for Eclipse e4 UIElements. It's looking
> okay, but one thing that I can't seem to figure out is how to let users
> define attributes in any order.
>
> eg.
> Command returns commands::Command:
> {commands::Command}
> 'Command'
> elementId=EString
> '{'
> ('category' category=[commands::Category|EString])?
> ('commandName' commandName=EString)?
> ('contributorURI' contributorURI=EString)?
> ('description' description=EString)?
> ('parameters' '{' parameters+=CommandParameter (
> parameters+=CommandParameter)* '}')?
> ('tags' '{' tags+=EString ( tags+=EString)* '}')?
> '}';
>
>
> When trying out the DSL, attributes can only be defined in the order
> that is specified above (eg. if you want to define category, then it
> MUST be defined first). I'd like to be able to define them in any order.
> Is there a way to do this? It seemed to be causing a lot of confusion at
> first, so I sorted all attributes in alphabetical order as a
> "workaround", but that's not good enough.
> Any help would be much appreciated!
>
> Thanks.
>
> - Jesse
>
Previous Topic:Testing my language using the AbstractXtextTests and getModelAndExpect
Next Topic:How to use a custom XtextResourceSet
Goto Forum:
  


Current Time: Fri Apr 26 07:59:06 GMT 2024

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

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

Back to the top