PCRE error codes should be removed and replaced with extern const char* variables which expose the error strings directly (under nice variable names) 10 points to anyone who can figure out what errorText is trying to do in under 30 seconds: /* Error code numbers. They are given names so that they can more easily be tracked. */ enum ErrorCode { ERR0, ERR1, ERR2, ERR3, ERR4, ERR5, ERR6, ERR7, ERR8, ERR9, ERR10, ERR11, ERR12, ERR13, ERR14, ERR15, ERR16, ERR17 }; /* The texts of compile-time error messages. These are "char *" because they are passed to the outside world. */ static const char* error_text(ErrorCode code) { static const char error_texts[] = /* 1 */ "\\ at end of pattern\0" "\\c at end of pattern\0" "character value in \\x{...} sequence is too large\0" "numbers out of order in {} quantifier\0" /* 5 */ "number too big in {} quantifier\0" "missing terminating ] for character class\0" "internal error: code overflow\0" "range out of order in character class\0" "nothing to repeat\0" /* 10 */ "unmatched parentheses\0" "internal error: unexpected repeat\0" "unrecognized character after (?\0" "failed to get memory\0" "missing )\0" /* 15 */ "reference to non-existent subpattern\0" "regular expression too large\0" "parentheses nested too deeply" ; int i = code; const char* text = error_texts; while (i > 1) i -= !*text++; return text; }
PCRE has been removed entirely!