1 |
/*************************************************
|
2 |
* Perl-Compatible Regular Expressions *
|
3 |
*************************************************/
|
4 |
|
5 |
|
6 |
/* PCRE is a library of functions to support regular expressions whose syntax
|
7 |
and semantics are as close as possible to those of the Perl 5 language.
|
8 |
|
9 |
Written by Philip Hazel
|
10 |
Copyright (c) 1997-2006 University of Cambridge
|
11 |
|
12 |
-----------------------------------------------------------------------------
|
13 |
Redistribution and use in source and binary forms, with or without
|
14 |
modification, are permitted provided that the following conditions are met:
|
15 |
|
16 |
* Redistributions of source code must retain the above copyright notice,
|
17 |
this list of conditions and the following disclaimer.
|
18 |
|
19 |
* Redistributions in binary form must reproduce the above copyright
|
20 |
notice, this list of conditions and the following disclaimer in the
|
21 |
documentation and/or other materials provided with the distribution.
|
22 |
|
23 |
* Neither the name of the University of Cambridge nor the names of its
|
24 |
contributors may be used to endorse or promote products derived from
|
25 |
this software without specific prior written permission.
|
26 |
|
27 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
28 |
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
29 |
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
30 |
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
31 |
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
32 |
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
33 |
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
34 |
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
35 |
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
36 |
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
37 |
POSSIBILITY OF SUCH DAMAGE.
|
38 |
-----------------------------------------------------------------------------
|
39 |
*/
|
40 |
|
41 |
/* This header contains definitions that are shared between the different
|
42 |
modules, but which are not relevant to the exported API. This includes some
|
43 |
functions whose names all begin with "_pcre_". */
|
44 |
|
45 |
#ifndef PCRE_INTERNAL_H
|
46 |
#define PCRE_INTERNAL_H
|
47 |
|
48 |
/* Define DEBUG to get debugging output on stdout. */
|
49 |
|
50 |
#if 0
|
51 |
#define DEBUG
|
52 |
#endif
|
53 |
|
54 |
/* Use a macro for debugging printing, 'cause that eliminates the use of #ifdef
|
55 |
inline, and there are *still* stupid compilers about that don't like indented
|
56 |
pre-processor statements, or at least there were when I first wrote this. After
|
57 |
all, it had only been about 10 years then... */
|
58 |
|
59 |
#ifdef DEBUG
|
60 |
#define DPRINTF(p) printf p
|
61 |
#else
|
62 |
#define DPRINTF(p) /*nothing*/
|
63 |
#endif
|
64 |
|
65 |
|
66 |
/* Get the definitions provided by running "configure" */
|
67 |
|
68 |
#include "config.h"
|
69 |
|
70 |
/* Standard C headers plus the external interface definition. The only time
|
71 |
setjmp and stdarg are used is when NO_RECURSE is set. */
|
72 |
|
73 |
#include <ctype.h>
|
74 |
#include <limits.h>
|
75 |
#include <setjmp.h>
|
76 |
#include <stdarg.h>
|
77 |
#include <stddef.h>
|
78 |
#include <stdio.h>
|
79 |
#include <stdlib.h>
|
80 |
#include <string.h>
|
81 |
|
82 |
#ifndef PCRE_SPY
|
83 |
#define PCRE_DEFINITION /* Win32 __declspec(export) trigger for .dll */
|
84 |
#endif
|
85 |
|
86 |
/* We need to have types that specify unsigned 16-bit and 32-bit integers. We
|
87 |
cannot determine these outside the compilation (e.g. by running a program as
|
88 |
part of "configure") because PCRE is often cross-compiled for use on other
|
89 |
systems. Instead we make use of the maximum sizes that are available at
|
90 |
preprocessor time in standard C environments. */
|
91 |
|
92 |
#if USHRT_MAX == 65535
|
93 |
typedef unsigned short pcre_uint16;
|
94 |
#elif UINT_MAX == 65535
|
95 |
typedef unsigned int pcre_uint16;
|
96 |
#else
|
97 |
#error Cannot determine a type for 16-bit unsigned integers
|
98 |
#endif
|
99 |
|
100 |
#if UINT_MAX == 4294967295
|
101 |
typedef unsigned int pcre_uint32;
|
102 |
#elif ULONG_MAX == 4294967295
|
103 |
typedef unsigned long int pcre_uint32;
|
104 |
#else
|
105 |
#error Cannot determine a type for 32-bit unsigned integers
|
106 |
#endif
|
107 |
|
108 |
/* All character handling must be done as unsigned characters. Otherwise there
|
109 |
are problems with top-bit-set characters and functions such as isspace().
|
110 |
However, we leave the interface to the outside world as char *, because that
|
111 |
should make things easier for callers. We define a short type for unsigned char
|
112 |
to save lots of typing. I tried "uchar", but it causes problems on Digital
|
113 |
Unix, where it is defined in sys/types, so use "uschar" instead. */
|
114 |
|
115 |
typedef unsigned char uschar;
|
116 |
|
117 |
/* When PCRE is compiled as a C++ library, the subject pointer can be replaced
|
118 |
with a custom type. This makes it possible, for example, to allow pcre_exec()
|
119 |
to process subject strings that are discontinuous by using a smart pointer
|
120 |
class. It must always be possible to inspect all of the subject string in
|
121 |
pcre_exec() because of the way it backtracks. Two macros are required in the
|
122 |
normal case, for sign-unspecified and unsigned char pointers. The former is
|
123 |
used for the external interface and appears in pcre.h, which is why its name
|
124 |
must begin with PCRE_. */
|
125 |
|
126 |
#ifdef CUSTOM_SUBJECT_PTR
|
127 |
#define PCRE_SPTR CUSTOM_SUBJECT_PTR
|
128 |
#define USPTR CUSTOM_SUBJECT_PTR
|
129 |
#else
|
130 |
#define PCRE_SPTR const char *
|
131 |
#define USPTR const unsigned char *
|
132 |
#endif
|
133 |
|
134 |
/* Include the public PCRE header and the definitions of UCP character property
|
135 |
values. */
|
136 |
|
137 |
#include "pcre.h"
|
138 |
#include "ucp.h"
|
139 |
|
140 |
/* When compiling for use with the Virtual Pascal compiler, these functions
|
141 |
need to have their names changed. PCRE must be compiled with the -DVPCOMPAT
|
142 |
option on the command line. */
|
143 |
|
144 |
#ifdef VPCOMPAT
|
145 |
#define strncmp(s1,s2,m) _strncmp(s1,s2,m)
|
146 |
#define memcpy(d,s,n) _memcpy(d,s,n)
|
147 |
#define memmove(d,s,n) _memmove(d,s,n)
|
148 |
#define memset(s,c,n) _memset(s,c,n)
|
149 |
#else /* VPCOMPAT */
|
150 |
|
151 |
/* To cope with SunOS4 and other systems that lack memmove() but have bcopy(),
|
152 |
define a macro for memmove() if HAVE_MEMMOVE is false, provided that HAVE_BCOPY
|
153 |
is set. Otherwise, include an emulating function for those systems that have
|
154 |
neither (there some non-Unix environments where this is the case). This assumes
|
155 |
that all calls to memmove are moving strings upwards in store, which is the
|
156 |
case in PCRE. */
|
157 |
|
158 |
#if ! HAVE_MEMMOVE
|
159 |
#undef memmove /* some systems may have a macro */
|
160 |
#if HAVE_BCOPY
|
161 |
#define memmove(a, b, c) bcopy(b, a, c)
|
162 |
#else /* HAVE_BCOPY */
|
163 |
void *
|
164 |
pcre_memmove(unsigned char *dest, const unsigned char *src, size_t n)
|
165 |
{
|
166 |
size_t i;
|
167 |
dest += n;
|
168 |
src += n;
|
169 |
for (i = 0; i < n; ++i) *(--dest) = *(--src);
|
170 |
return dest;
|
171 |
}
|
172 |
#define memmove(a, b, c) pcre_memmove(a, b, c)
|
173 |
#endif /* not HAVE_BCOPY */
|
174 |
#endif /* not HAVE_MEMMOVE */
|
175 |
#endif /* not VPCOMPAT */
|
176 |
|
177 |
|
178 |
/* PCRE keeps offsets in its compiled code as 2-byte quantities (always stored
|
179 |
in big-endian order) by default. These are used, for example, to link from the
|
180 |
start of a subpattern to its alternatives and its end. The use of 2 bytes per
|
181 |
offset limits the size of the compiled regex to around 64K, which is big enough
|
182 |
for almost everybody. However, I received a request for an even bigger limit.
|
183 |
For this reason, and also to make the code easier to maintain, the storing and
|
184 |
loading of offsets from the byte string is now handled by the macros that are
|
185 |
defined here.
|
186 |
|
187 |
The macros are controlled by the value of LINK_SIZE. This defaults to 2 in
|
188 |
the config.h file, but can be overridden by using -D on the command line. This
|
189 |
is automated on Unix systems via the "configure" command. */
|
190 |
|
191 |
#if LINK_SIZE == 2
|
192 |
|
193 |
#define PUT(a,n,d) \
|
194 |
(a[n] = (d) >> 8), \
|
195 |
(a[(n)+1] = (d) & 255)
|
196 |
|
197 |
#define GET(a,n) \
|
198 |
(((a)[n] << 8) | (a)[(n)+1])
|
199 |
|
200 |
#define MAX_PATTERN_SIZE (1 << 16)
|
201 |
|
202 |
|
203 |
#elif LINK_SIZE == 3
|
204 |
|
205 |
#define PUT(a,n,d) \
|
206 |
(a[n] = (d) >> 16), \
|
207 |
(a[(n)+1] = (d) >> 8), \
|
208 |
(a[(n)+2] = (d) & 255)
|
209 |
|
210 |
#define GET(a,n) \
|
211 |
(((a)[n] << 16) | ((a)[(n)+1] << 8) | (a)[(n)+2])
|
212 |
|
213 |
#define MAX_PATTERN_SIZE (1 << 24)
|
214 |
|
215 |
|
216 |
#elif LINK_SIZE == 4
|
217 |
|
218 |
#define PUT(a,n,d) \
|
219 |
(a[n] = (d) >> 24), \
|
220 |
(a[(n)+1] = (d) >> 16), \
|
221 |
(a[(n)+2] = (d) >> 8), \
|
222 |
(a[(n)+3] = (d) & 255)
|
223 |
|
224 |
#define GET(a,n) \
|
225 |
(((a)[n] << 24) | ((a)[(n)+1] << 16) | ((a)[(n)+2] << 8) | (a)[(n)+3])
|
226 |
|
227 |
#define MAX_PATTERN_SIZE (1 << 30) /* Keep it positive */
|
228 |
|
229 |
|
230 |
#else
|
231 |
#error LINK_SIZE must be either 2, 3, or 4
|
232 |
#endif
|
233 |
|
234 |
|
235 |
/* Convenience macro defined in terms of the others */
|
236 |
|
237 |
#define PUTINC(a,n,d) PUT(a,n,d), a += LINK_SIZE
|
238 |
|
239 |
|
240 |
/* PCRE uses some other 2-byte quantities that do not change when the size of
|
241 |
offsets changes. There are used for repeat counts and for other things such as
|
242 |
capturing parenthesis numbers in back references. */
|
243 |
|
244 |
#define PUT2(a,n,d) \
|
245 |
a[n] = (d) >> 8; \
|
246 |
a[(n)+1] = (d) & 255
|
247 |
|
248 |
#define GET2(a,n) \
|
249 |
(((a)[n] << 8) | (a)[(n)+1])
|
250 |
|
251 |
#define PUT2INC(a,n,d) PUT2(a,n,d), a += 2
|
252 |
|
253 |
|
254 |
/* When UTF-8 encoding is being used, a character is no longer just a single
|
255 |
byte. The macros for character handling generate simple sequences when used in
|
256 |
byte-mode, and more complicated ones for UTF-8 characters. */
|
257 |
|
258 |
#ifndef SUPPORT_UTF8
|
259 |
#define GETCHAR(c, eptr) c = *eptr;
|
260 |
#define GETCHARTEST(c, eptr) c = *eptr;
|
261 |
#define GETCHARINC(c, eptr) c = *eptr++;
|
262 |
#define GETCHARINCTEST(c, eptr) c = *eptr++;
|
263 |
#define GETCHARLEN(c, eptr, len) c = *eptr;
|
264 |
#define BACKCHAR(eptr)
|
265 |
|
266 |
#else /* SUPPORT_UTF8 */
|
267 |
|
268 |
/* Get the next UTF-8 character, not advancing the pointer. This is called when
|
269 |
we know we are in UTF-8 mode. */
|
270 |
|
271 |
#define GETCHAR(c, eptr) \
|
272 |
c = *eptr; \
|
273 |
if ((c & 0xc0) == 0xc0) \
|
274 |
{ \
|
275 |
int gcii; \
|
276 |
int gcaa = _pcre_utf8_table4[c & 0x3f]; /* Number of additional bytes */ \
|
277 |
int gcss = 6*gcaa; \
|
278 |
c = (c & _pcre_utf8_table3[gcaa]) << gcss; \
|
279 |
for (gcii = 1; gcii <= gcaa; gcii++) \
|
280 |
{ \
|
281 |
gcss -= 6; \
|
282 |
c |= (eptr[gcii] & 0x3f) << gcss; \
|
283 |
} \
|
284 |
}
|
285 |
|
286 |
/* Get the next UTF-8 character, testing for UTF-8 mode, and not advancing the
|
287 |
pointer. */
|
288 |
|
289 |
#define GETCHARTEST(c, eptr) \
|
290 |
c = *eptr; \
|
291 |
if (utf8 && (c & 0xc0) == 0xc0) \
|
292 |
{ \
|
293 |
int gcii; \
|
294 |
int gcaa = _pcre_utf8_table4[c & 0x3f]; /* Number of additional bytes */ \
|
295 |
int gcss = 6*gcaa; \
|
296 |
c = (c & _pcre_utf8_table3[gcaa]) << gcss; \
|
297 |
for (gcii = 1; gcii <= gcaa; gcii++) \
|
298 |
{ \
|
299 |
gcss -= 6; \
|
300 |
c |= (eptr[gcii] & 0x3f) << gcss; \
|
301 |
} \
|
302 |
}
|
303 |
|
304 |
/* Get the next UTF-8 character, advancing the pointer. This is called when we
|
305 |
know we are in UTF-8 mode. */
|
306 |
|
307 |
#define GETCHARINC(c, eptr) \
|
308 |
c = *eptr++; \
|
309 |
if ((c & 0xc0) == 0xc0) \
|
310 |
{ \
|
311 |
int gcaa = _pcre_utf8_table4[c & 0x3f]; /* Number of additional bytes */ \
|
312 |
int gcss = 6*gcaa; \
|
313 |
c = (c & _pcre_utf8_table3[gcaa]) << gcss; \
|
314 |
while (gcaa-- > 0) \
|
315 |
{ \
|
316 |
gcss -= 6; \
|
317 |
c |= (*eptr++ & 0x3f) << gcss; \
|
318 |
} \
|
319 |
}
|
320 |
|
321 |
/* Get the next character, testing for UTF-8 mode, and advancing the pointer */
|
322 |
|
323 |
#define GETCHARINCTEST(c, eptr) \
|
324 |
c = *eptr++; \
|
325 |
if (utf8 && (c & 0xc0) == 0xc0) \
|
326 |
{ \
|
327 |
int gcaa = _pcre_utf8_table4[c & 0x3f]; /* Number of additional bytes */ \
|
328 |
int gcss = 6*gcaa; \
|
329 |
c = (c & _pcre_utf8_table3[gcaa]) << gcss; \
|
330 |
while (gcaa-- > 0) \
|
331 |
{ \
|
332 |
gcss -= 6; \
|
333 |
c |= (*eptr++ & 0x3f) << gcss; \
|
334 |
} \
|
335 |
}
|
336 |
|
337 |
/* Get the next UTF-8 character, not advancing the pointer, incrementing length
|
338 |
if there are extra bytes. This is called when we know we are in UTF-8 mode. */
|
339 |
|
340 |
#define GETCHARLEN(c, eptr, len) \
|
341 |
c = *eptr; \
|
342 |
if ((c & 0xc0) == 0xc0) \
|
343 |
{ \
|
344 |
int gcii; \
|
345 |
int gcaa = _pcre_utf8_table4[c & 0x3f]; /* Number of additional bytes */ \
|
346 |
int gcss = 6*gcaa; \
|
347 |
c = (c & _pcre_utf8_table3[gcaa]) << gcss; \
|
348 |
for (gcii = 1; gcii <= gcaa; gcii++) \
|
349 |
{ \
|
350 |
gcss -= 6; \
|
351 |
c |= (eptr[gcii] & 0x3f) << gcss; \
|
352 |
} \
|
353 |
len += gcaa; \
|
354 |
}
|
355 |
|
356 |
/* If the pointer is not at the start of a character, move it back until
|
357 |
it is. Called only in UTF-8 mode. */
|
358 |
|
359 |
#define BACKCHAR(eptr) while((*eptr & 0xc0) == 0x80) eptr--;
|
360 |
|
361 |
#endif
|
362 |
|
363 |
|
364 |
/* In case there is no definition of offsetof() provided - though any proper
|
365 |
Standard C system should have one. */
|
366 |
|
367 |
#ifndef offsetof
|
368 |
#define offsetof(p_type,field) ((size_t)&(((p_type *)0)->field))
|
369 |
#endif
|
370 |
|
371 |
|
372 |
/* These are the public options that can change during matching. */
|
373 |
|
374 |
#define PCRE_IMS (PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL)
|
375 |
|
376 |
/* Private options flags start at the most significant end of the four bytes,
|
377 |
but skip the top bit so we can use ints for convenience without getting tangled
|
378 |
with negative values. The public options defined in pcre.h start at the least
|
379 |
significant end. Make sure they don't overlap! */
|
380 |
|
381 |
#define PCRE_FIRSTSET 0x40000000 /* first_byte is set */
|
382 |
#define PCRE_REQCHSET 0x20000000 /* req_byte is set */
|
383 |
#define PCRE_STARTLINE 0x10000000 /* start after \n for multiline */
|
384 |
#define PCRE_ICHANGED 0x08000000 /* i option changes within regex */
|
385 |
#define PCRE_NOPARTIAL 0x04000000 /* can't use partial with this regex */
|
386 |
|
387 |
/* Options for the "extra" block produced by pcre_study(). */
|
388 |
|
389 |
#define PCRE_STUDY_MAPPED 0x01 /* a map of starting chars exists */
|
390 |
|
391 |
/* Masks for identifying the public options that are permitted at compile
|
392 |
time, run time, or study time, respectively. */
|
393 |
|
394 |
#define PUBLIC_OPTIONS \
|
395 |
(PCRE_CASELESS|PCRE_EXTENDED|PCRE_ANCHORED|PCRE_MULTILINE| \
|
396 |
PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA|PCRE_UNGREEDY|PCRE_UTF8| \
|
397 |
PCRE_NO_AUTO_CAPTURE|PCRE_NO_UTF8_CHECK|PCRE_AUTO_CALLOUT|PCRE_FIRSTLINE)
|
398 |
|
399 |
#define PUBLIC_EXEC_OPTIONS \
|
400 |
(PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK| \
|
401 |
PCRE_PARTIAL)
|
402 |
|
403 |
#define PUBLIC_DFA_EXEC_OPTIONS \
|
404 |
(PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK| \
|
405 |
PCRE_PARTIAL|PCRE_DFA_SHORTEST|PCRE_DFA_RESTART)
|
406 |
|
407 |
#define PUBLIC_STUDY_OPTIONS 0 /* None defined */
|
408 |
|
409 |
/* Magic number to provide a small check against being handed junk. Also used
|
410 |
to detect whether a pattern was compiled on a host of different endianness. */
|
411 |
|
412 |
#define MAGIC_NUMBER 0x50435245UL /* 'PCRE' */
|
413 |
|
414 |
/* Negative values for the firstchar and reqchar variables */
|
415 |
|
416 |
#define REQ_UNSET (-2)
|
417 |
#define REQ_NONE (-1)
|
418 |
|
419 |
/* The maximum remaining length of subject we are prepared to search for a
|
420 |
req_byte match. */
|
421 |
|
422 |
#define REQ_BYTE_MAX 1000
|
423 |
|
424 |
/* Flags added to firstbyte or reqbyte; a "non-literal" item is either a
|
425 |
variable-length repeat, or a anything other than literal characters. */
|
426 |
|
427 |
#define REQ_CASELESS 0x0100 /* indicates caselessness */
|
428 |
#define REQ_VARY 0x0200 /* reqbyte followed non-literal item */
|
429 |
|
430 |
/* Miscellaneous definitions */
|
431 |
|
432 |
typedef int BOOL;
|
433 |
|
434 |
#define FALSE 0
|
435 |
#define TRUE 1
|
436 |
|
437 |
/* Escape items that are just an encoding of a particular data value. Note that
|
438 |
ESC_n is defined as yet another macro, which is set in config.h to either \n
|
439 |
(the default) or \r (which some people want). */
|
440 |
|
441 |
#ifndef ESC_e
|
442 |
#define ESC_e 27
|
443 |
#endif
|
444 |
|
445 |
#ifndef ESC_f
|
446 |
#define ESC_f '\f'
|
447 |
#endif
|
448 |
|
449 |
#ifndef ESC_n
|
450 |
#define ESC_n NEWLINE
|
451 |
#endif
|
452 |
|
453 |
#ifndef ESC_r
|
454 |
#define ESC_r '\r'
|
455 |
#endif
|
456 |
|
457 |
/* We can't officially use ESC_t because it is a POSIX reserved identifier
|
458 |
(presumably because of all the others like size_t). */
|
459 |
|
460 |
#ifndef ESC_tee
|
461 |
#define ESC_tee '\t'
|
462 |
#endif
|
463 |
|
464 |
/* Codes for different types of Unicode property */
|
465 |
|
466 |
#define PT_ANY 0 /* Any property - matches all chars */
|
467 |
#define PT_LAMP 1 /* L& - the union of Lu, Ll, Lt */
|
468 |
#define PT_GC 2 /* General characteristic (e.g. L) */
|
469 |
#define PT_PC 3 /* Particular characteristic (e.g. Lu) */
|
470 |
#define PT_SC 4 /* Script (e.g. Han) */
|
471 |
|
472 |
/* Flag bits and data types for the extended class (OP_XCLASS) for classes that
|
473 |
contain UTF-8 characters with values greater than 255. */
|
474 |
|
475 |
#define XCL_NOT 0x01 /* Flag: this is a negative class */
|
476 |
#define XCL_MAP 0x02 /* Flag: a 32-byte map is present */
|
477 |
|
478 |
#define XCL_END 0 /* Marks end of individual items */
|
479 |
#define XCL_SINGLE 1 /* Single item (one multibyte char) follows */
|
480 |
#define XCL_RANGE 2 /* A range (two multibyte chars) follows */
|
481 |
#define XCL_PROP 3 /* Unicode property (2-byte property code follows) */
|
482 |
#define XCL_NOTPROP 4 /* Unicode inverted property (ditto) */
|
483 |
|
484 |
/* These are escaped items that aren't just an encoding of a particular data
|
485 |
value such as \n. They must have non-zero values, as check_escape() returns
|
486 |
their negation. Also, they must appear in the same order as in the opcode
|
487 |
definitions below, up to ESC_z. There's a dummy for OP_ANY because it
|
488 |
corresponds to "." rather than an escape sequence. The final one must be
|
489 |
ESC_REF as subsequent values are used for \1, \2, \3, etc. There is are two
|
490 |
tests in the code for an escape greater than ESC_b and less than ESC_Z to
|
491 |
detect the types that may be repeated. These are the types that consume
|
492 |
characters. If any new escapes are put in between that don't consume a
|
493 |
character, that code will have to change. */
|
494 |
|
495 |
enum { ESC_A = 1, ESC_G, ESC_B, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s, ESC_W,
|
496 |
ESC_w, ESC_dum1, ESC_C, ESC_P, ESC_p, ESC_X, ESC_Z, ESC_z, ESC_E,
|
497 |
ESC_Q, ESC_REF };
|
498 |
|
499 |
/* Opcode table: OP_BRA must be last, as all values >= it are used for brackets
|
500 |
that extract substrings. Starting from 1 (i.e. after OP_END), the values up to
|
501 |
OP_EOD must correspond in order to the list of escapes immediately above.
|
502 |
Note that whenever this list is updated, the two macro definitions that follow
|
503 |
must also be updated to match. */
|
504 |
|
505 |
enum {
|
506 |
OP_END, /* 0 End of pattern */
|
507 |
|
508 |
/* Values corresponding to backslashed metacharacters */
|
509 |
|
510 |
OP_SOD, /* 1 Start of data: \A */
|
511 |
OP_SOM, /* 2 Start of match (subject + offset): \G */
|
512 |
OP_NOT_WORD_BOUNDARY, /* 3 \B */
|
513 |
OP_WORD_BOUNDARY, /* 4 \b */
|
514 |
OP_NOT_DIGIT, /* 5 \D */
|
515 |
OP_DIGIT, /* 6 \d */
|
516 |
OP_NOT_WHITESPACE, /* 7 \S */
|
517 |
OP_WHITESPACE, /* 8 \s */
|
518 |
OP_NOT_WORDCHAR, /* 9 \W */
|
519 |
OP_WORDCHAR, /* 10 \w */
|
520 |
OP_ANY, /* 11 Match any character */
|
521 |
OP_ANYBYTE, /* 12 Match any byte (\C); different to OP_ANY for UTF-8 */
|
522 |
OP_NOTPROP, /* 13 \P (not Unicode property) */
|
523 |
OP_PROP, /* 14 \p (Unicode property) */
|
524 |
OP_EXTUNI, /* 15 \X (extended Unicode sequence */
|
525 |
OP_EODN, /* 16 End of data or \n at end of data: \Z. */
|
526 |
OP_EOD, /* 17 End of data: \z */
|
527 |
|
528 |
OP_OPT, /* 18 Set runtime options */
|
529 |
OP_CIRC, /* 19 Start of line - varies with multiline switch */
|
530 |
OP_DOLL, /* 20 End of line - varies with multiline switch */
|
531 |
OP_CHAR, /* 21 Match one character, casefully */
|
532 |
OP_CHARNC, /* 22 Match one character, caselessly */
|
533 |
OP_NOT, /* 23 Match anything but the following char */
|
534 |
|
535 |
OP_STAR, /* 24 The maximizing and minimizing versions of */
|
536 |
OP_MINSTAR, /* 25 all these opcodes must come in pairs, with */
|
537 |
OP_PLUS, /* 26 the minimizing one second. */
|
538 |
OP_MINPLUS, /* 27 This first set applies to single characters */
|
539 |
OP_QUERY, /* 28 */
|
540 |
OP_MINQUERY, /* 29 */
|
541 |
OP_UPTO, /* 30 From 0 to n matches */
|
542 |
OP_MINUPTO, /* 31 */
|
543 |
OP_EXACT, /* 32 Exactly n matches */
|
544 |
|
545 |
OP_NOTSTAR, /* 33 The maximizing and minimizing versions of */
|
546 |
OP_NOTMINSTAR, /* 34 all these opcodes must come in pairs, with */
|
547 |
OP_NOTPLUS, /* 35 the minimizing one second. */
|
548 |
OP_NOTMINPLUS, /* 36 This set applies to "not" single characters */
|
549 |
OP_NOTQUERY, /* 37 */
|
550 |
OP_NOTMINQUERY, /* 38 */
|
551 |
OP_NOTUPTO, /* 39 From 0 to n matches */
|
552 |
OP_NOTMINUPTO, /* 40 */
|
553 |
OP_NOTEXACT, /* 41 Exactly n matches */
|
554 |
|
555 |
OP_TYPESTAR, /* 42 The maximizing and minimizing versions of */
|
556 |
OP_TYPEMINSTAR, /* 43 all these opcodes must come in pairs, with */
|
557 |
OP_TYPEPLUS, /* 44 the minimizing one second. These codes must */
|
558 |
OP_TYPEMINPLUS, /* 45 be in exactly the same order as those above. */
|
559 |
OP_TYPEQUERY, /* 46 This set applies to character types such as \d */
|
560 |
OP_TYPEMINQUERY, /* 47 */
|
561 |
OP_TYPEUPTO, /* 48 From 0 to n matches */
|
562 |
OP_TYPEMINUPTO, /* 49 */
|
563 |
OP_TYPEEXACT, /* 50 Exactly n matches */
|
564 |
|
565 |
OP_CRSTAR, /* 51 The maximizing and minimizing versions of */
|
566 |
OP_CRMINSTAR, /* 52 all these opcodes must come in pairs, with */
|
567 |
OP_CRPLUS, /* 53 the minimizing one second. These codes must */
|
568 |
OP_CRMINPLUS, /* 54 be in exactly the same order as those above. */
|
569 |
OP_CRQUERY, /* 55 These are for character classes and back refs */
|
570 |
OP_CRMINQUERY, /* 56 */
|
571 |
OP_CRRANGE, /* 57 These are different to the three sets above. */
|
572 |
OP_CRMINRANGE, /* 58 */
|
573 |
|
574 |
OP_CLASS, /* 59 Match a character class, chars < 256 only */
|
575 |
OP_NCLASS, /* 60 Same, but the bitmap was created from a negative
|
576 |
class - the difference is relevant only when a UTF-8
|
577 |
character > 255 is encountered. */
|
578 |
|
579 |
OP_XCLASS, /* 61 Extended class for handling UTF-8 chars within the
|
580 |
class. This does both positive and negative. */
|
581 |
|
582 |
OP_REF, /* 62 Match a back reference */
|
583 |
OP_RECURSE, /* 63 Match a numbered subpattern (possibly recursive) */
|
584 |
OP_CALLOUT, /* 64 Call out to external function if provided */
|
585 |
|
586 |
OP_ALT, /* 65 Start of alternation */
|
587 |
OP_KET, /* 66 End of group that doesn't have an unbounded repeat */
|
588 |
OP_KETRMAX, /* 67 These two must remain together and in this */
|
589 |
OP_KETRMIN, /* 68 order. They are for groups the repeat for ever. */
|
590 |
|
591 |
/* The assertions must come before ONCE and COND */
|
592 |
|
593 |
OP_ASSERT, /* 69 Positive lookahead */
|
594 |
OP_ASSERT_NOT, /* 70 Negative lookahead */
|
595 |
OP_ASSERTBACK, /* 71 Positive lookbehind */
|
596 |
OP_ASSERTBACK_NOT, /* 72 Negative lookbehind */
|
597 |
OP_REVERSE, /* 73 Move pointer back - used in lookbehind assertions */
|
598 |
|
599 |
/* ONCE and COND must come after the assertions, with ONCE first, as there's
|
600 |
a test for >= ONCE for a subpattern that isn't an assertion. */
|
601 |
|
602 |
OP_ONCE, /* 74 Once matched, don't back up into the subpattern */
|
603 |
OP_COND, /* 75 Conditional group */
|
604 |
OP_CREF, /* 76 Used to hold an extraction string number (cond ref) */
|
605 |
|
606 |
OP_BRAZERO, /* 77 These two must remain together and in this */
|
607 |
OP_BRAMINZERO, /* 78 order. */
|
608 |
|
609 |
OP_BRANUMBER, /* 79 Used for extracting brackets whose number is greater
|
610 |
than can fit into an opcode. */
|
611 |
|
612 |
OP_BRA /* 80 This and greater values are used for brackets that
|
613 |
extract substrings up to EXTRACT_BASIC_MAX. After
|
614 |
that, use is made of OP_BRANUMBER. */
|
615 |
};
|
616 |
|
617 |
/* WARNING WARNING WARNING: There is an implicit assumption in pcre.c and
|
618 |
study.c that all opcodes are less than 128 in value. This makes handling UTF-8
|
619 |
character sequences easier. */
|
620 |
|
621 |
/* The highest extraction number before we have to start using additional
|
622 |
bytes. (Originally PCRE didn't have support for extraction counts highter than
|
623 |
this number.) The value is limited by the number of opcodes left after OP_BRA,
|
624 |
i.e. 255 - OP_BRA. We actually set it a bit lower to leave room for additional
|
625 |
opcodes. */
|
626 |
|
627 |
#define EXTRACT_BASIC_MAX 100
|
628 |
|
629 |
|
630 |
/* This macro defines textual names for all the opcodes. These are used only
|
631 |
for debugging. The macro is referenced only in pcre_printint.c. */
|
632 |
|
633 |
#define OP_NAME_LIST \
|
634 |
"End", "\\A", "\\G", "\\B", "\\b", "\\D", "\\d", \
|
635 |
"\\S", "\\s", "\\W", "\\w", "Any", "Anybyte", \
|
636 |
"notprop", "prop", "extuni", \
|
637 |
"\\Z", "\\z", \
|
638 |
"Opt", "^", "$", "char", "charnc", "not", \
|
639 |
"*", "*?", "+", "+?", "?", "??", "{", "{", "{", \
|
640 |
"*", "*?", "+", "+?", "?", "??", "{", "{", "{", \
|
641 |
"*", "*?", "+", "+?", "?", "??", "{", "{", "{", \
|
642 |
"*", "*?", "+", "+?", "?", "??", "{", "{", \
|
643 |
"class", "nclass", "xclass", "Ref", "Recurse", "Callout", \
|
644 |
"Alt", "Ket", "KetRmax", "KetRmin", "Assert", "Assert not", \
|
645 |
"AssertB", "AssertB not", "Reverse", "Once", "Cond", "Cond ref",\
|
646 |
"Brazero", "Braminzero", "Branumber", "Bra"
|
647 |
|
648 |
|
649 |
/* This macro defines the length of fixed length operations in the compiled
|
650 |
regex. The lengths are used when searching for specific things, and also in the
|
651 |
debugging printing of a compiled regex. We use a macro so that it can be
|
652 |
defined close to the definitions of the opcodes themselves.
|
653 |
|
654 |
As things have been extended, some of these are no longer fixed lenths, but are
|
655 |
minima instead. For example, the length of a single-character repeat may vary
|
656 |
in UTF-8 mode. The code that uses this table must know about such things. */
|
657 |
|
658 |
#define OP_LENGTHS \
|
659 |
1, /* End */ \
|
660 |
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* \A, \G, \B, \B, \D, \d, \S, \s, \W, \w */ \
|
661 |
1, 1, /* Any, Anybyte */ \
|
662 |
3, 3, 1, /* NOTPROP, PROP, EXTUNI */ \
|
663 |
1, 1, 2, 1, 1, /* \Z, \z, Opt, ^, $ */ \
|
664 |
2, /* Char - the minimum length */ \
|
665 |
2, /* Charnc - the minimum length */ \
|
666 |
2, /* not */ \
|
667 |
/* Positive single-char repeats ** These are */ \
|
668 |
2, 2, 2, 2, 2, 2, /* *, *?, +, +?, ?, ?? ** minima in */ \
|
669 |
4, 4, 4, /* upto, minupto, exact ** UTF-8 mode */ \
|
670 |
/* Negative single-char repeats - only for chars < 256 */ \
|
671 |
2, 2, 2, 2, 2, 2, /* NOT *, *?, +, +?, ?, ?? */ \
|
672 |
4, 4, 4, /* NOT upto, minupto, exact */ \
|
673 |
/* Positive type repeats */ \
|
674 |
2, 2, 2, 2, 2, 2, /* Type *, *?, +, +?, ?, ?? */ \
|
675 |
4, 4, 4, /* Type upto, minupto, exact */ \
|
676 |
/* Character class & ref repeats */ \
|
677 |
1, 1, 1, 1, 1, 1, /* *, *?, +, +?, ?, ?? */ \
|
678 |
5, 5, /* CRRANGE, CRMINRANGE */ \
|
679 |
33, /* CLASS */ \
|
680 |
33, /* NCLASS */ \
|
681 |
0, /* XCLASS - variable length */ \
|
682 |
3, /* REF */ \
|
683 |
1+LINK_SIZE, /* RECURSE */ \
|
684 |
2+2*LINK_SIZE, /* CALLOUT */ \
|
685 |
1+LINK_SIZE, /* Alt */ \
|
686 |
1+LINK_SIZE, /* Ket */ \
|
687 |
1+LINK_SIZE, /* KetRmax */ \
|
688 |
1+LINK_SIZE, /* KetRmin */ \
|
689 |
1+LINK_SIZE, /* Assert */ \
|
690 |
1+LINK_SIZE, /* Assert not */ \
|
691 |
1+LINK_SIZE, /* Assert behind */ \
|
692 |
1+LINK_SIZE, /* Assert behind not */ \
|
693 |
1+LINK_SIZE, /* Reverse */ \
|
694 |
1+LINK_SIZE, /* Once */ \
|
695 |
1+LINK_SIZE, /* COND */ \
|
696 |
3, /* CREF */ \
|
697 |
1, 1, /* BRAZERO, BRAMINZERO */ \
|
698 |
3, /* BRANUMBER */ \
|
699 |
1+LINK_SIZE /* BRA */ \
|
700 |
|
701 |
|
702 |
/* A magic value for OP_CREF to indicate the "in recursion" condition. */
|
703 |
|
704 |
#define CREF_RECURSE 0xffff
|
705 |
|
706 |
/* Error code numbers. They are given names so that they can more easily be
|
707 |
tracked. */
|
708 |
|
709 |
enum { ERR0, ERR1, ERR2, ERR3, ERR4, ERR5, ERR6, ERR7, ERR8, ERR9,
|
710 |
ERR10, ERR11, ERR12, ERR13, ERR14, ERR15, ERR16, ERR17, ERR18, ERR19,
|
711 |
ERR20, ERR21, ERR22, ERR23, ERR24, ERR25, ERR26, ERR27, ERR28, ERR29,
|
712 |
ERR30, ERR31, ERR32, ERR33, ERR34, ERR35, ERR36, ERR37, ERR38, ERR39,
|
713 |
ERR40, ERR41, ERR42, ERR43, ERR44, ERR45, ERR46, ERR47 };
|
714 |
|
715 |
/* The real format of the start of the pcre block; the index of names and the
|
716 |
code vector run on as long as necessary after the end. We store an explicit
|
717 |
offset to the name table so that if a regex is compiled on one host, saved, and
|
718 |
then run on another where the size of pointers is different, all might still
|
719 |
be well. For the case of compiled-on-4 and run-on-8, we include an extra
|
720 |
pointer that is always NULL. For future-proofing, a few dummy fields were
|
721 |
originally included - even though you can never get this planning right - but
|
722 |
there is only one left now.
|
723 |
|
724 |
NOTE NOTE NOTE:
|
725 |
Because people can now save and re-use compiled patterns, any additions to this
|
726 |
structure should be made at the end, and something earlier (e.g. a new
|
727 |
flag in the options or one of the dummy fields) should indicate that the new
|
728 |
fields are present. Currently PCRE always sets the dummy fields to zero.
|
729 |
NOTE NOTE NOTE:
|
730 |
*/
|
731 |
|
732 |
typedef struct real_pcre {
|
733 |
pcre_uint32 magic_number;
|
734 |
pcre_uint32 size; /* Total that was malloced */
|
735 |
pcre_uint32 options;
|
736 |
pcre_uint32 dummy1; /* For future use, maybe */
|
737 |
|
738 |
pcre_uint16 top_bracket;
|
739 |
pcre_uint16 top_backref;
|
740 |
pcre_uint16 first_byte;
|
741 |
pcre_uint16 req_byte;
|
742 |
pcre_uint16 name_table_offset; /* Offset to name table that follows */
|
743 |
pcre_uint16 name_entry_size; /* Size of any name items */
|
744 |
pcre_uint16 name_count; /* Number of name items */
|
745 |
pcre_uint16 ref_count; /* Reference count */
|
746 |
|
747 |
const unsigned char *tables; /* Pointer to tables or NULL for std */
|
748 |
const unsigned char *nullpad; /* NULL padding */
|
749 |
} real_pcre;
|
750 |
|
751 |
/* The format of the block used to store data from pcre_study(). The same
|
752 |
remark (see NOTE above) about extending this structure applies. */
|
753 |
|
754 |
typedef struct pcre_study_data {
|
755 |
pcre_uint32 size; /* Total that was malloced */
|
756 |
pcre_uint32 options;
|
757 |
uschar start_bits[32];
|
758 |
} pcre_study_data;
|
759 |
|
760 |
/* Structure for passing "static" information around between the functions
|
761 |
doing the compiling, so that they are thread-safe. */
|
762 |
|
763 |
typedef struct compile_data {
|
764 |
const uschar *lcc; /* Points to lower casing table */
|
765 |
const uschar *fcc; /* Points to case-flipping table */
|
766 |
const uschar *cbits; /* Points to character type table */
|
767 |
const uschar *ctypes; /* Points to table of type maps */
|
768 |
const uschar *start_code; /* The start of the compiled code */
|
769 |
const uschar *start_pattern; /* The start of the pattern */
|
770 |
uschar *name_table; /* The name/number table */
|
771 |
int names_found; /* Number of entries so far */
|
772 |
int name_entry_size; /* Size of each entry */
|
773 |
int top_backref; /* Maximum back reference */
|
774 |
unsigned int backref_map; /* Bitmap of low back refs */
|
775 |
int req_varyopt; /* "After variable item" flag for reqbyte */
|
776 |
BOOL nopartial; /* Set TRUE if partial won't work */
|
777 |
} compile_data;
|
778 |
|
779 |
/* Structure for maintaining a chain of pointers to the currently incomplete
|
780 |
branches, for testing for left recursion. */
|
781 |
|
782 |
typedef struct branch_chain {
|
783 |
struct branch_chain *outer;
|
784 |
uschar *current;
|
785 |
} branch_chain;
|
786 |
|
787 |
/* Structure for items in a linked list that represents an explicit recursive
|
788 |
call within the pattern. */
|
789 |
|
790 |
typedef struct recursion_info {
|
791 |
struct recursion_info *prevrec; /* Previous recursion record (or NULL) */
|
792 |
int group_num; /* Number of group that was called */
|
793 |
const uschar *after_call; /* "Return value": points after the call in the expr */
|
794 |
USPTR save_start; /* Old value of md->start_match */
|
795 |
int *offset_save; /* Pointer to start of saved offsets */
|
796 |
int saved_max; /* Number of saved offsets */
|
797 |
} recursion_info;
|
798 |
|
799 |
/* When compiling in a mode that doesn't use recursive calls to match(),
|
800 |
a structure is used to remember local variables on the heap. It is defined in
|
801 |
pcre.c, close to the match() function, so that it is easy to keep it in step
|
802 |
with any changes of local variable. However, the pointer to the current frame
|
803 |
must be saved in some "static" place over a longjmp(). We declare the
|
804 |
structure here so that we can put a pointer in the match_data structure.
|
805 |
NOTE: This isn't used for a "normal" compilation of pcre. */
|
806 |
|
807 |
struct heapframe;
|
808 |
|
809 |
/* Structure for passing "static" information around between the functions
|
810 |
doing traditional NFA matching, so that they are thread-safe. */
|
811 |
|
812 |
typedef struct match_data {
|
813 |
unsigned long int match_call_count; /* As it says */
|
814 |
unsigned long int match_limit; /* As it says */
|
815 |
unsigned long int match_limit_recursion; /* As it says */
|
816 |
int *offset_vector; /* Offset vector */
|
817 |
int offset_end; /* One past the end */
|
818 |
int offset_max; /* The maximum usable for return data */
|
819 |
const uschar *lcc; /* Points to lower casing table */
|
820 |
const uschar *ctypes; /* Points to table of type maps */
|
821 |
BOOL offset_overflow; /* Set if too many extractions */
|
822 |
BOOL notbol; /* NOTBOL flag */
|
823 |
BOOL noteol; /* NOTEOL flag */
|
824 |
BOOL utf8; /* UTF8 flag */
|
825 |
BOOL endonly; /* Dollar not before final \n */
|
826 |
BOOL notempty; /* Empty string match not wanted */
|
827 |
BOOL partial; /* PARTIAL flag */
|
828 |
BOOL hitend; /* Hit the end of the subject at some point */
|
829 |
const uschar *start_code; /* For use when recursing */
|
830 |
USPTR start_subject; /* Start of the subject string */
|
831 |
USPTR end_subject; /* End of the subject string */
|
832 |
USPTR start_match; /* Start of this match attempt */
|
833 |
USPTR end_match_ptr; /* Subject position at end match */
|
834 |
int end_offset_top; /* Highwater mark at end of match */
|
835 |
int capture_last; /* Most recent capture number */
|
836 |
int start_offset; /* The start offset value */
|
837 |
recursion_info *recursive; /* Linked list of recursion data */
|
838 |
void *callout_data; /* To pass back to callouts */
|
839 |
struct heapframe *thisframe; /* Used only when compiling for no recursion */
|
840 |
} match_data;
|
841 |
|
842 |
/* A similar structure is used for the same purpose by the DFA matching
|
843 |
functions. */
|
844 |
|
845 |
typedef struct dfa_match_data {
|
846 |
const uschar *start_code; /* Start of the compiled pattern */
|
847 |
const uschar *start_subject; /* Start of the subject string */
|
848 |
const uschar *end_subject; /* End of subject string */
|
849 |
const uschar *tables; /* Character tables */
|
850 |
int moptions; /* Match options */
|
851 |
int poptions; /* Pattern options */
|
852 |
void *callout_data; /* To pass back to callouts */
|
853 |
} dfa_match_data;
|
854 |
|
855 |
/* Bit definitions for entries in the pcre_ctypes table. */
|
856 |
|
857 |
#define ctype_space 0x01
|
858 |
#define ctype_letter 0x02
|
859 |
#define ctype_digit 0x04
|
860 |
#define ctype_xdigit 0x08
|
861 |
#define ctype_word 0x10 /* alphameric or '_' */
|
862 |
#define ctype_meta 0x80 /* regexp meta char or zero (end pattern) */
|
863 |
|
864 |
/* Offsets for the bitmap tables in pcre_cbits. Each table contains a set
|
865 |
of bits for a class map. Some classes are built by combining these tables. */
|
866 |
|
867 |
#define cbit_space 0 /* [:space:] or \s */
|
868 |
#define cbit_xdigit 32 /* [:xdigit:] */
|
869 |
#define cbit_digit 64 /* [:digit:] or \d */
|
870 |
#define cbit_upper 96 /* [:upper:] */
|
871 |
#define cbit_lower 128 /* [:lower:] */
|
872 |
#define cbit_word 160 /* [:word:] or \w */
|
873 |
#define cbit_graph 192 /* [:graph:] */
|
874 |
#define cbit_print 224 /* [:print:] */
|
875 |
#define cbit_punct 256 /* [:punct:] */
|
876 |
#define cbit_cntrl 288 /* [:cntrl:] */
|
877 |
#define cbit_length 320 /* Length of the cbits table */
|
878 |
|
879 |
/* Offsets of the various tables from the base tables pointer, and
|
880 |
total length. */
|
881 |
|
882 |
#define lcc_offset 0
|
883 |
#define fcc_offset 256
|
884 |
#define cbits_offset 512
|
885 |
#define ctypes_offset (cbits_offset + cbit_length)
|
886 |
#define tables_length (ctypes_offset + 256)
|
887 |
|
888 |
/* Layout of the UCP type table that translates property names into types and
|
889 |
codes. */
|
890 |
|
891 |
typedef struct {
|
892 |
const char *name;
|
893 |
pcre_uint16 type;
|
894 |
pcre_uint16 value;
|
895 |
} ucp_type_table;
|
896 |
|
897 |
|
898 |
/* Internal shared data tables. These are tables that are used by more than one
|
899 |
of the exported public functions. They have to be "external" in the C sense,
|
900 |
but are not part of the PCRE public API. The data for these tables is in the
|
901 |
pcre_tables.c module. */
|
902 |
|
903 |
extern const int _pcre_utf8_table1[];
|
904 |
extern const int _pcre_utf8_table2[];
|
905 |
extern const int _pcre_utf8_table3[];
|
906 |
extern const uschar _pcre_utf8_table4[];
|
907 |
|
908 |
extern const int _pcre_utf8_table1_size;
|
909 |
|
910 |
extern const ucp_type_table _pcre_utt[];
|
911 |
extern const int _pcre_utt_size;
|
912 |
|
913 |
extern const uschar _pcre_default_tables[];
|
914 |
|
915 |
extern const uschar _pcre_OP_lengths[];
|
916 |
|
917 |
|
918 |
/* Internal shared functions. These are functions that are used by more than
|
919 |
one of the exported public functions. They have to be "external" in the C
|
920 |
sense, but are not part of the PCRE public API. */
|
921 |
|
922 |
extern int _pcre_ord2utf8(int, uschar *);
|
923 |
extern real_pcre * _pcre_try_flipped(const real_pcre *, real_pcre *,
|
924 |
const pcre_study_data *, pcre_study_data *);
|
925 |
extern int _pcre_ucp_findprop(const int, int *, int *);
|
926 |
extern int _pcre_ucp_othercase(const int);
|
927 |
extern int _pcre_valid_utf8(const uschar *, int);
|
928 |
extern BOOL _pcre_xclass(int, const uschar *);
|
929 |
|
930 |
#endif
|
931 |
|
932 |
/* End of pcre_internal.h */
|