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