Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Problem Implementing linking-scoping(How can I implement my scope provider to make the linking mechanism working in my grammar?)
Problem Implementing linking-scoping [message #645398] Fri, 17 December 2010 02:00 Go to next message
Jake is currently offline JakeFriend
Messages: 21
Registered: November 2010
Junior Member
I've a problem (Im a newbie) implementig a scope provider for this example grammar:

/*****************************************/
Program:

ports+=port*

main=main;

port:

{port} "inputPort"|"outputPort" name=ID portBody=PortBody;

PortBody:

"{" "Operation" ":" name=ID "}";

main:

{main} "{" opCalls += opCall* "}";

opCall:

op=[PortBody] "(" INT ( "," INT)* ")";

/*****************************************/

How can I implement my scope provider to make the linking mechanism working in my grammar (e.g I wold link sum in the snippet down here)

inputPort pt1{

Operation: sum

}


main {

sum(1,2)

}


Re: Problem Implementing linking-scoping [message #645432 is a reply to message #645398] Fri, 17 December 2010 09:16 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

The short answer is: The linking/scoping works out of the box, provided you use the SimpleNameFragment instead of the QualifiedNameFragment (search this forum or the documentation).
Right now, the name used for "sum" is pt1.sum (qualified name calculated using the names of the containers as well).

Alex
Re: Problem Implementing linking-scoping [message #645457 is a reply to message #645432] Fri, 17 December 2010 10:11 Go to previous messageGo to next message
Meinte Boersma is currently offline Meinte BoersmaFriend
Messages: 434
Registered: July 2009
Location: Leiden, Netherlands
Senior Member
And an equally short semi-answer is: you might find some hints in http://dslmeinte.wordpress.com/2010/09/06/tricks-for-impleme nting-scoping/ (and sorry for the shameless plugging again Very Happy).

Re: Problem Implementing linking-scoping [message #645497 is a reply to message #645457] Fri, 17 December 2010 13:51 Go to previous message
Jake is currently offline JakeFriend
Messages: 21
Registered: November 2010
Junior Member
Thank you very much to both! I really like this newgroup, fully and promptly answers!
Previous Topic:Problem on adding xtext to Eclipse3.6
Next Topic:Content Assistant Proposal
Goto Forum:
  


Current Time: Fri Apr 26 05:24:43 GMT 2024

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

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

Back to the top