eclipse / xtext

Eclipse Xtext™ is a language development framework
http://www.eclipse.org/Xtext
Eclipse Public License 2.0
754 stars 317 forks source link

Fragments are disallowed in unordered groups #3068

Open tom-fonda opened 1 month ago

tom-fonda commented 1 month ago

This issue matches this old bug report on Bugzilla; it was also initially briefly discussed in the forum.

Fragments are always rejected in unordered groups, but it looks like at least fragments consisting of an (multiple?) assignment(s?) exclusively should be allowed (please correct me if I'm wrong, I'm quite new to grammars, parsers and Xtext).

LorenzoBettini commented 1 month ago

cc @szarnekow

szarnekow commented 3 weeks ago

Fragments should generally speaking be allowed as unordered elements since they don't defer the object instantiation to the called rule. There's no need to inspect the body of the called fragment.

See org.eclipse.xtext.GrammarUtil.isEObjectFragmentRuleCall(EObject)