Bug #9344 » 9344.patch
include/ruby/oniguruma.h | ||
---|---|---|
ONIG_EXTERN
|
||
void onig_set_warn_func P_((OnigWarnFunc f));
|
||
ONIG_EXTERN
|
||
void onig_set_verb_warn_func P_((OnigWarnFunc f));
|
||
ONIG_EXTERN
|
||
int onig_new P_((OnigRegex*, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, const OnigSyntaxType* syntax, OnigErrorInfo* einfo));
|
||
ONIG_EXTERN
|
||
int onig_reg_init P_((OnigRegex reg, OnigOptionType option, OnigCaseFoldType case_fold_flag, OnigEncoding enc, const OnigSyntaxType* syntax));
|
re.c | ||
---|---|---|
onigenc_set_default_caseconv_table((UChar*)casetable);
|
||
onigenc_set_default_encoding(ONIG_ENCODING_ASCII);
|
||
onig_set_warn_func(re_warn);
|
||
onig_set_verb_warn_func(re_warn);
|
||
rb_define_virtual_variable("$~", match_getter, match_setter);
|
||
rb_define_virtual_variable("$&", last_match_getter, 0);
|
regparse.c | ||
---|---|---|
static OnigWarnFunc onig_warn = onig_null_warn;
|
||
#endif
|
||
#ifdef DEFAULT_VERB_WARN_FUNCTION
|
||
static OnigWarnFunc onig_verb_warn = (OnigWarnFunc )DEFAULT_VERB_WARN_FUNCTION;
|
||
#else
|
||
static OnigWarnFunc onig_verb_warn = onig_null_warn;
|
||
#endif
|
||
extern void onig_set_warn_func(OnigWarnFunc f)
|
||
{
|
||
onig_warn = f;
|
||
}
|
||
extern void onig_set_verb_warn_func(OnigWarnFunc f)
|
||
{
|
||
onig_verb_warn = f;
|
||
}
|
||
static void CC_DUP_WARN(ScanEnv *env);
|
||
static void
|
||
... | ... | |
#ifdef USE_WARNING_REDUNDANT_NESTED_REPEAT_OPERATOR
|
||
if (!IS_QUANTIFIER_BY_NUMBER(qn) && !IS_QUANTIFIER_BY_NUMBER(qnt) &&
|
||
IS_SYNTAX_BV(env->syntax, ONIG_SYN_WARN_REDUNDANT_NESTED_REPEAT)) {
|
||
UChar buf[WARN_BUFSIZE];
|
||
switch (ReduceTypeTable[targetq_num][nestq_num]) {
|
||
case RQ_ASIS:
|
||
break;
|
||
case RQ_DEL:
|
||
if (onig_verb_warn != onig_null_warn) {
|
||
onig_snprintf_with_pattern(buf, WARN_BUFSIZE, env->enc,
|
||
env->pattern, env->pattern_end,
|
||
(UChar* )"redundant nested repeat operator");
|
||
(*onig_verb_warn)((char* )buf);
|
||
if (onig_warn != onig_null_warn) {
|
||
onig_syntax_warn(env, "regular expression has redundant nested repeat operator '%s'", PopularQStr[targetq_num]);
|
||
}
|
||
goto warn_exit;
|
||
break;
|
||
default:
|
||
if (onig_verb_warn != onig_null_warn) {
|
||
onig_snprintf_with_pattern(buf, WARN_BUFSIZE, env->enc,
|
||
env->pattern, env->pattern_end,
|
||
(UChar* )"nested repeat operator %s and %s was replaced with '%s'",
|
||
PopularQStr[targetq_num], PopularQStr[nestq_num],
|
||
ReduceQStr[ReduceTypeTable[targetq_num][nestq_num]]);
|
||
(*onig_verb_warn)((char* )buf);
|
||
if (onig_warn != onig_null_warn) {
|
||
onig_syntax_warn(env, "nested repeat operator '%s' and '%s' was replaced with '%s' in regular expression",
|
||
PopularQStr[targetq_num], PopularQStr[nestq_num],
|
||
ReduceQStr[ReduceTypeTable[targetq_num][nestq_num]]);
|
||
}
|
||
goto warn_exit;
|
||
break;
|