From e36dd522913f79973f0493cc885ce066920ed6e2 Mon Sep 17 00:00:00 2001 From: usa Date: Thu, 24 Jan 2008 07:25:46 +0000 Subject: * parse.y (reg_fragment_setenc_gen): recognize regexp with option n as as ASCII-8BIT instead of US-ASCII. [ruby-dev:33339] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ parse.y | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index 3467104689..37687ce2b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Jan 24 16:24:25 2008 NAKAMURA Usaku + + * parse.y (reg_fragment_setenc_gen): recognize regexp with option n as + as ASCII-8BIT instead of US-ASCII. [ruby-dev:33339] + Thu Jan 24 15:44:42 2008 Yukihiro Matsumoto * array.c (collect_bang_i): use rb_ary_store() to avoid potential diff --git a/parse.y b/parse.y index aabcc5c18f..d6434d78c4 100644 --- a/parse.y +++ b/parse.y @@ -456,6 +456,7 @@ static int lvar_defined_gen(struct parser_params*, ID); #define RE_OPTION_ENCODING_SHIFT 8 #define RE_OPTION_ENCODING(e) (((e)&0xff)<>RE_OPTION_ENCODING_SHIFT)&0xff) +#define RE_OPTION_ENCODING_NONE(o) ((o)&32) #define RE_OPTION_MASK 0xff #define NODE_STRTERM NODE_ZARRAY /* nothing to gc */ @@ -8478,6 +8479,9 @@ reg_fragment_setenc_gen(struct parser_params* parser, VALUE str, int options) } ENCODING_SET(str, idx); } + else if (RE_OPTION_ENCODING_NONE(options)) { + rb_enc_associate(str, rb_ascii8bit_encoding()); + } } static void -- cgit v1.2.3