matz: 1.6.0 final (hopufully)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-09-12 05:37:38 +00:00
parent 9d823983dc
commit fbcc6dea0c
20 changed files with 135 additions and 78 deletions

View File

@ -1,12 +1,39 @@
Tue Sep 12 14:36:49 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* stable version 1.6.0 released.
Tue Sep 12 07:05:24 2000 Wakou Aoyama <wakou@fsinet.or.jp> Tue Sep 12 07:05:24 2000 Wakou Aoyama <wakou@fsinet.or.jp>
* lib/cgi.rb: version 2.0.0: require ruby1.5.4 or later. * lib/cgi.rb: version 2.0.0: require ruby1.5.4 or later.
* lib/net/telnet.rb: version 1.6.0 * lib/net/telnet.rb: version 1.6.0
Wed Sep 6 17:06:59 2000 Yukihiro Matsumoto <matz@ruby-lang.org> Tue Sep 12 03:26:07 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* stable version 1.6.0 released. * eval.c (massign): use to_ary to get an array if available.
* object.c (rb_Array): ditto.
Mon Sep 11 14:24:47 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* hash.c (ruby_setenv): should not free the element of
origenvironment.
* parse.y (command_call): kYIELD moved to this rule to allow
'a = yield b'. (ruby-bugs-ja:#PR15)
Mon Sep 11 01:27:54 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_yield_0): proc#call([]) should pass single value to
the block.
* eval.c (callargs): reduce array allocation.
* eval.c (massign): precise check for argument number.
Fri Sep 8 10:05:17 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* gc.c (STR_NO_ORIG): should be FL_USER2.
Thu Sep 7 14:17:51 2000 Yukihiro Matsumoto <matz@ruby-lang.org> Thu Sep 7 14:17:51 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
@ -163,7 +190,7 @@ Fri Aug 25 15:24:39 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* variable.c (rb_cvar_declare): ditto. * variable.c (rb_cvar_declare): ditto.
* variable.c (mod_av_set): second class variable assignment at the * variable.c (mod_av_set): second class variable assignment at the
toplevel shoule not give warning. toplevel should not give warning.
Fri Aug 25 01:18:36 2000 Yukihiro Matsumoto <matz@ruby-lang.org> Fri Aug 25 01:18:36 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
@ -720,7 +747,7 @@ Sat Jul 1 15:22:35 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
Sat Jul 1 15:22:35 2000 Yukihiro Matsumoto <matz@netlab.co.jp> Sat Jul 1 15:22:35 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* eval.c (rb_eval): the value from RTEST() is not valid Ruby * eval.c (rb_eval): the value from RTEST() is not valid Ruby
objct. result shoule be either true or false. objct. result should be either true or false.
Sat Jul 1 09:30:06 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp> Sat Jul 1 09:30:06 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>

View File

@ -355,7 +355,10 @@ rb_ary_unshift_m(argc, argv, ary)
VALUE *argv; VALUE *argv;
VALUE ary; VALUE ary;
{ {
if (argc > 0) { if (argc == 0) {
rb_raise(rb_eArgError, "wrong # of arguments(at least 1)");
}
if (argc > 1) {
long len = RARRAY(ary)->len; long len = RARRAY(ary)->len;
/* make rooms by setting the last item */ /* make rooms by setting the last item */
@ -363,7 +366,6 @@ rb_ary_unshift_m(argc, argv, ary)
/* sliding items */ /* sliding items */
MEMMOVE(RARRAY(ary)->ptr + argc, RARRAY(ary)->ptr, VALUE, len); MEMMOVE(RARRAY(ary)->ptr + argc, RARRAY(ary)->ptr, VALUE, len);
MEMCPY(RARRAY(ary)->ptr, argv, VALUE, argc); MEMCPY(RARRAY(ary)->ptr, argv, VALUE, argc);
} }
return ary; return ary;

View File

@ -33,14 +33,6 @@ cmp_failed()
return Qfalse; return Qfalse;
} }
static VALUE
cmp_eq2(a)
VALUE *a;
{
return rb_rescue2(cmp_eq, (VALUE)a, cmp_failed, 0,
rb_eStandardError, rb_eNameError, 0);
}
static VALUE static VALUE
cmp_equal(x, y) cmp_equal(x, y)
VALUE x, y; VALUE x, y;
@ -50,7 +42,8 @@ cmp_equal(x, y)
if (x == y) return Qtrue; if (x == y) return Qtrue;
a[0] = x; a[1] = y; a[0] = x; a[1] = y;
return rb_rescue2(cmp_eq2, (VALUE)a, cmp_failed, 0, rb_eScriptError, 0); return rb_rescue2(cmp_eq, (VALUE)a, cmp_failed, 0,
rb_eStandardError, rb_eNameError, 0);
} }
static VALUE static VALUE

View File

@ -945,7 +945,7 @@ AC_DEFINE_UNQUOTED(RUBY_ARCHLIB, "${RUBY_LIB_PATH}/${arch}")
AC_DEFINE_UNQUOTED(RUBY_SITE_ARCHLIB, "${RUBY_SITE_LIB_PATH2}/${arch}") AC_DEFINE_UNQUOTED(RUBY_SITE_ARCHLIB, "${RUBY_SITE_LIB_PATH2}/${arch}")
AC_ARG_WITH(search-path, AC_ARG_WITH(search-path,
[--with-search-path specify the additional search path], [--with-search-path=DIR specify the additional search path],
[search_path=$withval]) [search_path=$withval])
if test "$search_path" != ""; then if test "$search_path" != ""; then
AC_DEFINE_UNQUOTED(RUBY_SEARCH_PATH,"$search_path") AC_DEFINE_UNQUOTED(RUBY_SEARCH_PATH,"$search_path")

26
eval.c
View File

@ -439,7 +439,8 @@ rb_method_boundp(klass, id, ex)
return Qfalse; return Qfalse;
} }
static ID init, eqq, each, aref, aset, match, missing, added, singleton_added; static ID init, eqq, each, aref, aset, match, to_ary;
static ID missing, added, singleton_added;
static ID __id__, __send__; static ID __id__, __send__;
void void
@ -3425,9 +3426,14 @@ rb_yield_0(val, self, klass, acheck)
if ((state = EXEC_TAG()) == 0) { if ((state = EXEC_TAG()) == 0) {
if (nd_type(block->var) == NODE_MASGN) if (nd_type(block->var) == NODE_MASGN)
massign(self, block->var, val, acheck); massign(self, block->var, val, acheck);
else else {
if (val != Qundef &&
TYPE(val) == T_ARRAY && RARRAY(val)->len == 1) {
val = RARRAY(val)->ptr[0];
}
assign(self, block->var, val, acheck); assign(self, block->var, val, acheck);
} }
}
POP_TAG(); POP_TAG();
if (state) goto pop_state; if (state) goto pop_state;
} }
@ -3524,8 +3530,18 @@ massign(self, node, val, check)
val = rb_ary_new2(0); val = rb_ary_new2(0);
} }
else if (TYPE(val) != T_ARRAY) { else if (TYPE(val) != T_ARRAY) {
if (rb_respond_to(val, to_ary)) {
VALUE ary = rb_funcall(val, to_ary, 0);
if (TYPE(ary) != T_ARRAY) {
rb_raise(rb_eTypeError, "%s#to_ary should return Array",
rb_class2name(CLASS_OF(val)));
}
val = ary;
}
else {
val = rb_ary_new3(1, val); val = rb_ary_new3(1, val);
} }
}
len = RARRAY(val)->len; len = RARRAY(val)->len;
list = node->nd_head; list = node->nd_head;
for (i=0; list && i<len; i++) { for (i=0; list && i<len; i++) {
@ -3546,6 +3562,9 @@ massign(self, node, val, check)
assign(self, node->nd_args, rb_ary_new2(0), check); assign(self, node->nd_args, rb_ary_new2(0), check);
} }
} }
else if (check && i < len) {
goto arg_error;
}
while (list) { while (list) {
i++; i++;
@ -5567,6 +5586,7 @@ Init_eval()
aref = rb_intern("[]"); aref = rb_intern("[]");
aset = rb_intern("[]="); aset = rb_intern("[]=");
match = rb_intern("=~"); match = rb_intern("=~");
to_ary = rb_intern("to_ary");
missing = rb_intern("method_missing"); missing = rb_intern("method_missing");
added = rb_intern("method_added"); added = rb_intern("method_added");
singleton_added = rb_intern("singleton_method_added"); singleton_added = rb_intern("singleton_method_added");
@ -5961,8 +5981,6 @@ callargs(args)
case 0: case 0:
return Qundef; return Qundef;
break; break;
case 1:
return RARRAY(args)->ptr[0];
default: default:
return args; return args;
} }

View File

@ -15,6 +15,9 @@
#ifdef HAVE_CDEFS_H #ifdef HAVE_CDEFS_H
# include <cdefs.h> # include <cdefs.h>
#endif #endif
#ifdef HAVE_SYS_CDEFS_H
# include <sys/cdefs.h>
#endif
#include <ndbm.h> #include <ndbm.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>

View File

@ -6,6 +6,7 @@ if have_library("gdbm", "dbm_open")
end end
gdbm or have_library("db", "dbm_open") or have_library("dbm", "dbm_open") gdbm or have_library("db", "dbm_open") or have_library("dbm", "dbm_open")
have_header("cdefs.h") have_header("cdefs.h")
have_header("sys/cdefs.h")
if have_header("ndbm.h") and have_func("dbm_open") if have_header("ndbm.h") and have_func("dbm_open")
have_func("dbm_clearerr") unless gdbm have_func("dbm_clearerr") unless gdbm
create_makefile("dbm") create_makefile("dbm")

2
gc.c
View File

@ -751,7 +751,7 @@ obj_free(obj)
} }
break; break;
case T_STRING: case T_STRING:
#define STR_NO_ORIG FL_USER3 /* copied from string.c */ #define STR_NO_ORIG FL_USER2 /* copied from string.c */
if (!RANY(obj)->as.string.orig || FL_TEST(obj, STR_NO_ORIG)) if (!RANY(obj)->as.string.orig || FL_TEST(obj, STR_NO_ORIG))
free(RANY(obj)->as.string.ptr); free(RANY(obj)->as.string.ptr);
break; break;

2
hash.c
View File

@ -1055,6 +1055,7 @@ ruby_setenv(name, value)
environ = tmpenv; /* tell exec where it is now */ environ = tmpenv; /* tell exec where it is now */
} }
if (!value) { if (!value) {
if (environ[i] != origenviron[i])
free(environ[i]); free(environ[i]);
while (environ[i]) { while (environ[i]) {
environ[i] = environ[i+1]; environ[i] = environ[i+1];
@ -1067,6 +1068,7 @@ ruby_setenv(name, value)
environ[i+1] = 0; /* make sure it's null terminated */ environ[i+1] = 0; /* make sure it's null terminated */
} }
else { else {
if (environ[i] != origenviron[i])
free(environ[i]); free(environ[i]);
} }
environ[i] = ALLOC_N(char, strlen(name) + strlen(value) + 2); environ[i] = ALLOC_N(char, strlen(name) + strlen(value) + 2);

View File

@ -276,7 +276,7 @@ module Net
end end
def retrlines(cmd, callback = nil) def retrlines(cmd, callback = nil)
if iterator? if block_given?
callback = Proc.new callback = Proc.new
elsif not callback.is_a?(Proc) elsif not callback.is_a?(Proc)
callback = Proc.new {|line| print line, "\n"} callback = Proc.new {|line| print line, "\n"}
@ -300,7 +300,7 @@ module Net
end end
def storbinary(cmd, file, blocksize, rest_offset = nil, callback = nil) def storbinary(cmd, file, blocksize, rest_offset = nil, callback = nil)
if iterator? if block_given?
callback = Proc.new callback = Proc.new
end end
use_callback = callback.is_a?(Proc) use_callback = callback.is_a?(Proc)
@ -319,7 +319,7 @@ module Net
end end
def storlines(cmd, file, callback = nil) def storlines(cmd, file, callback = nil)
if iterator? if block_given?
callback = Proc.new callback = Proc.new
end end
use_callback = callback.is_a?(Proc) use_callback = callback.is_a?(Proc)
@ -342,7 +342,7 @@ module Net
def getbinaryfile(remotefile, localfile, def getbinaryfile(remotefile, localfile,
blocksize = DEFAULT_BLOCKSIZE, callback = nil) blocksize = DEFAULT_BLOCKSIZE, callback = nil)
if iterator? if block_given?
callback = Proc.new callback = Proc.new
end end
use_callback = callback.is_a?(Proc) use_callback = callback.is_a?(Proc)
@ -365,7 +365,7 @@ module Net
end end
def gettextfile(remotefile, localfile, callback = nil) def gettextfile(remotefile, localfile, callback = nil)
if iterator? if block_given?
callback = Proc.new callback = Proc.new
end end
use_callback = callback.is_a?(Proc) use_callback = callback.is_a?(Proc)
@ -383,7 +383,7 @@ module Net
def putbinaryfile(localfile, remotefile, def putbinaryfile(localfile, remotefile,
blocksize = DEFAULT_BLOCKSIZE, callback = nil) blocksize = DEFAULT_BLOCKSIZE, callback = nil)
if iterator? if block_given?
callback = Proc.new callback = Proc.new
end end
use_callback = callback.is_a?(Proc) use_callback = callback.is_a?(Proc)
@ -404,7 +404,7 @@ module Net
end end
def puttextfile(localfile, remotefile, callback = nil) def puttextfile(localfile, remotefile, callback = nil)
if iterator? if block_given?
callback = Proc.new callback = Proc.new
end end
use_callback = callback.is_a?(Proc) use_callback = callback.is_a?(Proc)

View File

@ -33,7 +33,7 @@ the terms of the Ruby Distribute License.
: start {|http| .... } : start {|http| .... }
creates a new Net::HTTP object and starts HTTP session. creates a new Net::HTTP object and starts HTTP session.
When this method is called as iterator, gives HTTP object to block When this method is called with a block, gives HTTP object to block
and close HTTP session after block call finished. and close HTTP session after block call finished.
: get( path, header = nil, dest = '' ) : get( path, header = nil, dest = '' )
@ -46,7 +46,7 @@ the terms of the Ruby Distribute License.
# example # example
response, body = http.get( '/index.html' ) response, body = http.get( '/index.html' )
If called as iterator, give a part String of entity body. If called with a block, give a part String of entity body.
Note: Note:
If status is not 2xx(success), ProtocolError exception is If status is not 2xx(success), ProtocolError exception is
@ -81,7 +81,7 @@ the terms of the Ruby Distribute License.
"header" must be a Hash like { 'Accept' => '*/*', ... }. "header" must be a Hash like { 'Accept' => '*/*', ... }.
This method returns Net::HTTPResponse object and "dest". This method returns Net::HTTPResponse object and "dest".
If called as iterator, gives a part String of entity body. If called with a block, gives a part String of entity body.
: get2( path, header = nil ) {|adapter| .... } : get2( path, header = nil ) {|adapter| .... }
send GET request for "path". send GET request for "path".
@ -165,7 +165,7 @@ All "key" is case-insensitive.
entity body. A body is written to "dest" using "<<" method. entity body. A body is written to "dest" using "<<" method.
: body {|str| ... } : body {|str| ... }
get entity body by using iterator. get entity body by using block.
If this method is called twice, block is not called and If this method is called twice, block is not called and
returns first "dest". returns first "dest".
@ -350,11 +350,13 @@ module Net
@socket.reopen @socket.reopen
end end
resp = yield( u_header ) yield( u_header )
if ublock then if ublock then
adapter = HTTPReadAdapter.new( @command ) adapter = HTTPReadAdapter.new( @command )
ublock.call adapter ublock.call adapter
resp = adapter.off resp = adapter.off
else
resp = @command.get_response
end end
unless keep_alive? u_header, resp then unless keep_alive? u_header, resp then

View File

@ -31,7 +31,7 @@ Net::Protocol
: start( account, password ) {|pop| .... } : start( account, password ) {|pop| .... }
starts POP3 session. starts POP3 session.
When called as iterator, give a POP3 object to block and When called with a block, give a POP3 object to block and
close session after block call is finished. close session after block call is finished.
: each {|popmail| .... } : each {|popmail| .... }
@ -80,7 +80,7 @@ Object
end end
: all {|str| .... } : all {|str| .... }
You can use all/pop/mail as the iterator. You can use all/pop/mail with a block.
argument 'str' is a read string (a part of mail). argument 'str' is a read string (a part of mail).
# usage example # usage example
@ -180,7 +180,7 @@ module Net
end end
def all( dest = '' ) def all( dest = '' )
if iterator? then if block_given? then
dest = NetPrivate::ReadAdapter.new( Proc.new ) dest = NetPrivate::ReadAdapter.new( Proc.new )
end end
@command.retr( @num, dest ) @command.retr( @num, dest )

View File

@ -46,7 +46,7 @@ Object
'*args' are specified in subclasses. '*args' are specified in subclasses.
When is called as iterator, gives Protocol object to block and When is called with a block, gives Protocol object to block and
close session when block finished. close session when block finished.
: finish : finish
@ -73,7 +73,7 @@ module Net
def start( address = 'localhost', port = nil, *args ) def start( address = 'localhost', port = nil, *args )
instance = new( address, port ) instance = new( address, port )
if iterator? then if block_given? then
instance.start( *args ) { yield instance } instance.start( *args ) { yield instance }
else else
instance.start( *args ) instance.start( *args )
@ -167,9 +167,9 @@ module Net
connect connect
do_start( *args ) do_start( *args )
@active = true @active = true
yield self if iterator? yield self if block_given?
ensure ensure
finish if iterator? finish if block_given?
end end
end end
@ -561,7 +561,7 @@ module Net
while (str = readuntil( "\r\n" )) != ".\r\n" do while (str = readuntil( "\r\n" )) != ".\r\n" do
str.chop! str.chop!
arr.push str arr.push str
yield str if iterator? yield str if block_given?
end end
@pipe << "read #{arr.size} lines\n" if pipeon @pipe << "read #{arr.size} lines\n" if pipeon

View File

@ -33,7 +33,7 @@ Net::Protocol
opens TCP connection and starts SMTP session. opens TCP connection and starts SMTP session.
If protocol had been started, do nothing and return false. If protocol had been started, do nothing and return false.
When this methods is called as iterator, give a SMTP object to block and When this methods is called with a block, give a SMTP object to block and
close session after block call finished. close session after block call finished.
If account and password are given, is trying to get authentication If account and password are given, is trying to get authentication
@ -42,7 +42,7 @@ Net::Protocol
: send_mail( mailsrc, from_addr, *to_addrs ) : send_mail( mailsrc, from_addr, *to_addrs )
: sendmail( mailsrc, from_addr, *to_addrs ) : sendmail( mailsrc, from_addr, *to_addrs )
This method sends 'mailsrc' as mail. SMTP read strings This method sends 'mailsrc' as mail. SMTP read strings
from 'mailsrc' by calling 'each' iterator, and convert them from 'mailsrc' by calling 'each' method, and convert them
into "\r\n" terminated string when write. into "\r\n" terminated string when write.
from_addr must be String. from_addr must be String.
@ -62,7 +62,7 @@ Net::Protocol
: ready( from_addr, to_addrs ) {|adapter| .... } : ready( from_addr, to_addrs ) {|adapter| .... }
This method stands by the SMTP object for sending mail. This method stands by the SMTP object for sending mail.
In the block of this iterator, you can call ONLY 'write' method In the block of this method, you can call ONLY 'write' method
for 'adapter'. for 'adapter'.
# usage example # usage example

View File

@ -312,7 +312,7 @@ module Net
end end
else else
message = "Trying " + @options["Host"] + "...\n" message = "Trying " + @options["Host"] + "...\n"
yield(message) if iterator? yield(message) if block_given?
@log.write(message) if @options.has_key?("Output_log") @log.write(message) if @options.has_key?("Output_log")
@dumplog.log_dump('#', message) if @options.has_key?("Dump_log") @dumplog.log_dump('#', message) if @options.has_key?("Dump_log")
@ -335,7 +335,7 @@ module Net
@sock.binmode @sock.binmode
message = "Connected to " + @options["Host"] + ".\n" message = "Connected to " + @options["Host"] + ".\n"
yield(message) if iterator? yield(message) if block_given?
@log.write(message) if @options.has_key?("Output_log") @log.write(message) if @options.has_key?("Output_log")
@dumplog.log_dump('#', message) if @options.has_key?("Dump_log") @dumplog.log_dump('#', message) if @options.has_key?("Dump_log")
end end
@ -489,11 +489,11 @@ module Net
end end
@log.print(buf) if @options.has_key?("Output_log") @log.print(buf) if @options.has_key?("Output_log")
line.concat(buf) line.concat(buf)
yield buf if iterator? yield buf if block_given?
rescue EOFError # End of file reached rescue EOFError # End of file reached
if line == '' if line == ''
line = nil line = nil
yield nil if iterator? yield nil if block_given?
end end
break break
end end
@ -554,7 +554,7 @@ module Net
end end
self.puts(string) self.puts(string)
if iterator? if block_given?
waitfor({"Prompt" => match, "Timeout" => time_out}){|c| yield c } waitfor({"Prompt" => match, "Timeout" => time_out}){|c| yield c }
else else
waitfor({"Prompt" => match, "Timeout" => time_out}) waitfor({"Prompt" => match, "Timeout" => time_out})
@ -569,7 +569,7 @@ module Net
username = options username = options
end end
if iterator? if block_given?
line = waitfor(/login[: ]*\z/n){|c| yield c } line = waitfor(/login[: ]*\z/n){|c| yield c }
if password if password
line.concat( cmd({"String" => username, line.concat( cmd({"String" => username,
@ -706,7 +706,7 @@ end
* 1999/04/11 - wakou * 1999/04/11 - wakou
* version 0.163 * version 0.163
* STDOUT.write(message) --> yield(message) if iterator? * STDOUT.write(message) --> yield(message) if block_given?
* 1999/03/17 - wakou * 1999/03/17 - wakou
* version 0.162 * version 0.162

View File

@ -544,7 +544,8 @@ The variable ruby-indent-level controls the amount of indentation.
(or (not (eq ?| (char-after (point)))) (or (not (eq ?| (char-after (point))))
(save-excursion (save-excursion
(or (eolp) (forward-char -1)) (or (eolp) (forward-char -1))
(and (search-backward "|") (cond
((search-backward "|" nil t)
(skip-chars-backward " \t\n") (skip-chars-backward " \t\n")
(and (not (eolp)) (and (not (eolp))
(progn (progn
@ -552,7 +553,8 @@ The variable ruby-indent-level controls the amount of indentation.
(not (looking-at "\\{"))) (not (looking-at "\\{")))
(progn (progn
(forward-word -1) (forward-word -1)
(not (looking-at "do\\>[^_]"))))))))) (not (looking-at "do\\>[^_]")))))
(t t))))))
(setq indent (+ indent ruby-indent-level))))))) (setq indent (+ indent ruby-indent-level)))))))
indent))) indent)))

View File

@ -990,8 +990,16 @@ VALUE
rb_Array(val) rb_Array(val)
VALUE val; VALUE val;
{ {
ID to_ary;
if (TYPE(val) == T_ARRAY) return val; if (TYPE(val) == T_ARRAY) return val;
to_ary = rb_intern("to_ary");
if (rb_respond_to(val, to_ary)) {
val = rb_funcall(val, to_ary, 0);
}
else {
val = rb_funcall(val, rb_intern("to_a"), 0); val = rb_funcall(val, rb_intern("to_a"), 0);
}
if (TYPE(val) != T_ARRAY) { if (TYPE(val) != T_ARRAY) {
rb_raise(rb_eTypeError, "`to_a' did not return Array"); rb_raise(rb_eTypeError, "`to_a' did not return Array");
} }

17
parse.y
View File

@ -190,7 +190,7 @@ static void top_local_setup();
%type <node> aref_args opt_block_arg block_arg stmt_rhs %type <node> aref_args opt_block_arg block_arg stmt_rhs
%type <node> mrhs superclass generic_call block_call var_ref %type <node> mrhs superclass generic_call block_call var_ref
%type <node> f_arglist f_args f_optarg f_opt f_block_arg opt_f_block_arg %type <node> f_arglist f_args f_optarg f_opt f_block_arg opt_f_block_arg
%type <node> array assoc_list assocs assoc undef_list backref %type <node> assoc_list assocs assoc undef_list backref
%type <node> block_var opt_block_var brace_block do_block lhs none %type <node> block_var opt_block_var brace_block do_block lhs none
%type <node> mlhs mlhs_head mlhs_basic mlhs_entry mlhs_item mlhs_node %type <node> mlhs mlhs_head mlhs_basic mlhs_entry mlhs_item mlhs_node
%type <id> fitem variable sym symbol operation operation2 operation3 %type <id> fitem variable sym symbol operation operation2 operation3
@ -421,10 +421,6 @@ expr : mlhs '=' mrhs
yyerror("return appeared outside of method"); yyerror("return appeared outside of method");
$$ = NEW_RETURN($2); $$ = NEW_RETURN($2);
} }
| kYIELD ret_args
{
$$ = NEW_YIELD($2);
}
| command_call | command_call
| expr kAND expr | expr kAND expr
{ {
@ -469,6 +465,12 @@ command_call : operation call_args
$$ = new_super($2); $$ = new_super($2);
fixpos($$, $2); fixpos($$, $2);
} }
| kYIELD ret_args
{
$$ = NEW_YIELD($2);
fixpos($$, $2);
}
mlhs : mlhs_basic mlhs : mlhs_basic
| tLPAREN mlhs_entry ')' | tLPAREN mlhs_entry ')'
@ -1025,9 +1027,6 @@ ret_args : call_args
} }
} }
array : none
| args trailer
primary : literal primary : literal
{ {
$$ = NEW_LIT($1); $$ = NEW_LIT($1);
@ -1083,7 +1082,7 @@ primary : literal
value_expr($1); value_expr($1);
$$ = NEW_CALL($1, tAREF, $3); $$ = NEW_CALL($1, tAREF, $3);
} }
| tLBRACK array ']' | tLBRACK aref_args ']'
{ {
if ($2 == 0) if ($2 == 0)
$$ = NEW_ZARRAY(); /* zero length array*/ $$ = NEW_ZARRAY(); /* zero length array*/

4
ruby.1
View File

@ -1,6 +1,6 @@
.\"Ruby is copyrighted by Yukihiro Matsumoto <matz@zetabits.com>. .\"Ruby is copyrighted by Yukihiro Matsumoto <matz@zetabits.com>.
.na .na
.TH RUBY 1 "ruby 1.6" "2000-09-04" "Ruby Programmers Reference Guide" .TH RUBY 1 "ruby 1.6" "2000-09-11" "Ruby Programmers Reference Guide"
.SH NAME .SH NAME
ruby - Interpreted object-oriented scripting language ruby - Interpreted object-oriented scripting language
.SH SYNOPSIS .SH SYNOPSIS
@ -195,7 +195,7 @@ used to tell Ruby where to load the library scripts. Directory path
will be added to the load-path variable ($:'). will be added to the load-path variable ($:').
.TP .TP
.B -Kkcode .B -Kkcode
specifies KANJI (Japanese) code-set. specifies KANJI (Japanese) encoding.
.TP .TP
.B -l .B -l
enables automatic line-ending processing, which means to firstly set enables automatic line-ending processing, which means to firstly set

View File

@ -1,4 +1,4 @@
#define RUBY_VERSION "1.6.0" #define RUBY_VERSION "1.6.0"
#define RUBY_RELEASE_DATE "2000-09-07" #define RUBY_RELEASE_DATE "2000-09-12"
#define RUBY_VERSION_CODE 160 #define RUBY_VERSION_CODE 160
#define RUBY_RELEASE_CODE 20000907 #define RUBY_RELEASE_CODE 20000912