annotate src/regexp.h @ 1804:f38b7359dafd v7.2.102

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