Skip to main content



      Home
Home » Modeling » TMF (Xtext) » parsing issue affecting content assist
parsing issue affecting content assist [message #1805449] Mon, 15 April 2019 08:58 Go to next message
Eclipse UserFriend
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 77 times)

[Updated on: Mon, 15 April 2019 09:02] by Moderator

Re: parsing issue affecting content assist [message #1805451 is a reply to message #1805449] Mon, 15 April 2019 09:07 Go to previous messageGo to next message
Eclipse UserFriend
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] ';'
;   
Re: parsing issue affecting content assist [message #1805470 is a reply to message #1805451] Mon, 15 April 2019 14:20 Go to previous message
Eclipse UserFriend
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: Mon Mar 24 09:48:45 EDT 2025

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

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

Back to the top