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