Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Unassigned Rule calls
Unassigned Rule calls [message #670061] Thu, 12 May 2011 14:34 Go to next message
n.lincke is currently offline n.linckeFriend
Messages: 11
Registered: April 2011
Junior Member
I have a question: I would like to do something like this:

RuleA: RuleB | RuleC;

RuleB: RuleD | RuleE;
RuleC: RuleF | RuleG;

RuleD: name=ID...;
RuleE: name=ID...;
RuleF: name=ID...;
RuleG: name=ID...;


But RuleA is not working! Do I understand something wrong? It looks like that xtext is not able to compute a unassigned Rule Call,which is made out of unassigned rule calls... I would think, that it could work... I would expect that the xtext code generator creates some kind of an interface tree...

Re: Unassigned Rule calls [message #670073 is a reply to message #670061] Thu, 12 May 2011 14:50 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
In what way isn't that working? Is it because it can't figure out the
correct inheritance hierarchy? Are any of the rules involved in other
structures - if so it may be confused and you may need to help Xtext by
declaring what the rules return.

- henrik

On 5/12/11 4:34 PM, forums-noreply@eclipse.org wrote:
> I have a question: I would like to do something like this:
>
> RuleA: RuleB | RuleC;
>
> RuleB: RuleD | RuleE;
> RuleC: RuleF | RuleG;
>
> RuleD: name=ID...;
> RuleE: name=ID...;
> RuleF: name=ID...;
> RuleG: name=ID...;
>
>
> But RuleA is not working! Do I understand something wrong?
> It looks like that xtext is not able to compute a
> unassigned Rule Call,which is made out of unassigned rule
> calls... I would think, that it could work... I would
> expect that the xtext code generator creates some kind of
> an interface tree...
>
Re: Unassigned Rule calls [message #670233 is a reply to message #670073] Fri, 13 May 2011 07:38 Go to previous messageGo to next message
n.lincke is currently offline n.linckeFriend
Messages: 11
Registered: April 2011
Junior Member
Good Morning,
I tried my little example and it worked...
My Problem is when my grammar contains the RuleA, shows every other rule with a name=ID tag the error: "There may not be two features named 'name'" .

And if I delete the e from name in one rule ( unimportant which one) everything seems to work again...
The other wierd thing is that when I write

RuleA: RuleD | RuleE | RuleC;

and erase rule b completely, is everything fine again...
I am pretty sure that this last thing points to the mistake I overlook...

Perhaps could someone of you give me a hint...
Re: Unassigned Rule calls [message #670242 is a reply to message #670233] Fri, 13 May 2011 07:56 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

can you please post the grammar that gives you the error?

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Unassigned Rule calls [message #670325 is a reply to message #670233] Fri, 13 May 2011 14:07 Go to previous message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
The hierarchy is built "bottom up", the model generator does not
understand that the two hierarchies represent the same thing unless you
help with declarations of what the rules produce.

Something like...

RuleX returns MyThing : RuleB | RuleC ;
RuleB returns MyThing : ... ;
RuleC returns MyThing : ... ;

etc.

You can also achieve this by doing:

MyThing : RuleA | RuleB | RuleC | .... ;

Typically, you want more control over your model, and you can switch to
using an external model (instead of generating it from the grammar).

Regards
- henrik

On 5/13/11 9:38 AM, forums-noreply@eclipse.org wrote:
> Good Morning,
> I tried my little example and it worked...
> My Problem is when my grammar contains the RuleA, shows
> every other rule with a name=ID tag the error: "There may
> not be two features named 'name'" .
>
> And if I delete the e from name in one rule ( unimportant
> which one) everything seems to work again...
> The other wierd thing is that when I write
> RuleA: RuleD | RuleE | RuleC;
> and erase rule b completely, is everything fine again...
> I am pretty sure that this last thing points to the mistake
> I overlook...
> Perhaps could someone of you give me a hint...
>
Previous Topic:No initial ValidationJob
Next Topic:Shadowing with ImportedNamespaceAwareSP
Goto Forum:
  


Current Time: Fri Apr 26 14:20:20 GMT 2024

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

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

Back to the top