Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [Xtext 2.8] : Cross-references howto with indexed references
[Xtext 2.8] : Cross-references howto with indexed references [message #1516489] Thu, 18 December 2014 23:07 Go to next message
Didier Garcin is currently offline Didier GarcinFriend
Messages: 68
Registered: April 2013
Member
Hi,

If my language allows writing the qualified name of a reference like this :
a.b[i*2].c[3]


The qualified name can't be defined as a terminal.
As a result, it must be handled by a parser rules set involving those of expressions.

Nevertheless, xtext demands these rules are data type rules. They aren't.
What to do in this case ?

Thanks a lot if you answer me.

[Updated on: Thu, 18 December 2014 23:48]

Report message to a moderator

Re: [Xtext 2.8] : Cross-references howto with indexed references [message #1516905 is a reply to message #1516489] Fri, 19 December 2014 05:54 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Datatype rules are parser rules, aren't they
But if you want a cross ref inside a cross ref the outer stuff may be a kind of derived cross refs


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Fri, 19 December 2014 05:55]

Report message to a moderator

Re: [Xtext 2.8] : Cross-references howto with indexed references [message #1516983 is a reply to message #1516905] Fri, 19 December 2014 07:09 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Btw arent a b c 3 separate references?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [Xtext 2.8] : Cross-references howto with indexed references [message #1521667 is a reply to message #1516905] Sun, 21 December 2014 23:41 Go to previous messageGo to next message
Didier Garcin is currently offline Didier GarcinFriend
Messages: 68
Registered: April 2013
Member
Christian Dietrich wrote on Fri, 19 December 2014 05:54
Datatype rules are parser rules, aren't they


Yes, I agree. (I've discovered all this stuff after writing my post and didn't update it very well. It's why it is a bit inconsistent.)

Christian Dietrich wrote on Fri, 19 December 2014 05:54

But if you want a cross ref inside a cross ref the outer stuff may be a kind of derived cross refs


This is not my primary concern. The example is to show the difficulty of taking into account references with indexes and more of that, arithmetic expressions in it.

My concern is : "How to specify a cross-reference involving a field of a composite type."

a.b[i*2].c[3]


Of course,it is interesting to link i to its definition as well but my thinking is to link c to its definition.
My concern is that [i]a.b[i*2].c[3][/i] is handled by a set of parser rules and I have some difficulties to wrap them in EDataType.

And I wanted to know what is the method.


Christian Dietrich wrote on Fri, 19 December 2014 05:54
Btw arent a b c 3 separate references?


I would like to crossref c and i only.

About crossrefs, What am I supposed to do with :
The rule 'Simple_name' is not valid for a cross reference since it does not return an EString. You'll have to wrap it in a data type rule.


Simple_name: {Simple_name}
        (IDENTIFIER P)* (IDENTIFIER | OPERATOR_SYMBOL); 


Thanks a lot.

[Updated on: Mon, 22 December 2014 00:39]

Report message to a moderator

Re: [Xtext 2.8] : Cross-references howto with indexed references [message #1522321 is a reply to message #1521667] Mon, 22 December 2014 08:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
hi

Simple_name: {Simple_name}
        (IDENTIFIER P)* (IDENTIFIER | OPERATOR_SYMBOL); 


isnt a datatype rule.

Simple_name returns ecore::EString:
        (IDENTIFIER P)* (IDENTIFIER | OPERATOR_SYMBOL); 


is one.

you may have a look at

https://www.eclipse.org/forums/index.php/t/896147/ as well (if you consider to customize the linking behaviour)


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [Xtext 2.8] : Cross-references howto with indexed references [message #1522483 is a reply to message #1522321] Mon, 22 December 2014 10:36 Go to previous message
Didier Garcin is currently offline Didier GarcinFriend
Messages: 68
Registered: April 2013
Member
Ah, yes. I think it will satisfy me.

Thanks again !
Previous Topic:Additional source folders in Xtext project
Next Topic:ScopeProvider: comparing references
Goto Forum:
  


Current Time: Thu Mar 28 13:03:46 GMT 2024

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

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

Back to the top