* parse.y (negate_lit): new function to negate literal numeric
values in compile time.
* regex.c (re_match_exec): charset info may be stored in MBC
region when $KCODE != NONE.
* error.c (set_syserr): should preserve duplicated error names.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c (env_shift): ditto.
* hash.c (env_invert): ditto.
* hash.c (env_replace): ditto.
* hash.c (env_update): ditto.
* array.c (rb_ary_join): dispatch based on "to_str".
* array.c (rb_ary_times): ditto.
* array.c (rb_ary_equal): ditto.
* process.c (rb_f_exec): dispatch based on "to_ary".
* eval.c (umethod_bind): exact class match is not required. relax
the restriction to subclasses.
* eval.c (rb_eval): call "inherited" before executing class body.
* class.c (rb_define_class): call "inherited" after defining the
constant.
* class.c (rb_define_class_under): ditto.
* eval.c (massign): expand first element if RHS is an array and
its size is 1, and LHS has concrete assignment target (i.e. LHS
has target(s) other than *var).
* eval.c (massign): avoid unnecessary avalue/svalue conversion.
* eval.c (rb_yield_0): ditto
* array.c (rb_ary_update): do not allocate unused array if rpl is
nil (i.e. merely removing elements).
* io.c (io_read): should resize supplied string if it's shorter
than expected.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
st_compare_func_t, st_hash_func_t and st_each_func_t.
* st.h, st.c: Do explicit function declarations and do not rely on
implicit declarations. On such platforms as IA64, int argument
values are NOT automatically promoted to long (64bit) values, so
explicit declarations are mandatory for those functions that
take long values or pointers. This fixes miniruby's coredump on
FreeBSD/IA64.
* class.c, eval.c, gc.c, hash.c, marshal.c, parse.y, variable.c:
Add proper casts to avoid warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
mvalue, etc.
* eval.c (rb_yield_0): new parameter added to tell whether val is
an array value or not.
* parse.y (yield_args): restructuring: new nodes: NODE_RESTARY2,
NODE_SVALUE; removed node: NODE_RESTARGS.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (cmd_brace_block): new tLBRACE_ARG block rule
* parse.y (command): can take optional cmd_brace_block; use %prec
to resolve shift/reduce conflict. (ruby-bugs-ja PR#372)
* eval.c (ruby_finalize): trace_func should be cleared here (after
executing exit procs and finalizers).
* eval.c (rb_define_alloc_func): new allocation framework, based
on Nobu's work [ruby-dev:19116]. "allocate" method is no longer
used for object allocation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c (rb_check_array_type): new function: return an array
(convert if possible), or nil.
* string.c (rb_check_string_type): new function: return a string
(convert if possible), or nil.
* numeric.c (rb_dbl_cmp): returns nil if values are not
comparable.
* numeric.c (fix_cmp,flo_cmp): use rb_num_coerce_cmp()
* bignum.c (rb_big_cmp): ditto.
* numeric.c (rb_num_coerce_cmp): new coercing function for "<=>",
which does not raise TypeError.
* numeric.c (do_coerce): can be supress exception now.
* object.c (rb_mod_cmp): should return nil for non class/module
objects.
* re.c (rb_reg_eqq): return false if the argument is not a
string. now returns boolean value.
* class.c (rb_include_module): argument should be T_MODULE, not
T_class, nor T_ICLASS.
* eval.c (is_defined): "defined?" should return "assignment" for
attribute assignment (e.g. a.foo=b) and indexed assignment
(e.g. a[2] = 44).
* parse.y (aryset): use NODE_ATTRASGN.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* configure.in (LIBRUBYARG_STATIC, LIBRUBYARG_SHARED): linker
argument to link static/shared library respectively.
* Makefile.in (LIBRUBYARG_STATIC, LIBRUBYARG_SHARED): added.
* bcc32/Makefile.sub, win32/Makefile.sub: ditto.
* instruby.rb (LIBRUBY_A): install to libdir.
* lib/mkmf.rb (link_command): link static library of ruby, or
try_run fails unless LIBRUBY_SO is installed. [ruby-dev:18646]
* eval.c (call_trace_func): toplevel caller was missing.
[ruby-dev:18754]
* eval.c (proc_to_s): adjust created line number.
* parse.y (primary, do_block, brace_block): adjust line number of
block to beginning line, instead of the first statement inside
the block.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
asin, acosh, atanh, log, log10 and sqrt.
* eval.c (rb_add_method): initialize should always be private.
* parse.y (expr): add rescue modifier rule.
* parse.y (command_call): return, break and next with argument is
now part of this rule.
* parse.y (yylex): "a" in "a /5" should be considered as a local
variable. [experimental]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
really a module, whose methods must be safe for reciever's type.
* eval.c (rb_eval): nosuper should not be inherited unless the
overwritten method is an undef placeholder.
* parse.y (primary): allow 'when'-less case statement; persuaded
by Sean Chittenden.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
execution of the class body.
* parse.y (primary): remove "return outside of method" check at
compile time.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval.c (ruby_run): should set toplevel visibility again here.
* eval.c (rb_eval): should not rely on ruby_class == rb_cObject
check. Besides allow implicit publicity for attribute set
methods.
* parse.y (primary): need not to check class_nest, just set
whether method is an attrset or not.
* string.c (rb_str_each_line): p might be at the top of the
string.
* class.c (rb_make_metaclass): class of metaclass should be
metaclass of superclass, unless class itself is a metaclass;
class of metaclass of metaclass should point back to self.
eh, confusing, isn't it.
* class.c (rb_singleton_class): check if its class is singleton
AND attached to self.
* eval.c (rb_eval): should define class/module under ruby_cbase.
* eval.c (rb_eval): should set class/module path based on
ruby_cbase, not ruby_class.
* eval.c (module_setup): use ruby_cbase instead of ruby_class.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
backtrace cannot be genetated.
* intern.h (ruby_yyparse): rather than yyparse().
* parse.y (yylex): nextc() returns -1 at end of input, not 0.
* parse.y (newline_node): reduce deplicated newline node.
* parse.y (literal_concat): get rid of warning.
* parse.y (new_evstr): fixed junk code.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
to obj.meta.meta.super (ruby-bugs-ja:PR#324).
* parse.y (yylex): the warning message "invalid
character syntax" was never issued.
* marshal.c (r_bytes): do not use alloca (ruby-bugs:PR#382).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enum.c (enum_find): do not use rb_eval_cmd(); should not accept
a string for if_none.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval.c (jump_tag_but_local_jump): preserve retval in
LocalJumpError exceptions.
* parse.y (command): no more check for "super outside of method".
* eval.c (rb_mod_define_method): should set last_class and
last_func in the block->frame.
* eval.c (error_handle): should handle TAG_THROW as well.
* parse.y (yylex): new decimal notation '0d4567'.
* parse.y (yylex): new octal notation '0o777'.
* parse.y (string_content): every string_content node should
return string only. use NODE_EVSTR to coercing.
* eval.c (rb_eval): NODE_EVSTR support.
* re.c (rb_reg_quote): avoid unnecessary string allocation.
* string.c (get_pat): quote metachracters before compiling a
string into a regex.
* string.c (rb_str_split_m): special treatment of strings of size
1, but AWK emulation. now uses get_pat().
* string.c (rb_str_match_m): quote metacharacters.
* string.c (rb_str_match2): ditto.
* ext/socket/socket.c (sock_addrinfo): make all 3 versions of
getaddrinfo happy. [ruby-core:00184]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e