annotate src/regexp.h @ 33293:42b89193ab3e v9.0.1912

patch 9.0.1912: Cirrus-CI running out of credits Commit: https://github.com/vim/vim/commit/6f00d17e8d64ed46c85625e8ac38ed0928b32c58 Author: Christian Brabandt <cb@256bit.org> Date: Tue Sep 19 20:16:46 2023 +0200 patch 9.0.1912: Cirrus-CI running out of credits Problem: Cirrus-CI running out of credits Solution: disable Cirrus-CI for now We are running out of credits for Cirrus CI already at the middle of the month and unfortunately this means our CI now consistently fails. This all hapens because cirrus ci is not enforcing the free-tier limits (see also https://cirrus-ci.org/blog/2023/07/17/limiting-free-usage-of-cirrus-ci/). Perhaps at the beginning of the next month we can revisit and enable just a build without testing it. Hopefully this is won't take too many credits and we can at least verify that building works. Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Tue, 19 Sep 2023 20:30:10 +0200
parents 7fb4e244b16e
children 90063f44c99a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10042
4aead6a9b7a9 commit https://github.com/vim/vim/commit/edf3f97ae2af024708ebb4ac614227327033ca47
Christian Brabandt <cb@256bit.org>
parents: 6328
diff changeset
1 /* vi:set ts=8 sts=4 sw=4 noet:
7
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 /*
4444
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
25 * In the NFA engine: how many braces are allowed.
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
26 * TODO(RE): Use dynamic memory allocation instead of static, like here
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
27 */
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
28 #define NFA_MAX_BRACES 20
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
29
6328
adfbffe1e642 updated for version 7.4.497
Bram Moolenaar <bram@vim.org>
parents: 5838
diff changeset
30 /*
adfbffe1e642 updated for version 7.4.497
Bram Moolenaar <bram@vim.org>
parents: 5838
diff changeset
31 * In the NFA engine: how many states are allowed
adfbffe1e642 updated for version 7.4.497
Bram Moolenaar <bram@vim.org>
parents: 5838
diff changeset
32 */
adfbffe1e642 updated for version 7.4.497
Bram Moolenaar <bram@vim.org>
parents: 5838
diff changeset
33 #define NFA_MAX_STATES 100000
28226
89c181c99e23 patch 8.2.4639: not sufficient parenthesis in preprocessor macros
Bram Moolenaar <Bram@vim.org>
parents: 18753
diff changeset
34 #define NFA_TOO_EXPENSIVE (-1)
6328
adfbffe1e642 updated for version 7.4.497
Bram Moolenaar <bram@vim.org>
parents: 5838
diff changeset
35
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16378
diff changeset
36 // Which regexp engine to use? Needed for vim_regcomp().
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16378
diff changeset
37 // Must match with 'regexpengine'.
6328
adfbffe1e642 updated for version 7.4.497
Bram Moolenaar <bram@vim.org>
parents: 5838
diff changeset
38 #define AUTOMATIC_ENGINE 0
adfbffe1e642 updated for version 7.4.497
Bram Moolenaar <bram@vim.org>
parents: 5838
diff changeset
39 #define BACKTRACKING_ENGINE 1
adfbffe1e642 updated for version 7.4.497
Bram Moolenaar <bram@vim.org>
parents: 5838
diff changeset
40 #define NFA_ENGINE 2
adfbffe1e642 updated for version 7.4.497
Bram Moolenaar <bram@vim.org>
parents: 5838
diff changeset
41
4444
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
42 typedef struct regengine regengine_T;
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
43
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
44 /*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 * Structure returned by vim_regcomp() to pass on to vim_regexec().
4444
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
46 * This is the general structure. For the actual matcher, two specific
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
47 * structures are used. See code below.
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
48 */
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
49 typedef struct regprog
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
50 {
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
51 regengine_T *engine;
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
52 unsigned regflags;
14354
ffd834f893aa patch 8.1.0192: executing regexp recursively fails with a crash
Christian Brabandt <cb@256bit.org>
parents: 11521
diff changeset
53 unsigned re_engine; // automatic, backtracking or nfa engine
ffd834f893aa patch 8.1.0192: executing regexp recursively fails with a crash
Christian Brabandt <cb@256bit.org>
parents: 11521
diff changeset
54 unsigned re_flags; // second argument for vim_regcomp()
ffd834f893aa patch 8.1.0192: executing regexp recursively fails with a crash
Christian Brabandt <cb@256bit.org>
parents: 11521
diff changeset
55 int re_in_use; // prog is being executed
4444
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
56 } regprog_T;
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
57
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
58 /*
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
59 * Structure used by the back track matcher.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 * These fields are only to be used in regexp.c!
4444
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
61 * See regexp.c for an explanation.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 typedef struct
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 {
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16378
diff changeset
65 // These four members implement regprog_T
4444
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
66 regengine_T *engine;
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
67 unsigned regflags;
6328
adfbffe1e642 updated for version 7.4.497
Bram Moolenaar <bram@vim.org>
parents: 5838
diff changeset
68 unsigned re_engine;
14354
ffd834f893aa patch 8.1.0192: executing regexp recursively fails with a crash
Christian Brabandt <cb@256bit.org>
parents: 11521
diff changeset
69 unsigned re_flags;
ffd834f893aa patch 8.1.0192: executing regexp recursively fails with a crash
Christian Brabandt <cb@256bit.org>
parents: 11521
diff changeset
70 int re_in_use;
4444
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
71
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 int regstart;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 char_u reganch;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 char_u *regmust;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 int regmlen;
4686
8db697ae406a updated for version 7.3.1090
Bram Moolenaar <bram@vim.org>
parents: 4647
diff changeset
76 #ifdef FEAT_SYN_HL
4444
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
77 char_u reghasz;
4686
8db697ae406a updated for version 7.3.1090
Bram Moolenaar <bram@vim.org>
parents: 4647
diff changeset
78 #endif
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16378
diff changeset
79 char_u program[1]; // actually longer..
4444
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
80 } bt_regprog_T;
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
81
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
82 /*
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
83 * Structure representing a NFA state.
16378
3d6b282e2d6e patch 8.1.1194: typos and small problems in source files
Bram Moolenaar <Bram@vim.org>
parents: 14354
diff changeset
84 * An NFA state may have no outgoing edge, when it is a NFA_MATCH state.
4444
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
85 */
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
86 typedef struct nfa_state nfa_state_T;
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
87 struct nfa_state
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
88 {
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
89 int c;
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
90 nfa_state_T *out;
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
91 nfa_state_T *out1;
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
92 int id;
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16378
diff changeset
93 int lastlist[2]; // 0: normal, 1: recursive
4583
321cfbef9431 updated for version 7.3.1039
Bram Moolenaar <bram@vim.org>
parents: 4571
diff changeset
94 int val;
4444
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
95 };
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
96
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
97 /*
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
98 * Structure used by the NFA matcher.
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
99 */
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
100 typedef struct
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
101 {
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16378
diff changeset
102 // These three members implement regprog_T
4444
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
103 regengine_T *engine;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 unsigned regflags;
6328
adfbffe1e642 updated for version 7.4.497
Bram Moolenaar <bram@vim.org>
parents: 5838
diff changeset
105 unsigned re_engine;
14354
ffd834f893aa patch 8.1.0192: executing regexp recursively fails with a crash
Christian Brabandt <cb@256bit.org>
parents: 11521
diff changeset
106 unsigned re_flags;
ffd834f893aa patch 8.1.0192: executing regexp recursively fails with a crash
Christian Brabandt <cb@256bit.org>
parents: 11521
diff changeset
107 int re_in_use;
4444
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
108
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16378
diff changeset
109 nfa_state_T *start; // points into state[]
4772
03375ccf28a2 updated for version 7.3.1133
Bram Moolenaar <bram@vim.org>
parents: 4718
diff changeset
110
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16378
diff changeset
111 int reganch; // pattern starts with ^
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16378
diff changeset
112 int regstart; // char at start of pattern
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16378
diff changeset
113 char_u *match_text; // plain text to match with
4772
03375ccf28a2 updated for version 7.3.1133
Bram Moolenaar <bram@vim.org>
parents: 4718
diff changeset
114
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16378
diff changeset
115 int has_zend; // pattern contains \ze
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16378
diff changeset
116 int has_backref; // pattern contains \1 .. \9
4686
8db697ae406a updated for version 7.3.1090
Bram Moolenaar <bram@vim.org>
parents: 4647
diff changeset
117 #ifdef FEAT_SYN_HL
8db697ae406a updated for version 7.3.1090
Bram Moolenaar <bram@vim.org>
parents: 4647
diff changeset
118 int reghasz;
8db697ae406a updated for version 7.3.1090
Bram Moolenaar <bram@vim.org>
parents: 4647
diff changeset
119 #endif
4690
9d97a0c045ef updated for version 7.3.1092
Bram Moolenaar <bram@vim.org>
parents: 4686
diff changeset
120 char_u *pattern;
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16378
diff changeset
121 int nsubexp; // number of ()
4444
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
122 int nstate;
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16378
diff changeset
123 nfa_state_T state[1]; // actually longer..
4444
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
124 } nfa_regprog_T;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 * Structure to be used for single-line matching.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 * Sub-match "no" starts at "startp[no]" and ends just before "endp[no]".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 * When there is no match, the pointer is NULL.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 typedef struct
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 regprog_T *regprog;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 char_u *startp[NSUBEXP];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 char_u *endp[NSUBEXP];
31235
7fb4e244b16e patch 9.0.0951: trying every character position for a match is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
136
7fb4e244b16e patch 9.0.0951: trying every character position for a match is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
137 colnr_T rm_matchcol; // match start without "\zs"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 int rm_ic;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 } regmatch_T;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 * Structure to be used for multi-line matching.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 * Sub-match "no" starts in line "startpos[no].lnum" column "startpos[no].col"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 * and ends in line "endpos[no].lnum" just before column "endpos[no].col".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 * The line numbers are relative to the first line, thus startpos[0].lnum is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 * always 0.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 * When there is no match, the line number is -1.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 typedef struct
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 regprog_T *regprog;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 lpos_T startpos[NSUBEXP];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 lpos_T endpos[NSUBEXP];
31235
7fb4e244b16e patch 9.0.0951: trying every character position for a match is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
154
7fb4e244b16e patch 9.0.0951: trying every character position for a match is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
155 colnr_T rmm_matchcol; // match start without "\zs"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 int rmm_ic;
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16378
diff changeset
157 colnr_T rmm_maxcol; // when not zero: maximum column
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 } regmmatch_T;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 * Structure used to store external references: "\z\(\)" to "\z\1".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 * 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
163 * from 1 to zero the matches need to be freed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 typedef struct
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 short refcnt;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 char_u *matches[NSUBEXP];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 } reg_extmatch_T;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170
4444
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
171 struct regengine
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
172 {
28568
53f25723f378 patch 8.2.4808: unused item in engine struct
Bram Moolenaar <Bram@vim.org>
parents: 28226
diff changeset
173 // bt_regcomp or nfa_regcomp
4444
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
174 regprog_T *(*regcomp)(char_u*, int);
28568
53f25723f378 patch 8.2.4808: unused item in engine struct
Bram Moolenaar <Bram@vim.org>
parents: 28226
diff changeset
175 // bt_regfree or nfa_regfree
4805
66803af09906 updated for version 7.3.1149
Bram Moolenaar <bram@vim.org>
parents: 4785
diff changeset
176 void (*regfree)(regprog_T *);
28568
53f25723f378 patch 8.2.4808: unused item in engine struct
Bram Moolenaar <Bram@vim.org>
parents: 28226
diff changeset
177 // bt_regexec_nl or nfa_regexec_nl
11521
578df034735d patch 8.0.0643: when a pattern search is slow Vim becomes unusable
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
178 int (*regexec_nl)(regmatch_T *, char_u *, colnr_T, int);
28568
53f25723f378 patch 8.2.4808: unused item in engine struct
Bram Moolenaar <Bram@vim.org>
parents: 28226
diff changeset
179 // bt_regexec_mult or nfa_regexec_mult
29071
b90bca860b5a patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29048
diff changeset
180 long (*regexec_multi)(regmmatch_T *, win_T *, buf_T *, linenr_T, colnr_T, int *);
28568
53f25723f378 patch 8.2.4808: unused item in engine struct
Bram Moolenaar <Bram@vim.org>
parents: 28226
diff changeset
181 //char_u *expr;
4444
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
182 };
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 418
diff changeset
183
29048
c98fc7a4dde4 patch 8.2.5046: vim_regsub() can overwrite the destination
Bram Moolenaar <Bram@vim.org>
parents: 28568
diff changeset
184 // Flags used by vim_regsub() and vim_regsub_both()
c98fc7a4dde4 patch 8.2.5046: vim_regsub() can overwrite the destination
Bram Moolenaar <Bram@vim.org>
parents: 28568
diff changeset
185 #define REGSUB_COPY 1
c98fc7a4dde4 patch 8.2.5046: vim_regsub() can overwrite the destination
Bram Moolenaar <Bram@vim.org>
parents: 28568
diff changeset
186 #define REGSUB_MAGIC 2
c98fc7a4dde4 patch 8.2.5046: vim_regsub() can overwrite the destination
Bram Moolenaar <Bram@vim.org>
parents: 28568
diff changeset
187 #define REGSUB_BACKSLASH 4
c98fc7a4dde4 patch 8.2.5046: vim_regsub() can overwrite the destination
Bram Moolenaar <Bram@vim.org>
parents: 28568
diff changeset
188
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16378
diff changeset
189 #endif // _REGEXP_H