fixed error messages by allowing more than one "simultaneous" symbol2str

This commit is contained in:
ceriel
1989-11-17 11:31:05 +00:00
parent 676fee0a3e
commit a43e504fb1
2 changed files with 15 additions and 12 deletions

View File

@@ -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--