Граф коммитов

274 Коммитов

Автор SHA1 Сообщение Дата
matz 38bde8a9e0 * parse.y (open_args): warning message changed to "don't put space
before argument parentheses".

* io.c (argf_read): ARGF.read() should read all argument files.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-26 14:59:19 +00:00
matz f550e69efc * parse.y (arg_ambiguous): hopefully better message.
* lib/cgi.rb (CGI::QueryExtension::initialize_query): to_ary


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3711 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-22 08:18:19 +00:00
nobu 05ebd131cf * parse.y (block_append, value_expr0, assign_in_cond,
warn_unless_e_option, warning_unless_e_option, range_op,
  cond0): adjust line number in warning.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-21 08:44:38 +00:00
eban 534c5a2910 * parse.y (void_expr0): node might become NULL after calling remove_begin().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-19 18:17:59 +00:00
nobu ecdf51dfc4 * parse.y (cond0): warn only range literals whose both side are
literals.  [ruby-core:00964]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-17 05:22:40 +00:00
matz e74149056b * variable.c (rb_mod_name): always return empty string for
anonymous class/module.  (ruby-bugs-ja PR#424)

* config.sub: stop forcing addition of -gnu to -linux.

* variable.c (classname): refactoring.

* variable.c (rb_class_path): __tmp__classpath__ handling moved
  from classname().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-10 08:37:12 +00:00
matz 8e09f5b907 * variable.c (rb_obj_remove_instance_variable): better message.
[ruby-talk:68987]

* variable.c (rb_mod_remove_const): ditto.

* object.c (rb_obj_ivar_get): ditto.

* object.c (rb_obj_ivar_set): ditto.

* parse.y (yylex): ditto.

* eval.c (rb_mod_define_method): Allow UnboundMethod as
  parameter.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-09 15:06:57 +00:00
matz ed0b577108 * eval.c (Init_Proc): make Method and UnboundMethod independent.
They are like instance and its class. [ruby-core:00941]

* parse.y (yylex): disallow global variables like "$1ve".
  [ruby-core:00945]

* marshal.c (marshal_dump): Marshal.dump(0, false) should cause an
  error. (ruby-bugs-ja PR#421)

* regex.c (re_compile_pattern): warn if '-' is the edge of
  character range.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-08 05:40:29 +00:00
matz e9b5878c41 * eval.c (avalue_splat): new function to do unary * (splat)
operator.

* eval.c (avalue_to_svalue,svalue_to_avalue,svalue_to_mrhs): do
  not use implicit "to_ary" conversion.

* ext/curses/curses.c (GetWINDOW,GetMOUSE): add taint check.

* ext/curses/curses.c (curses_init_screen): ditto.

* ext/curses/curses.c (window_initialize): ditto.

* gc.c (os_each_obj): prohibit ObjectSpace#each_object in safe
  mode ($SAFE >= 4).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-26 07:01:14 +00:00
nobu 5aadcd9349 * parse.y (block_append): warn unused lteral.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-23 15:09:07 +00:00
nobu bf12ea0deb * parse.y (stmt, primary): get rid of SEGV at empty or invalid
condition.  (ruby-bugs-ja:PR#410)

* parse.y (cond_negative): negate condition node when NODE_NOT.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-20 07:03:22 +00:00
matz 9d77639f30 * parse.y (dsym): :"symbol string" style should not contain `\0'.
* process.c (proc_detach): new method Proc#detach(pid) which
  create background watcher thread to issue waitpid. [new]

* process.c (rb_detach_process): utility function to detach
  process from C code.

* ext/pty/pty.c (pty_finalize_syswait): terminate watcher thread,
  and detach child process (by creating new idle waitpid watcher
  thread).

* ext/pty/pty.c (pty_syswait): may lost signal stopped child.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-07 05:59:42 +00:00
matz 3738f871aa * parse.y (yycompile): zero clear ruby_eval_tree_begin if
compilation failed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3545 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-03 07:34:24 +00:00
matz 6a6d0ad220 * parse.y (arg): parse 'lhs = a rescue b' as 'lhs=(a rescue b)'.
* io.c (rb_io_fread): should not clearerr() if there's no filled
  buffer (i.e. rb_io_fread() returning zero).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-03 05:17:39 +00:00
matz 64db238388 * string.c (rb_str_cmp_m): return nil if str2 does not respond to
both "to_str" and "<=>".

* compar.c (cmp_gt): return nil if "<=>" returns nil (means
  incomparable).

* compar.c (cmp_ge): ditto.

* compar.c (cmp_lt): ditto.

* compar.c (cmp_between): use RTEST(), since cmp_lt and cmp_gt may
  return nil.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-02-20 20:40:20 +00:00
matz 2cd6d0f597 * eval.c (rb_thread_remove): thread may die in the process of
rb_thread_die().  this change was suggested by Rudi Cilibrasi
  <cilibrar@drachma.ugcs.caltech.edu>.

* eval.c (rb_thread_start_0): main thread swapped by fork() may
  terminate rb_thread_start_0() successfully. call ruby_stop(0);
  this change too was suggested by Rudi.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-02-20 10:09:31 +00:00
matz d88376b135 * parse.y (clhs): allow "Foo::Bar = x".
* parse.y (primary): "self[n]=x" can be legal even when "[]=" is
  private.  changes submitted in [ruby-talk:63982]

* parse.y (aryset): ditto.

* parse.y (attrset): "self.foo=x" can be legal even when "foo="
  is private.

* eval.c (is_defined): private "[]=" and "foo=" support.

* eval.c (rb_eval): ditto.

* eval.c (assign): ditto.

* eval.c (rb_eval): "foo=" should not always be public.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-02-20 03:35:44 +00:00
nobu 884efe7c5e * node.h (nd_cpath): nested class/module declaration.
[EXPREIMENTAL]

* eval.c (rb_eval): ditto.

* gc.c (rb_gc_mark_children): ditto.

* parse.y (cpath): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-02-19 09:27:49 +00:00
matz 937092b820 * range.c (range_step): step might be float 0 < x < 1.
* eval.c (rb_thread_schedule): pause if no runnable thread when
  there's only one thread.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-02-13 09:11:11 +00:00
matz bb7085084e * parse.y (yylex): no .<digit> floating literal anymore.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-02-05 08:11:27 +00:00
matz 74d5623029 * variable.c (rb_obj_classname): new function.
* string.c (rb_str_dup): should preserve original's class (but not
  hidden singleton class).

* string.c (rb_str_substr): ditto.

* parse.y: backout EXPR_CMDARG removal.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-31 04:00:17 +00:00
matz f758195486 * parse.y (yylex): remove EXPR_CMDARG according to the RHG book.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-31 03:15:33 +00:00
matz d35979cdfe * parse.y: tMINUS should have lower precedence than tPOW.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-24 09:18:04 +00:00
nobu 5799eb9d5e * parse.y (arg): missing arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-23 06:50:10 +00:00
matz affe49b23b * parse.y (arg): syntaxify tPOW negative number hack.
* 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
2003-01-23 03:39:25 +00:00
matz 1c770e7077 * parse.y (arg): put back old ** behavior for negative number
right operand.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-21 08:12:07 +00:00
michal 4e13d36561 -Wall cleanups (removed unused vars, no 'code has no effect' warnings)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-16 07:38:40 +00:00
michal 9df466b287 Updated Copyrights of Matz to 2003.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-16 07:34:03 +00:00
matz 6e1f15fc8b * parse.y (list_append): avoid O(n) search using node->nd_next->nd_end.
* parse.y (list_append): ditto.

* eval.c (rb_eval): NODE_ARRY nd_end adoption.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-14 07:45:19 +00:00
matz dadb16d894 * parse.y (stmt): NODE_NOT elimitation for if/unless/while/until node.
* parse.y (primary): ditto.

* eval.c (rb_eval): reduce recursive rb_eval() call by using sort
  of continuation passing style.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-09 06:16:43 +00:00
matz 6d481a4ae4 * hash.c (env_clear): new Hash compatible method.
* 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
2003-01-07 07:36:40 +00:00
knu 91b9d37a85 * st.h, st.c: Introduce new conventional typedef's, st_data_t,
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
2003-01-06 15:55:43 +00:00
matz 0082edfd3d * eval.c (massign): removed awkward conversion between yvalue,
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
2003-01-01 03:24:29 +00:00
nobu 559ca6258a * parse.y (parse_string): readjusted.
* parse.y (heredoc_identifier): readjusted.

* parse.y (here_document): make EOL codes of single-quoted
  here-documents consistent.

* parse.y (yylex): reduced unnecessary conditionals.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-30 22:56:21 +00:00
eban c2e3d3971b * parse.y (yylex): do not accept " __END__\n". ([ruby-dev:19245])
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-30 18:19:08 +00:00
eban 71da1d91b0 * parse.y (yylex): use strncmp instead of strcmp.
accept "__END__\r\n".  ([ruby-dev:19241])


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-30 12:17:41 +00:00
matz ee9d5d41d1 021224
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-24 08:53:56 +00:00
matz bc49bc7c6b * parse.y (do_block): split "do" block and tLBRACE_ARG block.
* 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
2002-12-20 08:33:17 +00:00
matz baa00aa250 * numeric.c (num_step): use DBL_EPSILON.
* 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
2002-12-19 09:20:20 +00:00
nobu 86db656415 * node.h (NODE_ATTRASGN): new node, assignment to attribute.
[ruby-core:00637].

* eval.c (is_defined, rb_eval): ditto.

* parse.y (attrset, node_assign): ditto.

* string.c (rb_str_substr): tail sharing.  [ruby-core:00650]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-17 10:34:30 +00:00
nobu 65f3eef1ee * parse.y (nextc): get rid of overrun. (pointed out by akr
[ruby-list:36773])


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-16 06:56:33 +00:00
nobu c476b6e05c * parse.y (dispose_string): dispose String object.
* parse.y (heredoc_restore, here_document): fix memory leak.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-15 02:48:40 +00:00
nobu a35365d96d * parse.y (expr): rescue clause was ignored.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-13 03:35:03 +00:00
nobu f87abaadcc * parse.y (dsym): garbage returned. (ruby-bugs-ja:PR#358)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-11-17 14:01:57 +00:00
nobu 604689628d * configure.in (LIBRUBY_A): append -static. [ruby-dev:18689]
* 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
2002-11-14 13:51:19 +00:00
matz a1c02ee495 * math.c (math_acos): check errno after operation. ditto for
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
2002-11-14 06:18:59 +00:00
matz a61871bea2 * parse.y: back out an unintended change in the syntax.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-11-07 23:01:45 +00:00
matz 54fdacb125 * class.c (rb_define_method): do not set NOEX_CFUNC if klass is
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
2002-11-07 19:18:16 +00:00
nobu d4f2f6a7f7 * eval.c (rb_eval): added NODE_DSYM, symbol literal with
interpolation.

* node.h: ditto.

* intern.h: prototypes; rb_is_junk_id, rb_str_dump, rb_str_intern

* object.c (sym_inspect): escape and quote for non-alphanumeric
  symbols.

* parse.y (dsym, tokadd_string, yylex): extended symbol literals.

* parse.y (rb_is_junk_id): added.

* string.c (rb_str_dump, rb_str_intern) : make extern.

* lib/mkmf.rb (create_makefile): deffile should be removed by
  distclean, not clean.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-23 10:17:30 +00:00
nobu 8232622071 * parse.y (value_expr0): allow return/break/next/redo/retry in rhs
of logical operator.  [ruby-dev:18534]

* parse.y (remove_begin): eliminate useless NODE_BEGIN.
  [ruby-dev:18535]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-18 14:13:41 +00:00