Pristine Ack-5.5
[Ack-5.5.git] / lang / cem / cpp.ansi / make.tokcase
1 cat <<'--EOT--'
2 #include "Lpars.h"
3
4 char *
5 symbol2str(tok)
6         int tok;
7 {
8         static char buf[2] = { '\0', '\0' };
9
10         if (040 <= tok && tok < 0177) {
11                 buf[0] = tok;
12                 buf[1] = '\0';
13                 return buf;
14         }
15         switch (tok) {
16 --EOT--
17 sed '
18 /{[A-Z]/!d
19 s/.*{\(.*\),.*\(".*"\).*$/      case \1 :\
20                 return \2;/
21 '
22 cat <<'--EOT--'
23         case '\n':
24         case '\f':
25         case '\v':
26         case '\r':
27         case '\t':
28                 buf[0] = tok;
29                 return buf;
30         default:
31                 return "bad token";
32         }
33 }
34 --EOT--