class.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  3. * See the copyright notice in the ACK home directory, in the file "Copyright".
  4. */
  5. /* $Id$ */
  6. /* U S E O F C H A R A C T E R C L A S S E S */
  7. /* As a starter, chars are divided into classes, according to which
  8. token they can be the start of.
  9. At present such a class number is supposed to fit in 4 bits.
  10. */
  11. #define class(ch) (tkclass[ch])
  12. /* Being the start of a token is, fortunately, a mutual exclusive
  13. property, so, as there are less than 16 classes they can be
  14. packed in 4 bits.
  15. */
  16. #define STSKIP 0 /* spaces and so on: skipped characters */
  17. #define STNL 1 /* newline character(s): update linenumber etc. */
  18. #define STGARB 2 /* garbage ascii character: not allowed in C */
  19. #define STSIMP 3 /* this character can occur as token in C */
  20. #define STCOMP 4 /* this one can start a compound token in C */
  21. #define STELL 5 /* wide character- or string- constant prefix */
  22. #define STIDF 6 /* being the initial character of an identifier */
  23. #define STCHAR 7 /* the starter of a character constant */
  24. #define STSTR 8 /* the starter of a string */
  25. #define STNUM 9 /* the starter of a numeric constant */
  26. #define STEOI 10 /* End-Of-Information mark */
  27. #define STMSPEC 11 /* special class for token expansion */
  28. #define NOEXPM '\003' /* don't expand the next macro identifier */
  29. #define TOKSEP '\004' /* the token separator */
  30. /* But occurring inside a token is not, so we need 1 bit for each
  31. class. This is implemented as a collection of tables to speed up
  32. the decision whether a character has a special meaning.
  33. */
  34. #define in_idf(ch) (inidf[ch])
  35. #define is_oct(ch) (isoct[ch])
  36. #define is_dig(ch) (isdig[ch])
  37. #define is_hex(ch) (ishex[ch])
  38. #define is_wsp(ch) (iswsp[ch])
  39. extern char tkclass[];
  40. extern char inidf[], isoct[], isdig[], ishex[], iswsp[];