Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Troubles understanding Qualified Name
Troubles understanding Qualified Name [message #1804320] Fri, 22 March 2019 07:34 Go to next message
Eclipse UserFriend
I have a simple DSL with definitions and imports and I need to use Qualified Names. Here an example of the DSL

---- xtext dsl definition -----

grammar test.mydsl.MyDsl1 with org.eclipse.xtext.common.Terminals

generate myDsl1 "http : www mydsl test MyDsl1"

Model:
definitions += Definition*
imports += ImportDef*
;

Definition:
'def' name = QualifiedID text = STRING ';'
;

ImportDef:
'import' obiect = [Definition] 'as' name = ID ';'
;

QualifiedID:
ID ('.' ID)*
;

----- here an example for definitions ------

def aa.aa "this is aa.aa";
def aa.bb "this is aa.bb";
def cc "this is cc without namespace";
def dd "this is dd without namespace";

---- and here I like to use the definitions ------

import cc as CC;
import aa.aa as AA;

-----

Now my problem is, in the import I can not use the qualified name, eg. aa.aa or aa.bb are not valid, this gives an error
But importing cc and dd works
also the context help only shows the non qualified definitions, cc and dd

I'm relatively new to Xtext (well, I did some small stuff long, long ago with oAW) and I'v read the book from Lorenzo Bettini, Second Edition, but this is still annoying to me.

Any hints how to solve this?

index.php/fa/35111/0/
index.php/fa/35112/0/

Thanks Max

PS: as new user I'm not allowed to post URLs, so the url in the grammar file is invalid
Re: Troubles understanding Qualified Name [message #1804414 is a reply to message #1804320] Mon, 25 March 2019 15:20 Go to previous messageGo to next message
Eclipse UserFriend
obiect = [Definition]

is short for

obiect = [Definition|ID]

which means: refer to Definition, parse ID.

ID does not allow "."

=>

obiect = [Definition|QualifiedID]
Re: Troubles understanding Qualified Name [message #1804444 is a reply to message #1804414] Tue, 26 March 2019 04:23 Go to previous message
Eclipse UserFriend
Thanks, works!
Previous Topic:Validation (warning) when object is not used
Next Topic:EByte
Goto Forum:
  


Current Time: Thu Jun 12 11:37:33 EDT 2025

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

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

Back to the top