Skip to main content



      Home
Home » Modeling » TMF (Xtext) » conflict between 'literals' and qualifiednames
conflict between 'literals' and qualifiednames [message #554755] Tue, 24 August 2010 06:50 Go to next message
Eclipse UserFriend
Hi,

say I have rules like

Model:
    'model' name=ID ...

QualifiedName:
    ID ('.' ID)*;

.

It now is impossible to use 'model' in qnames like 'org.example.model.myModel' because Xtext seems to interpret the 'model' in the qname as the beginning of the Model-rule. Is there a workaround?

Thanks.

Regards,


Alexander
Re: conflict between 'literals' and qualifiednames [message #554759 is a reply to message #554755] Tue, 24 August 2010 07:08 Go to previous messageGo to next message
Eclipse UserFriend
Hello Alexander,

what about

Model:
    'model' name=ID fqn=QualifiedName;

QualifiedName:
    ('model' | ID) ('.' ('model' | ID))*;


Regards
Christian
Re: conflict between 'literals' and qualifiednames [message #554764 is a reply to message #554755] Tue, 24 August 2010 07:12 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

this is a standard problem as keywords are keywords wherever they
appear. You either introduce a separate data type rule for ID+keywords

IdOrKeywords: ID|'model';

and use IdOrKeyword wherever you would have used ID before or you simply
put it in the QualifiedName rule

QualifiedName: (ID|'model') ('.' (ID|'model'))*;


Note that you also can escape keywords.

^model will not be read as the keyword "model" but an ID with string
value "model". The caret is removed by the value converter.

Alex
Re: conflict between 'literals' and qualifiednames [message #554785 is a reply to message #554755] Tue, 24 August 2010 08:06 Go to previous message
Eclipse UserFriend
Thanks for your help.

Kind regards,

Alexander
Previous Topic:Externalize workflow settings in xtext 1.0
Next Topic:Generating code from within DSL Editor
Goto Forum:
  


Current Time: Mon Jul 07 12:48:01 EDT 2025

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

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

Back to the top