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

212 Коммитов

Автор SHA1 Сообщение Дата
aamine 4ebc9ec226 * parse.y: should not use non-NODE VALUEs in the semantic stack.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-09-06 01:24:41 +00:00
aamine 7ac3b71611 * gc.c (gc_sweep): should mark parser.
* parse.y (rb_gc_mark_parser): new function.
* intern.h (rb_gc_mark_parser): added.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-09-05 20:00:52 +00:00
matz 64901cd69b * class.c (rb_make_metaclass): obj.meta.super.meta should be equal
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
2002-09-04 06:37:39 +00:00
aamine 10c4364287 * gc.c (gc_sweep): does reclaim nodes in also compile time, if we can.
* ruby.c (load_file): omit GC if we can.
* parse.y (ruby_parser_stack_on_heap): new function.
* intern.h (ruby_parser_stack_on_heap): added.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-09-02 12:19:30 +00:00
michal ffc13a6525 *.c: Int vs Long cleanup
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-08-21 15:47:54 +00:00
nobu 92ca6c7773 * eval.c (ruby_current_node) : added to set sourceline on demand.
* eval.c (error_pos, error_print, rb_longjmp, assign): set source
  file/line.

* eval.c (rb_eval): store current node instead of file/line, and
  preserve it at return.

* eval.c (module_setup): ditto.

* eval.c (struct thread): store node instead of file/line.

* eval.c (rb_thread_raise): ditto.

* intern.h (ruby_current_node): added.

* intern.h (ruby_set_current_source): added.

* parse.y (stmt, arg): not fix position of assignment.

* parse.y (node_assign): ditto.

* parse.y (yycompile): clear current node.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-08-15 11:49:40 +00:00
matz 5e6634ce67 * parse.y (tokadd_string): ignore backslashed spaces in %w.
* 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
2002-08-01 09:42:38 +00:00
matz 7194b66fb2 * random.c: replace with Mersenne Twister RNG.
* 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
2002-07-26 06:12:39 +00:00
aamine d5dc032e33 * parse.y (yylex): modify to accept a code like "m (a){...}".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-07-26 03:13:06 +00:00
aamine 55a65fd4e9 * parse.y (yylex): fix typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-07-17 21:49:40 +00:00
aamine 141d0c380f * parse.y (heredoc_identifier): modify typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-07-15 01:33:36 +00:00
nobu 9b198b3d85 * parse.y (literal_concat_string): wrong optimization.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-07-13 00:32:46 +00:00
aamine 02b589fd43 * parse.y: remove useless function str_extend_p().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-07-04 14:41:36 +00:00
michal 46934759bc object.c: rb_Integer reformat, nil#to_f added to rb_define_method.
parse.y: Clean unused vars.
range.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-07-02 09:58:13 +00:00
matz f0221db462 * re.c (rb_reg_expr_str): need to process backslashes properly.
* object.c (rb_any_to_a): declare Object#to_a to be obsolete.

* object.c (rb_Array): do not convert nil into [] automagically.

* object.c (rb_Integer): use "to_int" instead of
  "to_i". [experimental]

* object.c (nil_to_f): new method.

* object.c (rb_Integer): Symbols and nil should cause error.

* object.c (rb_Float): nil should cause error.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-28 14:42:46 +00:00
nobu eb5ea93c7c missing ;
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-27 17:16:39 +00:00
nobu 264d2e4da9 * parse.y (literal_concat_string): non-string last expression in
#{} was ignored when followed by literal.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-26 23:29:10 +00:00
nobu 0fdfc0bbef * parse.y (words, qwords): word list literal rules.
* parse.y (parse_string): ditto.

* parse.y (yylex): %W: word list literal with interpolation. [new]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-26 08:01:00 +00:00
nobu a97ba8c7f7 * parse.y (string1, xstring, regexp): moved lex_strnest
initialization to string_contents/xstring_contents.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-25 09:56:36 +00:00
nobu e8e3f56b81 * parse.y (string_dvar): allow back references in interpolation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-24 15:18:00 +00:00
matz 05b4ec8683 * parse.y (yylex): __END__ should not be effective within
string literals.

* parse.y (here_document): should be aware of __END__ within here
  documents.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-24 07:59:02 +00:00
nobu 33061b45b4 * eval.c (rb_eval): NODE_EVSTR is no longer used.
* eval.c (eval): not enforce to make assigned variables dynamic.

* parse.y (string): split rules to strings/xstring/regexp to allow
  arbitrary statements inside string interpolation.

* parse.y (here_document): splitted into three phases.

* parse.y (literall_append, literal_concat): added.
  append/concatinate string literals.

* sample/test.rb (valid_syntax): adjust line number for BEGIN.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-24 07:20:42 +00:00
nobu 772f420a18 * parse.y (yylex): ? followed by successive word charaters is
ternary operator not numeric literal.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-18 15:53:57 +00:00
nobu de9251e2c7 * parse.y (yylex): commands after break/next/rescue can take
arguments.  (ruby-bugs-ja:PR#265)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-18 15:46:24 +00:00
matz 1979d9ae1f * parse.y (yylex): obsolete '?<whitespace>'; use '?\s', '?\n',
etc, instead.

* parse.y (yylex): no here document after a dot.

* parse.y (yylex): should have set lex_state after '`'.

* parse.y (yylex): should have set lex_state properly after
  tOP_ASGN.

* bignum.c (rb_big2dbl): return canonical HUGE_VAL for infinity.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-18 06:29:07 +00:00
nobu 12c00312aa * parse.y (yylex): should pushback proper char after '<<'.
* parse.y (range_op, cond0, cond): get rid of doubled warnings.

* parse.y (value_expr): reduce recursion level.

* parse.y (logop): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-18 03:53:23 +00:00
nobu aa79984980 * parse.y (read_escape): deny zero-width hexadecimal character.
(ruby-bugs-ja:PR#260)

* parse.y (tokadd_escape): ditto.

* regex.c (re_compile_pattern): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-14 06:27:18 +00:00
matz b3ecbfaa01 * eval.c (svalue_to_avalue): v may be Qundef. This fix was
suggested by Guy Decoux.

* hash.c (rb_hash_s_create): use rb_hash_aset() instead of calling
  st_insert() directly, to dup&freeze string keys.

* parse.y (yylex): proper error message for "@@0".

* parse.y (yylex): paren to parse_string() must be zero for
  unparenthesized strings.

* parse.y (str_extend): broken string when unterminated "#{".

* enum.c (enum_sort_by): had a bug in 1 element enumeration.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-13 03:55:44 +00:00
matz 91511afa9c * parse.y (yylex): 'do' should return kDO_BLOCK on EXPR_ENDARG.
* parse.y (singleton): "def (()).a end" dumped core.

* parse.y (range_op): node may be null.

* parse.y (match_gen): ditto.

* parse.y (arg): void value check for "..", "...", "!", and "not".

* parse.y (match_gen): void value check for "=~".

* parse.y (value_expr): check NODE_AND and NODE_OR recursively.

* parse.y (cond0): void value check added for conditionals.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-12 09:22:20 +00:00
nobu 94f86651d6 * parse.y (stmt): fix typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-11 17:39:38 +00:00
eban 6e01d2e2f5 * parse.y (%%): remove '%%' line on the end of the file(parse error).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-11 07:26:03 +00:00
matz 22010642b2 * eval.c (rb_eval): ruby_frame->last_func may be null, if it's
called outside of a method.

* parse.y (arg): use INT2NUM, not INT2FIX for tUMINUS.

* parse.y (arg): unnecessary negative tPOW treatment.

* parse.y (tokadd_escape): wrong backslash escapement.

* parse.y (stmt,arg): too much void value check.

* parse.y (stmt,arg): need to check void value on rules which does
  not use node_assign().

* ext/socket/socket.c (ipaddr): need not to taint hostnames.

* range.c (range_include): should be based on "<=>", whereas
  member? still is based on "each".

* range.c (range_min,range_max): redefine methods based on "<=>".


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-11 07:02:23 +00:00
nobu 31de741673 * numeric.c (fix_lshift): negative shift count means right shift.
* numeric.c (fix_rshift): return -1 when left side operand is
  negative.

* parse.y (yylex): `0_' should be an error. (ruby-bugs-ja:PR#239)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-10 10:06:12 +00:00
michal 6956135b4b Trivial: GCC3.1 fix (not worth to mention in ChangeLog)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-05 06:10:57 +00:00
matz b7bc0cae53 * string.c (rb_str_aset): should raise error if an indexing string
is not found in the receiver.

* sprintf.c (rb_f_sprintf): "%d" should convert objects into
  integers using Integer().

* lib/tempfile.rb (Tempfile::size): added.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-04 07:34:19 +00:00
nobu 2263dbe022 * parse.y (here_document): check if identifier is terminated.
(ruby-bugs-ja:PR#239)

* parse.y (yylex): should pushback proper char after '**'.
  (ruby-bugs-ja:PR#240)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-02 22:16:55 +00:00
matz 4ab1577db3 * parse.y: yyparse #defines moved from intern.h
* ruby.c (proc_options): access prefixed "ruby_yydebug".

* applied modifies to pacify some of gcc -Wall warnings.

* parse.y (arg): no more ugly hack for "**", so that "-2**2" to be
  parsed as "(-2)**2", whereas "- 2**2" or "-(2)**2" to be parsed
  as "-(2**2)".

* parse.y (yylex): '-2' to be literal fixnum. [new]

* time.c (time_succ): new method for Range support.

* time.c (time_arg): nil test against v[6] (usec).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-05-29 05:20:39 +00:00
michal bab153b243 * array.c: fixed format string for 'long' args (%d -> %ld).
* class.c: ditto.

	* eval.c: ditto.

	* numeric.c: ditto.

	* pack.c: ditto.

	* parse.y: ditto.

	* range.c: ditto.

	* string.c: ditto.

	* util.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-05-28 18:11:07 +00:00
aamine 3caee29585 * parse.y (yylex): case '<': here-document label ate '-'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-05-22 09:40:17 +00:00
nobu dbdd56faf8 * parse.y (bodystmt): ensure clause was excuted on else clause
without rescue clase.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-05-20 16:22:23 +00:00
matz eb6118992b * eval.c (rb_clear_cache_by_class): new function.
* eval.c (set_method_visibility): should have clear cache forq
  updated visibility.

* numeric.c (flo_to_s): default format precision to be "%.16g".

* util.c (ruby_strtod): use own strtod(3) implementation to avoid
  locale hell.  Due to this change "0xff".to_f no longer returns 255.0

* eval.c (avalue_to_yvalue): new function to distinguish yvalue
  (no-arg == Qundef) from svalue (no-arg == Qnil).

* eval.c (rb_yield_0): use avalue_to_yvalue().

* eval.c (assign): warn if val == Qundef where it means rhs is
  void (e.g. yield without value or call without argument).

* parse.y (value_expr): need not to warn for WHILE and UNTIL,
  since they can have return value (via valued break).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-05-14 06:22:31 +00:00
nobu 8473a82934 * parse.y (here_document): preserve line number begins here
document.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-05-10 10:05:30 +00:00
matz b134b91278 * various files: macro fix-up by Michal Rokos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-04-25 13:57:01 +00:00
matz e3a8c62630 * io.c (rb_io_mode_flags): both 'r+b' and 'rb+' should be allowed.
* io.c (rb_io_mode_modenum): ditto.

* gc.c (rb_memerror): rename from mem_error, and exported.

* gc.c (Init_GC): pre-allocate NoMemoryError instance.

* object.c (convert_type): error message changed from "failed to
  convert" to "cannot convert", since it does not try to convert
  if an object does not respond to the converting method.

* eval.c (block_pass): convert Method to Proc using
  rb_check_convert_type().

* object.c (rb_check_convert_type): always convert T_DATA

* eval.c (rb_thread_cleanup): should not terminate main_thread by
  Fatal error.

* regex.c (is_in_list): need to not exclude NUL and NEWLINE.

* re.c (rb_reg_expr_str): wrong backslash escapement.

* re.c (rb_reg_expr_str): do not escape embedded space
  characters.

* marshal.c (w_object): T_DATA process patch from Joel VanderWerf
  <vjoel@PATH.Berkeley.EDU>.  This is temporary hack; it remains
  undocumented, and it will be removed when marshaling is
  re-designed.

* marshal.c (r_object): ditto.

* numeric.c (num_step): Integer#step is moved to Numeric#step;
  Fixnum#step is merged into this method.

* numeric.c (int_dotimes): Fixnum#times is merged.

* numeric.c (int_upto): Fixnum#upto is merged.

* numeric.c (int_downto): Fixnum#downto is merged.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-04-24 04:54:16 +00:00
matz 8c3157e43f * eval.c (rb_thread_cleanup): current thread may be THREAD_STOPPED,
for example when terminated from signal handler.

* regex.c (re_compile_pattern): remove /p support.

* regex.h: ditto.

* parse.y (parse_regx): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-04-19 04:14:07 +00:00
matz 5527b3b961 * eval.c (assign): ruby_verbose should be surrounded by RTEST().
* object.c (rb_str2cstr): ditto.

* parse.y (void_expr): ditto.

* parse.y (void_stmts): ditto.

* variable.c (rb_ivar_get): ditto.

* variable.c (rb_cvar_set): ditto.

* variable.c (rb_cvar_get): ditto.

* dir.c (glob_helper): should have proceed link when link->path
  was non existing symbolic link.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-04-11 10:03:01 +00:00
matz f60b87038d * parse.y (primary): while/until statement modifiers to "begin"
statement now work as "do .. while" even when begin statement
  has "rescue" or "ensure" [new].

* parse.y (bodystmt): rescue/ensure is allowed at every bodies,
  i.e. method bodies, begin bodies, class bodies[new], and module
  bodies[new].

* ext/socket/socket.c (sock_addrinfo): should specify ai_socktype
  for getaddrinfo hints.

* eval.c (rb_f_abort): embed aborting message into exception
  object [new].

* eval.c (terminate_process): utility function for exit and abort.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-26 06:18:51 +00:00
nobu 59993515a4 too reverted.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-20 10:21:23 +00:00
matz 760878b424 * eval.c (is_defined): should check receiver only once.
* eval.c (is_defined): should handle NODE_NEWLINE.

* file.c (rb_file_s_expand_path): memory leak fixed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-20 09:43:15 +00:00
matz 6d2e56ce7c * re.c (rb_reg_search): should clear last_match if pos is out of
string range.

* string.c (rb_str_index_m): ditto.

* string.c (rb_str_rindex): ditto.

* class.c (rb_define_class): should handle autoload.

* class.c (rb_define_module): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-19 09:03:11 +00:00