[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.tmf] Re: How to return a list of objects?

Hi Michael,

it's the case that we don't have enough ideas - actually we have a concept on how to solve this one - it has just not yet been implemented :-)

You may want to subscribe to https://bugs.eclipse.org/bugs/show_bug.cgi?id=263773

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

Michael Scharf schrieb:
it is currently not possible to return a list of objects from a parser rule. You'll have to copy the annotation snippet to every location.

I have been thinking of different solutions:

1. have something like macro-rules: they look like rules
   but in realty, they are copied into each location
   (the solution you suggested but automated)
2. allow to inherit a rule (run it in the context of the
   "parent" rule). In that case it would act as
   "extension" (not much different form solution 1)
3. rules with no assignment could return a list
   that can be assigned to a list variable:
     ListRule returns list: list+=Element (',' List+=Element);
4. rules could have attributes
     Parent: list=ListRule.list;
     ListRule: list+=Element (',' List+=Element);
5. Allow expression to build up the object:
     Parent: ListRule as X {list=X.list; foo=X.foo};
     ListRule: (foo?='foo')? list+=Element (',' List+=Element);
....

Michael