Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext Beginner Scoping/Referencing Problem(Referencing based on previous reference)
Xtext Beginner Scoping/Referencing Problem [message #1818732] Wed, 25 December 2019 11:10 Go to next message
Selin Aydin is currently offline Selin AydinFriend
Messages: 1
Registered: December 2019
Junior Member
Hi everyone,

I have a language like this:

objectA{
 attribute1
}

objectB{
 objectA.attribute1
}



Grammer rules, like
refObject=[Object]'.'attRef=[Attribute] 
only work inside an object. I can reference ObjectA.attribute1 only in ObjectA, but not in Object B. I'm trying to get into the ScopeProvider, but is it possible to create a reference (attribute) based on the reference before (object)? Is there some documentation of similar cases? Thanks in advance!
Re: Xtext Beginner Scoping/Referencing Problem [message #1818825 is a reply to message #1818732] Mon, 30 December 2019 06:33 Go to previous message
Uli Merkel is currently offline Uli MerkelFriend
Messages: 250
Registered: June 2013
Senior Member
Hi Selin.
In your case the reference should look like to handle the hierarchy :
attRef=[Attribute|FQN];
FQN: ID ('.' ID)*;

This should work out of the box.

Have a look into the documentation for FQN (full qualified name):

Entity: ... 'extends' extends=[Entity|Fqn]...;
Fqn: ID ('.' ID)*;

explained in https://nittka.github.io/2011/08/01/scoping1.html
Previous Topic:Code coverage of generated Java code
Next Topic:Error on retrieval of features in *Generator.xtend
Goto Forum:
  


Current Time: Tue Apr 23 11:22:37 GMT 2024

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

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

Back to the top