1 /* Copyright (C) 2001-2006 Artifex Software, Inc.
2    All Rights Reserved.
3 
4    This software is provided AS-IS with no warranty, either express or
5    implied.
6 
7    This software is distributed under license and may not be copied, modified
8    or distributed except as expressly authorized under the terms of that
9    license.  Refer to licensing information at http://www.artifex.com/
10    or contact Artifex Software, Inc.,  7 Mt. Lassen Drive - Suite A-134,
11    San Rafael, CA  94903, U.S.A., +1(415)492-9861, for further information.
12 */
13 
14 /* $Id: scanchar.h 8022 2007-06-05 22:23:38Z giles $ */
15 /* Definitions for token scanner character type table */
16 /* Requires scommon.h */
17 
18 #ifndef scanchar_INCLUDED
19 #  define scanchar_INCLUDED
20 
21 /*
22  * An array for fast scanning of names, numbers, and hex strings.
23  * Indexed by character code (including exceptions), it contains:
24  *      0 - max_radix-1 for valid digits,
25  *      ctype_name for other characters valid in names,
26  *      ctype_btoken for characters introducing binary tokens
27  *        (if the binary token feature is enabled),
28  *      ctype_space for whitespace characters,
29  *      ctype_exception for exceptions (see scommon.h), and
30  *      ctype_other for everything else.
31  * Exceptions are negative values; we bias the table origin accordingly.
32  *
33  * NOTE: This table is defined in iscantab.c and used in a variety of places.
34  * If any of the values below change, you must edit the table.
35  */
36 extern const byte scan_char_array[max_stream_exception + 256];
37 
38 #define scan_char_decoder (&scan_char_array[max_stream_exception])
39 #define min_radix 2
40 #define max_radix 36
41 #define ctype_name 100
42 #define ctype_btoken 101
43 #define ctype_space 102
44 #define ctype_other 103
45 #define ctype_exception 104
46 /* Special characters with no \xxx representation */
47 #define char_NULL 0
48 #define char_EOT 004		/* ^D, job delimiter */
49 #define char_VT 013		/* ^K, vertical tab */
50 #define char_DOS_EOF 032	/* ^Z */
51 /*
52  * Most systems define '\n' as 0x0a and '\r' as 0x0d; however, OS-9
53  * has '\n' = '\r' = 0x0d and '\l' = 0x0a.  To deal with this,
54  * we introduce abstract characters char_CR and char_EOL such that
55  * any of [char_CR], [char_CR char_EOL], or [char_EOL] is recognized
56  * as an end-of-line sequence.
57  */
58 #define char_CR '\r'
59 #if '\r' == '\n'
60 #  define char_EOL 0x0a		/* non-OS-9 compilers complain about '\l' */
61 #else
62 #  define char_EOL '\n'
63 #endif
64 
65 #endif /* scanchar_INCLUDED */
66