According to Geoff Hutchison:
> These would make sense. This is an untest patch, but I assume it works
> -Geoff
> 
> Index: parser.cc
> ===================================================================
> RCS file: /opt/htdig/cvs/htdig3/htsearch/parser.cc,v
> retrieving revision 1.6
> diff -c -3 -p -r1.6 parser.cc
> *** parser.cc   1998/12/06 18:45:10     1.6
> --- parser.cc   1999/02/16 18:20:07
> *************** Parser::factor(int output)
> *** 155,160 ****
> --- 155,163 ----
>         else
>         {
>             valid = 0;
> +           error = 0;
> +           error << " ')' instead of '" << current->word.get();

I think you want "expected ')' instead ..." up there!

> +           error << '\'';
>         }
>       }
>       else if (lookahead == WORD)
> *************** Parser::factor(int output)
> *** 168,173 ****
> --- 171,179 ----
>       else
>       {
>         valid = 0;
> +       error = 0;
> +       error << "expected a word instead of '" << current->word.get();
> +       error << '\'';
>       }
>   }
> 

The other problem is that the and's and or's have been changed to &'s and
|'s, so the error message is a tad misleading.  E.g.:

        expected a word instead of '|'

when I tried tool and or toolbar.  Here's my patch:

--- ./htsearch/parser.cc.errors Mon Feb 15 20:37:20 1999
+++ ./htsearch/parser.cc        Tue Feb 16 14:17:21 1999
@@ -155,6 +155,9 @@
        else
        {
            valid = 0;
+           error = 0;
+           error << "expected ')' instead of '" << current->word.get();
+           error << '\'';
        }
     }
     else if (lookahead == WORD)
@@ -168,6 +171,19 @@
     else
     {
        valid = 0;
+       error = 0;
+       error << "expected a word instead of '" << current->word.get();
+       error << '\'';
+    }
+
+    if (!valid)
+    {
+       switch (lookahead)
+       {
+       case '&':       error << " or 'AND'";   break;
+       case '|':       error << " or 'OR'";    break;
+       case '!':       error << " or 'NOT'";   break;
+       }
     }
 }
 

There's still another problem -- when I try an expression that doesn't have
enough closing parentheses, instead of a syntax error message, I get an
internal server error, with this error in the error log for Apache:

        access to /home/httpd/cgi-bin/htsearch failed for cliff.scrc.umanitoba.ca, 
reason: Premature end of script headers

This suggests that htsearch is dying before even putting out a Content-type
header.  Any ideas?

-- 
Gilles R. Detillieux              E-mail: <[EMAIL PROTECTED]>
Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/~grdetil
Dept. Physiology, U. of Manitoba  Phone:  (204)789-3766
Winnipeg, MB  R3E 3J7  (Canada)   Fax:    (204)789-3930
------------------------------------
To unsubscribe from the htdig3-dev mailing list, send a message to
[EMAIL PROTECTED] containing the single word "unsubscribe" in
the SUBJECT of the message.

Reply via email to