make.tokcase 629 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. cat <<'--EOT--'
  2. /* Generated by make.tokcase */
  3. /* $Id$ */
  4. #include "Lpars.h"
  5. char *
  6. symbol2str(tok)
  7. int tok;
  8. {
  9. #define SIZBUF 8
  10. /* allow for a few invocations in f.i. an argument list */
  11. static char buf[SIZBUF];
  12. static int index;
  13. switch (tok) {
  14. --EOT--
  15. sed '
  16. /{[A-Z]/!d
  17. s/.*{\(.*\),.*\(".*"\).*$/ case \1 :\
  18. return \2;/
  19. '
  20. cat <<'--EOT--'
  21. default:
  22. if (tok <= 0) return "end of file";
  23. if (tok < 040 || tok >= 0177) {
  24. return "bad token";
  25. }
  26. /* fall through */
  27. case '\n':
  28. case '\f':
  29. case '\v':
  30. case '\r':
  31. case '\t':
  32. index = (index+2) & (SIZBUF-1);
  33. buf[index] = tok;
  34. return &buf[index];
  35. }
  36. }
  37. --EOT--