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".
5 * Author: Ceriel J.H. Jacobs
8 /* U S E O F C H A R A C T E R C L A S S E S */
10 /* $Id: class.h,v 1.6 1994/06/24 12:40:02 ceriel Exp $ */
12 /* As a starter, chars are divided into classes, according to which
13 token they can be the start of.
14 At present such a class number is supposed to fit in 4 bits.
17 #define class(ch) (tkclass[ch])
19 /* Being the start of a token is, fortunately, a mutual exclusive
20 property, so, as there are less than 16 classes they can be
24 #define STSKIP 0 /* spaces and so on: skipped characters */
25 #define STNL 1 /* newline character(s): update linenumber etc. */
26 #define STGARB 2 /* garbage ascii character: not allowed */
27 #define STSIMP 3 /* this character can occur as token */
28 #define STCOMP 4 /* this one can start a compound token */
29 #define STIDF 5 /* being the initial character of an identifier */
30 #define STCHAR 6 /* the starter of a character constant */
31 #define STSTR 7 /* the starter of a string */
32 #define STNUM 8 /* the starter of a numeric constant */
33 #define STEOI 9 /* End-Of-Information mark */
35 /* But occurring inside a token is not, so we need 1 bit for each
36 class. This is implemented as a collection of tables to speed up
37 the decision whether a character has a special meaning.
39 #define in_idf(ch) ((unsigned)ch < 0177 && inidf[ch])
40 #define is_oct(ch) ((unsigned)ch < 0177 && isoct[ch])
41 #define is_dig(ch) ((unsigned)ch < 0177 && isdig[ch])
42 #define is_hex(ch) ((unsigned)ch < 0177 && ishex[ch])
44 extern char tkclass[];
45 extern char inidf[], isoct[], isdig[], ishex[];