Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » parsing issue affecting content assist
parsing issue affecting content assist [message #1805449] Mon, 15 April 2019 12:58 Go to next message
Mihai Sterpu is currently offline Mihai SterpuFriend
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 23 times)

[Updated on: Mon, 15 April 2019 13:02]

Report message to a moderator

Re: parsing issue affecting content assist [message #1805451 is a reply to message #1805449] Mon, 15 April 2019 13:07 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 13214
Registered: July 2009
Senior Member
can you please open a bug at github.com/eclipse/xtext-core
as a workaround you may try

FooDef:
    "FooDef" name=ID '{'
    	x=X
    '}';
    
X:
	"barRef" '=' barRef=[Bar|ID] ';'
;   


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: parsing issue affecting content assist [message #1805470 is a reply to message #1805451] Mon, 15 April 2019 18:20 Go to previous message
Mihai Sterpu is currently offline Mihai SterpuFriend
Messages: 3
Registered: December 2014
Junior Member
Hi!

Thank you for your response! I created the bug ticket.
Previous Topic:Null properties of the EObject in the ScopeProvider
Next Topic:Getting IEObjectDescription from JvmTypeRefence without proxy resolution
Goto Forum:
  


Current Time: Wed Nov 20 19:21:50 GMT 2019

Powered by FUDForum. Page generated in 0.02102 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top