diff options
-rw-r--r-- | ChangeLog | 29 | ||||
-rw-r--r-- | README.jp | 2 | ||||
-rw-r--r-- | hash.c | 4 | ||||
-rw-r--r-- | io.c | 2 | ||||
-rw-r--r-- | parse.y | 58 | ||||
-rw-r--r-- | ruby.1 | 6 | ||||
-rw-r--r-- | win32/config.h.in | 1 |
7 files changed, 77 insertions, 25 deletions
@@ -1,14 +1,39 @@ +Mon Sep 4 12:58:31 2000 Yukihiro Matsumoto <matz@ruby-lang.org> + + * stable version 1.6.0 released. + Mon Sep 4 13:40:40 2000 WATANABE Hirofumi <eban@os.rim.or.jp> * configure.in: renamed libruby.a to libruby.{cygwin,mingw32}.a on cygwin and mingw32. -Fri Sep 1 10:36:45 2000 Yukihiro Matsumoto <matz@ruby-lang.org> +Sun Sep 3 23:44:04 2000 Noriaki Harada <tenmei@maoh.office.ne.jp> - * stable version 1.6.0 released. + * io.c (NO_SAFE_RENAME): for BeOS too. + +Sun Sep 3 11:31:53 2000 Takaaki Tateishi <ttate@jaist.ac.jp> + + * parse.y (rescue): no assignment was done if rescue body as + empty. + +Sat Sep 2 10:52:21 2000 Yukihiro Matsumoto <matz@ruby-lang.org> + + * parse.y (call_args,aref_args): block_call can be the last + argument. + + * parse.y (COND_PUSH,COND_POP): maintain condition stack to allow + kDO2 in parentheses in while/until/for conditions. + + * parse.y (yylex): generate kDO2 for EXPR_ARG outside of + while/until/for condition. Fri Sep 1 10:36:29 2000 Yukihiro Matsumoto <matz@ruby-lang.org> + * parse.y (aref_args,opt_call_args): add block_call to allow a + method without parentheses and with block as a last argument. + + * hash.c (rb_hash_sort): should not retrun nil. + * re.c (match_aref): should use rb_reg_nth_match(). * eval.c (POP_SCOPE): recycled scopes too much @@ -191,7 +191,7 @@ Public License)または以下に示す条件で本プログラムを再配布で * 著者 -コメント,バグレポートその他は matz@zetabis.com まで. +コメント,バグレポートその他は matz@zetabits.com まで. ------------------------------------------------------- created at: Thu Aug 3 11:57:36 JST 1995 Local variables: @@ -613,7 +613,9 @@ static VALUE rb_hash_sort(hash) VALUE hash; { - return rb_ary_sort_bang(rb_hash_to_a(hash)); + VALUE entries = rb_hash_to_a(hash); + rb_ary_sort_bang(entries); + return entries; } static int @@ -19,7 +19,7 @@ #include <ctype.h> #include <errno.h> -#if defined(MSDOS) || defined(__BOW__) || defined(__CYGWIN__) || defined(NT) || defined(__human68k__) || defined(__EMX__) +#if defined(MSDOS) || defined(__BOW__) || defined(__CYGWIN__) || defined(NT) || defined(__human68k__) || defined(__EMX__) || defined(__BEOS__) # define NO_SAFE_RENAME #endif @@ -58,6 +58,17 @@ static enum lex_state { } lex_state; static int cond_nest = 0; +static unsigned long cond_stack = 0; +#define COND_PUSH do {\ + cond_nest++;\ + cond_stack = (cond_stack<<1)|1;\ +} while(0) +#define COND_POP do {\ + cond_nest--;\ + cond_stack >>= 1;\ +} while (0) +#define IN_COND (cond_nest > 0 && (cond_stack&1)) + static int class_nest = 0; static int in_single = 0; static int compile_for_eval = 0; @@ -214,8 +225,6 @@ static void top_local_setup(); * precedence table */ -/*%nonassoc kDO -%nonassoc kDO2*/ %left kIF_MOD kUNLESS_MOD kWHILE_MOD kUNTIL_MOD kRESCUE_MOD %left kOR kAND %right kNOT @@ -859,15 +868,19 @@ aref_args : none { $$ = NEW_LIST($1); } + | args ',' command_call opt_nl + { + $$ = list_append($1, $3); + } | block_call opt_nl { $$ = NEW_LIST($1); } - | args opt_nl + | args ',' block_call opt_nl { - $$ = $1; + $$ = list_append($1, $3); } - | args ',' opt_nl + | args trailer { $$ = $1; } @@ -876,11 +889,7 @@ aref_args : none value_expr($4); $$ = arg_concat($1, $4); } - | assocs - { - $$ = NEW_LIST(NEW_HASH($1)); - } - | assocs ',' + | assocs trailer { $$ = NEW_LIST(NEW_HASH($1)); } @@ -896,6 +905,10 @@ opt_call_args : none { $$ = NEW_LIST($1); } + | args ',' block_call + { + $$ = list_append($1, $3); + } call_args : command_call { @@ -1152,7 +1165,7 @@ primary : literal $$ = NEW_UNLESS(cond($2), $4, $5); fixpos($$, $2); } - | kWHILE {cond_nest++;} expr do { cond_nest--; } + | kWHILE {COND_PUSH;} expr do {COND_POP;} compstmt kEND { @@ -1160,7 +1173,7 @@ primary : literal $$ = NEW_WHILE(cond($3), $6, 1); fixpos($$, $3); } - | kUNTIL {cond_nest++;} expr do { cond_nest--; } + | kUNTIL {COND_PUSH;} expr do {COND_POP;} compstmt kEND { @@ -1176,7 +1189,7 @@ primary : literal $$ = NEW_CASE($2, $3); fixpos($$, $2); } - | kFOR block_var kIN {cond_nest++;} expr do {cond_nest--;} + | kFOR block_var kIN {COND_PUSH;} expr do {COND_POP;} compstmt kEND { @@ -1442,8 +1455,7 @@ method_call : operation '(' opt_call_args close_paren close_paren : ')' { - if (cond_nest == 0) - lex_state = EXPR_PAREN; + if (!IN_COND) lex_state = EXPR_PAREN; } stmt_rhs : block_call @@ -1484,7 +1496,7 @@ rescue : kRESCUE exc_list exc_var then compstmt rescue { - if ($3 && $5) { + if ($3) { $3 = node_assign($3, NEW_GVAR(rb_intern("$!"))); $5 = block_append($3, $5); } @@ -1908,6 +1920,7 @@ yycompile(f, line) rb_gc(); ruby_in_compile = 0; cond_nest = 0; + cond_stack = 0; class_nest = 0; in_single = 0; cur_mid = 0; @@ -3198,7 +3211,13 @@ yylex() case ']': case '}': + lex_state = EXPR_END; + return c; + case ')': + if (cond_nest > 0) { + cond_stack >>= 1; + } lex_state = EXPR_END; return c; @@ -3264,6 +3283,9 @@ yylex() return '~'; case '(': + if (cond_nest > 0) { + cond_stack = (cond_stack<<1)|0; + } if (lex_state == EXPR_BEG || lex_state == EXPR_MID) { c = tLPAREN; } @@ -3513,7 +3535,9 @@ yylex() if (state == EXPR_FNAME) { yylval.id = rb_intern(kw->name); } - if (state == EXPR_PAREN && kw->id[0] == kDO) { + if (kw->id[0] == kDO && + (state == EXPR_PAREN || + (!IN_COND && state == EXPR_ARG))) { return kDO2; } return kw->id[state != EXPR_BEG]; @@ -1,6 +1,6 @@ -.\"Ruby is copyrighted by Yukihiro Matsumoto <matz@netlab.co.jp>. +.\"Ruby is copyrighted by Yukihiro Matsumoto <matz@zetabits.com>. .na -.TH RUBY 1 "ruby 1.5" "5/Nov/99" "Ruby Programmers Reference Guide" +.TH RUBY 1 "ruby 1.6" "2000-09-04" "Ruby Programmers Reference Guide" .SH NAME ruby - Interpreted object-oriented scripting language .SH SYNOPSIS @@ -288,4 +288,4 @@ state messages during compiling scripts. You don't have to specify this switch, unless you are going to debug the Ruby interpreter. .PP .SH AUTHOR - Ruby is designed and implemented by Yukihiro Matsumoto <matz@netlab.co.jp>. + Ruby is designed and implemented by Yukihiro Matsumoto <matz@zetabits.com>. diff --git a/win32/config.h.in b/win32/config.h.in index b56238e869..9a1c24cd15 100644 --- a/win32/config.h.in +++ b/win32/config.h.in @@ -38,6 +38,7 @@ #define RSHIFT(x,y) ((x)>>y) #define FILE_COUNT _cnt +#define DEFAULT_KCODE KCODE_NONE #define DLEXT ".so" #define DLEXT2 ".dll" #define RUBY_LIB "/lib/ruby/1.6" |