There are certain classes of grammars for which the (completion) parser doesn’t return all sorts that are allowed at a particular position.

How to reproduce:

  • Add the following grammar to EntityLang:


context-free syntax
“if” ID “then” Property* ElseIfPart* ElsePart? “end” -> Property {cons(“If”)}
“elseif” ID “then” Property* -> ElseIfPart {cons(“ElseIf”)}
“else” Property* -> ElsePart {cons(“Else”)}

  • Now insert something like this in an entity:


if cond then
elseif cond then
//cursor
end

  • Trigger completion at the marked cursor location. Only Property is in the list of candidate sorts. I expected ElseIfPart and ElsePart to be in the list too. The correct sorts are reported when I trigger completion with the cursor right after the last then keyword.

As far as I have seen it happens often when there are consecutive * and ? symbols in a production.

It doesn’t appear to be fixable by inserting extra (recovery) productions.

Submitted by Tobi Vollebregt on 18 April 2011 at 16:57

On 18 April 2011 at 16:58 Tobi Vollebregt tagged completion

On 8 January 2013 at 15:04 Eelco Visser tagged 1.1

On 8 January 2013 at 15:04 Eelco Visser tagged @maartje

On 18 January 2013 at 20:04 Guido Wachsmuth tagged @gohla

On 22 January 2013 at 07:43 Gabriël Konat removed tag @gohla

On 7 February 2013 at 10:11 Gabriël Konat tagged unconfirmed

On 7 February 2013 at 11:08 Gabriël Konat commented:

The sorts do not seem to show up in the console message, unless there is a completion template for that sort. Is this intended behavior?


On 7 February 2013 at 11:09 Gabriël Konat removed tag unconfirmed

On 8 February 2013 at 13:45 Maartje commented:

fixed in new completion handling (Spoofax 1.1).


On 8 February 2013 at 13:45 Maartje closed this issue.

Log in to post comments