class.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /* $Header$ */
  2. /* U S E O F C H A R A C T E R C L A S S E S */
  3. /* As a starter, chars are divided into classes, according to which
  4. token they can be the start of.
  5. At present such a class number is supposed to fit in 4 bits.
  6. */
  7. #define class(ch) (tkclass[ch])
  8. /* Being the start of a token is, fortunately, a mutual exclusive
  9. property, so, although there are less than 16 classes they can be
  10. packed in 4 bits.
  11. */
  12. #define STSKIP 0 /* spaces and so on: skipped characters */
  13. #define STNL 1 /* newline character(s): update linenumber etc. */
  14. #define STGARB 2 /* garbage ascii character: not allowed in C */
  15. #define STSIMP 3 /* this character can occur as token in C */
  16. #define STCOMP 4 /* this one can start a compound token in C */
  17. #define STIDF 5 /* being the initial character of an identifier */
  18. #define STCHAR 6 /* the starter of a character constant */
  19. #define STSTR 7 /* the starter of a string */
  20. #define STNUM 8 /* the starter of a numeric constant */
  21. #define STEOI 9 /* End-Of-Information mark */
  22. /* But occurring inside a token is not, so we need 1 bit for each
  23. class. This is implemented as a collection of tables to speed up
  24. the decision whether a character has a special meaning.
  25. */
  26. #define in_idf(ch) (inidf[ch])
  27. #define is_oct(ch) (isoct[ch])
  28. #define is_dig(ch) (isdig[ch])
  29. #define is_hex(ch) (ishex[ch])
  30. extern char tkclass[];
  31. extern char inidf[], isoct[], isdig[], ishex[];