41 if (code >= 0)
return (
UChar* )0;
45 p =
"mismatch";
break;
47 p =
"no support in this configuration";
break;
49 p =
"failed to allocate memory";
break;
51 p =
"undefined type (bug)";
break;
53 p =
"internal parser error (bug)";
break;
55 p =
"stack error (bug)";
break;
57 p =
"undefined bytecode (bug)";
break;
59 p =
"unexpected bytecode (bug)";
break;
61 p =
"match-stack limit over";
break;
63 p =
"parse depth limit over";
break;
65 p =
"default multibyte-encoding is not set";
break;
67 p =
"can't convert to wide-char on specified multibyte-encoding";
break;
69 p =
"invalid argument";
break;
71 p =
"end pattern at left brace";
break;
73 p =
"end pattern at left bracket";
break;
75 p =
"empty char-class";
break;
77 p =
"premature end of char-class";
break;
79 p =
"end pattern at escape";
break;
81 p =
"end pattern at meta";
break;
83 p =
"end pattern at control";
break;
85 p =
"invalid meta-code syntax";
break;
87 p =
"invalid control-code syntax";
break;
89 p =
"char-class value at end of range";
break;
91 p =
"char-class value at start of range";
break;
93 p =
"unmatched range specifier in char-class";
break;
95 p =
"target of repeat operator is not specified";
break;
97 p =
"target of repeat operator is invalid";
break;
99 p =
"nested repeat operator";
break;
101 p =
"unmatched close parenthesis";
break;
103 p =
"end pattern with unmatched parenthesis";
break;
105 p =
"end pattern in group";
break;
107 p =
"undefined group option";
break;
109 p =
"invalid POSIX bracket type";
break;
111 p =
"invalid pattern in look-behind";
break;
113 p =
"invalid repeat range {lower,upper}";
break;
115 p =
"invalid conditional pattern";
break;
117 p =
"too big number";
break;
119 p =
"too big number for repeat range";
break;
121 p =
"upper is smaller than lower in repeat range";
break;
123 p =
"empty range in char class";
break;
125 p =
"mismatch multibyte code length in char-class range";
break;
127 p =
"too many multibyte code ranges are specified";
break;
129 p =
"too short multibyte code string";
break;
131 p =
"too big backref number";
break;
133 #ifdef USE_NAMED_GROUP 134 p =
"invalid backref number/name";
break;
136 p =
"invalid backref number";
break;
139 p =
"numbered backref/call is not allowed. (use name)";
break;
141 p =
"too short digits";
break;
143 p =
"too long wide-char value";
break;
145 p =
"group name is empty";
break;
147 p =
"invalid group name <%n>";
break;
149 #ifdef USE_NAMED_GROUP 150 p =
"invalid char in group name <%n>";
break;
152 p =
"invalid char in group number <%n>";
break;
155 p =
"undefined name <%n> reference";
break;
157 p =
"undefined group <%n> reference";
break;
159 p =
"multiplex defined name <%n>";
break;
161 p =
"multiplex definition name <%n> call";
break;
163 p =
"never ending recursion";
break;
165 p =
"group number is too big for capture history";
break;
167 p =
"invalid character property name {%n}";
break;
169 p =
"too many capture groups are specified";
break;
171 p =
"invalid code point value";
break;
173 p =
"too big wide-char value";
break;
175 p =
"not supported encoding combination";
break;
177 p =
"invalid combination of options";
break;
180 p =
"undefined error code";
break;
186 static void sprint_byte(
char* s,
unsigned int v)
191 static void sprint_byte_with_x(
char* s,
unsigned int v)
197 UChar buf[],
int buf_size,
int *is_over)
209 if (code > 0xffff && len + 10 <= buf_size) {
210 sprint_byte_with_x((
char*)(&(
buf[len])), (
unsigned int)(code >> 24));
211 sprint_byte((
char*)(&(
buf[len+4])), (
unsigned int)(code >> 16));
212 sprint_byte((
char*)(&(
buf[len+6])), (
unsigned int)(code >> 8));
213 sprint_byte((
char*)(&(
buf[len+8])), (
unsigned int)code);
216 else if (len + 6 <= buf_size) {
217 sprint_byte_with_x((
char*)(&(
buf[len])), (
unsigned int)(code >> 8));
218 sprint_byte((
char*)(&(
buf[len+4])), (
unsigned int)code);
230 if (len >= buf_size)
break;
233 *is_over = ((p < end) ? 1 : 0);
236 len = (int )
MIN((end - s), buf_size);
238 *is_over = ((buf_size < (end - s)) ? 1 : 0);
246 #define MAX_ERROR_PAR_LEN 30 258 va_start(vargs, code);
322 n =
xvsnprintf((
char* )buf, bufsize, (
const char* )fmt, args);
324 need = (pat_end - pat) * 4 + 4;
326 if (n + need < (
size_t )bufsize) {
327 static const char sep[] =
": /";
328 memcpy((
char* )buf + n, sep,
sizeof(sep));
332 while (p < pat_end) {
334 len =
enclen(enc, p, pat_end);
336 while (len-- > 0) *s++ = *p++;
342 sprint_byte_with_x((
char* )bs, (
unsigned int )(*p++));
345 while (blen-- > 0) *s++ = *bp++;
349 else if (*p ==
'\\') {
351 len =
enclen(enc, p, pat_end);
352 while (len-- > 0) *s++ = *p++;
354 else if (*p ==
'/') {
355 *s++ = (
unsigned char )
'\\';
360 sprint_byte_with_x((
char* )bs, (
unsigned int )(*p++));
363 while (len-- > 0) *s++ = *bp++;
383 pat, pat_end, fmt, args);
#define ONIGERR_MATCH_STACK_LIMIT_OVER
unsigned int OnigCodePoint
UChar * onig_error_code_to_format(OnigPosition code)
#define ONIGERR_TOO_MANY_CAPTURE_GROUPS
#define ONIGENC_IS_MBC_HEAD(enc, p, e)
#define ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION
#define ONIGERR_INVALID_COMBINATION_OF_OPTIONS
#define ONIGERR_META_CODE_SYNTAX
#define ONIGERR_INVALID_LOOK_BEHIND_PATTERN
#define ONIGERR_INVALID_BACKREF
#define ONIGERR_END_PATTERN_AT_LEFT_BRACKET
void onig_snprintf_with_pattern(UChar buf[], int bufsize, OnigEncoding enc, UChar *pat, UChar *pat_end, const UChar *fmt,...)
#define ONIGERR_UNDEFINED_GROUP_OPTION
#define ONIGERR_INVALID_CODE_POINT_VALUE
#define ONIG_ENCODING_ASCII
#define ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED
#define ONIGERR_TOO_BIG_NUMBER
#define ONIGERR_INVALID_GROUP_NAME
#define ONIGERR_MULTIPLEX_DEFINED_NAME
#define ONIGERR_END_PATTERN_AT_ESCAPE
#define ONIGERR_CONTROL_CODE_SYNTAX
#define ONIGERR_MULTIPLEX_DEFINITION_NAME_CALL
#define ONIGERR_MISMATCH_CODE_LENGTH_IN_CLASS_RANGE
#define ONIGERR_END_PATTERN_AT_META
#define ONIGERR_EMPTY_RANGE_IN_CHAR_CLASS
#define ONIGERR_NESTED_REPEAT_OPERATOR
int onig_error_code_to_str(UChar *s, OnigPosition code,...)
#define ONIGERR_INVALID_CHAR_IN_GROUP_NAME
#define ONIGERR_INVALID_ARGUMENT
#define ONIGERR_END_PATTERN_AT_CONTROL
#define ONIGENC_IS_CODE_SPACE(enc, code)
#define ONIGERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE
#define ONIGERR_END_PATTERN_IN_GROUP
#define ONIGERR_UNDEFINED_NAME_REFERENCE
#define ONIGERR_UNDEFINED_BYTECODE
#define ONIGERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS
#define ONIGERR_UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE
#define ONIGENC_MBC_MINLEN(enc)
#define ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED
#define ONIGERR_UNDEFINED_GROUP_REFERENCE
#define ONIGERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS
#define ONIGENC_MBC_TO_CODE(enc, p, end)
#define MAX_ERROR_PAR_LEN
void onig_vsnprintf_with_pattern(UChar buf[], int bufsize, OnigEncoding enc, UChar *pat, UChar *pat_end, const UChar *fmt, va_list args)
unsigned char buf[MIME_BUF_SIZE]
#define ONIGERR_TOO_SHORT_MULTI_BYTE_STRING
#define ONIGERR_SPECIFIED_ENCODING_CANT_CONVERT_TO_WIDE_CHAR
#define ONIGERR_CHAR_CLASS_VALUE_AT_START_OF_RANGE
#define ONIGERR_INVALID_CHAR_PROPERTY_NAME
#define ONIGERR_EMPTY_GROUP_NAME
#define ONIGERR_STACK_BUG
register unsigned int len
#define ONIGERR_END_PATTERN_AT_LEFT_BRACE
#define ONIGERR_TARGET_OF_REPEAT_OPERATOR_INVALID
#define ONIGERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY
#define ONIGERR_PREMATURE_END_OF_CHAR_CLASS
#define ONIGERR_PARSE_DEPTH_LIMIT_OVER
ONIG_EXTERN int onigenc_str_bytelen_null(OnigEncoding enc, const OnigUChar *p)
#define ONIGERR_TOO_LONG_WIDE_CHAR_VALUE
#define ONIGERR_TOO_BIG_WIDE_CHAR_VALUE
#define ONIGERR_INVALID_REPEAT_RANGE_PATTERN
#define ONIGERR_NEVER_ENDING_RECURSION
#define ONIGERR_UNEXPECTED_BYTECODE
#define ONIGERR_INVALID_POSIX_BRACKET_TYPE
#define ONIGERR_TOO_BIG_BACKREF_NUMBER
#define ONIGENC_IS_CODE_PRINT(enc, code)
#define ONIGERR_DEFAULT_ENCODING_IS_NOT_SET
#define ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE
#define ONIGERR_UNMATCHED_CLOSE_PARENTHESIS
#define ONIGERR_EMPTY_CHAR_CLASS
#define ONIGERR_TOO_SHORT_DIGITS
#define ONIG_NO_SUPPORT_CONFIG
#define ONIGERR_PARSER_BUG
#define ONIGERR_INVALID_CONDITION_PATTERN
#define ONIGERR_TOO_MANY_MULTI_BYTE_RANGES
#define enclen(enc, p, e)