[#15625] rb_hash_initialize — Takaaki Tateishi <ttate@...>
立石です.
22 messages
2002/01/04
[#15627] Re: rb_hash_initialize
— matz@... (Yukihiro Matsumoto)
2002/01/04
まつもと ゆきひろです
[#15628] Re: rb_hash_initialize
— Takaaki Tateishi <ttate@...>
2002/01/04
立石です.
[#15632] Re: rb_hash_initialize
— matz@... (Yukihiro Matsumoto)
2002/01/04
まつもと ゆきひろです
[#15634] Re: rb_hash_initialize
— Takaaki Tateishi <ttate@...>
2002/01/04
立石です.
[#15636] Re: rb_hash_initialize
— kjana@...4lab.to (YANAGAWA Kazuhisa)
2002/01/05
In message <200201042027.g04KR9VI015833@smtp16.dti.ne.jp>
[#15639] Re: rb_hash_initialize
— Takaaki Tateishi <ttate@...>
2002/01/05
At Sat, 5 Jan 2002 12:06:04 +0900,
[#15640] Re: rb_hash_initialize
— nobu.nakada@...
2002/01/05
なかだです。
[#15641] Re: rb_hash_initialize
— Takaaki Tateishi <ttate@...>
2002/01/05
At Sat, 5 Jan 2002 13:52:55 +0900,
[#15645] Enumerable#to_hash (Re: [ruby-talk:30339] Re: OT: Re: Sorting a Hash by value of integer stored in the Hash) — nobu.nakada@...
なかだです。
4 messages
2002/01/06
[#15649] Re: Enumerable#to_hash (Re: [ruby-talk:30339] Re: OT: Re: Sorting a Hash by value of integer stored in the Hash)
— matz@... (Yukihiro Matsumoto)
2002/01/07
まつもと ゆきひろです
[#15668] Re: [ruby-cvs] ruby, ruby/win32: * win32/resource.rb: Modify copyright in resource script. — nobu.nakada@...
なかだです。
7 messages
2002/01/10
[#15672] Re: [ruby-cvs] ruby, ruby/win32: * win32/resource.rb: Modify copyright in resource script.
— Takahiro Kambe <taca@...>
2002/01/10
余談です。
[#15685] undefined method `inherited' for false (NameError) — WATANABE Hirofumi <eban@...>
わたなべです。
13 messages
2002/01/15
[#15686] Re: undefined method `inherited' for false (NameError)
— nobu.nakada@...
2002/01/15
なかだです。
[#15688] Re: undefined method `inherited' for false (NameError)
— WATANABE Hirofumi <eban@...>
2002/01/16
わたなべです。
[#15689] Re: undefined method `inherited' for false (NameError)
— matz@... (Yukihiro Matsumoto)
2002/01/16
まつもと ゆきひろです
[#15690] Re: undefined method `inherited' for false (NameError)
— WATANABE Hirofumi <eban@...>
2002/01/16
わたなべです。
[#15691] Re: undefined method `inherited' for false (NameError)
— nobu.nakada@...
2002/01/16
なかだです。
[#15692] Re: undefined method `inherited' for false (NameError)
— WATANABE Hirofumi <eban@...>
2002/01/16
わたなべです。
[#15693] Re: undefined method `inherited' for false (NameError)
— matz@... (Yukihiro Matsumoto)
2002/01/16
まつもと ゆきひろです
[#15700] method cache — Takaaki Tateishi <ttate@...>
立石です.
9 messages
2002/01/17
[#15701] Re: method cache
— matz@... (Yukihiro Matsumoto)
2002/01/17
まつもと ゆきひろです
[#15704] Re: method cache
— Takaaki Tateishi <ttate@...>
2002/01/17
At Thu, 17 Jan 2002 18:23:40 +0900,
[#15703] SIG_IGN がひきつがれない — akira yamada / やまだあきら <akira@...>
8 messages
2002/01/17
[#15708] Re: SIG_IGN がひきつがれない
— matz@... (Yukihiro Matsumoto)
2002/01/17
まつもと ゆきひろです
[#15711] clearing method cache in rb_eval() — "K.Kosako" <kosako@...>
rb_eval()の中のNODE_CLASS, NODE_SCLASSの部分で、
5 messages
2002/01/18
[#15733] Win32API enhancement — matz@... (Yukihiro Matsumoto)
まつもと ゆきひろです
7 messages
2002/01/21
[#15745] Win32OLE — Masaki Suketa <masaki.suketa@...>
助田です。
5 messages
2002/01/21
[#15757] 文字列→整数変換 — nobu.nakada@...
なかだです。
30 messages
2002/01/25
[#15758] Re: 文字列→整数変換
— matz@... (Yukihiro Matsumoto)
2002/01/25
まつもと ゆきひろです
[#15779] Re: 文字列→整数変換
— nobu.nakada@...
2002/01/27
なかだです。
[#15780] Re: 文字列→整数変換
— matz@... (Yukihiro Matsumoto)
2002/01/28
まつもと ゆきひろです
[#15781] Re: 文字列→整数変換
— nobu.nakada@...
2002/01/28
なかだです。
[#15782] Re: 文字列→整数変換
— matz@... (Yukihiro Matsumoto)
2002/01/28
まつもと ゆきひろです
[#15795] [PATCH] improve on \G — nobu.nakada@...
なかだです。
11 messages
2002/01/29
[#15801] Re: [PATCH] improve on \G
— matz@... (Yukihiro Matsumoto)
2002/01/29
まつもと ゆきひろです
[#15796] GC after load — Minero Aoki <aamine@...>
あおきです。
13 messages
2002/01/29
[#15799] Re: GC after load
— Minero Aoki <aamine@...>
2002/01/29
あおきです。舌足らずでした。
[#15802] Re: GC after load
— matz@... (Yukihiro Matsumoto)
2002/01/29
まつもと ゆきひろです
[#15806] Re: GC after load
— Minero Aoki <aamine@...>
2002/01/30
あおきです。
[#15807] Re: GC after load
— matz@... (Yukihiro Matsumoto)
2002/01/30
まつもと ゆきひろです
[#15810] racc fails on alpha-freebsd — Minero Aoki <aamine@...>
あおきです。
12 messages
2002/01/30
[#15812] Re: racc fails on alpha-freebsd
— matz@... (Yukihiro Matsumoto)
2002/01/30
まつもと ゆきひろです
[#15819] Re: racc fails on alpha-freebsd
— Minero Aoki <aamine@...>
2002/01/31
あおきです。
[#15830] [ 提案 ] puts, print 等を IO から分離 — UENO Katsuhiro <unnie@...>
うえのです。
14 messages
2002/01/31
[#15833] Re: [ 提案 ] puts, print 等を IO から分離
— matz@... (Yukihiro Matsumoto)
2002/02/01
まつもと ゆきひろです
[#15837] Re: [ 提案 ] puts, print 等を IO から分離
— Tanaka Akira <akr@...17n.org>
2002/02/01
In article <1012537417.431157.12483.nullmailer@ev.netlab.jp>,
[ruby-dev:15779] Re: 文字列→整数変換
From:
nobu.nakada@...
Date:
2002-01-27 19:59:30 UTC
List:
ruby-dev #15779
なかだです。
追加。
At Fri, 25 Jan 2002 17:35:02 +0900,
Nobuyoshi-Nakada wrote:
> * eval/parser, Integer(), Float()
> 各数字間に高々一個の'_'が許される。符号の後、'.','e'の前後(浮
> 動少数点数の場合)には許されない。
prefixだけしかない整数(0xだけ、0bだけ)はエラー。
'e'のあとに指数部がないもの(符号だけのものも含む)もエラー。
前者は1.4はちゃんとエラーになるんですが、1.6.2あたりから-0xとか
-0bなんてのが通ってしまいます。
あと、今のところどうも'e'の前後の'_'はわざと通るようにしてある
ようなんですが、これはエラーになるように変更するということでしょ
うか。
Index: parse.y
===================================================================
RCS file: /cvs/ruby/src/ruby/parse.y,v
retrieving revision 1.144
diff -u -2 -p -w -r1.144 parse.y
--- parse.y 2002/01/21 07:44:06 1.144
+++ parse.y 2002/01/27 18:31:34
@@ -3313,7 +3313,7 @@ yylex()
case '5': case '6': case '7': case '8': case '9':
{
- int is_float, seen_point, seen_e, seen_uc;
+ int is_float, seen_point, seen_e, nondigit;
- is_float = seen_point = seen_e = seen_uc = 0;
+ is_float = seen_point = seen_e = nondigit = 0;
lex_state = EXPR_END;
newtok();
@@ -3323,23 +3323,27 @@ yylex()
}
if (c == '0') {
+ int start = toklen();
c = nextc();
if (c == 'x' || c == 'X') {
/* hexadecimal */
c = nextc();
+ if (ISXDIGIT(c)) {
do {
if (c == '_') {
- seen_uc = 1;
+ if (nondigit) break;
+ nondigit = c;
continue;
}
if (!ISXDIGIT(c)) break;
- seen_uc = 0;
+ nondigit = 0;
tokadd(c);
} while (c = nextc());
+ }
pushback(c);
tokfix();
- if (toklen() == 0) {
+ if (toklen() == start) {
yyerror("hexadecimal number without hex-digits");
}
- else if (seen_uc) goto trailing_uc;
+ else if (nondigit) goto trailing_uc;
yylval.val = rb_cstr2inum(tok(), 16);
return tINTEGER;
@@ -3348,19 +3352,22 @@ yylex()
/* binary */
c = nextc();
+ if (c == '0' || c == '1') {
do {
if (c == '_') {
- seen_uc = 1;
+ if (nondigit) break;
+ nondigit = c;
continue;
}
if (c != '0'&& c != '1') break;
- seen_uc = 0;
+ nondigit = 0;
tokadd(c);
} while (c = nextc());
+ }
pushback(c);
tokfix();
- if (toklen() == 0) {
+ if (toklen() == start) {
yyerror("numeric literal without digits");
}
- else if (seen_uc) goto trailing_uc;
+ else if (nondigit) goto trailing_uc;
yylval.val = rb_cstr2inum(tok(), 2);
return tINTEGER;
@@ -3370,21 +3377,24 @@ yylex()
do {
if (c == '_') {
- seen_uc = 1;
+ if (nondigit) break;
+ nondigit = c;
continue;
}
if (c < '0' || c > '7') break;
- seen_uc = 0;
+ nondigit = 0;
tokadd(c);
} while (c = nextc());
+ if (toklen() > start) {
pushback(c);
tokfix();
- if (seen_uc) goto trailing_uc;
+ if (nondigit) goto trailing_uc;
yylval.val = rb_cstr2inum(tok(), 8);
return tINTEGER;
}
+ }
if (c > '7' && c <= '9') {
yyerror("Illegal octal digit");
}
- else if (c == '.') {
+ else if (c == '.' || c == 'e' || c == 'E') {
tokadd('0');
}
@@ -3400,10 +3410,10 @@ yylex()
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
- seen_uc = 0;
+ nondigit = 0;
tokadd(c);
break;
case '.':
- if (seen_uc) goto trailing_uc;
+ if (nondigit) goto trailing_uc;
if (seen_point || seen_e) {
goto decode_num;
@@ -3421,5 +3431,5 @@ yylex()
is_float++;
seen_point++;
- seen_uc = 0;
+ nondigit = 0;
break;
@@ -3432,8 +3442,13 @@ yylex()
seen_e++;
is_float++;
- while ((c = nextc()) == '_')
- seen_uc = 1;
- if (c == '-' || c == '+')
+ nondigit = c;
+ if ((c = nextc()) == '_') {
+ nondigit = c;
+ c = nextc();
+ }
+ if (c == '-' || c == '+') {
tokadd(c);
+ nondigit = c;
+ }
else
continue;
@@ -3441,5 +3456,6 @@ yylex()
case '_': /* `_' in number just ignored */
- seen_uc = 1;
+ if (nondigit) goto decode_num;
+ nondigit = c;
break;
@@ -3453,7 +3469,9 @@ yylex()
pushback(c);
tokfix();
- if (seen_uc) {
+ if (nondigit) {
+ char tmp[30];
trailing_uc:
- yyerror("trailing `_' in number");
+ sprintf(tmp, "trailing `%c' in number", nondigit);
+ yyerror(tmp);
}
if (is_float) {
--
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
中田 伸悦