#include "autoconf.h"#include "config.h"#include <limits.h>#include <string.h>#include <ctype.h>#include <stdlib.h>#include <stddef.h>#include "pcre.h"#include "externs.h"#include "timeutil.h"Include dependency graph for pcre.cpp:

Go to the source code of this file.
Data Structures | |
| struct | real_pcre |
| struct | pcre_study_data |
| struct | compile_data |
| struct | branch_chain |
| struct | recursion_info |
| struct | match_data |
| struct | eptrblock |
Defines | |
| #define | LINK_SIZE 2 |
| #define | MATCH_LIMIT 100000 |
| #define | NEWLINE '\n' |
| #define | PUT(a, n, d) |
| #define | GET(a, n) (((a)[n] << 8) | (a)[(n)+1]) |
| #define | MAX_PATTERN_SIZE (1 << 16) |
| #define | PUTINC(a, n, d) PUT(a,n,d), a += LINK_SIZE |
| #define | PUT2(a, n, d) |
| #define | GET2(a, n) (((a)[n] << 8) | (a)[(n)+1]) |
| #define | PUT2INC(a, n, d) PUT2(a,n,d), a += 2 |
| #define | PCRE_IMS (PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL) |
| #define | PCRE_FIRSTSET 0x40000000 |
| #define | PCRE_REQCHSET 0x20000000 |
| #define | PCRE_STARTLINE 0x10000000 |
| #define | PCRE_ICHANGED 0x08000000 |
| #define | PCRE_STUDY_MAPPED 0x01 |
| #define | PUBLIC_OPTIONS |
| #define | PUBLIC_EXEC_OPTIONS (PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK) |
| #define | PUBLIC_STUDY_OPTIONS 0 |
| #define | MAGIC_NUMBER 0x50435245UL |
| #define | REQ_UNSET (-2) |
| #define | REQ_NONE (-1) |
| #define | REQ_CASELESS 0x0100 |
| #define | REQ_VARY 0x0200 |
| #define | ESC_e 27 |
| #define | ESC_f '\f' |
| #define | ESC_n NEWLINE |
| #define | ESC_r '\r' |
| #define | ESC_tee '\t' |
| #define | XCL_NOT 0x01 |
| #define | XCL_MAP 0x02 |
| #define | XCL_END 0 |
| #define | XCL_SINGLE 1 |
| #define | XCL_RANGE 2 |
| #define | OP_NAME_LIST |
| #define | OP_LENGTHS |
| #define | EXTRACT_BASIC_MAX 150 |
| #define | CREF_RECURSE 0xffff |
| #define | ERR1 "\\ at end of pattern" |
| #define | ERR2 "\\c at end of pattern" |
| #define | ERR3 "unrecognized character follows \\" |
| #define | ERR4 "numbers out of order in {} quantifier" |
| #define | ERR5 "number too big in {} quantifier" |
| #define | ERR6 "missing terminating ] for character class" |
| #define | ERR7 "invalid escape sequence in character class" |
| #define | ERR8 "range out of order in character class" |
| #define | ERR9 "nothing to repeat" |
| #define | ERR10 "operand of unlimited repeat could match the empty string" |
| #define | ERR11 "internal error: unexpected repeat" |
| #define | ERR12 "unrecognized character after (?" |
| #define | ERR13 "POSIX named classes are supported only within a class" |
| #define | ERR14 "missing )" |
| #define | ERR15 "reference to non-existent subpattern" |
| #define | ERR16 "erroffset passed as NULL" |
| #define | ERR17 "unknown option bit(s) set" |
| #define | ERR18 "missing ) after comment" |
| #define | ERR19 "parentheses nested too deeply" |
| #define | ERR20 "regular expression too large" |
| #define | ERR21 "failed to get memory" |
| #define | ERR22 "unmatched parentheses" |
| #define | ERR23 "internal error: code overflow" |
| #define | ERR24 "unrecognized character after (?<" |
| #define | ERR25 "lookbehind assertion is not fixed length" |
| #define | ERR26 "malformed number after (?(" |
| #define | ERR27 "conditional group contains more than two branches" |
| #define | ERR28 "assertion expected after (?(" |
| #define | ERR29 "(?R or (?digits must be followed by )" |
| #define | ERR30 "unknown POSIX class name" |
| #define | ERR31 "POSIX collating elements are not supported" |
| #define | ERR32 "this version of PCRE is not compiled with PCRE_UTF8 support" |
| #define | ERR33 "spare error" |
| #define | ERR34 "character value in \\x{...} sequence is too large" |
| #define | ERR35 "invalid condition (?(0)" |
| #define | ERR36 "\\C not allowed in lookbehind assertion" |
| #define | ERR37 "PCRE does not support \\L, \\l, \\N, \\P, \\p, \\U, \\u, or \\X" |
| #define | ERR38 "number after (?C is > 255" |
| #define | ERR39 "closing ) for (?C expected" |
| #define | ERR40 "recursive call could loop indefinitely" |
| #define | ERR41 "unrecognized character after (?P" |
| #define | ERR42 "syntax error after (?P" |
| #define | ERR43 "two named groups have the same name" |
| #define | ERR44 "invalid UTF-8 string" |
| #define | ctype_space 0x01 |
| #define | ctype_letter 0x02 |
| #define | ctype_digit 0x04 |
| #define | ctype_xdigit 0x08 |
| #define | ctype_word 0x10 |
| #define | ctype_meta 0x80 |
| #define | cbit_space 0 |
| #define | cbit_xdigit 32 |
| #define | cbit_digit 64 |
| #define | cbit_upper 96 |
| #define | cbit_lower 128 |
| #define | cbit_word 160 |
| #define | cbit_graph 192 |
| #define | cbit_print 224 |
| #define | cbit_punct 256 |
| #define | cbit_cntrl 288 |
| #define | cbit_length 320 |
| #define | lcc_offset 0 |
| #define | fcc_offset 256 |
| #define | cbits_offset 512 |
| #define | ctypes_offset (cbits_offset + cbit_length) |
| #define | tables_length (ctypes_offset + 256) |
| #define | DPRINTF(p) |
| #define | BRASTACK_SIZE 200 |
| #define | REC_STACK_SAVE_MAX 30 |
| #define | MAXLIT 250 |
| #define | REQ_BYTE_MAX 1000 |
| #define | match_condassert 0x01 |
| #define | match_isgroup 0x02 |
| #define | MATCH_MATCH 1 |
| #define | MATCH_NOMATCH 0 |
| #define | GETCHAR(c, eptr) c = *eptr; |
| #define | GETCHARINC(c, eptr) c = *eptr++; |
| #define | GETCHARINCTEST(c, eptr) c = *eptr++; |
| #define | GETCHARLEN(c, eptr, len) c = *eptr; |
| #define | BACKCHAR(eptr) |
| #define | REGISTER register |
| #define | RMATCH(rx, ra, rb, rc, rd, re, rf, rg) rx = match(ra,rb,rc,rd,re,rf,rg) |
| #define | RRETURN(ra) return ra |
| #define | fi i |
| #define | fc c |
Typedefs | |
| typedef unsigned char | uschar |
Enumerations | |
| enum | { ESC_A = 1, ESC_G, ESC_B, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s, ESC_W, ESC_w, ESC_dum1, ESC_C, ESC_Z, ESC_z, ESC_E, ESC_Q, ESC_REF } |
| enum | { OP_END, OP_SOD, OP_SOM, OP_NOT_WORD_BOUNDARY, OP_WORD_BOUNDARY, OP_NOT_DIGIT, OP_DIGIT, OP_NOT_WHITESPACE, OP_WHITESPACE, OP_NOT_WORDCHAR, OP_WORDCHAR, OP_ANY, OP_ANYBYTE, OP_EODN, OP_EOD, OP_OPT, OP_CIRC, OP_DOLL, OP_CHARS, OP_NOT, OP_STAR, OP_MINSTAR, OP_PLUS, OP_MINPLUS, OP_QUERY, OP_MINQUERY, OP_UPTO, OP_MINUPTO, OP_EXACT, OP_NOTSTAR, OP_NOTMINSTAR, OP_NOTPLUS, OP_NOTMINPLUS, OP_NOTQUERY, OP_NOTMINQUERY, OP_NOTUPTO, OP_NOTMINUPTO, OP_NOTEXACT, OP_TYPESTAR, OP_TYPEMINSTAR, OP_TYPEPLUS, OP_TYPEMINPLUS, OP_TYPEQUERY, OP_TYPEMINQUERY, OP_TYPEUPTO, OP_TYPEMINUPTO, OP_TYPEEXACT, OP_CRSTAR, OP_CRMINSTAR, OP_CRPLUS, OP_CRMINPLUS, OP_CRQUERY, OP_CRMINQUERY, OP_CRRANGE, OP_CRMINRANGE, OP_CLASS, OP_NCLASS, OP_XCLASS, OP_REF, OP_RECURSE, OP_CALLOUT, OP_ALT, OP_KET, OP_KETRMAX, OP_KETRMIN, OP_ASSERT, OP_ASSERT_NOT, OP_ASSERTBACK, OP_ASSERTBACK_NOT, OP_REVERSE, OP_ONCE, OP_COND, OP_CREF, OP_BRAZERO, OP_BRAMINZERO, OP_BRANUMBER, OP_BRA } |
Functions | |
| int | pcre_copy_substring (const char *subject, int *ovector, int stringcount, int stringnumber, char *buffer, int size) |
| const unsigned char * | pcre_maketables (void) |
| static void | set_bit (uschar *start_bits, int c, bool caseless, compile_data *cd) |
| static bool | set_start_bits (const uschar *code, uschar *start_bits, bool caseless, bool utf8, compile_data *cd) |
| pcre_extra * | pcre_study (const pcre *external_re, int options, const char **errorptr) |
| static bool | compile_regex (int, int, int *, uschar **, const uschar **, const char **, bool, int, int *, int *, branch_chain *, compile_data *) |
| static int | check_escape (const uschar **ptrptr, const char **errorptr, int bracount, int options, bool isclass) |
| static bool | is_counted_repeat (const uschar *p) |
| static const uschar * | read_repeat_counts (const uschar *p, int *minp, int *maxp, const char **errorptr) |
| static const uschar * | first_significant_code (const uschar *code, int *options, int optbit) |
| static int | find_fixedlength (uschar *code, int options) |
| static const uschar * | find_bracket (const uschar *code, int number) |
| static const uschar * | find_recurse (const uschar *code, bool utf8) |
| static bool | could_be_empty_branch (const uschar *code, const uschar *endcode, bool utf8) |
| static bool | could_be_empty (const uschar *code, const uschar *endcode, branch_chain *bcptr, bool utf8) |
| static bool | check_posix_syntax (const uschar *ptr, const uschar **endptr, compile_data *cd) |
| static int | check_posix_name (const uschar *ptr, int len) |
| static void | adjust_recurse (uschar *group, int adjust, bool utf8, compile_data *cd) |
| static bool | compile_branch (int *optionsptr, int *brackets, uschar **codeptr, const uschar **ptrptr, const char **errorptr, int *firstbyteptr, int *reqbyteptr, branch_chain *bcptr, compile_data *cd) |
| static bool | is_anchored (register const uschar *code, int *options, unsigned int bracket_map, unsigned int backref_map) |
| static bool | is_startline (const uschar *code, unsigned int bracket_map, unsigned int backref_map) |
| static int | find_firstassertedchar (const uschar *code, int *options, bool inassert) |
| pcre * | pcre_compile (const char *pattern, int options, const char **errorptr, int *erroroffset, const unsigned char *tables) |
| static bool | match_ref (int offset, register const uschar *eptr, int length, match_data *md, unsigned long int ims) |
| static int | match (REGISTER const uschar *eptr, REGISTER const uschar *ecode, int offset_top, match_data *md, unsigned long int ims, eptrblock *eptrb, int flags) |
| int | pcre_exec (const pcre *external_re, const pcre_extra *extra_data, const char *subject, int length, int start_offset, int options, int *offsets, int offsetcount) |
Variables | |
| static unsigned char | pcre_default_tables [] |
| static const uschar | OP_lengths [] = { OP_LENGTHS } |
| static const char | rep_min [] = { 0, 0, 1, 1, 0, 0 } |
| static const char | rep_max [] = { 0, 0, 0, 0, 1, 1 } |
| static const short int | escapes [] |
| static const char *const | posix_names [] |
| static const uschar | posix_name_lengths [] |
| static const int | posix_class_maps [] |
| static const unsigned char | digitab [] |
| int(*) | pcre_callout (pcre_callout_block *) = NULL |
| #define BRASTACK_SIZE 200 |
| #define cbit_cntrl 288 |
| #define cbit_digit 64 |
Definition at line 578 of file pcre.cpp.
Referenced by compile_branch(), pcre_maketables(), and set_start_bits().
| #define cbit_graph 192 |
| #define cbit_length 320 |
| #define cbit_lower 128 |
| #define cbit_print 224 |
| #define cbit_punct 256 |
| #define cbit_space 0 |
Definition at line 576 of file pcre.cpp.
Referenced by compile_branch(), pcre_maketables(), and set_start_bits().
| #define cbit_upper 96 |
| #define cbit_word 160 |
Definition at line 581 of file pcre.cpp.
Referenced by compile_branch(), pcre_maketables(), and set_start_bits().
| #define cbit_xdigit 32 |
| #define cbits_offset 512 |
| #define CREF_RECURSE 0xffff |
| #define ctype_digit 0x04 |
Definition at line 568 of file pcre.cpp.
Referenced by check_escape(), compile_branch(), is_counted_repeat(), match(), pcre_compile(), pcre_maketables(), and read_repeat_counts().
| #define ctype_letter 0x02 |
Definition at line 567 of file pcre.cpp.
Referenced by check_posix_syntax(), pcre_maketables(), and set_bit().
| #define ctype_meta 0x80 |
Definition at line 571 of file pcre.cpp.
Referenced by compile_branch(), pcre_compile(), and pcre_maketables().
| #define ctype_space 0x01 |
Definition at line 566 of file pcre.cpp.
Referenced by compile_branch(), match(), pcre_compile(), and pcre_maketables().
| #define ctype_word 0x10 |
Definition at line 570 of file pcre.cpp.
Referenced by match(), pcre_compile(), and pcre_maketables().
| #define ctype_xdigit 0x08 |
| #define ctypes_offset (cbits_offset + cbit_length) |
Definition at line 594 of file pcre.cpp.
Referenced by pcre_compile(), pcre_exec(), and pcre_study().
| #define DPRINTF | ( | p | ) |
Definition at line 1306 of file pcre.cpp.
Referenced by compile_regex(), match(), pcre_compile(), and pcre_exec().
| #define ERR1 "\\ at end of pattern" |
| #define ERR10 "operand of unlimited repeat could match the empty string" |
| #define ERR11 "internal error: unexpected repeat" |
| #define ERR12 "unrecognized character after (?" |
| #define ERR13 "POSIX named classes are supported only within a class" |
| #define ERR14 "missing )" |
| #define ERR15 "reference to non-existent subpattern" |
| #define ERR16 "erroffset passed as NULL" |
| #define ERR17 "unknown option bit(s) set" |
| #define ERR18 "missing ) after comment" |
| #define ERR19 "parentheses nested too deeply" |
| #define ERR2 "\\c at end of pattern" |
| #define ERR20 "regular expression too large" |
| #define ERR21 "failed to get memory" |
| #define ERR22 "unmatched parentheses" |
| #define ERR23 "internal error: code overflow" |
| #define ERR24 "unrecognized character after (?<" |
| #define ERR25 "lookbehind assertion is not fixed length" |
| #define ERR26 "malformed number after (?(" |
| #define ERR27 "conditional group contains more than two branches" |
| #define ERR28 "assertion expected after (?(" |
| #define ERR29 "(?R or (?digits must be followed by )" |
| #define ERR3 "unrecognized character follows \\" |
| #define ERR30 "unknown POSIX class name" |
| #define ERR31 "POSIX collating elements are not supported" |
| #define ERR32 "this version of PCRE is not compiled with PCRE_UTF8 support" |
| #define ERR34 "character value in \\x{...} sequence is too large" |
| #define ERR35 "invalid condition (?(0)" |
| #define ERR36 "\\C not allowed in lookbehind assertion" |
| #define ERR37 "PCRE does not support \\L, \\l, \\N, \\P, \\p, \\U, \\u, or \\X" |
| #define ERR38 "number after (?C is > 255" |
| #define ERR39 "closing ) for (?C expected" |
| #define ERR4 "numbers out of order in {} quantifier" |
| #define ERR40 "recursive call could loop indefinitely" |
| #define ERR41 "unrecognized character after (?P" |
| #define ERR42 "syntax error after (?P" |
| #define ERR43 "two named groups have the same name" |
| #define ERR5 "number too big in {} quantifier" |
| #define ERR6 "missing terminating ] for character class" |
| #define ERR7 "invalid escape sequence in character class" |
| #define ERR8 "range out of order in character class" |
| #define ERR9 "nothing to repeat" |
| #define EXTRACT_BASIC_MAX 150 |
Definition at line 401 of file pcre.cpp.
Referenced by compile_branch(), find_bracket(), is_anchored(), is_startline(), match(), and pcre_compile().
| #define fc c |
Referenced by do_mail_stats(), and match().
| #define fcc_offset 256 |
Definition at line 592 of file pcre.cpp.
Referenced by pcre_compile(), pcre_exec(), and pcre_study().
| #define fi i |
Referenced by match().
| #define GET | ( | a, | |||
| n | ) | (((a)[n] << 8) | (a)[(n)+1]) |
Definition at line 82 of file pcre.cpp.
Referenced by adjust_recurse(), compile_branch(), compile_regex(), could_be_empty_branch(), find_firstassertedchar(), find_fixedlength(), first_significant_code(), is_anchored(), is_startline(), match(), and set_start_bits().
| #define GET2 | ( | a, | |||
| n | ) | (((a)[n] << 8) | (a)[(n)+1]) |
Definition at line 101 of file pcre.cpp.
Referenced by compile_branch(), could_be_empty_branch(), find_bracket(), find_fixedlength(), is_anchored(), is_startline(), and match().
| #define GETCHARINCTEST | ( | c, | |||
| eptr | ) | c = *eptr++; |
| #define lcc_offset 0 |
Definition at line 591 of file pcre.cpp.
Referenced by pcre_compile(), pcre_exec(), and pcre_study().
| #define LINK_SIZE 2 |
Definition at line 57 of file pcre.cpp.
Referenced by adjust_recurse(), compile_branch(), compile_regex(), could_be_empty_branch(), find_bracket(), find_firstassertedchar(), find_fixedlength(), is_anchored(), is_startline(), match(), pcre_compile(), and set_start_bits().
| #define MAGIC_NUMBER 0x50435245UL |
Definition at line 140 of file pcre.cpp.
Referenced by pcre_compile(), pcre_exec(), and pcre_study().
| #define match_isgroup 0x02 |
| #define MATCH_LIMIT 100000 |
| #define MATCH_MATCH 1 |
| #define MATCH_NOMATCH 0 |
| #define MAX_PATTERN_SIZE (1 << 16) |
| #define MAXLIT 250 |
| #define NEWLINE '\n' |
Definition at line 59 of file pcre.cpp.
Referenced by compile_branch(), match(), pcre_compile(), and pcre_exec().
| #define OP_NAME_LIST |
Value:
"End", "\\A", "\\G", "\\B", "\\b", "\\D", "\\d", \ "\\S", "\\s", "\\W", "\\w", "Any", "Anybyte", "\\Z", "\\z", \ "Opt", "^", "$", "chars", "not", \ "*", "*?"