Community
Participate
Working Groups
Build Identifier: 20110615-0604 If you define an unordered group where all elements are optional (like class modifiers in Java) it leads into an infinite/endless loop if you hit code-completion. If you test the sample you will notice that the endless loop is caused by the ui.InternalMyDslParser.rule__ClassDeclaration__MembersAssignment_4 method. It starts searching for proposals within it's nested rule and this leads to an infinite recursion. Reproducible: Always Steps to Reproduce: 1. Create a new empty xtext project 2. Copy the grammar from the attachment into the project and run the MWE2 3. Start Eclipse 4. Create a new empty DSL file 5. Place the cursor on the first line and hit CTRL+Space 6. The proposal provider will end up in an endless loop.
Created attachment 205128 [details] A demo grammar causing the problem
I added a second sample grammar which demonstrates the problem. This time there's no recursion in the grammar but the error is caused by the unordered group. The Parser tries to find all available proposals but gets stuck because all elements are optional. (That's how it seems to be) The parser loops within rule__ClassDeclaration__Group__4__Impl because the input.LA(1) always returns EOF in this case the rule__ClassDeclaration__MembersAssignment_4 is called over and over. Somehow the empty group causes the parser to never change the alt3 value and there the problem starts. To test the second grammar: Simply add an empty file and hit ctrl+space
Created attachment 205129 [details] A second grammar without recursive rule calls.
Good catch. Things like Foo: {Foo} (a | b?); can cause an infinite recursion.
Pushed to master.
Closing all bugs that were set to RESOLVED before Neon.0