how to add a separator in in xtext list?

2019-08-27 18:06发布

问题:

I have the following grammar fragment:

FixtureGroup:
                            name            = ID 
    ':'                     fixtures += [Fixture]*
    ';';

And in the instance I can type for the above rule the following:

FrontLeft: FrontLeft1 FrontLeft2;

However, what I like to type is a plus in between:

FrontLeft: FrontLeft1 + FrontLeft2;

How should I change the grammar to accomplish this?

回答1:

the ususal pattern is

':' (fixtures += [Fixture] ('+' fixtures += [Fixture])*)?