Pergunta

I have created my ecore model:

enter image description here

I have specified it in my xtext file:

MinRequirementsType returns MinRequirementsType:
    'MinRequirementsType'

Next I want to implement the rule, but when I try

enum minrequire: 0|1 ;

I get a mistake!

How is the correct syntax?

Foi útil?

Solução

Your enum declaration is wrong. Try the following:

grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals

generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"

Model: test+=Test*;

enum OneOrZero: one = '1' | zero = '0';

Test returns Test: value = OneOrZero;

Regards,

Xavier

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top