Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Assertion failed for unordered group
Assertion failed for unordered group [message #1712135] Wed, 21 October 2015 13:24 Go to next message
Anakreontas Mentis is currently offline Anakreontas MentisFriend
Messages: 85
Registered: October 2014
Member
I have one or more comma separated attributes where each one occurs at most once. The following rule encodes my requirements:
EqPanel : 
      (',' 'HEIGHT'   '=' NUM)
    & (',' 'NAME'     '=' tag   = idstring)
    & (',' 'TITLE'    '=' title = idlike)
    & (',' 'WIDTH'    '=' width = NUM)
    & (',' 'XPOS'     '=' NUM)
    & (',' 'YPOS'     '=' NUM)
 ;


XText does not produce any warnings during compilation but at runtime I get the error message:
Rule ruleEqPanel failed predicate getUnorderedGroupHelper.canLeave(.....)

I don't understand what causes the error. The grammar is not ambiguous as far as I can tell.
Re: Assertion failed for unordered group [message #1712145 is a reply to message #1712135] Wed, 21 October 2015 14:01 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14664
Registered: July 2009
Senior Member
you implementation indicates a "at least" as well not a "at most"
maybe you actually want to

EqPanel : 
      (',' 'HEIGHT'   '=' NUM)?
    & (',' 'NAME'     '=' tag   = idstring)?
    & (',' 'TITLE'    '=' title = idlike)?
    & (',' 'WIDTH'    '=' width = NUM)?
    & (',' 'XPOS'     '=' NUM)?
    & (',' 'YPOS'     '=' NUM)?
 ;


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Assertion failed for unordered group [message #1712152 is a reply to message #1712145] Wed, 21 October 2015 14:40 Go to previous messageGo to next message
Anakreontas Mentis is currently offline Anakreontas MentisFriend
Messages: 85
Registered: October 2014
Member
Ah yes.

Thank you Christian.
Re: Assertion failed for unordered group [message #1712153 is a reply to message #1712135] Wed, 21 October 2015 14:46 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
On 21.10.15 15:24, Anakreontas Mentis wrote:
> I have one or more comma separated attributes where each one occurs at
> most once. The following rule encodes my requirements:
>
> EqPanel : (',' 'HEIGHT' '=' NUM)
> & (',' 'NAME' '=' tag = idstring)
> & (',' 'TITLE' '=' title = idlike)
> & (',' 'WIDTH' '=' width = NUM)
> & (',' 'XPOS' '=' NUM)
> & (',' 'YPOS' '=' NUM)
> ;
>
>
> XText does not produce any warnings during compilation but at runtime I
> get the error message:
> Rule ruleEqPanel failed predicate getUnorderedGroupHelper.canLeave(.....)
>
> I don't understand what causes the error. The grammar is not ambiguous
> as far as I can tell.

Your grammar does not specify that each attribute occurs at most once
but exactly once. You have to mark the optional parts as optional ;)

EqPanel : (',' 'HEIGHT' '=' NUM)?
& (',' 'NAME' '=' tag = idstring)?
& (',' 'TITLE' '=' title = idlike)?
& (',' 'WIDTH' '=' width = NUM)?
& (',' 'XPOS' '=' NUM)?
& (',' 'YPOS' '=' NUM)?
;

Best,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Find help at http://xtext.itemis.com or xtext(@)itemis.com
Blog: zarnekow.blogspot.com
Twitter: @szarnekow
Google+: https://www.google.com/+SebastianZarnekow
Re: Assertion failed for unordered group [message #1712154 is a reply to message #1712153] Wed, 21 October 2015 14:47 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Lesson learned: refresh before post :)

Thank you for monitoring the forum, Christian!

Cheers,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Find help at http://xtext.itemis.com or xtext(@)itemis.com
Blog: zarnekow.blogspot.com
Twitter: @szarnekow
Google+: https://www.google.com/+SebastianZarnekow
Previous Topic:Unable to parse with character "
Next Topic:Enable or disable grammatical rule by file extension
Goto Forum:
  


Current Time: Tue Apr 16 12:59:24 GMT 2024

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

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

Back to the top