File: re-cmp.h

package info (click to toggle)
crossfire 1.11.0-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 24,456 kB
  • ctags: 7,800
  • sloc: ansic: 80,483; sh: 11,825; perl: 2,327; lex: 1,946; makefile: 1,149
file content (74 lines) | stat: -rw-r--r-- 1,706 bytes parent folder | download
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 */