[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.tmf] Re: How to assign attributes inside rules?

Hi Michael,

you may try to use a value converter to assign something to your int attribute. For example you may configure data type rules:

FooIntAttr1 returns ecore::EInt: 'x';
FooIntAttr2 returns ecore::EInt: 'y';

and use

Foo: alternative=FooIntAttr1 Alternative1 | alternative=FooIntAttr2 Alternative2;

That should do the trick.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Michael Scharf schrieb:
Hi,

is there a way to assign attributes to constant values
inside a rule?

class Foo {
  attr int alternative;
}

  Foo returns my::Foo: 'x' Alternative1 | 'y' Alternative2;

I want to set an attribute in my::Foo depending on
which alternative has been used (e.g. I want to
assign to the attribute 'alternative' 1 if Alternative1
was used and 2 if Alternative2 was used)



Michael