-Time-stamp: <2005-03-02 16:08:59 blp>
+Time-stamp: <2005-05-02 23:31:38 blp>
What Ben's working on now.
--------------------------
TODO
----
+lex_token_representation() should take a buffer to fill.
+
Make valgrind --leak-check=yes --show-reachable=yes work.
Add NOT_REACHED() macro.
+Mon May 2 23:27:28 2005 Ben Pfaff <blp@gnu.org>
+
+ * lexer.c: (lex_error) Improve error messages.
+
Mon May 2 22:28:17 2005 Ben Pfaff <blp@gnu.org>
* get.c: (cmd_match_files) Check token type before trying to match
lex_error (const char *message, ...)
{
char *token_rep;
+ char where[128];
token_rep = lex_token_representation ();
- if (token_rep[0] == 0)
- msg (SE, _("Syntax error at end of file."));
- else if (message)
+ if (token == T_STOP)
+ strcpy (where, "end of file");
+ else if (token == '.')
+ strcpy (where, "end of command");
+ else
+ snprintf (where, sizeof where, "`%s'", token_rep);
+ free (token_rep);
+
+ if (message)
{
char buf[1024];
va_list args;
vsnprintf (buf, 1024, message, args);
va_end (args);
- msg (SE, _("Syntax error %s at `%s'."), buf, token_rep);
+ msg (SE, _("Syntax error %s at %s."), buf, where);
}
else
- msg (SE, _("Syntax error at `%s'."), token_rep);
-
- free (token_rep);
+ msg (SE, _("Syntax error at %s."), where);
}
/* Checks that we're at end of command.
}
else
{
- lex_error (_("expecting %s"), lex_token_name (t));
+ lex_error (_("expecting `%s'"), lex_token_name (t));
return 0;
}
}