ack/lang/m2/comp/make.tokcase

36 lines
598 B
Plaintext
Raw Normal View History

1986-03-20 14:52:03 +00:00
cat <<'--EOT--'
1989-11-17 11:52:33 +00:00
/* Generated by make.tokcase */
/* $Header$ */
1986-03-20 14:52:03 +00:00
#include "Lpars.h"
char *
symbol2str(tok)
int tok;
{
1989-11-17 11:52:33 +00:00
#define SIZBUF 8
/* allow for a few invocations in f.i. an argument list */
1989-12-07 16:28:05 +00:00
static char buf[SIZBUF] = { '\'', 0, '\'', 0, '\'', 0, '\'', 0};
static int index = 1;
1986-03-20 14:52:03 +00:00
switch (tok) {
--EOT--
1989-11-17 11:52:33 +00:00
1986-03-20 14:52:03 +00:00
sed '
/{[A-Z]/!d
s/.*{\(.*\),.*\(".*"\).*$/ case \1 :\
return \2;/
'
1989-11-17 11:52:33 +00:00
1986-03-20 14:52:03 +00:00
cat <<'--EOT--'
1989-11-17 11:52:33 +00:00
default:
if (tok <= 0) return "end of file";
if (tok < 040 || tok >= 0177) {
return "bad token";
}
1989-12-07 16:28:05 +00:00
index = (index+4) & (SIZBUF-1);
1989-11-17 11:52:33 +00:00
buf[index] = tok;
1989-12-07 16:28:05 +00:00
return &buf[index-1];
1986-03-20 14:52:03 +00:00
}
}
--EOT--