|
|
1.1 ! root 1: /* ! 2: * Regular expressions. ! 3: * Contains the definition of type `RE' plus ! 4: * the interpreter ops, etc. ! 5: */ ! 6: ! 7: /* Operators (order is important) */ ! 8: #define REEND 0 /* End of RE */ ! 9: #define STEND 1 /* Stack end */ ! 10: #define OR 2 /* Union of RE's */ ! 11: #define LPAR 3 /* Left parenthesis */ ! 12: #define RPAR 4 /* Right Parenthesis */ ! 13: #define CLOS 5 /* Closure */ ! 14: #define NECLOS 6 /* Non-empty closure */ ! 15: #define ZORO 7 /* Zero or one occurrences */ ! 16: #define CONC 8 /* any character - also pseudo op */ ! 17: #define DCONC 9 /* Any character - dual case compare */ ! 18: #define CCLASS 10 /* RE character class */ ! 19: #define DCCLASS 11 /* RE character class - dual case */ ! 20: #define BOL 12 /* Beginning of line */ ! 21: #define EOL 13 /* End of line */ ! 22: #define ANY 14 /* Any character */ ! 23: #define termop(x) ((x)>=CONC) ! 24: #define postop(x) ((x)>=CLOS&&(x)<=ZORO) ! 25: ! 26: /* Miscellany */ ! 27: #define NCCHAR 256 /* Number of characters in a character class */ ! 28: #define NBPC 8 /* Bits per character */ ! 29: #define NCLASS ((NCCHAR+NBPC-1)/NBPC) /* Size of class */ ! 30: #define NRE 100 /* Max. number of elements on RE stack */ ! 31: ! 32: typedef struct RE { ! 33: struct RE *r_next; ! 34: int r_op; ! 35: union rebit { ! 36: int u_ival; ! 37: char *u_cptr; ! 38: struct RE *u_re; ! 39: } r_left, r_right; ! 40: } RE; ! 41: ! 42: extern char *reerror; ! 43: extern redual; /* Dual case mode */ ! 44: extern int refull; /* Full expression */ ! 45: RE *reparse(); ! 46: int reget(); ! 47: int reunget();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.