Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Cross reference with dot in a name
Cross reference with dot in a name [message #1759620] Thu, 13 April 2017 18:29 Go to next message
Eclipse UserFriend
I have a grammar in which variable names can have dots in them.
But when I try to use cross reference for it. It is not able to find it when there is a dot in var name.
xtext seems to be treating these dots specially. How can I force xtext stop treating the dots specially.

VarDecl:
'VAR' name=VarID ';'
;

VarID:
ID ('.' ID)*
;
Assign:
left=[VarDecl|VarID] '=' right=ID


Works:
VAR varName;
varName = x

Doesn't work: (cannot find var.name)
VAR var.name;
var.name = x
Re: Cross reference with dot in a name [message #1759794 is a reply to message #1759620] Tue, 18 April 2017 02:26 Go to previous messageGo to next message
Eclipse UserFriend
hi,

i cannot reproduce this.
can you please share everything needed to reproduce it. e.g. did you customizations to scoping, nameproviders etc.
do you have other stuff in the grammar that could interfer etc.
Re: Cross reference with dot in a name [message #1759803 is a reply to message #1759794] Tue, 18 April 2017 11:26 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

the "qualified name" is based on hierarchy of objects, each on has his simple name (just the delivered ID, no dots).
The dots come into place where you want to refer to an object inside a higher level object:
classA.variableB

which are defined as
class A { variable B}

HIH, Uli
Re: Cross reference with dot in a name [message #1801919 is a reply to message #1759803] Tue, 29 January 2019 09:23 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

i have this same issue. I will post details here to not open another thread, please just tell me if i should open another.

My intention, same as the author, is only to have dots "." in the name no import or package representation. Only being able to parse name with dots and resolve them in cross references.

My grammar is like:

Name:
    ID ('.' ID)*
;

Email:
    Name '@' Name
;

Customer:
	'customer' name = Name	'email'	email = Email
;

Application:
    'application' name = ID 'administrator' admin = [Customer]


I don't have any customization in place, so no custom ScopeProvider or NameProvider.

I can declare customers like stated in before rules
customer test.user email test.user@test.com

But as soon as i try to use them in a cross reference:
application AppTest administrator test.user

i receive the error:
Couldn't resolve reference to Customer 'test'.


Any hint will be welcome,

Thanks in advance,
David
Re: Cross reference with dot in a name [message #1801935 is a reply to message #1801919] Tue, 29 January 2019 10:50 Go to previous messageGo to next message
Eclipse UserFriend
i dont understand

the solution applied would be

admin = [Customer|Name]
Re: Cross reference with dot in a name [message #1801943 is a reply to message #1801935] Tue, 29 January 2019 12:30 Go to previous messageGo to next message
Eclipse UserFriend
Hi Christian,

thanks! That solved the issue.
Now I find my self wondering why is needed both alternatives :-)

Thanks again,
David
Re: Cross reference with dot in a name [message #1801949 is a reply to message #1801943] Tue, 29 January 2019 13:01 Go to previous message
Eclipse UserFriend
admin = [Customer] is short for admin = [Customer|ID] which means: reference to customer, parse ID
ID does not allow .

Previous Topic:Customize the inserted value from auto-complete from the proposed
Next Topic:Xbase DSL Editor is extremely slow
Goto Forum:
  


Current Time: Sat Jun 14 14:26:23 EDT 2025

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

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

Back to the top