class.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. /* $Id$ */
  2. /* As a starter, chars are divided into classes, according to which
  3. token they can be the start of.
  4. */
  5. #define class(ch) (tkclass[ch])
  6. #define STSKIP 0 /* spaces and so on: skipped characters */
  7. #define STNL 1 /* newline character(s): update linenumber etc. */
  8. #define STGARB 2 /* garbage ascii character: not allowed */
  9. #define STDOT 3 /* '.' can start a number, or be a separate token */
  10. #define STCOMP 4 /* this one can start a compound token */
  11. #define STIDF 5 /* being the initial character of an identifier */
  12. #define STCHAR 6 /* the starter of a character constant */
  13. #define STSTR 7 /* the starter of a string */
  14. #define STNUM 8 /* the starter of a numeric constant */
  15. #define STEOI 9 /* End-Of-Information mark */
  16. #define STSIMP 10 /* this character can occur as token */
  17. /* But occurring inside a token is not an exclusive property,
  18. so we need 1 bit for each class.
  19. This is implemented as a collection of tables to speed up
  20. the decision whether a character has a special meaning.
  21. */
  22. #define in_idf(ch) ((unsigned)ch < 0177 && inidf[ch])
  23. #define in_ext(ch) ((unsigned)ch < 0177 && inext[ch])
  24. #define is_oct(ch) ((unsigned)ch < 0177 && isoct[ch])
  25. #define is_dig(ch) ((unsigned)ch < 0177 && isdig[ch])
  26. #define is_hex(ch) ((unsigned)ch < 0177 && ishex[ch])
  27. #define is_token(ch) ((unsigned)ch < 0177 && istoken[ch])
  28. extern char tkclass[];
  29. extern char inidf[], isoct[], isdig[], ishex[], inext[], istoken[];