зеркало из https://github.com/github/ruby.git
* regenc.c (onigenc_minimum_property_name_to_ctype):
\p{...} should be case insensitive. [ruby-core:33000] * regenc.c (onigenc_property_list_add_property): ditto. * enc/euc_jp.c (init_property_list, property_name_to_ctype): to lowercase property names. * enc/shift_jis.c (init_property_list, property_name_to_ctype): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
63b0601792
Коммит
dbf7e6f9f2
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
Tue Nov 9 13:24:33 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* regenc.c (onigenc_minimum_property_name_to_ctype):
|
||||
\p{...} should be case insensitive. [ruby-core:33000]
|
||||
|
||||
* regenc.c (onigenc_property_list_add_property):
|
||||
ditto.
|
||||
|
||||
* enc/euc_jp.c (init_property_list, property_name_to_ctype):
|
||||
to lowercase property names.
|
||||
|
||||
* enc/shift_jis.c (init_property_list, property_name_to_ctype):
|
||||
ditto.
|
||||
|
||||
Tue Nov 9 13:29:36 2010 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* win32/win32.c (overlapped_socket_io): get rid of a warning of 64bit
|
||||
|
|
14
enc/euc_jp.c
14
enc/euc_jp.c
|
@ -274,8 +274,8 @@ init_property_list(void)
|
|||
{
|
||||
int r;
|
||||
|
||||
PROPERTY_LIST_ADD_PROP("Hiragana", CR_Hiragana);
|
||||
PROPERTY_LIST_ADD_PROP("Katakana", CR_Katakana);
|
||||
PROPERTY_LIST_ADD_PROP("hiragana", CR_Hiragana);
|
||||
PROPERTY_LIST_ADD_PROP("katakana", CR_Katakana);
|
||||
PropertyInited = 1;
|
||||
|
||||
end:
|
||||
|
@ -286,11 +286,17 @@ static int
|
|||
property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
|
||||
{
|
||||
st_data_t ctype;
|
||||
UChar *s, *e;
|
||||
|
||||
PROPERTY_LIST_INIT_CHECK;
|
||||
|
||||
if (onig_st_lookup_strend(PropertyNameTable, p, end, &ctype) == 0) {
|
||||
return onigenc_minimum_property_name_to_ctype(enc, p, end);
|
||||
s = e = ALLOC_N(UChar, end-p+1);
|
||||
for (; p < end; p++) {
|
||||
*e++ = ONIGENC_ASCII_CODE_TO_LOWER_CASE(*p);
|
||||
}
|
||||
|
||||
if (onig_st_lookup_strend(PropertyNameTable, s, e, &ctype) == 0) {
|
||||
return onigenc_minimum_property_name_to_ctype(enc, s, e);
|
||||
}
|
||||
|
||||
return ctype;
|
||||
|
|
|
@ -283,8 +283,8 @@ init_property_list(void)
|
|||
{
|
||||
int r;
|
||||
|
||||
PROPERTY_LIST_ADD_PROP("Hiragana", CR_Hiragana);
|
||||
PROPERTY_LIST_ADD_PROP("Katakana", CR_Katakana);
|
||||
PROPERTY_LIST_ADD_PROP("hiragana", CR_Hiragana);
|
||||
PROPERTY_LIST_ADD_PROP("katakana", CR_Katakana);
|
||||
PropertyInited = 1;
|
||||
|
||||
end:
|
||||
|
@ -295,11 +295,17 @@ static int
|
|||
property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
|
||||
{
|
||||
hash_data_type ctype;
|
||||
UChar *s, *e;
|
||||
|
||||
PROPERTY_LIST_INIT_CHECK;
|
||||
|
||||
if (onig_st_lookup_strend(PropertyNameTable, p, end, &ctype) == 0) {
|
||||
return onigenc_minimum_property_name_to_ctype(enc, p, end);
|
||||
s = e = ALLOC_N(UChar, end-p+1);
|
||||
for (; p < end; p++) {
|
||||
*e++ = ONIGENC_ASCII_CODE_TO_LOWER_CASE(*p);
|
||||
}
|
||||
|
||||
if (onig_st_lookup_strend(PropertyNameTable, s, e, &ctype) == 0) {
|
||||
return onigenc_minimum_property_name_to_ctype(enc, s, e);
|
||||
}
|
||||
|
||||
return (int)ctype;
|
||||
|
|
2
regenc.c
2
regenc.c
|
@ -811,7 +811,7 @@ onigenc_minimum_property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
|
|||
len = onigenc_strlen(enc, p, end);
|
||||
for (pbe = (pb = PBS) + sizeof(PBS)/sizeof(PBS[0]); pb < pbe; ++pb) {
|
||||
if (len == pb->len &&
|
||||
onigenc_with_ascii_strncmp(enc, p, end, pb->name, pb->len) == 0)
|
||||
STRNCASECMP(p, pb->name, len) == 0)
|
||||
return pb->ctype;
|
||||
}
|
||||
|
||||
|
|
|
@ -538,6 +538,14 @@ class TestM17N < Test::Unit::TestCase
|
|||
assert(r.fixed_encoding?)
|
||||
assert_match(r, "\xa4\xa2".force_encoding("euc-jp"))
|
||||
|
||||
r = /\p{AsciI}/e
|
||||
assert(r.fixed_encoding?)
|
||||
assert_match(r, "a".force_encoding("euc-jp"))
|
||||
|
||||
r = /\p{hiraganA}/e
|
||||
assert(r.fixed_encoding?)
|
||||
assert_match(r, "\xa4\xa2".force_encoding("euc-jp"))
|
||||
|
||||
r = eval('/\u{3042}\p{Hiragana}/'.force_encoding("euc-jp"))
|
||||
assert(r.fixed_encoding?)
|
||||
assert_equal(Encoding::UTF_8, r.encoding)
|
||||
|
|
Загрузка…
Ссылка в новой задаче