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:
parent
ae3a58e8c5
commit
9d7ff244c3
13
ChangeLog
13
ChangeLog
@ -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>
|
Mon Aug 17 08:31:56 2009 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
* lib/date/delta.rb: merged from date4. [experimental]
|
* lib/date/delta.rb: merged from date4. [experimental]
|
||||||
|
31
regparse.c
31
regparse.c
@ -1698,7 +1698,8 @@ new_code_range(BBuf** pbuf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
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 r, inc_n, pos;
|
||||||
int low, high, bound, x;
|
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 (inc_n != 1) {
|
||||||
if (from > data[low*2])
|
if (from > data[low*2])
|
||||||
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])
|
if (to < data[(high - 1)*2 + 1])
|
||||||
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) {
|
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
|
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 (from > to) {
|
||||||
if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC))
|
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 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
|
static int
|
||||||
@ -5031,24 +5044,24 @@ i_apply_case_fold(OnigCodePoint from, OnigCodePoint to[],
|
|||||||
if ((is_in != 0 && !IS_NCCLASS_NOT(cc)) ||
|
if ((is_in != 0 && !IS_NCCLASS_NOT(cc)) ||
|
||||||
(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) {
|
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 {
|
else {
|
||||||
BITSET_SET_BIT_CHKDUP(bs, *to);
|
BITSET_SET_BIT(bs, *to);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (is_in != 0) {
|
if (is_in != 0) {
|
||||||
if (ONIGENC_MBC_MINLEN(env->enc) > 1 || *to >= SINGLE_BYTE_SIZE) {
|
if (ONIGENC_MBC_MINLEN(env->enc) > 1 || *to >= SINGLE_BYTE_SIZE) {
|
||||||
if (IS_NCCLASS_NOT(cc)) clear_not_flag_cclass(cc, env->enc);
|
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 {
|
else {
|
||||||
if (IS_NCCLASS_NOT(cc)) {
|
if (IS_NCCLASS_NOT(cc)) {
|
||||||
BITSET_CLEAR_BIT(bs, *to);
|
BITSET_CLEAR_BIT(bs, *to);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
BITSET_SET_BIT_CHKDUP(bs, *to);
|
BITSET_SET_BIT(bs, *to);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS */
|
#endif /* CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user