[#16708] includedir — nobu.nakada@...
なかだです。
[#16732] sharing sub-regexp — Tanaka Akira <akr@...17n.org>
Oniguruma についてひとつ要望があります。
Tanaka Akiraさんの<hvopu1hxfyd.fsf@coulee.a02.aist.go.jp>から
まつもと ゆきひろです
In article <1017890618.302241.17865.nullmailer@ev.netlab.jp>,
Tanaka Akiraさんの<hvo7knn93ug.fsf@coulee.a02.aist.go.jp>から
In article <20020405044506.D4784349@helium.ruby-lang.org>,
Tanaka Akiraさんの<hvopu1e4omy.fsf@coulee.a02.aist.go.jp>から
In article <20020410025054.C8DF0915@helium.ruby-lang.org>,
In article <hvor8lnchak.fsf@coulee.a02.aist.go.jp>,
前田です。
In article <87pu15z80q.wl@studly.priv.netlab.jp>,
前田です。
In article <87g01x1e6m.wl@studly.priv.netlab.jp>,
西山和広です。
In article <20020416180631.988E.ZN@mbf.nifty.com>,
前田です。
In article <87u1qaj0xe.wl@studly.priv.netlab.jp>,
前田です。
まつもと ゆきひろです
In article <1019116103.420173.12691.nullmailer@picachu.netlab.jp>,
前田です。
なかだです。
In article <200204181023.g3IANgM21124@sharui.nakada.kanuma.tochigi.jp>,
まつもと ゆきひろです
In article <1019140164.869863.14833.nullmailer@picachu.netlab.jp>,
[#16757] === — "Akinori MUSHA" <knu@...>
Array, Hash, Proc などで、 === が以下のように定義されていると
[#16761] StringIO — tadf@...
ふなばです。
なかだです。
ふなばです。
なかだです。
ふなばです。
青山です。
まつもと ゆきひろです
In article <1022740594.117106.6073.nullmailer@picachu.netlab.jp>,
前田です。
In article <874rgqdt3x.wl@studly.priv.netlab.jp>,
青山です。
まつもと ゆきひろです
青山です。
まつもと ゆきひろです
青山です。
まつもと ゆきひろです
青山です。
[#16776] Ruby 1.7.2 segfault — takuma ozawa <metal@...>
小澤といいます。
なかだです。
[#16790] Ruby Shim — "Akinori MUSHA" <knu@...>
1.7 early access kit という仮称で提案した構想ですが、先ほど
新井です。
At Tue, 9 Apr 2002 02:12:27 +0900,
なかだです。
[#16816] remove_const: cannot remove constant — Koji Arai <JCA02266@...>
新井です。
[#16833] math.c 1.10 — "U.Nakamura" <usa@...>
こんにちは、なかむら(う)です。
まつもと ゆきひろです
さくです。
なかだです。
まつもと ゆきひろです
[#16868] make error on debian potato — Wakou Aoyama <wakou@...>
青山です。
[#16869] Makefiles dependency — nobu.nakada@...
なかだです。
わたなべです。
なかだです。
わたなべです。
なかだです。
わたなべです。
なかだです。
[#16894] compile failure in process.c, setpgrp() & setpgid() — Ryo HAYASAKA <ryoh@...>
早坂@北陸先端です.
[#16923] Module::new with block is useful? — "Shin'ya Adzumi" <adzumi@...>
あづみです。
[#16978] Re: [rubyist:1343] Re: another sample for the Method — Koji Arai <JCA02266@...>
新井です。
[#16989] making Proc in C (Re: [rubyist:1356] Re: another sample for the Method) — nobu.nakada@...
なかだです。
[ruby-dev:16960] Re: Regexp#to_s
なかだです。
At Thu, 18 Apr 2002 17:05:28 +0900,
Tanaka Akira wrote:
> 実装しました。
余分な(?:)を付けないようにしてみましたが、ここまですることもな
い?
Index: re.c
===================================================================
RCS file: /cvs/ruby/src/ruby/re.c,v
retrieving revision 1.63
diff -u -2 -p -r1.63 re.c
--- re.c 2002/04/18 08:46:18 1.63
+++ re.c 2002/04/18 10:18:27
@@ -360,35 +360,92 @@ rb_reg_to_s(re)
VALUE re;
{
- int all;
+ int options;
+ const int embeddable = RE_OPTION_MULTILINE|RE_OPTION_IGNORECASE|RE_OPTION_EXTENDED;
+ long len;
+ const char* ptr;
VALUE str = rb_str_buf_new2("(?");
rb_reg_check(re);
+
+ options = RREGEXP(re)->ptr->options;
+ ptr = RREGEXP(re)->str;
+ len = RREGEXP(re)->len;
+ if (len >= 4 && ptr[0] == '(' && ptr[1] == '?' && ptr[len-1] == ')') {
+ int nest = 0;
+ ptr += 2;
+ if ((len -= 3) > 0) {
+ do {
+ if (*ptr == 'm') {
+ options |= RE_OPTION_MULTILINE;
+ }
+ else if (*ptr == 'i') {
+ options |= RE_OPTION_IGNORECASE;
+ }
+ else if (*ptr == 'x') {
+ options |= RE_OPTION_EXTENDED;
+ }
+ else break;
+ ++ptr;
+ } while (--len > 0);
+ }
+ if (len > 1 && *ptr == '-') {
+ ++ptr;
+ --len;
+ do {
+ if (*ptr == 'm') {
+ options &= ~RE_OPTION_MULTILINE;
+ }
+ else if (*ptr == 'i') {
+ options &= ~RE_OPTION_IGNORECASE;
+ }
+ else if (*ptr == 'x') {
+ options &= ~RE_OPTION_EXTENDED;
+ }
+ else break;
+ ++ptr;
+ } while (--len > 0);
+ }
+ if (*ptr == ':') {
+ const char* p = ++ptr;
+ long l = --len;
+ kcode_set_option(re);
+ while (len > 0) {
+ int n;
+ if (*p == '(') {
+ ++nest;
+ }
+ else if (*p == ')') {
+ if (--nest < 0) break;
+ }
+ else if (*p == '\\') {
+ --l;
+ ++p;
+ }
+ n = mbclen(*p);
+ l -= n;
+ p += n;
+ }
+ kcode_reset_option();
+ }
+ if (nest) {
+ options = RREGEXP(re)->ptr->options;
+ ptr = RREGEXP(re)->str;
+ len = RREGEXP(re)->len;
+ }
+ }
- all = 1;
- if (RREGEXP(re)->ptr->options & RE_OPTION_MULTILINE)
- rb_str_buf_cat2(str, "m");
- else
- all = 0;
- if (RREGEXP(re)->ptr->options & RE_OPTION_IGNORECASE)
- rb_str_buf_cat2(str, "i");
- else
- all = 0;
- if (RREGEXP(re)->ptr->options & RE_OPTION_EXTENDED)
- rb_str_buf_cat2(str, "x");
- else
- all = 0;
+ if (options & RE_OPTION_MULTILINE) rb_str_buf_cat2(str, "m");
+ if (options & RE_OPTION_IGNORECASE) rb_str_buf_cat2(str, "i");
+ if (options & RE_OPTION_EXTENDED) rb_str_buf_cat2(str, "x");
- if (!all) {
+ if ((options & embeddable) != embeddable) {
rb_str_buf_cat2(str, "-");
- if (!(RREGEXP(re)->ptr->options & RE_OPTION_MULTILINE))
- rb_str_buf_cat2(str, "m");
- if (!(RREGEXP(re)->ptr->options & RE_OPTION_IGNORECASE))
- rb_str_buf_cat2(str, "i");
- if (!(RREGEXP(re)->ptr->options & RE_OPTION_EXTENDED))
- rb_str_buf_cat2(str, "x");
+ if (!(options & RE_OPTION_MULTILINE)) rb_str_buf_cat2(str, "m");
+ if (!(options & RE_OPTION_IGNORECASE)) rb_str_buf_cat2(str, "i");
+ if (!(options & RE_OPTION_EXTENDED)) rb_str_buf_cat2(str, "x");
}
rb_str_buf_cat2(str, ":");
- rb_reg_expr_str(str, RREGEXP(re)->str, RREGEXP(re)->len);
+ rb_reg_expr_str(str, ptr, len);
rb_str_buf_cat2(str, ")");
--
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
中田 伸悦