From d57dfac96196e7cc13df6b28071fcbe3683f6a81 Mon Sep 17 00:00:00 2001 From: ceriel Date: Fri, 17 Nov 1989 11:27:26 +0000 Subject: [PATCH] improved error messages --- lang/cem/cemcom.ansi/LLmessage.c | 2 +- lang/cem/cemcom.ansi/make.tokcase | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/lang/cem/cemcom.ansi/LLmessage.c b/lang/cem/cemcom.ansi/LLmessage.c index 8e89113ae..1f952c535 100644 --- a/lang/cem/cemcom.ansi/LLmessage.c +++ b/lang/cem/cemcom.ansi/LLmessage.c @@ -19,7 +19,7 @@ LLmessage(tk) { error("end of file expected"); } else if (tk) { - error("%s missing", symbol2str(tk)); + error("%s missing before %s", symbol2str(tk), symbol2str(DOT)); insert_token(tk); } else { diff --git a/lang/cem/cemcom.ansi/make.tokcase b/lang/cem/cemcom.ansi/make.tokcase index 90205c691..f121c3ec4 100755 --- a/lang/cem/cemcom.ansi/make.tokcase +++ b/lang/cem/cemcom.ansi/make.tokcase @@ -1,19 +1,17 @@ cat <<'--EOT--' /* Generated by make.tokcase */ -/* $Header: */ +/* $Header$ */ #include "Lpars.h" char * symbol2str(tok) int tok; { - static char buf[2] = { '\0', '\0' }; +#define SIZBUF 8 + /* allow for a few invocations in f.i. an argument list */ + static char buf[SIZBUF]; + static int index; - if (040 <= tok && tok < 0177) { - buf[0] = tok; - buf[1] = '\0'; - return buf; - } switch (tok) { --EOT-- @@ -24,15 +22,19 @@ s/.*{\(.*\),.*\(".*"\).*$/ case \1 :\ ' cat <<'--EOT--' + default: + if (tok < 040 || tok >= 0177) { + return "bad token"; + } + /* fall through */ case '\n': case '\f': case '\v': case '\r': case '\t': - buf[0] = tok; - return buf; - default: - return "bad token"; + index = (index+2) & (SIZBUF-1); + buf[index] = tok; + return &buf[index]; } } --EOT-- -- 2.34.1