<HEAD><TITLE>discuss@charon: [213] in "Coldmud discussion meeting"</TITLE>
<H1>[213] in Coldmud discussion meeting</H1></HEAD>
<A HREF="/"><IMG SRC="/i-d.gif" ALT="root"></A>
<A HREF="?213"><IMG SRC="/i-back.gif" ALT="meeting"></A>
<A HREF="/help.html"><IMG SRC="/i-help.gif" ALT="help"></A>
<A HREF="1"><IMG SRC="/i-first.gif" ALT="first"></A>
<A HREF="211"><IMG SRC="/i-fref.gif" ALT="first in chain"></A>
<A HREF="212"><IMG SRC="/i-pref.gif" ALT="previous in chain"></A>
<A HREF="212"><IMG SRC="/i-prev.gif" ALT="previous"></A>
<A HREF="214"><IMG SRC="/i-next.gif" ALT="next"></A>
<A HREF="214"><IMG SRC="/i-nref.gif" ALT="next in chain"></A>
<A HREF="215"><IMG SRC="/i-lref.gif" ALT="last in chain"></A>
<A HREF="1641"><IMG SRC="/i-last.gif" ALT="last"></A>
<HR><H2>Re: match_template() needs help with consistancy</H2>
<H3>daemon@ATHENA.MIT.EDU (Thu Apr 28 02:49:22 1994
)</H3>
<PRE>
From: stewarta@netcom.com (Alex Stewart)
To: ghudson@MIT.EDU (Greg Hudson)
Date: Wed, 27 Apr 1994 23:47:37 -0700 (PDT)
Cc: coldstuff@MIT.EDU
In-Reply-To: &lt;9404280426.AA15198@maze.MIT.EDU&gt; from "Greg Hudson" at Apr 28, 94 00:26:34 am

&gt; My justification:
&gt; 
&gt; * If the user wants to match a wildcard with something that includes
&gt; text that would match the next word pattern, the user should simply
&gt; quote the entire argument as a C string literal, and leave it at that.

I don't think anybody's objecting to this (if I understand what you're
referring to properly).

&gt; * The user generally doesn't want any processing to get in the way
&gt; when it's not necessary; therefore, no processing at all is done on
&gt; the last argument.

This is bad.  It is bad quite simply because it means parsing is handled
differently in some cases than in others and it's not always immediately
obvious which is which.  Rules should be consistent for the entire match or not
exist at all.

&gt; As far as I know, these rules are completely consistent with MOO's
&gt; verb-dobj-preposition-iobj parsing rules, assuming the pattern is of
&gt; the form "foo * bar *".

No, MOO parsing does not function this way (iobjstr quoting is handled exactly
the same as dobjstr quoting, the way it should be), nor does anything else that
I am familiar with.

&gt; &gt; match_template("f * d *", "f \"zz\" cc d foo") =&gt; ["f", "zz", "cc", "d", "foo"]

[...]
&gt; According to these rules, a wildcard can (apparently) result in more
&gt; than one field.  This requires in-db checking every time you match a
&gt; template containing a wildcard, and worse, it is ambiguous: consider:

This was (I hope) an accident.  The above result should be ["f", "zz cc", "d",
"foo"], in my opinion, which does not produce such bugs and is consistent with
most standard quoting and parsing rules.

In short, I believe the following rules should be used for matching templates:

1.  Quoted portions should match only wildcards, never keywords.
2.  Toplevel quotes should be stripped from match_template output.
3.  Aside from this, standard wildcard rules apply.  Quotes have no
significance in field separation aside from the requirement that a quoted
portion cannot be broken into multiple fields and no portion of it can match a
keyword.
4.  All rules are consistently applied throughout the match.

Basically, quotes just say "this is not a keyword and it is all one thing" and
that's all they do, and they are transparent to anything beyond the parsing
stage.

-Riche


</PRE>
