Newsgroups: rec.arts.int-fiction
Path: nntp.gmd.de!news.ruhr-uni-bochum.de!news.rwth-aachen.de!uni-paderborn.de!fu-berlin.de!main.Germany.EU.net!mcsun!EU.net!newsfeed.internetmci.com!MAXWELL!not-for-mail
From: klo@nexusprime.org (Kevin Lo)
Subject: Re: [Inform 5.5] <BIG> What's the story with parse_name?
Message-ID: <MPLANET.322cac99klo9896af@news.nexusprime.org>
Date: Tue, 3 Sep 1996 18:09:39 -0400
References: <50i1sn$4k@news.dx.net>
X-Newsreader: MicroPlanet Gravity v1.00 (30 Day Trial)
Lines: 56

In article <50i1sn$4k@news.dx.net>, professor.falken@pnx.com says...
> Could anyone help me figure out what's going on here?
> 
> I have found parse_name to be a very useful property on objects.  I
> was worried about a conflict in definition, though.  The Designers
> Manual (2nd edition) clams that parse_name
> 
>  ...returns:  0 if the text didn't make any sense at all, 1 to make
>     the parser resume its usual course..., or the number of words in
>     a row succesfully matched.
> 
> Which made perfect sense to me, except that I didn't understand what
> to return if only one word is successfully matched, the return code of
> "1" being already reserved for telling the parser to revert to looking
> at the name property.
> 
> I have come to find out, however, that Inform 5.5 (with library
> version 5/12) doesn't work like this at all; the definition given
> above is wrong.  For example, given the code:
> 
>  Object startroom "Starting room"
>    with description "Starting room.",
>    has light;
> 
>  Nearby Apple "red apple"
>    with name "red" "apple";
> 
>  Nearby Banana "yellow banana"
>    with name "yellow" "banana";
> 
>  Nearby Thing "strange object"
>    with name "strange" "object",
>    parse_name [; return 1;];

  Someone correct me if I'm wrong, but doesn't parse_name routine check every 
word passed to the parser, then return results based on code within the 
routine? If so, this routine is saying, "You said a noun- you must mean me!".  
So, you must do something like this instead:

  Nearby Thing "strange object"
    with name "strange" "object",
    parse_name [j k;
                while (NextWord()=='thing' or j) i++;
                return i;
                ];

  So, in essence, your parse_name routine is returning 1 for every "incomplete" 
noun it finds (i.e. "banana", not "yellow banana" - it'd probably mess up on 
"apple" too), and is screwing up everything else. :)

-- 
      ^       
    _' `_      * Kevin Lo -- http://www.nexusprime.org/personal/klo/
 .-~'   `~-.    - klo@bigfoot.com               - HTML / Perl / C / Java  
(  ' __. `  )   - Callsign: KF4JXF              - AKA Radnor & FDC Merlin
 `-''   ``-'

