Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Troubles understanding Qualified Name
Troubles understanding Qualified Name [message #1804320] Fri, 22 March 2019 11:34 Go to next message
Maximilian Weißböck is currently offline Maximilian WeißböckFriend
Messages: 2
Registered: March 2019
Junior Member
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 19:20 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13158
Registered: July 2009
Senior Member
obiect = [Definition]

is short for

obiect = [Definition|ID]

which means: refer to Definition, parse ID.

ID does not allow "."

=>

obiect = [Definition|QualifiedID]


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Troubles understanding Qualified Name [message #1804444 is a reply to message #1804414] Tue, 26 March 2019 08:23 Go to previous message
Maximilian Weißböck is currently offline Maximilian WeißböckFriend
Messages: 2
Registered: March 2019
Junior Member
Thanks, works!
Previous Topic:Validation (warning) when object is not used
Next Topic:EByte
Goto Forum:
  


Current Time: Thu Oct 17 15:06:32 GMT 2019

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

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

Back to the top