1 1.1 agc This code is structured roughly as follows: 2 1.1 agc 3 1.1 agc xmalloc.c: 4 1.1 agc - Wrappers for the malloc() functions, for error generation and 5 1.1 agc memory leak checking purposes. 6 1.1 agc 7 1.1 agc tre-mem.c: 8 1.1 agc - A simple and efficient memory allocator. 9 1.1 agc 10 1.1 agc tre-stack.c: 11 1.1 agc - Implements a simple stack data structure. 12 1.1 agc 13 1.1 agc tre-ast.c: 14 1.1 agc - Abstract syntax tree (AST) definitions. 15 1.1 agc 16 1.1 agc tre-parse.c: 17 1.1 agc - Regexp parser. Parses a POSIX regexp (with TRE extensions) into 18 1.1 agc an abstract syntax tree (AST). 19 1.1 agc 20 1.1 agc tre-compile.c: 21 1.1 agc - Compiles ASTs to ready-to-use regex objects. Comprised of two parts: 22 1.1 agc * Routine to convert an AST to a tagged AST. A tagged AST has 23 1.1 agc appropriate minimized or maximized tags added to keep track of 24 1.1 agc submatches. 25 1.1 agc * Routine to convert tagged ASTs to tagged nondeterministic state 26 1.1 agc machines (TNFAs) without epsilon transitions (transitions on 27 1.1 agc empty strings). 28 1.1 agc 29 1.1 agc tre-match-parallel.c: 30 1.1 agc - Parallel TNFA matcher. 31 1.1 agc * The matcher basically takes a string and a TNFA and finds the 32 1.1 agc leftmost longest match and submatches in one pass over the input 33 1.1 agc string. Only the beginning of the input string is scanned until 34 1.1 agc a leftmost match and longest match is found. 35 1.1 agc * The matcher cannot handle back references, but the worst case 36 1.1 agc time consumption is O(l) where l is the length of the input 37 1.1 agc string. The space consumption is constant. 38 1.1 agc 39 1.1 agc tre-match-backtrack.c: 40 1.1 agc - A traditional backtracking matcher. 41 1.1 agc * Like the parallel matcher, takes a string and a TNFA and finds 42 1.1 agc the leftmost longest match and submatches. Portions of the 43 1.1 agc input string may (and usually are) scanned multiple times. 44 1.1 agc * Can handle back references. The worst case time consumption, 45 1.1 agc however, is O(k^l) where k is some constant and l is the length 46 1.1 agc of the input string. The worst case space consumption is O(l). 47 1.1 agc 48 1.1 agc tre-match-approx.c: 49 1.1 agc - Approximate parallel TNFA matcher. 50 1.1 agc * Finds the leftmost and longest match and submatches in one pass 51 1.1 agc over the input string. The match may contain errors. Each 52 1.1 agc missing, substituted, or extra character in the match increases 53 1.1 agc the cost of the match. A maximum cost for the returned match 54 1.1 agc can be given. The cost of the found match is returned. 55 1.1 agc * Cannot handle back references. The space and time consumption 56 1.1 agc bounds are the same as for the parallel exact matcher, but 57 1.1 agc in general this matcher is slower than the exact matcher. 58 1.1 agc 59 1.1 agc regcomp.c: 60 1.1 agc - Implementation of the regcomp() family of functions as simple 61 1.1 agc wrappers for tre_compile(). 62 1.1 agc 63 1.1 agc regexec.c: 64 1.1 agc - Implementation of the regexec() family of functions. 65 1.1 agc * The appropriate matcher is dispatched according to the 66 1.1 agc features used in the compiled regex object. 67 1.1 agc 68 1.1 agc regerror.c: 69 1.1 agc - Implements the regerror() function. 70