Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Parser Rule Fragments
Parser Rule Fragments [message #1725076] Mon, 29 February 2016 14:43 Go to next message
Ronan B is currently offline Ronan BFriend
Messages: 273
Registered: July 2009
Senior Member
Hi,
I was reading https://www.eclipse.org/forums/index.php/t/1072927/ and hoping to solve my unordered group issue as outlined a while back in https://www.eclipse.org/forums/index.php/t/1071359/.

It seems the Parser Rule Fragments concept introduced in Xtext 2.9 is rather restrictive in that it cannot be used in unordered groups. When I use the following fragment XText complains "Unassigned rule calls may not be used in unordered groups"

fragment X returns xyz::Element :
(( children+=Node ) | ( properties += Property ))*
;

Element returns xyz::Element:
'element'name=OptionallyQuotedName'{'
(
X
& 'des' des=(ConcatenatedString|QuotedConcatenatedString) ';'?
& X
& 'ref' ref=(ConcatenatedString|QuotedConcatenatedString) ';'?
& X
)
'}';

Also I think it is odd that the fragment must have an explicit return type matching the rule from which it is used, or have I misunderstood?

Thanks!
Ronan

[Updated on: Mon, 29 February 2016 19:38]

Report message to a moderator

Re: Parser Rule Fragments [message #1725196 is a reply to message #1725076] Tue, 01 March 2016 14:40 Go to previous messageGo to next message
Ronan B is currently offline Ronan BFriend
Messages: 273
Registered: July 2009
Senior Member
Hi,
A quick follow up. I don't see any documentation of "rule fragments". Can someone provide a few samples, or even confirm my suspiction that they cannot be used in unordered groups.
Thanks!
Ronan
Re: Parser Rule Fragments [message #1725251 is a reply to message #1725196] Wed, 02 March 2016 07:14 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 83
Registered: January 2016
Location: Kiel
Member

Hi Ronan,
seems like it is the unassigned call to 'X' that the error is about.
Also you don't need to specify the return type, but you can if you want to have a common type for the features used in a fragment.
Sven
Re: Parser Rule Fragments [message #1742897 is a reply to message #1725251] Thu, 08 September 2016 13:00 Go to previous messageGo to next message
Martin Westerkamp is currently offline Martin WesterkampFriend
Messages: 9
Registered: September 2016
Junior Member
I just stumbled across the same issue. It seems to be caused by the "and" operator.
Super:
	A | B;
fragment frag returns Super:
	name = ID;
A:
	frag |
	something = ID;
B:
	frag &
	something = ID;

While A works without any issues, B throws the same error "Unassigned rule calls may not be used in unordered groups".
Is there any reason behind that?

Greets,
Martin
Re: Parser Rule Fragments [message #1742911 is a reply to message #1742897] Thu, 08 September 2016 14:27 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13885
Registered: July 2009
Senior Member
looks like a bug to me

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:xtext get parser rule name based on context
Next Topic:Xtext project from ecore models
Goto Forum:
  


Current Time: Sun Apr 18 00:45:21 GMT 2021

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

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

Back to the top