comparison src/regexp.h @ 7:3fc0f57ecb91 v7.0001

updated for version 7.0001
author vimboss
date Sun, 13 Jun 2004 20:20:40 +0000
parents
children c60ba877860b
comparison
equal deleted inserted replaced
6:c2daee826b8f 7:3fc0f57ecb91
1 /* vi:set ts=8 sts=4 sw=4:
2 *
3 * NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE
4 *
5 * This is NOT the original regular expression code as written by Henry
6 * Spencer. This code has been modified specifically for use with Vim, and
7 * should not be used apart from compiling Vim. If you want a good regular
8 * expression library, get the original code.
9 *
10 * NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE
11 */
12
13 #ifndef _REGEXP_H
14 #define _REGEXP_H
15
16 /*
17 * The number of sub-matches is limited to 10.
18 * The first one (index 0) is the whole match, referenced with "\0".
19 * The second one (index 1) is the first sub-match, referenced with "\1".
20 * This goes up to the tenth (index 9), referenced with "\9".
21 */
22 #define NSUBEXP 10
23
24 /*
25 * Structure returned by vim_regcomp() to pass on to vim_regexec().
26 * These fields are only to be used in regexp.c!
27 * See regep.c for an explanation.
28 */
29 typedef struct
30 {
31 int regstart;
32 char_u reganch;
33 char_u *regmust;
34 int regmlen;
35 unsigned regflags;
36 char_u reghasz;
37 char_u program[1]; /* actually longer.. */
38 } regprog_T;
39
40 /*
41 * Structure to be used for single-line matching.
42 * Sub-match "no" starts at "startp[no]" and ends just before "endp[no]".
43 * When there is no match, the pointer is NULL.
44 */
45 typedef struct
46 {
47 regprog_T *regprog;
48 char_u *startp[NSUBEXP];
49 char_u *endp[NSUBEXP];
50 int rm_ic;
51 } regmatch_T;
52
53 /*
54 * Structure to be used for multi-line matching.
55 * Sub-match "no" starts in line "startpos[no].lnum" column "startpos[no].col"
56 * and ends in line "endpos[no].lnum" just before column "endpos[no].col".
57 * The line numbers are relative to the first line, thus startpos[0].lnum is
58 * always 0.
59 * When there is no match, the line number is -1.
60 */
61 typedef struct
62 {
63 regprog_T *regprog;
64 lpos_T startpos[NSUBEXP];
65 lpos_T endpos[NSUBEXP];
66 int rmm_ic;
67 } regmmatch_T;
68
69 /*
70 * Structure used to store external references: "\z\(\)" to "\z\1".
71 * Use a reference count to avoid the need to copy this around. When it goes
72 * from 1 to zero the matches need to be freed.
73 */
74 typedef struct
75 {
76 short refcnt;
77 char_u *matches[NSUBEXP];
78 } reg_extmatch_T;
79
80 #endif /* _REGEXP_H */