Inform - Support - Patches

About Patches  

Compiler  
Library  

DM4 Errata  

Issue L60901

ParseToken() returns wrong value
Submitted by: Neil Cerutti     Appeared in: Library 6/9     Fixed in: Library 6/10
Problem

A small group of similar bugs was introduced into Parserm.h in library 6/9. The return values from this routine were changed so that 0, which used to mean 'failed', now means, "result in multiple object list." A few spots in ParseToken still return 0, when they should return the new value for an error condition, '-1' (minus one).

These bugs were seen most often as "vile 0 errors from hell". They cause Inform to call actions with 'noun' or 'second' set to 0, which assume 'noun' or 'second' will be an object. If you were using the 'trace' debugging verb, you could see that Inform thought it had succesfully matched tokens that it had not.

Solution
--- parserm     Wed Apr 28 21:26:18 1999
+++ parserm.h   Tue Jun 29 08:53:24 1999
@@ -1619,7 +1619,7 @@

                NUMBER_TOKEN:
                    l=TryNumber(wn++);
-                   if (l==-1000) { etype=NUMBER_PE; rfalse; }
+                   if (l==-1000) { etype=NUMBER_PE; return -1; }
                    #ifdef DEBUG;
                    if (parser_trace>=3) print "  [Read number as ", l, "]^";
                    #endif;
@@ -1767,7 +1767,7 @@
             for (l=1:l<=LanguageDescriptors-->0:l=l+4)
                 if (o == LanguageDescriptors-->l) jump AssumeDescriptor;
             pronoun__word=pronoun_word; pronoun__obj=pronoun_obj;
-            etype=VAGUE_PE; return 0;
+            etype=VAGUE_PE; return -1;
         }
     }

@@ -1781,7 +1781,7 @@

     .TryAgain;
 !   First, we parse any descriptive words (like "the", "five" or "every"):
-    l = Descriptors(token_allows_multiple); if (l~=0) { etype=l; return 0; }
+    l = Descriptors(token_allows_multiple); if (l~=0) { etype=l; return -1; }

     .TryAgain2;

@@ -1882,7 +1882,7 @@
         if (l==0)
         {   if (indef_possambig)
             {   ResetDescriptors(); wn = desc_wn; jump TryAgain2; }
-            etype=CantSee(); return l;  ! Choose best error
+            etype=CantSee(); return -1; ! Choose best error
         }


Last updated 17 April 2013. This site is no longer supported; information may be out of date.
Maintained as a historical archive by the Interactive Fiction Technology Foundation. Copyright 1993-2018 IFTF, CC-BY-SA unless otherwise noted.
This page was originally managed by Roger Firth.