Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Access References' features
Access References' features [message #1715159] Thu, 19 November 2015 16:38 Go to next message
Ivan Maradzhiyski is currently offline Ivan MaradzhiyskiFriend
Messages: 2
Registered: November 2015
Junior Member
Hello,
I have defined the following grammar:
enum FieldType :
  INTEGER | FLOAT | TEXT | BLOB | NULLT
;
Table:
   'Table' name = ID 
   '{'
       (field += Field | references += Reference)+
   '}'
;

Field:
	name=ID type = FieldType
;

Reference:
	"Reference" refered = [Table]
	('{'
		field = [Field]
	 '}')?
;

and here is my language:
	Table userLevel
	{
		name TEXT
		ranking INTEGER
	}
	Table user
	{
		name TEXT 
		fullName TEXT
                Reference userLevel
                {
                 	/*here are selectable name and fullName from user, I need name and ranking from userLevel */
                }
	}

When I define a reference to userLevel in table user, I want to select a field from userLevel (e.g. name or ranking). Instead I can only select name or fullName, which are fields of table user.
How can I solve this problem?

Thank you in advance.
Regards,
Ivan
Re: Access References' features [message #1715427 is a reply to message #1715159] Mon, 23 November 2015 14:00 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14677
Registered: July 2009
Senior Member
How does you scope provider impl look like?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Access References' features [message #1715435 is a reply to message #1715427] Mon, 23 November 2015 14:33 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14677
Registered: July 2009
Senior Member
something like

def IScope scope_Reference_field(Reference ctx, EReference r) {
return Scopes.scopeFor(ctx.getTable().getField());
}


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Access References' features [message #1715544 is a reply to message #1715435] Tue, 24 November 2015 10:38 Go to previous message
Ivan Maradzhiyski is currently offline Ivan MaradzhiyskiFriend
Messages: 2
Registered: November 2015
Junior Member
It works!
Thank you for your hint!
Regards,
Ivan
Previous Topic:XText Formatter2; textRegionsAccess undefined
Next Topic:Getting errors and warnings headless?
Goto Forum:
  


Current Time: Wed May 08 07:06:52 GMT 2024

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

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

Back to the top