4 #define uchar __reuchar
5 typedef unsigned char uchar;
6 #define nelem(x) (sizeof(x)/sizeof((x)[0]))
9 typedef struct Resublist Resublist;
15 /* max character classes per program */
17 #define NCLASS (sizeof(RePrOg.class)/sizeof(Reclass))
19 /* max rune ranges per character class */
20 #define NCCRUNE (sizeof(Reclass)/sizeof(Rune))
23 * Actions and Tokens (Reinst types)
25 * 02xx are operators, value == precedence
26 * 03xx are tokens, i.e. operands for operators
29 #define OPERATOR 0200 /* Bitmask of all operators */
30 #define START 0200 /* Start, used for marker on stack */
31 #define RBRA 0201 /* Right bracket, ) */
32 #define LBRA 0202 /* Left bracket, ( */
33 #define OR 0203 /* Alternation, | */
34 #define CAT 0204 /* Concatentation, implicit operator */
35 #define STAR 0205 /* Closure, * */
36 #define PLUS 0206 /* a+ == aa* */
37 #define QUEST 0207 /* a? == a|nothing, i.e. 0 or 1 a's */
38 #define ANY 0300 /* Any character except newline, . */
39 #define ANYNL 0301 /* Any character including newline, . */
40 #define NOP 0302 /* No operation, internal use only */
41 #define BOL 0303 /* Beginning of line, ^ */
42 #define EOL 0304 /* End of line, $ */
43 #define CCLASS 0305 /* Character class, [] */
44 #define NCCLASS 0306 /* Negated character class, [] */
45 #define END 0377 /* Terminate: match found */
48 * regexec execution lists
51 #define BIGLISTSIZE (10*LISTSIZE)
52 typedef struct Relist Relist;
55 Reinst* inst; /* Reinstruction of the thread */
56 Resublist se; /* matched subexpressions in this thread */
58 typedef struct Reljunk Reljunk;
71 extern Relist* _renewthread(Relist*, Reinst*, Resublist*);
72 extern void _renewmatch(Resub*, int, Resublist*);
73 extern Relist* _renewemptythread(Relist*, Reinst*, char*);
74 extern Relist* _rrenewemptythread(Relist*, Reinst*, Rune*);