【发布时间】:2020-05-02 14:53:25
【问题描述】:
在我的 dsl 中,我尝试了以下操作:
grammar org.xtext.example.mydsl.Recipe with org.eclipse.xtext.common.Terminals
generate recipe "http://www.xtext.org/example/mydsl/Recipe"
Model:
recipe=Recipe;
enum Ingredients:
Meat | Fish | Rice
;
enum Steps_Type:
Cut | Boil | Prepare
;
Recipe:
'Recipe'
'{'
ingredient+=Ingredient+
step+=Step+
'}'
;
Ingredient:
'ingredient' ingredient_name=Ingredients quantity=INT ('kg' | 'g')
;
Step:
'['
step=Steps_Type
ingredient=[Ingredient]
']'
;
我的问题出在台阶上。我只想显示我在食谱上声明的成分。 例如,如果我这样做:
Recipe {
ingredient Fish 1 kg
ingredient Meat 2kg
[
Cut
]
}
下切我只希望鱼和肉作为选项出现。
我已经阅读了有关交叉引用的信息,但是在使用枚举来限制用户输入时我无法让它工作。
【问题讨论】:
标签: xtext cross-reference