2013-11-23 31 views
0

硬編碼的預定義的值開始來回在這裏http://www.eclipse.org/Xtext/documentation.html#DomainModelWalkThrough 我想添加一些預定義的類型字符串,以便在XTEXT

entity ent{ 
    d:INTEGERS 
} 

是合法的。如果沒有申報statment

datatype INTEGERS 

我已經試過

Type: 
    DataType | Entity | value=PredefType; 

enum PredefType: INTEGERS='INTEGERS' | STRING='STRING'; 

Type: 
    DataType | Entity | PredefType; 

PredefType: 
    name='INTEGERS' | name='STRING'; 

但既不工作。

對不起,如果問題很傻,我是新來的xtext。

回答

0
Type: 
DataType | Entity | PredefType; 

PredefType: type=SimpleType; 

enum SimpleType: INTEGERS='INTEGERS' | STRING='STRING'; 
+0

這似乎不起作用。在生成的插件中,我收到一個編譯錯誤「不匹配的輸入'INTEGERS'期待RULE_ID」 – user833970