Ensure viminfo is written on Cmd-q
[MacVim.git] / src / regexp.h
blob09c8d0c794dca952a0791ad743fd5b81fae154e1
1 /* vi:set ts=8 sts=4 sw=4:
3 * NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE
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.
10 * NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE
13 #ifndef _REGEXP_H
14 #define _REGEXP_H
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".
22 #define NSUBEXP 10
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.
29 typedef struct
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;
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.
45 typedef struct
47 regprog_T *regprog;
48 char_u *startp[NSUBEXP];
49 char_u *endp[NSUBEXP];
50 int rm_ic;
51 } regmatch_T;
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.
61 typedef struct
63 regprog_T *regprog;
64 lpos_T startpos[NSUBEXP];
65 lpos_T endpos[NSUBEXP];
66 int rmm_ic;
67 colnr_T rmm_maxcol; /* when not zero: maximum column */
68 } regmmatch_T;
71 * Structure used to store external references: "\z\(\)" to "\z\1".
72 * Use a reference count to avoid the need to copy this around. When it goes
73 * from 1 to zero the matches need to be freed.
75 typedef struct
77 short refcnt;
78 char_u *matches[NSUBEXP];
79 } reg_extmatch_T;
81 #endif /* _REGEXP_H */