Bug 501118 - Fragments not working with "and" operator in Rule
Summary: Fragments not working with "and" operator in Rule
Status: ASSIGNED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.10.0   Edit
Hardware: PC Linux
: P3 major with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2016-09-09 04:10 EDT by Martin Westerkamp CLA
Modified: 2024-05-24 08:23 EDT (History)
4 users (show)

See Also:


Attachments
Reproducing Project (4.62 KB, application/x-zip-compressed)
2016-09-09 04:34 EDT, Karsten Thoms CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Westerkamp CLA 2016-09-09 04:10:30 EDT
Defined fragments cannot be used in rules that make use of the "and" operator.
While in the following example rule A works without any issues, B throws an "Unassigned rule calls may not be used in unordered groups" error.


Super:
	A | B;
fragment frag returns Super:
	name = ID;
A:
	frag |
	something = ID;
B:
	frag &
	something = ID;
Comment 1 Karsten Thoms CLA 2016-09-09 04:34:49 EDT
Created attachment 264069 [details]
Reproducing Project

The check would need to detect that 'frag' is actually a fragment call and that the assignment is assured within the fragment.
Comment 2 Tommaso Fonda CLA 2024-05-24 03:49:34 EDT
Hi, I'm reviving this old bug report because I'd like to try to fix this issue. I'm quite new to Xtext but I feel that with a little guidance I could succeed.

In his comment, Karsten wrote: "The check would need to detect that 'frag' is actually a fragment call and that the assignment is assured within the fragment.".

A quick glance at the code in XtextValidator.java makes me think that implementing the first check (checking that the rule is a fragment) is trivial, but I'm not quite sure how, exactly, to ensure that the assignment takes place within the fragment.

My first hypothesis is that I need to check that the fragment rule only contains  assigned rule calls and nothing else - is this correct? What else should I check?

Thanks.
Comment 3 Lorenzo Bettini CLA 2024-05-24 08:23:18 EDT
Tommaso, we moved to GitHub Issues, so as a first step, you could open a new issue https://github.com/eclipse/xtext/issues mentioning this bug, possibly with some background.

If you haven't done so, you can use Oomph to have a workspace to work/experiment on Xtext code base: https://github.com/eclipse/xtext/blob/main/CONTRIBUTING.md