ruby-changes:12836
From: naruse <ko1@a...>
Date: Mon, 17 Aug 2009 10:47:41 +0900 (JST)
Subject: [ruby-changes:12836] Ruby:r24568 (trunk): Don't warn if the duplicate is caused by /i.
naruse 2009-08-17 10:46:34 +0900 (Mon, 17 Aug 2009) New Revision: 24568 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=24568 Log: 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 Modified files: trunk/ChangeLog trunk/regparse.c Index: regparse.c =================================================================== --- regparse.c (revision 24567) +++ regparse.c (revision 24568) @@ -1698,7 +1698,8 @@ } 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 @@ 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,8 +1776,14 @@ } 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)) return 0; @@ -1784,10 +1791,16 @@ 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 not_code_range_buf(OnigEncoding enc, BBuf* bbuf, BBuf** pbuf, ScanEnv* env) { int r, i, n; @@ -5031,24 +5044,24 @@ 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 */ Index: ChangeLog =================================================================== --- ChangeLog (revision 24567) +++ ChangeLog (revision 24568) @@ -1,3 +1,16 @@ +Mon Aug 17 10:37:41 2009 NARUSE, Yui <naruse@r...> + + * 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@d...> * lib/date/delta.rb: merged from date4. [experimental] -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/