I have generated an Xtext grammar from an ecore model and the grammar that I got is the following:
generate myDsl "http://www.xtext.org/example/mydsl16/MyDsl"
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
WorldMap returns WorldMap:
'WorldMap'
'{'
'WorldMap' WorldMap=EString
'countrycorona' countrycorona+=CountryCorona ( "," countrycorona+=CountryCorona)*
'}';
CountryCorona returns CountryCorona:
'CountryCorona'
'{'
'CountryCorona' CountryCorona=EString
'population' population=EInt
'continent' continent=EString
'infectedPopulation' infectedPopulation=EInt
'zonelabel' zonelabel=zonelabelcolour
'}';
EString returns ecore::EString:
STRING | ID;
EInt returns ecore::EInt:
'-'? INT;
enum zonelabelcolour returns zonelabelcolour:
red = 'red' | orange = 'orange' | yellow = 'yellow' | green = 'green' | white = 'white';
My issue is that when I try write a model for this grammar, I usually use CTRL Space, to get the suggestion for the following token. However after I write WorldMap { WorldMap, I get
no viable alternative at input ''
Furthermore, I do not get a suggestion that the next token should be an EString. Refering to Xtext documentation I should be able to use this EString, but apparently I can't. Do you know what might be the issue?
Thank you!
Xtext content assist does not do a deep analysis of datatype rules. Thus you have to implement the content assist rule in the proposal provider yourself e.g.