#!/bin/sh
#
#	Make a symbol name
#
(
echo 'char *token_name(i)
int i;
{
    static char buf[10];
    switch(i)
    {
	default  : if(i<256)
		   {
		       if(i<32 || i>126)
			   sprintf(buf, "0%o", i);
		       else
		           sprintf(buf, "'%c'", i);
		       return buf;
		   }
		   else
		       return("<Unknown token>");
	case   0 : return("<End of input>");'
awk '/[0-9]$/{if ($3 != "") {printf"	case %d : return(\"%s\");\n",  $3, $2}}'	< tokens.h
echo '    }
}'
) > token_name.c
