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