[Xtext] Ecore Metamodel Question [message #62540] |
Wed, 22 July 2009 13:02 |
Eclipse User |
|
|
|
Originally posted by: oba.informatik.uni-kiel.de
Hi all,
both of the following grammars yield to the same Ecore Metamodel:
======================================
GRAMMAR 1
======================================
Model :
(elements+=DataType)+
;
DataType:
'datatype' name=ID ';'?
;
======================================
GRAMMAR 2
======================================
Model :
(elements+=DataType)*
;
DataType:
'datatype' name=ID ';'?
;
======================================
But I would expect that in the first one, the lower bound of the
reference "elements" would be set to 1. This is not the case, can some
one tell me, what I am overseeing/misunderstanding?
Thanks a lot!
mN
|
|
|
|
Re: [Xtext] Ecore Metamodel Question [message #62660 is a reply to message #62565] |
Wed, 22 July 2009 13:20 |
Eclipse User |
|
|
|
Originally posted by: oba.informatik.uni-kiel.de
Michael Burkhardt wrote:
> Hello mN,
hi, thanks for your reply, Micha
> what's wrong?
> You expect in grammar 1 at least one Datatype?
>
> Why you dont use a definition like (see below):
>
> Model:
> head = DataType (tails += DataType)*;
Well, this is what the first rule ( Model: (elements+=DataType)+; )
does, isn't it? Except naming the first element separately.
I do not need this rule at least not in this form but I want to
understand why the generator does not set the lower bound of the
reference "elements" in the generated Ecore model to 1 when my rule says
that it should contain at least one "datatype".
Thanks
mN
|
|
|
Re: [Xtext] Ecore Metamodel Question [message #62683 is a reply to message #62540] |
Wed, 22 July 2009 13:22 |
Sebastian Zarnekow Messages: 3118 Registered: July 2009 |
Senior Member |
|
|
Hi mN,
its intentional. We didn't want to introduce to many constraints in the
metamodel. However, there is an open issue and you may want to comment
it: https://bugs.eclipse.org/bugs/show_bug.cgi?id=266830
If you want strict constraints in your metamodel, you can use a post
processing step. Have a look at the docs to learn about it.
Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 22.07.2009 15:02 Uhr, schrieb myName:
> Hi all,
>
> both of the following grammars yield to the same Ecore Metamodel:
> ======================================
> GRAMMAR 1
> ======================================
> Model :
> (elements+=DataType)+
> ;
> DataType:
> 'datatype' name=ID ';'?
> ;
> ======================================
> GRAMMAR 2
> ======================================
> Model :
> (elements+=DataType)*
> ;
> DataType:
> 'datatype' name=ID ';'?
> ;
> ======================================
>
> But I would expect that in the first one, the lower bound of the
> reference "elements" would be set to 1. This is not the case, can some
> one tell me, what I am overseeing/misunderstanding?
>
> Thanks a lot!
>
> mN
|
|
|
Re: [Xtext] Ecore Metamodel Question [message #62707 is a reply to message #62683] |
Wed, 22 July 2009 13:27 |
Eclipse User |
|
|
|
Originally posted by: oba.informatik.uni-kiel.de
Sebastian Zarnekow wrote:
> Hi mN,
>
> its intentional. We didn't want to introduce to many constraints in the
> metamodel. However, there is an open issue and you may want to comment
> it: https://bugs.eclipse.org/bugs/show_bug.cgi?id=266830
>
> If you want strict constraints in your metamodel, you can use a post
> processing step. Have a look at the docs to learn about it.
>
> Regards,
> Sebastian
>
oh, I see. Thanks Sebastian.
|
|
|
Powered by
FUDForum. Page generated in 0.02969 seconds