1 /* 2 * substitution list 3 */ 4 typedef struct Resublist Resublist; 5 struct Resublist 6 { 7 Resub m[32]; 8 }; 9 10 /* max subexpressions per program */ 11 Resublist ReSuBlIsT; 12 #define NSUBEXP (sizeof(ReSuBlIsT.m)/sizeof(Resub)) 13 14 /* max character classes per program */ 15 Reprog RePrOg; 16 #define NCLASS (sizeof(RePrOg.class)/sizeof(Reclass)) 17 18 /* max rune ranges per character class */ 19 #define NCCRUNE (sizeof(Reclass)/sizeof(wchar_t)) 20 21 /* 22 * Actions and Tokens (Reinst types) 23 * 24 * 02xx are operators, value == precedence 25 * 03xx are tokens, i.e. operands for operators 26 */ 27 #define RUNE 0177 28 #define OPERATOR 0200 /* Bitmask of all operators */ 29 #define START 0200 /* Start, used for marker on stack */ 30 #define RBRA 0201 /* Right bracket, ) */ 31 #define LBRA 0202 /* Left bracket, ( */ 32 #define OR 0203 /* Alternation, | */ 33 #define CAT 0204 /* Concatentation, implicit operator */ 34 #define STAR 0205 /* Closure, * */ 35 #define PLUS 0206 /* a+ == aa* */ 36 #define QUEST 0207 /* a? == a|nothing, i.e. 0 or 1 a's */ 37 #define ANY 0300 /* Any character except newline, . */ 38 #define ANYNL 0301 /* Any character including newline, . */ 39 #define NOP 0302 /* No operation, internal use only */ 40 #define BOL 0303 /* Beginning of line, ^ */ 41 #define EOL 0304 /* End of line, $ */ 42 #define CCLASS 0305 /* Character class, [] */ 43 #define NCCLASS 0306 /* Negated character class, [] */ 44 #define END 0377 /* Terminate: match found */ 45 46 /* 47 * regexec execution lists 48 */ 49 #define LISTINCREMENT 8 50 typedef struct Relist Relist; 51 struct Relist 52 { 53 Reinst *inst; /* Reinstruction of the thread */ 54 Resublist se; /* matched subexpressions in this thread */ 55 }; 56 extern Relist* _relist[2]; 57 extern Relist* _reliste[2]; 58 extern int _relistsize; 59 60 extern Relist* _renewthread(Relist*, Reinst*, Resublist*); 61 extern void _renewmatch(Resub*, int, Resublist*); 62