1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Don't warn if the duplicate is caused by /i.

* regparse.c (add_code_range_to_buf0): added with checkdup argument.

* regparse.c (add_code_range_to_buf): use above.

* regparse.c (add_code_range0): added with checkdup argument.

* regparse.c (add_code_range): use above.

* regparse.c (i_apply_case_fold): don't warn if the duplicate is

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2009-08-17 01:46:34 +00:00
parent ae3a58e8c5
commit 9d7ff244c3
2 changed files with 35 additions and 9 deletions

View file

@ -1,3 +1,16 @@
Mon Aug 17 10:37:41 2009 NARUSE, Yui <naruse@ruby-lang.org>
* regparse.c (add_code_range_to_buf0): added with checkdup argument.
* regparse.c (add_code_range_to_buf): use above.
* regparse.c (add_code_range0): added with checkdup argument.
* regparse.c (add_code_range): use above.
* regparse.c (i_apply_case_fold): don't warn if the duplicate is
caused by case folding.
Mon Aug 17 08:31:56 2009 Tadayoshi Funaba <tadf@dotrb.org>
* lib/date/delta.rb: merged from date4. [experimental]

View file

@ -1698,7 +1698,8 @@ new_code_range(BBuf** pbuf)
}
static int
add_code_range_to_buf(BBuf** pbuf, ScanEnv* env, OnigCodePoint from, OnigCodePoint to)
add_code_range_to_buf0(BBuf** pbuf, ScanEnv* env, OnigCodePoint from, OnigCodePoint to,
int checkdup)
{
int r, inc_n, pos;
int low, high, bound, x;
@ -1745,10 +1746,10 @@ add_code_range_to_buf(BBuf** pbuf, ScanEnv* env, OnigCodePoint from, OnigCodePoi
if (inc_n != 1) {
if (from > data[low*2])
from = data[low*2];
else CC_DUP_WARN(env);
else if (checkdup) CC_DUP_WARN(env);
if (to < data[(high - 1)*2 + 1])
to = data[(high - 1)*2 + 1];
else CC_DUP_WARN(env);
else if (checkdup) CC_DUP_WARN(env);
}
if (inc_n != 0 && (OnigCodePoint )high < n) {
@ -1775,7 +1776,13 @@ add_code_range_to_buf(BBuf** pbuf, ScanEnv* env, OnigCodePoint from, OnigCodePoi
}
static int
add_code_range(BBuf** pbuf, ScanEnv* env, OnigCodePoint from, OnigCodePoint to)
add_code_range_to_buf(BBuf** pbuf, ScanEnv* env, OnigCodePoint from, OnigCodePoint to)
{
return add_code_range_to_buf0(pbuf, env, from, to, 1);
}
static int
add_code_range0(BBuf** pbuf, ScanEnv* env, OnigCodePoint from, OnigCodePoint to, int checkdup)
{
if (from > to) {
if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC))
@ -1784,7 +1791,13 @@ add_code_range(BBuf** pbuf, ScanEnv* env, OnigCodePoint from, OnigCodePoint to)
return ONIGERR_EMPTY_RANGE_IN_CHAR_CLASS;
}
return add_code_range_to_buf(pbuf, env, from, to);
return add_code_range_to_buf0(pbuf, env, from, to, checkdup);
}
static int
add_code_range(BBuf** pbuf, ScanEnv* env, OnigCodePoint from, OnigCodePoint to)
{
return add_code_range0(pbuf, env, from, to, 1);
}
static int
@ -5031,24 +5044,24 @@ i_apply_case_fold(OnigCodePoint from, OnigCodePoint to[],
if ((is_in != 0 && !IS_NCCLASS_NOT(cc)) ||
(is_in == 0 && IS_NCCLASS_NOT(cc))) {
if (ONIGENC_MBC_MINLEN(env->enc) > 1 || *to >= SINGLE_BYTE_SIZE) {
add_code_range(&(cc->mbuf), env, *to, *to);
add_code_range0(&(cc->mbuf), env, *to, *to, 0);
}
else {
BITSET_SET_BIT_CHKDUP(bs, *to);
BITSET_SET_BIT(bs, *to);
}
}
#else
if (is_in != 0) {
if (ONIGENC_MBC_MINLEN(env->enc) > 1 || *to >= SINGLE_BYTE_SIZE) {
if (IS_NCCLASS_NOT(cc)) clear_not_flag_cclass(cc, env->enc);
add_code_range(&(cc->mbuf), env, *to, *to);
add_code_range0(&(cc->mbuf), env, *to, *to, 0);
}
else {
if (IS_NCCLASS_NOT(cc)) {
BITSET_CLEAR_BIT(bs, *to);
}
else
BITSET_SET_BIT_CHKDUP(bs, *to);
BITSET_SET_BIT(bs, *to);
}
}
#endif /* CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS */