Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Custom Qualified Name provider does not work, displays error
Custom Qualified Name provider does not work, displays error [message #883516] Fri, 08 June 2012 17:40 Go to next message
Latha Shankara is currently offline Latha ShankaraFriend
Messages: 33
Registered: June 2012
Member
Hello Xtexters,

I have a problem in working of custom qualified name provider. I have created a custom qualified name provider for my dsl. I have made the necessary bindings also.

Code for the custom qualified name provider is

public class MydslQualifiedNameProvider extends DefaultDeclarativeQualifiedNameProvider{

public QualifiedName qualifiedName(Element ele){
MethodDeclaration method = (MethodDeclaration)ele.eConatiner();
return QualifiedName.create(method.getName(), ele.getName);
}

In my dsl I want an element name to be appended along with its method name in the format,

methodName.elementName

I have provided appropriate scoping also,

@Inject MydslQualifiedNameProvider nameProviderr;
.....
scopes.scopeFor(elements, nameProvider, IScope.NULLSCOPE);

where elements - List of elements

But on running my dsl, it displays an error at '.'

classA{
.....
public real methodA(real x){
real y;
}
.....
}

class B{
public void methodB(){
methodA.y; // An error is displayed here saying '.' as mismatched input
}
}

I observed that I get correct scoping. What could be the reason for the error? Is there anything I am missing or is it related to grammar?

Thanks for any help..
Re: Custom Qualified Name provider does not work, displays error [message #883533 is a reply to message #883516] Fri, 08 June 2012 18:16 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13637
Registered: July 2009
Senior Member
can you share your grammar?
i guess you have something like ref=[Element] which is short for ref=[Element|ID]
but maybe it should be ref=[Element|FQN] with

FQN: ID ("." ID)*;


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Custom Qualified Name provider does not work, displays error [message #883687 is a reply to message #883533] Sat, 09 June 2012 04:46 Go to previous message
Latha Shankara is currently offline Latha ShankaraFriend
Messages: 33
Registered: June 2012
Member
Hi Christian,

Thanks a lot for your help!! That solved my problem. Smile
Previous Topic:xtext-utils: Content is not allowed in prolog
Next Topic:Refactoring rename - new reference text
Goto Forum:
  


Current Time: Sat Oct 24 04:30:59 GMT 2020

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

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

Back to the top