Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Ideas on ways to handle a type definition for fixed fields.
Ideas on ways to handle a type definition for fixed fields. [message #647332] Wed, 05 January 2011 16:42 Go to next message
drew frantz is currently offline drew frantzFriend
Messages: 340
Registered: July 2009
Senior Member
We have recently added a number of fixed length datatype defintions into our
language lets call it FRUIT(1)...FRUIT(4). Currently I specify type fields
as Identifiers and was looking to add new rules to support these as well.
Anyone run across this problem, with some simple rules. I have tried a
couple of things, that don't seem to work so I am looking for some guidance.
thanks,drew
Re: Ideas on ways to handle a type definition for fixed fields. [message #647366 is a reply to message #647332] Wed, 05 January 2011 18:58 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

sorry, I don't quite get what you are trying to do? Could you give a
couple of examples of the target syntax, i.e. what should your model
file look like?

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: Ideas on ways to handle a type definition for fixed fields. [message #647368 is a reply to message #647366] Wed, 05 January 2011 19:17 Go to previous messageGo to next message
drew frantz is currently offline drew frantzFriend
Messages: 340
Registered: July 2009
Senior Member
syntax:

typedef MyNewType
{
a : boolean ;
b : string;
c: fruit(1);
d: fruit(2);
e: fruit(10);

};


"Alexander Nittka" <alexander.nittka@itemis.de> wrote in message
news:ig2emi$m8p$1@news.eclipse.org...
> Hi,
>
> sorry, I don't quite get what you are trying to do? Could you give a
> couple of examples of the target syntax, i.e. what should your model file
> look like?
>
> Alex
Re: Ideas on ways to handle a type definition for fixed fields. [message #647370 is a reply to message #647368] Wed, 05 January 2011 19:27 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

do you define the simple datatypes elsewhere?

Attribute: name=ID ':' type=[Type] (isArray?='(' fieldlength=INT ')')?

The idea of the isArray is that you can test whether a fieldlength is
set (the default value for an unset value would be 0).

But maybe this is still too far from what you want.

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: Ideas on ways to handle a type definition for fixed fields. [message #647374 is a reply to message #647370] Wed, 05 January 2011 20:25 Go to previous message
drew frantz is currently offline drew frantzFriend
Messages: 340
Registered: July 2009
Senior Member
Thanks. I came to similar solution using the ('(' fieldlength=INT ')')?

"Alexander Nittka" <alexander.nittka@itemis.de> wrote in message
news:ig2gcr$pec$1@news.eclipse.org...
> Hi,
>
> do you define the simple datatypes elsewhere?
>
> Attribute: name=ID ':' type=[Type] (isArray?='(' fieldlength=INT ')')?
>
> The idea of the isArray is that you can test whether a fieldlength is set
> (the default value for an unset value would be 0).
>
> But maybe this is still too far from what you want.
>
> Alex
Previous Topic:Loading model objects
Next Topic:Invalidate Model on external changes
Goto Forum:
  


Current Time: Thu Apr 25 22:44:58 GMT 2024

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

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

Back to the top