Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Data Type Rule and EMF(Data Type Rules supposed to represent a EDataType)
Data Type Rule and EMF [message #554121] Fri, 20 August 2010 09:02 Go to next message
Softwareassi is currently offline SoftwareassiFriend
Messages: 7
Registered: August 2010
Junior Member
Hello,

I am writing my thesis about textual DSL and using Xtext 1.0 (Eclipse Helios Version) for defining my DSL. While reading the documentation I read about defining Data Type Rules and that these are special Parser Rules. The difference should be that the Parser Rule is an instance of EClass and the Data Type Rule an instance of EDataType (documentation Xtext 1.0 page 29).

So I was thinking when I define a Data Type Rule and I generate the ecore model out of it, the Data Type Rule should become a EDataType element in the model but I just got a regular EClass representation. I used the QualifiedName example from the Documentaion.

Actually my question is whether it is intended to get a EClass representation of my "QualifiedName" rule in my ecore model or should this be a EDataType representation . Or I am totaly wrong and I cannot see it this way?

This should be a Data Type Rule?

QualifiedName :
ID ('.' ID)*
;

Thanks in advance.

Sincerly
Matthias
Re: Data Type Rule and EMF [message #554129 is a reply to message #554121] Fri, 20 August 2010 09:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

a DataType rule does not create a new EDataType but rather helps you to instantiate one when parsing.

QualifiedName returns ecore::EString : 
  ID ('.' ID)*
;


and with the easiest possible sample

Model: name=QualifiedName;

QualifiedName :
ID ('.' ID)*
;


I Cannot see an EClass to be produced.

Regards
Christian



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Data Type Rule and EMF [message #554149 is a reply to message #554121] Fri, 20 August 2010 09:41 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

using

Model:
greeting=QualifiedName;
QualifiedName :
ID ('.' ID)*
;

I cannot reproduce your finding.

In the generated ecore file there is an EClass Model with an attribute
greeting of type EString. If you do not give a return type for the
datatype rule (possibly you have to provide a value converter), the type
used will be string.

Alex


Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de
Re: Data Type Rule and EMF [message #559336 is a reply to message #554149] Thu, 16 September 2010 12:12 Go to previous message
Softwareassi is currently offline SoftwareassiFriend
Messages: 7
Registered: August 2010
Junior Member
Hello,

thanks a lot for your efford. I think I just made a stupid mistake. I am really sorry. It is all working as it should like.
Previous Topic:Content assist and STRING objects
Next Topic:how to replace literal values by something defined in the grammar?
Goto Forum:
  


Current Time: Thu Apr 25 02:05:51 GMT 2024

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

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

Back to the top