Hello guys,
I need little help with understanding and fixing a problem, why Xtext parser stops parsing after finding a keyword from a language, even tough the syntax says something else.
I am using the xtext wizard from eclipse to create the Hello language, and then I just change the grammar section to be based on Xbase.
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.xbase.Xbase
generate myDsl ...
Model:
greetings+=Greeting*;
Greeting:
'Hello' name=QualifiedName '!';
and add this to the model inferrer
for (greeting : model.greetings)
{
acceptor.accept(greeting.toClass( QualifiedName.create(greeting.name) )).initializeLater
[
members += greeting.toMethod("hello" + greeting.name, greeting.newTypeRef(typeof(String)))
[
body = [ append('''return "Hello «greeting.name»";''') ]
]
]
}
then generate the code and run eclipse afterwards everything seems to work as expected, but when I write
the '.' and '!' get underlined and Hello is highlighted. The outline shows two elements which is wrong and
model inferrer is called twice. First time for 'test' Qualified name and second an empty string.
I expected that the inferrer would be called once with 'name' set to test.Hello
QualifiedName:
ValidID (=>'.' ValidID)*;