regex: Add new GRegexError code from PCRE 8.31

This commit is contained in:
Christian Persch 2012-06-28 23:20:39 +02:00
parent 2188a5e59c
commit 53b3175cfa
3 changed files with 9 additions and 2 deletions

View File

@ -518,6 +518,9 @@ translate_compile_error (gint *errcode, const gchar **errmsg)
case G_REGEX_ERROR_NAME_TOO_LONG: case G_REGEX_ERROR_NAME_TOO_LONG:
*errmsg = _("name is too long in (*MARK), (*PRUNE), (*SKIP), or (*THEN)"); *errmsg = _("name is too long in (*MARK), (*PRUNE), (*SKIP), or (*THEN)");
break; break;
case G_REGEX_ERROR_CHARACTER_VALUE_TOO_LARGE:
*errmsg = _("character value in \\u.... sequence is too large");
break;
case 116: /* erroffset passed as NULL */ case 116: /* erroffset passed as NULL */
/* This should not happen as we never pass a NULL erroffset */ /* This should not happen as we never pass a NULL erroffset */

View File

@ -130,7 +130,9 @@ G_BEGIN_DECLS
* @G_REGEX_ERROR_TOO_MANY_FORWARD_REFERENCES: too many forward references. Since: 2.34 * @G_REGEX_ERROR_TOO_MANY_FORWARD_REFERENCES: too many forward references. Since: 2.34
* @G_REGEX_ERROR_NAME_TOO_LONG: the name is too long in "(*MARK)", "(*PRUNE)", * @G_REGEX_ERROR_NAME_TOO_LONG: the name is too long in "(*MARK)", "(*PRUNE)",
* "(*SKIP)", or "(*THEN)". Since: 2.34 * "(*SKIP)", or "(*THEN)". Since: 2.34
* * @G_REGEX_ERROR_CHARACTER_VALUE_TOO_LARGE: the character value in the \\u sequence is
* too large. Since: 2.34
*
* Error codes returned by regular expressions functions. * Error codes returned by regular expressions functions.
* *
* Since: 2.14 * Since: 2.14
@ -194,7 +196,8 @@ typedef enum
G_REGEX_ERROR_MISSING_NAME = 169, G_REGEX_ERROR_MISSING_NAME = 169,
G_REGEX_ERROR_NOT_SUPPORTED_IN_CLASS = 171, G_REGEX_ERROR_NOT_SUPPORTED_IN_CLASS = 171,
G_REGEX_ERROR_TOO_MANY_FORWARD_REFERENCES = 172, G_REGEX_ERROR_TOO_MANY_FORWARD_REFERENCES = 172,
G_REGEX_ERROR_NAME_TOO_LONG = 175 G_REGEX_ERROR_NAME_TOO_LONG = 175,
G_REGEX_ERROR_CHARACTER_VALUE_TOO_LARGE = 176
} GRegexError; } GRegexError;
/** /**

View File

@ -2166,6 +2166,7 @@ main (int argc, char *argv[])
TEST_NEW_FAIL ("\\k", 0, G_REGEX_ERROR_MISSING_NAME); TEST_NEW_FAIL ("\\k", 0, G_REGEX_ERROR_MISSING_NAME);
TEST_NEW_FAIL ("a[\\NB]c", 0, G_REGEX_ERROR_NOT_SUPPORTED_IN_CLASS); TEST_NEW_FAIL ("a[\\NB]c", 0, G_REGEX_ERROR_NOT_SUPPORTED_IN_CLASS);
TEST_NEW_FAIL ("(*:0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEFG)XX", 0, G_REGEX_ERROR_NAME_TOO_LONG); TEST_NEW_FAIL ("(*:0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEFG)XX", 0, G_REGEX_ERROR_NAME_TOO_LONG);
TEST_NEW_FAIL ("\\u0100", G_REGEX_RAW | G_REGEX_JAVASCRIPT_COMPAT, G_REGEX_ERROR_CHARACTER_VALUE_TOO_LARGE);
/* These errors can't really be tested sanely: /* These errors can't really be tested sanely:
* G_REGEX_ERROR_EXPRESSION_TOO_LARGE * G_REGEX_ERROR_EXPRESSION_TOO_LARGE