In my dsl I was trying the following:
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]
']'
;
My problem is on the step. I want only the ingredients I've declared on the Recipe to appear. For example if I do this:
Recipe {
ingredient Fish 1 kg
ingredient Meat 2kg
[
Cut
]
}
Below cut I only want fish and meat to appear as options.
I've read about cross-references but I can't get it to work while using an enum to limit user input.