Seng Zhe
Seng Zhe

Reputation: 623

Xtext DSL: boolean rule with 2 different string

Currently I have problem in defining a boolean variable :

I have a class with a boolean variable:

Pet:
   isFeline ?= 'cat' | isFeline ?= 'dog' ;

However this result in Pet returning with 'cat'/'dog' as true. Is there anyway to define DSL: 'cat' as true and 'dog' as false ??

Upvotes: 1

Views: 1022

Answers (1)

Joko
Joko

Reputation: 590

Maybe you can try this:

Pet:
    {Pet} (isFeline?='cat' | 'dog');

Normally it should do what you want!

Upvotes: 2

Related Questions