parsing issue affecting content assist [message #1805449] |
Mon, 15 April 2019 12:58 |
Mihai Sterpu Messages: 3 Registered: December 2014 |
Junior Member |
|
|
Hi!
I have the following grammar definition:
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals hidden(SL_COMMENT, WS)
generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"
World:
{World}
fooBars+=FooBar*
;
FooBar:
Foo|Bar
;
Foo:
"Foo" name=ID '{'
fooDef=FooDef
'}'
;
FooDef:
"FooDef" name=ID '{'
"barRef" '=' barRef=[Bar|ID] ';'
'}';
Bar:
"Bar" name=ID '{'
'}';
The following code works just fine:
Bar bar1{}
Foo foo1
{
FooDef fd
{
barRef=bar1;
}
}
Reversing the definitions of bar1 and foo1 seems like working fine:
Foo foo1
{
FooDef fd
{
barRef=bar1;
}
}
Bar bar1{}
but actually, if you try to use the content assist after "bar Ref=" you will see it doesn't work.
The internal parser (antlr?) is confused because of the closing curly bracket of foo1 so everything after the foo1 definition is not parsed anymore.
If I replace the curly brackets from the grammar definition of FooDef with something else (ie. square brackets), then this is fine and content assist works.
I attached a picture with the error which is reported at the closing curly bracket of foo1.
Does this sound like an XText bug or maybe is there some way of configuring it so I avoid this problem?
This reproduced on a larger project but I reduced it to a small proof of concept grammar.
-
Attachment: p1.JPG
(Size: 32.76KB, Downloaded 65 times)
[Updated on: Mon, 15 April 2019 13:02] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04327 seconds