Pristine Ack-5.5
[Ack-5.5.git] / lang / pc / comp / class.h
1 /* U S E   O F   C H A R A C T E R   C L A S S E S */
2
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
8 #define class(ch)       (tkclass[ch])
9
10 /*      Being the start of a token is, fortunately, a mutual exclusive
11         property, so, as there are less than 16 classes they can be
12         packed in 4 bits.
13 */
14
15 #define STSKIP  0       /* spaces and so on: skipped characters         */
16 #define STNL    1       /* newline character(s): update linenumber etc. */
17 #define STGARB  2       /* garbage ascii character: not allowed         */
18 #define STSIMP  3       /* this character can occur as token            */
19 #define STCOMP  4       /* this one can start a compound token          */
20 #define STIDF   5       /* being the initial character of an identifier */
21 #define STCHAR  6       /* the starter of a character constant          */
22 #define STSTR   7       /* the starter of a string                      */
23 #define STNUM   8       /* the starter of a numeric constant            */
24 #define STEOI   9       /* End-Of-Information mark                      */
25
26 /*      But occurring inside a token is not, so we need 1 bit for each
27         class.  This is implemented as a collection of tables to speed up
28         the decision whether a character has a special meaning.
29 */
30 #define in_idf(ch)      ((unsigned)ch < 0177 && inidf[ch])
31 #define is_dig(ch)      ((unsigned)ch < 0177 && isdig[ch])
32
33 extern char tkclass[];
34 extern char inidf[], isdig[];