Problem with multiexcept lookahead

In the current version of Inform 7, incomplete input which depends on a multiexcept token, such as a player typing INSERT COIN rather than INSERT COIN INTO VENDING MACHINE, produces “I didn’t understand that sentence.” rather than “What do you want to insert the coin in?”, which is what library 6/11 produces.

I think the bug stems from Jesse McGrew’s patch for the multiexcept lookahead, which I assume has been incorporated into the 6/11N library:

inform-fiction.org/patches/L61127.html

Specifically, this is the point where the input is rejected:

                     if (wn > num_words) {
                         #Ifdef DEBUG;
                         if (parser_trace >= 2)
                             print " [Look-ahead aborted: prepositions missing]^";
                         #Endif;
                         jump LineFailed;
                     }

Here’s a partial patch:

                     if (wn > num_words) {				     
                         #Ifdef DEBUG;
                         if (parser_trace >= 2)
                             print " [Look-ahead aborted: prepositions missing]^";
                         #Endif;

-			     jump LineFailed;
+			     jump EmptyLine;
                     }

                     .....

                     } until (line_ttype-->pcount ~= PREPOSITION_TT);

+				.EmptyLine;

                     ! put back the non-preposition we just read

                     wn--;

The remaining bug with this is objects with prepositions in their name. PUT PURSE OF GOLD ON TABLE will work; PUT PURSE will generate the correct question; but PUT PURSE OF GOLD will still fail.

This seems to take care of it:

                             ! try to find another preposition word
                             do {
                                 l = NextWord();
                             } until ((wn >= num_words) ||
                                      (l && (l->#dict_par1) & 8 ~= 0));

                             if (l && (l->#dict_par1) & 8) continue;
		+       if (wn >= num_words) jump EmptyLine;

                             ! lookahead failed

Have you filed this as a bug report?

Yes, just did it now.