Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Cross Reference
Cross Reference [message #1759457] Tue, 11 April 2017 12:11 Go to next message
MOJ Na is currently offline MOJ NaFriend
Messages: 12
Registered: May 2015
Junior Member
Hello,

I do not know how cross reference works in the case that I want to use features of Actions rule in another rule.

Actions:
name=ID
(
(features+=Feature)
|(moves+=Move))
)*;
I would appreciate it if you could help me.

[Updated on: Tue, 11 April 2017 20:12]

Report message to a moderator

Re: Cross Reference [message #1759458 is a reply to message #1759457] Tue, 11 April 2017 20:12 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14732
Registered: July 2009
Senior Member
Hi I don't get the question. Can you please explain?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: Cross Reference [message #1759459 is a reply to message #1759458] Tue, 11 April 2017 20:29 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14732
Registered: July 2009
Senior Member
Ps maybe you are simply looking for

someRef=[Feature|FQN] ....;

FQN:ID ("." ID)*;


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: Cross Reference [message #1759460 is a reply to message #1759458] Tue, 11 April 2017 12:44 Go to previous messageGo to next message
MOJ Na is currently offline MOJ NaFriend
Messages: 12
Registered: May 2015
Junior Member
Sorry for the confusion. I have the following grammar:
Actions:
'Action' name=ID
'{'
((features+=Feature))*
'constraint' constraint= LiteralOrIdentifier
'}';

Feature:
'feature' ':' name+=ID;

LiteralOrIdentifier:
Literal
| Identifier;

Literal:
int=INT;

Identifier:
'feature' ref=[Feature];

Based on the above grammar, I expect the following text to be parsed correctly, but It gives me the error "could not resolve reference to feature Y"
Action test {
feature: X
feature : Y
constraint feature Y}

What I am missing?

Thank you very much for your help.
Re: Cross Reference [message #1759593 is a reply to message #1759459] Thu, 13 April 2017 14:15 Go to previous messageGo to next message
MOJ Na is currently offline MOJ NaFriend
Messages: 12
Registered: May 2015
Junior Member
Hi,

I have not been able to solve my problem yet. I am a beginner in Xtext, so I am not sure what I want to do is possible in Xtext . I tried "someRef=[Feature|FQN] ....,

FQN:ID ("." ID)*;", but I still get the same error.

What I should do?
Thank you very much for your help.
Re: Cross Reference [message #1759599 is a reply to message #1759593] Thu, 13 April 2017 08:37 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14732
Registered: July 2009
Senior Member
the problem is the following:

you can reference things with a name only by default.
you feature does not have one (it has a list of names with always one element)

=> the easiest is to change to

Feature:
'feature' ':' name=ID;


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: Cross Reference [message #1759611 is a reply to message #1759593] Thu, 13 April 2017 19:11 Go to previous messageGo to next message
MOJ Na is currently offline MOJ NaFriend
Messages: 12
Registered: May 2015
Junior Member
Thank you very much. The problem is that I need to have a list of features and then reference them.
Re: Cross Reference [message #1759612 is a reply to message #1759611] Thu, 13 April 2017 19:18 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14732
Registered: July 2009
Senior Member
You have a list of features but you reference them one by one right?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: Cross Reference [message #1759656 is a reply to message #1759612] Fri, 14 April 2017 15:31 Go to previous messageGo to next message
MOJ Na is currently offline MOJ NaFriend
Messages: 12
Registered: May 2015
Junior Member
Yes, that is what I am looking for
Re: Cross Reference [message #1759658 is a reply to message #1759656] Fri, 14 April 2017 15:58 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14732
Registered: July 2009
Senior Member
So Feature : ... name=ID will solve your problem

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: Cross Reference [message #1759672 is a reply to message #1759658] Fri, 14 April 2017 23:27 Go to previous message
MOJ Na is currently offline MOJ NaFriend
Messages: 12
Registered: May 2015
Junior Member
Thank you so much it solved my problem Smile
Previous Topic:Import issues regarding qualified names
Next Topic:Xtext and antlr4?
Goto Forum:
  


Current Time: Tue Nov 12 23:52:54 GMT 2024

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

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

Back to the top