Debian Codegraph @

include/re-cmp.h

raw symbols SCIP
1 /**
2 * @file
3 * Datastructures for representing a subset of regular expressions.
4 *
5 * @author
6 * Kjetil T. Homme \<[email protected]\> May 1993
7 */
8
9 #ifndef RE_CMP_H
10 #define RE_CMP_H
11
12 /* C o n f i g u r a t i o n
13 */
14
15 #define SAFE_CHECKS /**< Regexp's with syntax errors will core dump if
16 * this is undefined.
17 */
18
19 #define RE_TOKEN_MAX 64 /**< Max amount of tokens in a regexp.
20 * Each token uses ~264 bytes. They are allocated
21 * as needed, but never de-allocated.
22 * E.g. [A-Za-z0-9_] counts as one token, so 64
23 * should be plenty for most purposes.
24 */
25
26 /* D o n o t c h a n g e b e l o w
27 */
28
29 #ifdef uchar
30 # undef uchar
31 #endif
32 #ifdef Boolean
33 # undef Boolean
34 #endif
35 #ifdef True
36 # undef True
37 #endif
38 #ifdef False
39 # undef False
40 #endif
41
42 #define uchar unsigned char
43 #define Boolean uchar
44 #define True 1 /**< Changing this value will break the code */
45 #define False 0
46
47 typedef enum {
48 sel_any, /**< corresponds to eg . */
49 sel_end, /**< corresponds to eg \$ */
50 sel_single, /**< corresponds to eg q */
51 sel_range, /**< corresponds to eg [A-F] */
52 sel_array, /**< corresponds to eg [AF-RqO-T] */
53 sel_not_single, /**< corresponds to eg [^f] */
54 sel_not_range /**< corresponds to eg [^A-F] */
55 } selection_type;
56
57 typedef enum {
58 rep_once, /**< corresponds to no meta-char */
59 rep_once_or_more, /**< corresponds to + */
60 rep_null_or_once, /**< corresponds to eg ? */
61 rep_null_or_more /**< corresponds to eg * */
62 } repetetion_type;
63
64 typedef struct {
65 selection_type type;
66 union {
67 uchar single;
68 struct {
69 uchar low, high;
70 } range;
71 Boolean array[UCHAR_MAX];
72 } u;
73 repetetion_type repeat;
74 } selection;
75
76 #endif /* RE_CMP_H */