| 9 |
|
|
| 10 |
Written by: Philip Hazel <ph10@cam.ac.uk> |
Written by: Philip Hazel <ph10@cam.ac.uk> |
| 11 |
|
|
| 12 |
Copyright (c) 1997-2000 University of Cambridge |
Copyright (c) 1997-2001 University of Cambridge |
| 13 |
|
|
| 14 |
----------------------------------------------------------------------------- |
----------------------------------------------------------------------------- |
| 15 |
Permission is granted to anyone to use this software for any purpose on any |
Permission is granted to anyone to use this software for any purpose on any |
| 123 |
#define FALSE 0 |
#define FALSE 0 |
| 124 |
#define TRUE 1 |
#define TRUE 1 |
| 125 |
|
|
| 126 |
|
/* Escape items that are just an encoding of a particular data value. Note that |
| 127 |
|
ESC_N is defined as yet another macro, which is set in config.h to either \n |
| 128 |
|
(the default) or \r (which some people want). */ |
| 129 |
|
|
| 130 |
|
#ifndef ESC_E |
| 131 |
|
#define ESC_E 27 |
| 132 |
|
#endif |
| 133 |
|
|
| 134 |
|
#ifndef ESC_F |
| 135 |
|
#define ESC_F '\f' |
| 136 |
|
#endif |
| 137 |
|
|
| 138 |
|
#ifndef ESC_N |
| 139 |
|
#define ESC_N NEWLINE |
| 140 |
|
#endif |
| 141 |
|
|
| 142 |
|
#ifndef ESC_R |
| 143 |
|
#define ESC_R '\r' |
| 144 |
|
#endif |
| 145 |
|
|
| 146 |
|
#ifndef ESC_T |
| 147 |
|
#define ESC_T '\t' |
| 148 |
|
#endif |
| 149 |
|
|
| 150 |
/* These are escaped items that aren't just an encoding of a particular data |
/* These are escaped items that aren't just an encoding of a particular data |
| 151 |
value such as \n. They must have non-zero values, as check_escape() returns |
value such as \n. They must have non-zero values, as check_escape() returns |
| 152 |
their negation. Also, they must appear in the same order as in the opcode |
their negation. Also, they must appear in the same order as in the opcode |
| 153 |
definitions below, up to ESC_z. The final one must be ESC_REF as subsequent |
definitions below, up to ESC_z. The final one must be ESC_REF as subsequent |
| 154 |
values are used for \1, \2, \3, etc. There is a test in the code for an escape |
values are used for \1, \2, \3, etc. There is a test in the code for an escape |
| 155 |
greater than ESC_b and less than ESC_X to detect the types that may be |
greater than ESC_b and less than ESC_Z to detect the types that may be |
| 156 |
repeated. If any new escapes are put in-between that don't consume a character, |
repeated. If any new escapes are put in-between that don't consume a character, |
| 157 |
that code will have to change. */ |
that code will have to change. */ |
| 158 |
|
|
| 248 |
|
|
| 249 |
OP_ONCE, /* Once matched, don't back up into the subpattern */ |
OP_ONCE, /* Once matched, don't back up into the subpattern */ |
| 250 |
OP_COND, /* Conditional group */ |
OP_COND, /* Conditional group */ |
| 251 |
OP_CREF, /* Used to hold an extraction string number */ |
OP_CREF, /* Used to hold an extraction string number (cond ref) */ |
| 252 |
|
|
| 253 |
OP_BRAZERO, /* These two must remain together and in this */ |
OP_BRAZERO, /* These two must remain together and in this */ |
| 254 |
OP_BRAMINZERO, /* order. */ |
OP_BRAMINZERO, /* order. */ |
| 255 |
|
|
| 256 |
|
OP_BRANUMBER, /* Used for extracting brackets whose number is greater |
| 257 |
|
than can fit into an opcode. */ |
| 258 |
|
|
| 259 |
OP_BRA /* This and greater values are used for brackets that |
OP_BRA /* This and greater values are used for brackets that |
| 260 |
extract substrings. */ |
extract substrings up to a basic limit. After that, |
| 261 |
|
use is made of OP_BRANUMBER. */ |
| 262 |
}; |
}; |
| 263 |
|
|
| 264 |
/* The highest extraction number. This is limited by the number of opcodes |
/* The highest extraction number before we have to start using additional |
| 265 |
left after OP_BRA, i.e. 255 - OP_BRA. We actually set it somewhat lower. */ |
bytes. (Originally PCRE didn't have support for extraction counts highter than |
| 266 |
|
this number.) The value is limited by the number of opcodes left after OP_BRA, |
| 267 |
|
i.e. 255 - OP_BRA. We actually set it a bit lower to leave room for additional |
| 268 |
|
opcodes. */ |
| 269 |
|
|
| 270 |
#define EXTRACT_MAX 99 |
#define EXTRACT_BASIC_MAX 150 |
| 271 |
|
|
| 272 |
/* The texts of compile-time error messages are defined as macros here so that |
/* The texts of compile-time error messages are defined as macros here so that |
| 273 |
they can be accessed by the POSIX wrapper and converted into error codes. Yes, |
they can be accessed by the POSIX wrapper and converted into error codes. Yes, |
| 286 |
#define ERR10 "operand of unlimited repeat could match the empty string" |
#define ERR10 "operand of unlimited repeat could match the empty string" |
| 287 |
#define ERR11 "internal error: unexpected repeat" |
#define ERR11 "internal error: unexpected repeat" |
| 288 |
#define ERR12 "unrecognized character after (?" |
#define ERR12 "unrecognized character after (?" |
| 289 |
#define ERR13 "too many capturing parenthesized sub-patterns" |
#define ERR13 "unused error" |
| 290 |
#define ERR14 "missing )" |
#define ERR14 "missing )" |
| 291 |
#define ERR15 "back reference to non-existent subpattern" |
#define ERR15 "back reference to non-existent subpattern" |
| 292 |
#define ERR16 "erroffset passed as NULL" |
#define ERR16 "erroffset passed as NULL" |
| 293 |
#define ERR17 "unknown option bit(s) set" |
#define ERR17 "unknown option bit(s) set" |
| 294 |
#define ERR18 "missing ) after comment" |
#define ERR18 "missing ) after comment" |
| 295 |
#define ERR19 "too many sets of parentheses" |
#define ERR19 "parentheses nested too deeply" |
| 296 |
#define ERR20 "regular expression too large" |
#define ERR20 "regular expression too large" |
| 297 |
#define ERR21 "failed to get memory" |
#define ERR21 "failed to get memory" |
| 298 |
#define ERR22 "unmatched parentheses" |
#define ERR22 "unmatched parentheses" |
| 327 |
size_t size; |
size_t size; |
| 328 |
const unsigned char *tables; |
const unsigned char *tables; |
| 329 |
unsigned long int options; |
unsigned long int options; |
| 330 |
uschar top_bracket; |
unsigned short int top_bracket; |
| 331 |
uschar top_backref; |
unsigned short int top_backref; |
| 332 |
uschar first_char; |
uschar first_char; |
| 333 |
uschar req_char; |
uschar req_char; |
| 334 |
uschar code[1]; |
uschar code[1]; |