From a43e504fb10a38c1bd9362a0a6736ac4b7a7fd17 Mon Sep 17 00:00:00 2001 From: ceriel Date: Fri, 17 Nov 1989 11:31:05 +0000 Subject: [PATCH] fixed error messages by allowing more than one "simultaneous" symbol2str --- lang/cem/cemcom/ival.g | 3 ++- lang/cem/cemcom/make.tokcase | 24 +++++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/lang/cem/cemcom/ival.g b/lang/cem/cemcom/ival.g index e3738d6fd..7e1d61c7d 100644 --- a/lang/cem/cemcom/ival.g +++ b/lang/cem/cemcom/ival.g @@ -91,6 +91,7 @@ initial_value_pack(struct type **tpp; struct expr **expp;) initial_value_list(register struct type **tpp; struct expr **expp;) { struct expr *e1; register struct type **tpp2 = 0; + int err_flag = gen_error; } : { if (tpp) tpp2 = gen_tphead(tpp, 0); } @@ -102,7 +103,7 @@ initial_value_list(register struct type **tpp; struct expr **expp;) initial_value(tpp2, &e1) { if (!tpp) init_expression(&expp, e1); } ]* - { if (tpp) gen_tpend(); } + { if (tpp && ! err_flag) gen_tpend(); } ','? /* optional trailing comma */ ; diff --git a/lang/cem/cemcom/make.tokcase b/lang/cem/cemcom/make.tokcase index 90205c691..f121c3ec4 100755 --- a/lang/cem/cemcom/make.tokcase +++ b/lang/cem/cemcom/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