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

779 Коммитов

Автор SHA1 Сообщение Дата
nobu bf04c0946f * parse.y (parser_encode_length): chomp eol style modifiers.
* parse.y (parser_magic_comment): ditto.

* parse.y (set_file_encoding): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-17 16:21:21 +00:00
akr b92cee1ddb * re.c, regerror.c, string.c, parse.y, ruby.c, file.c:
use capital letter for \xHH notation.  [ruby-dev:32511]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-12 14:30:54 +00:00
matz 91142c95bb * parse.y (expr): 'not' and '!' should act as conditional
expression.   [ruby-dev:32548]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14198 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-12 03:45:36 +00:00
matz 6bd65de203 * parse.y (shadowing_lvar_gen): no duplicate error for "_".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-10 16:22:52 +00:00
matz 6e12ae857e * parse.y (parser_yylex): wrong token was generated. [ruby-dev:32498]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-09 23:16:54 +00:00
akr f4592d7bb0 * re.c (rb_reg_expr_str): use \xHH instead of \OOO.
* regerror.c (to_ascii): ditto.
  (onig_snprintf_with_pattern): ditto.
  (onig_snprintf_with_pattern): ditto.

* string.c (rb_str_inspect): ditto.
  (rb_str_dump): ditto.

* parse.y (parser_yylex): ditto.

* ruby.c (proc_options): ditto.

* file.c (rb_f_test): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-09 21:48:05 +00:00
matz 9d8075b99c * parse.y (expr): redefinable not (!) operator.
* parse.y (arg): ditto.

* object.c (rb_obj_not): new method "!".

* object.c (rb_obj_not_equal): new method "!=".

* object.c (rb_obj_not_match): new method "!~".

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-09 16:39:49 +00:00
nobu 0076f3b3f8 * parse.y (parser_magic_comment): delimits with a semicolon.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-09 03:03:18 +00:00
akr b12bb50149 * re.c (rb_reg_check_preprocess): new function for validating regexp
fragment.

* parse.y (regexp): invoke reg_fragment_check.
  (reg_fragment_check): defined.
  (reg_fragment_check_gen): defined.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-08 07:21:05 +00:00
akr f1b7e60cb9 * encoding.c (rb_enc_mbclen): make it never fail.
(rb_enc_nth): don't check the return value of rb_enc_mbclen.
  (rb_enc_strlen): ditto.
  (rb_enc_precise_mbclen): return needmore(1) if e <= p.
  (rb_enc_get_ascii): new function for extracting ASCII character.

* include/ruby/encoding.h (rb_enc_get_ascii): declared.

* include/ruby/regex.h (ismbchar): removed.

* re.c (rb_reg_expr_str): use rb_enc_get_ascii.
  (unescape_escaped_nonascii): use rb_enc_precise_mbclen to determine
  the termination of escaped non-ASCII character.
  (unescape_nonascii): use rb_enc_precise_mbclen.
  (rb_reg_quote): use rb_enc_get_ascii.
  (rb_reg_regsub): use rb_enc_get_ascii.

* string.c (rb_str_reverse) don't check the return value of
  rb_enc_mbclen.
  (rb_str_split_m): don't call rb_enc_mbclen with e <= p.

* parse.y (is_identchar): use ISASCII.
  (parser_ismbchar): removed.
  (parser_precise_mbclen): new macro.
  (parser_isascii): new macro.
  (parser_tokadd_mbchar): use parser_precise_mbclen to check invalid
  character precisely.
  (parser_tokadd_string): use parser_isascii.
  (parser_yylex): ditto.
  (is_special_global_name): don't call is_identchar with e <= p.
  (rb_enc_symname_p): ditto.

  [ruby-dev:32455]

* ext/tk/sample/tkextlib/vu/canvSticker2.rb: remove coding cookie
  because the encoding is not UTF-8.  [ruby-dev:32475]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-08 02:50:43 +00:00
matz 0f8e9a24c1 * parse.y (arg): typo fixed ("!" -> "|") in the ripper code.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-07 02:52:37 +00:00
matz aff0d98a5b * parse.y (arg): tUPLUS no longer works as identity operation any
more.  inspired by [ruby-talk:265532].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-07 02:51:31 +00:00
nobu 0af432ce08 * parse.y (rb_intern3): fix to changing encoding to default, and
uncommented r13835, which is rare but not impossible.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-05 06:25:56 +00:00
nobu 8ea5018d20 * parse.y (yycompile): get rid of tracing while parsing.
[ruby-dev:31351]

* thread.c (ruby_suppress_tracing): added a new parameter, which
  directs to call func always.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-05 04:41:27 +00:00
nobu 1524572ce9 * parse.y (parser_tokadd_mbchar): fix for ASCII chars. [ruby-dev:32432]
* parse.y (parser_parse_string, parser_here_document): prevent false
  error messages.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-02 13:08:03 +00:00
nobu 040e3e7bdd * parse.y (parser_tokadd_mbchar): check insufficient multibyte char.
[ruby-dev:32429]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-02 06:47:59 +00:00
akr 21729a1c77 * parse.y (regexp): fix /#{}\xa1\xa2/e to be EUC-JP.
(reg_fragment_setenc_gen): extracted from reg_compile_gen.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-02 00:16:24 +00:00
akr 7ff702406a * include/ruby/intern.h (rb_uv_to_utf8): declared.
* re.c (rb_reg_preprocess): new function for dynamic regexp with
  \u{} such as Regexp.new("\\u{6666}").
  (rb_reg_prepare_re): preprocess regexp for recompiling.
  (read_escaped_byte): new function.
  (unescape_escaped_nonascii): new function.
  (append_utf8): new function.
  (unescape_unicode_list): new function.
  (unescape_unicode_bmp): new function.
  (unescape_nonascii): new function.
  (rb_reg_initialize): preprocess regexp.

* pack.c (rb_uv_to_utf8): renamed from uv_to_utf8.

* parse.y (STR_NEW3): take func instead of has8 and hasmb.
  (parser_str_new): use default coderange mechanism except for regexp.
  (parser_tokadd_utf8): copy regexp source as-is.
  (parser_read_escape): UTF-8 stuff removed.
  (parser_tokadd_escape): has8bit and hasmb removed.
  (parser_tokadd_string): fix 8-bit single byte character with \u.
  (parser_parse_string): has8bit and hasmb removed.
  (parser_here_document): has8bit and hasmb removed.
  (parser_yylex): call parser_tokadd_utf8 instead of read_escape for
  UTF-8 character.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-01 16:56:19 +00:00
matz d5bd9d1593 * encoding.c: rename primary_encoding -> default_external (encoding).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-01 14:05:53 +00:00
nobu 4afa82056c * parse.y (newline_node): always remove NODE_BEGIN.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-30 18:34:34 +00:00
nobu 058ec52c0d * parse.y (stmt): remove unnecessary NODE_BEGIN. [ruby-core:13814]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-29 07:59:12 +00:00
akr f5ee0fd521 * include/ruby/encoding.h, encoding.c, re.c, string.c, parse.y:
rename ENC_CODERANGE_SINGLE to ENC_CODERANGE_7BIT.
  rename ENC_CODERANGE_MULTI to ENC_CODERANGE_8BIT.
  Because single byte 8bit character, such as Shift_JIS 1byte katakana,
  is represented by ENC_CODERANGE_MULTI even if it is not multi byte.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-27 02:21:17 +00:00
akr 2109a52503 * re.c (REG_CASESTATE): unused macro removed.
(rb_reg_prepare_re): check encoding difference.
  (rb_reg_initialize): check 8bit byte.

* parse.y (parser_tokadd_escape): fix has8bit.

  [ruby-dev:32113]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-23 06:30:26 +00:00
ko1 01dacec2b4 * include/ruby/ruby.h: rename RFloat#double_value -> float_value.
* numeric.c, parse.y: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-20 11:35:12 +00:00
nobu 64ba5303fd * parse.y (parser_read_escape): has8bit flag may be set with control
escape.  [ruby-core:13722]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-20 06:09:03 +00:00
nobu d7e4c1e66b * parse.y (parser_prepare): set begging after BOM if exists.
[ruby-core:13718]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-20 06:08:16 +00:00
matz 7a978073c9 * parse.y (parser_yylex): should clear parser->tokp as well.
[ruby-dev:32250]

* parse.y: remove NEED_ASSOC that break test_parser_events.

* parse.y (parser_yylex): should not decrement line numbers at the
  end of file.

* file.c (rb_find_file_ext): search .rb files first through in the
  loadpath.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-19 07:10:09 +00:00
nobu 9417595993 * parse.y (parser_read_escape): disallow control and meta modifiers
for non-ASCII characters.  [ruby-core:13685]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-18 16:53:12 +00:00
ko1 25c0cb981a * include/ruby/ruby.h: introduce 2 macros:
RFLOAT_VALUE(v), DOUBLE2NUM(dbl).
  Rename RFloat#value -> RFloat#double_value.
  Do not touch RFloat#double_value directly.
* bignum.c, insns.def, marshal.c, math.c, numeric.c, object.c,
  pack.c, parse.y, process.c, random.c, sprintf.c, string.c,
  time.c: apply above changes.
* ext/dl/mkcallback.rb, ext/json/ext/generator/generator.c:
  ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-13 16:00:53 +00:00
nobu d5a3389886 * common.mk (parse.c), ext/ripper/depend (ripper.c): process after
bison with sed.  [ruby-dev:32204]

* ruby.c (proc_options): use yydebug in cmdline_options.

* ruby.c (process_options): set yydebug flag of parser.

* parse.y (yydebug): moved into struct parser_params.

* parse.y (rb_parser_get_yydebug, rb_parser_set_yydebug): parser
  generic methods.

* */Makefile.sub (parse.c): moved to common.mk.

* tool/ytab.sed: comment out yydebug definition, and substitute
  yyerror with parser_yyerror.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-13 12:41:41 +00:00
davidflanagan 03919fd210 * parse.y: use ASCII encoding for string literals that are
7-bit clean, fixing regression from my previous patch



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-10 05:45:52 +00:00
nobu 87f538563f * parse.y (parser_nextc): added single line read forward buffer.
* parse.y (parser_yylex): adjust line number for fluent interface.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-09 14:33:18 +00:00
davidflanagan 453889cf0c * parse.y: fix segfault with \x escapes in regexps
delete unused #if 0 code regions from previous patch


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-08 06:14:45 +00:00
usa 219d2315af * parse.y (parser_read_escape): remove C99/gcc-ism.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-08 03:14:16 +00:00
davidflanagan baae1c4075 * parse.y: patch, based on Nobu's, work to support \u escapes
also modifications for better coderange detection
* test/ruby/test_unicode_escapes.rb: test cases
* test/ruby/test_mixed_unicode_escapes.rb: mixed encoding test cases



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-07 22:55:27 +00:00
davidflanagan 89397d2f6e * parse.y (rb_intern3): commented out broken code that prevented
correct interning of multi-byte symbols.  Without this patch
  :x==:x is false when x is a multi-byte character. 



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-07 22:17:58 +00:00
matz 950c618335 * parse.y (call_args): remove "parenthesize argument(s) for future
version" warning.  when I added this warning, I had a plan to
  reimplement the parser that is simpler than the current one.
  since we abandoned the plan, warning no longer required.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-04 16:23:59 +00:00
nobu f3cbb20b22 * parse.y (bvar): block-local variable can shadow outer variable.
[ruby-core:13036]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-29 09:42:18 +00:00
nobu 32865ef821 * misc/ruby-style.el (ruby-style-{case,label}-indent): adjust for
labels inside switch block.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-26 06:00:52 +00:00
matz bbe0af6be1 * parse.y (parser_yylex): dot at the head of the line denote line
continuation from previous one to support fluent interface.
  [experimental]

* misc/ruby-mode.el (ruby-calculate-indent): support fluent dot.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-25 17:06:29 +00:00
davidflanagan 966e15e655 * parse.y (parser_tokspace): increment tokidx
fixes test failure at [test/ruby/test_stringchar.rb:72]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-25 05:08:08 +00:00
nobu 2070362f33 * parse.y (parser_tokspace): make space in token buffer.
* parse.y (parser_yylex): fix encoding of single character literal.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-24 08:09:40 +00:00
nobu 3980699f54 * parse.y (call_args2): nd_head of NODE_BLOCK_PASS should be a list.
[ruby-core:12850]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-23 04:44:15 +00:00
nobu c7697aba34 * parse.y (parser_regx_options, reg_compile_gen): relaxened encoding
matching rule.

* re.c (rb_reg_initialize): always set encoding of Regexp.

* re.c (rb_reg_initialize_str): fix enconding for non 7bit-clean
  strings.

* re.c (rb_reg_initialize_m): use ascii encoding for 'n' option.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-19 07:41:03 +00:00
nobu 3cd040b6ef * encoding.c (rb_primary_encoding): added Encoding.primary_encoding.
* parse.y (rb_parser_encoding): added.

* ruby.c (proc_options): added -E and --encoding options.

* ruby.c (process_options): set primary encoding from command line
  option if set, or source encoding.

* include/ruby/encoding.h (rb_enc_from_encoding,
  rb_get_primary_encoding, rb_set_primary_encoding): prototypes.

* include/ruby/node.h (rb_parser_encoding): prototype.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-16 20:07:20 +00:00
nobu 676dc908b6 * parse.y (parser_regx_options): check if regexp encoding option
matches to current encoding.

* re.c (char_to_option, rb_char_to_option_kcode): 'n' is not kcode
  option now.

* re.c (rb_reg_to_s, rb_reg_error_desc): copy encoding rather than
  append as an option.

* re.c (make_regexp, rb_reg_prepare_re): use encoding of Regexp and
  String instead of kcode.

* re.c (rb_reg_initialize): set fixed option if none is set.

* re.c (rb_reg_regcomp): ditto.

* re.c (rb_reg_equal): check if encodings are equal.

* re.c (rb_reg_initialize_m): encoding option is obsolete.

* re.c (rb_kcode, rb_get_kcode, rb_set_kcode): removed.

* re.c (Init_Regexp): removed Regexp#kcode method.

* ruby.c (proc_options): allow long encoding name.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-16 05:48:40 +00:00
nobu e0a6ff2aa6 * parse.y (set_file_encoding): case-insensitive search, a patch from
David Flanagan <david AT davidflanagan.com> [ruby-core:12629]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-13 00:12:00 +00:00
matz d962ef7454 * parse.y: encoding specifier should work if the line matches
/coding[:=] ?/, a la Python PEP-263, so that VIM comments like
  "# vim: set fileencoding=<encoding name>" should be recognized.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-12 15:04:46 +00:00
nobu b1e97c9070 * trunk/parse.y (magic_comments): add "encoding" as same as "coding".
* trunk/parse.y (set_file_encoding): special file encoding handling.

* trunk/parse.y (parser_yylex): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-12 06:04:57 +00:00
usa 51baef22a6 * parse.y (parser_read_escape, parser_tokadd_escape): check code range.
[ruby-dev:31980]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-09 07:01:36 +00:00
nobu 78c4cc29ae * parse.y (STR_NEW3): check for if single byte sequence.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-09 06:40:26 +00:00
nobu 47732dbd2b * parse.y (reg_compile_gen): copy encoding from source string if
non-empty.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-04 07:28:35 +00:00
nobu 0f09f59ef7 * parse.y (reg_compile_gen): copy encoding from source string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-04 07:16:04 +00:00
nobu 5dd4990d0e * parse.y (parser_str_new, parser_yylex, rb_intern3): set code-range
bits.

* parse.y (parser_tokadd_string): check code-range.

* parse.y (parser_parse_string, parser_here_document): ditto.

* parse.y (parser_set_encode): check if valid encoding.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-03 07:58:50 +00:00
nobu 29621688c7 * io.c (rb_io_fdopen): create IO object from fd.
* parse.y (yycompile): use encoding of the source as default.

* ruby.c (proc_options, load_file): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-28 20:29:32 +00:00
nobu 5829a95b47 * parse.y (strings, xstring, regexp, dsym): empty strings have
US-ASCII encoding.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-27 00:42:51 +00:00
nobu e41b84895e * encoding.c (rb_enc_associate_index): deal with ASCII compatible
flags.

* encoding.c (rb_enc_check): allow ASCII compatible strings.

* parse.y (rb_intern_str): use ASCII encoding for ASCII string.

* string.c (rb_enc_str_coderange): check for code-range.

* string.c (rb_str_modify): clear code-range flags.

* string.c (rb_str_hash, rb_str_eql): ASCII compatible strings are
  comparable.

* include/ruby/encoding.h: added code-range flags.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-26 19:46:58 +00:00
nobu 94a0db11e7 * encoding.c (rb_enc_check): check for ASCII-compatibilities.
* parse.y (parser_tokadd_string, parser_parse_string,
  parser_here_document, parser_yylex): set encoding to US-ASCII.

* parse.y (rb_enc_symname_p): check if valid with encoding.

* parse.y (rb_intern3): let symbols have encoding.

* string.c (rb_str_hash): add encoding index.

* string.c (rb_str_comparable, rb_str_equal, rb_str_eql): check if
  compatible encoding.

* string.c (sym_inspect): made encoding aware.

* insns.def (opt_eq): compare with encoding.

* include/ruby/encoding.h (rb_enc_asciicompat): check if ASCII
  compatible.

* include/ruby/encoding.h (rb_enc_get_index): added prototype.

* include/ruby/intern.h (rb_str_comparable, rb_str_equal): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-26 09:39:08 +00:00
nobu 52866db1fe * parse.y (parser_yyerror): limit error message length.
[ruby-dev:31848]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-25 20:12:24 +00:00
nobu 0a274820bd * eval_method.ci (rb_attr): should not use alloca for unknowen size
input.  [ruby-dev:31816]

* parse.y (rb_intern_str): prevent str from optimization.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-22 23:58:03 +00:00
aamine 3f483f7082 * parse.y (ripper): rename event: arglist_* -> args_*.
* parse.y (ripper): rename event: restparam -> rest_param.
* parse.y (ripper): rename event: constpath_* -> const_path_*.
* parse.y (ripper): rename event: topconst_* -> top_const_*.
* parse.y (ripper): rename event: iter_block -> method_add_block.
* parse.y (ripper): support block local parameter declaration.
* parse.y (ripper): introduce new macro params_new.
* ext/ripper/lib/ripper/sexp.rb: should not dispose event arguments whose name ends with "_new" but arity != 0.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-17 12:02:35 +00:00
nobu 50f5de1491 * parse.y (struct parser_params): common members in the parser and
ripper must be placed at each same location.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-15 14:36:33 +00:00
nobu fd7e89ddc2 * parse.y (parser_initialize): set default encoding. [ruby-dev:31787]
* ruby.c (load_file): make new parse instance after processing shebang
  line options.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-15 08:32:12 +00:00
nobu 458c4e98aa * parse.y (brace_block): should use compstmt. patch submitted by
Kirill A. Shutemov <k.shutemov AT gmail.com>  [ruby-core:12154].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-13 05:00:23 +00:00
nobu f41c0a54e2 * parse.y (rb_id2str): fixed typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-13 04:47:10 +00:00
nobu 9391daf954 * io.c (rb_io_s_sysopen): should not use alloca for unknowen size
input.  [ruby-dev:31775]

* parse.y (rb_id2str): ditto.

* marshal.c (w_float): use snprintf instead of sprintf.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-12 06:19:06 +00:00
matz edd7c787ad * array.c (rb_ary_cycle): typo in rdoc. a patch from Yugui
<yugui@yugui.sakura.ne.jp>.  [ruby-dev:31748]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-06 12:33:45 +00:00
nobu 6a9b9f488b * parse.y (f_norm_arg, f_arg_item): not croak already erred names.
[ruby-dev:31687]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-30 19:18:05 +00:00
nobu 7aaf7dac8d * parse.y (assignable_gen): ignore already erred names.
* parse.y (shadowing_lvar_gen): always make new block local variable
  when shadowing outer local variable.  [ruby-dev:31507]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-30 18:49:00 +00:00
nobu 2656b0545e * parse.y (aref_args): args may not be a list. [ruby-dev:31592]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-29 03:48:19 +00:00
nobu 38b1f98a72 * parse.y (parser_prepare): set parser encode too when BOM exists.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-28 05:21:48 +00:00
nobu c456863bd6 * parse.y, re.c: re-applied revision 13092.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-25 07:06:47 +00:00
matz a25fbe3b3e * encoding.c: provide basic features for M17N.
* parse.y: encoding aware parsing.

* parse.y (pragma_encoding): encoding specification pragma.

* parse.y (rb_intern3): encoding specified symbols.

* string.c (rb_str_length): length based on characters.  
  for older behavior, bytesize method added.

* string.c (rb_str_index_m): index based on characters.  rindex as
  well.

* string.c (succ_char): encoding aware succeeding string.

* string.c (rb_str_reverse): reverse based on characters.

* string.c (rb_str_inspect): encoding aware string description.

* string.c (rb_str_upcase_bang): encoding aware case conversion.
  downcase, capitalize, swapcase as well.

* string.c (rb_str_tr_bang): tr based on characters.  delete,
  squeeze, tr_s, count as well.

* string.c (rb_str_split_m): split based on characters.

* string.c (rb_str_each_line): encoding aware each_line.

* string.c (rb_str_each_char): added.  iteration based on
  characters.

* string.c (rb_str_strip_bang): encoding aware whitespace
  stripping.  lstrip, rstrip as well.

* string.c (rb_str_justify): encoding aware justifying (ljust,
  rjust, center).

* string.c (str_encoding): get encoding attribute from a string. 

* re.c (rb_reg_initialize): encoding aware regular expression

* sprintf.c (rb_str_format): formatting (i.e. length count) based
  on characters.

* io.c (rb_io_getc): getc to return one-character string.
  for older behavior, getbyte method added.

* ext/stringio/stringio.c (strio_getc): ditto.

* io.c (rb_io_ungetc): allow pushing arbitrary string at the
  current reading point.

* ext/stringio/stringio.c (strio_ungetc): ditto.

* ext/strscan/strscan.c: encoding support.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-25 03:29:39 +00:00
ko1 e39eb9dab5 * compile.c, insns.def, parse.y: fix massign order. This change
causes performance problem.  Try vm1_swap benchmark.
  [ruby-dev:31522]
* insns.def, insnhelper.ci: move process body of expandarray insn to
  vm_expandarray().
* bootstraptest/test_knownbug.rb, bootstraptest/test_massign.rb:
  move a solved test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-23 07:10:56 +00:00
nobu ac41d27749 * parse.y (f_norm_arg): ripper has no shadowing check.
* parse.y (f_block_arg): dispatch blkarg_mark.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-23 06:51:21 +00:00
nobu fcab7ebb71 * parse.y (f_norm_arg): check also nested arguments. [ruby-dev:31502]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-23 04:19:45 +00:00
nobu 3f025d2078 * parse.y (reg_compile_gen): obtain error info from errinfo.
* re.c (rb_reg_error_desc): make RegexpError for initialization error.

* re.c (rb_reg_compile): return nil and set errinfo if error.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-18 05:05:36 +00:00
ko1 fc5885aa7a * parse.y: remove "//" type comment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-15 05:22:44 +00:00
ko1 fe898043cc * parse.y: fix rules around f_margs. "make test" passes all tests.
* bootstraptest/test_block.rb: add some tests for above.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-15 04:52:56 +00:00
nobu d3a1980b96 * parse.y (internal_id_gen): internal ID must be bigger than
tLAST_TOKEN.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-09 19:47:11 +00:00
nobu ae709e831f * parse.y (stmt): check if rhs has value before assignment instead
inside node_assign_gen().  [ruby-dev:31293]

* parse.y (call_bin_op_gen, call_uni_op_gen): split call_op_gen.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-09 07:04:56 +00:00
nobu fda5eeae72 * parse.y (f_marg_list): renamed from f_marg_head.
* parse.y (f_margs): allow multiple mandatory arguments after a splat.
  [ruby-dev:31153]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-09 05:01:37 +00:00
ko1 1951ef76ce * parse.y (value_expr_gen): fix to cause "void value expression"
when jump expression such as "next" are shown on value_expr().
  [ruby-dev:31119]
* bootstraptest/test_syntax.rb: fix to above change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-06 07:46:57 +00:00
ko1 1a30041536 * parse.y: fix a f_marg rule. [ruby-dev:31160]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12879 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-06 07:38:18 +00:00
nobu d9274e7d6b * parse.y (reg_compile_gen): set error if failed to compile regexp
literal.  [ruby-dev:31336]

* re.c (rb_reg_compile): should not use regexp which could not get
  initialized.  [ruby-dev:31333]
  return error message to let the parser know it.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-02 14:36:25 +00:00
matz 46eb6e9428 * parse.y (value_expr_gen): warn for empty expression ().
[ruby-dev:31252]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-23 09:13:44 +00:00
nobu bf27f224f0 * parse.y (stmt, mlhs_node, lhs, arg, var_ref): return dummy
NODE_BEGIN after errors.  [ruby-dev:31100], [ruby-dev:31118]

* parse.y (remove_begin): make empty NODE_BEGIN to NODE_NIL, instead
  of null.  [ruby-dev:31252], [ruby-dev:31263]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-20 01:39:30 +00:00
nobu 233221db60 * parse.y (rb_parser_append_print, rb_parser_while_loop): moved check
for node to the head.

* ruby.c (proc_options): do nothing for -p/-n options if tree is null.
  submitted by Yusuke ENDOH <mame AT tsg.ne.jp> at [ruby-dev:31243].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-18 00:19:10 +00:00
matz 608545ced0 * parse.y (bvar): semicolon was lost for ripper description.
[ruby-dev:31140]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-13 02:31:56 +00:00
nobu e6dc7d3d6f * parse.y (ripper_warningS): unused in ripper right now.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-13 02:25:29 +00:00
nobu 4a0ea31319 * parse.y (debug_lines): use rb_hash_lookup() to get rid of
call of Hash#default.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-13 02:17:58 +00:00
nobu b1d5c752fb * parse.y (dsym): convert also literals containing NUL to
symbol.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-13 02:16:27 +00:00
nobu 6dcf9f16cc * parse.y (program, stmt, primary): reduced duplicated code.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-13 02:09:40 +00:00
ko1 0ec2b20d2f * parse.y: fix node construction (around f_margs).
[ruby-dev:31143]
* bootstraptest/test_block.rb: add a test for above.
* insnhelper.ci: fix indent.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-07 07:16:05 +00:00
nobu e8fc29990f * parse.y (keyword_to_name): constified.
* ext/ripper/eventids2.c (token_to_eventid): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-06 05:57:14 +00:00
nobu c512a69a2d * parse.y (f_marg): wrap f_norm_arg assignment node with NODE_LIST.
[ruby-dev:31141]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-06 05:35:28 +00:00
akr a74dbca686 * parse.y (mlhs_basic): use mlhs_post after tSTAR.
[ruby-dev:31109]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-05 09:45:27 +00:00
nobu 46603a78af * include/ruby/{intern,ruby}.h, compile.[ch], error.c, eval.c,
eval_load.c, gc.c, iseq.c, main.c, parse.y, re.c, ruby.c,
  yarvcore.[ch] (ruby_eval_tree, ruby_sourcefile, ruby_sourceline,
  ruby_nerrs): purge global variables.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-05 08:12:18 +00:00
nobu a670571ad3 * parse.y (parser_parse_string): fix indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-05 02:02:30 +00:00
nobu 6bbcf6f43d * parse.y (global_symbols.last_id): reduce unused ID numbers.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-05 01:13:10 +00:00
nobu ba563e4a41 * include/ruby/st.h, st.c (st_init_table, st_init_table_with_size):
constified.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-05 01:06:49 +00:00
akr c1596a80af * parse.y (mlhs_inner): new rule. [ruby-dev:31132]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-04 09:32:45 +00:00
nobu fd3f9eee0e * parse.y (parser_yylex): return non-valid token for an invalid
instance/class variable name.  a patch from from Yusuke ENDOH
  <mame AT tsg.ne.jp>.  [ruby-dev:31095]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-29 15:17:02 +00:00
nobu 9c69eff7b3 * parse.y (stmts): fix for ripper.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-29 14:38:10 +00:00
ko1 0d7e74a6be * parse.y: fix to show line number of blank block.
[ruby-dev:31093]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-29 13:00:27 +00:00
matz 71f8ca8bc4 * parse.y (assoc_list): remove expanded hash literal (no splat).
* lib/webrick/httpstatus.rb (WEBrick::HTTPStatus::EOFError): adapt
  to new syntax.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-29 06:27:49 +00:00
nobu cf46a2fce6 * parse.y (dsym): return non-null NODE even if yyerror(). based on a
patch from from Yusuke ENDOH <mame AT tsg.ne.jp>.  [ruby-dev:31085]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-29 02:23:13 +00:00
matz baaa30ec03 * parse.y (assoc_list): odd number check only for NODE_ARRAY.
[ruby-dev:31082]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-28 14:33:45 +00:00
usa 8e11ff411a * parse.y (rb_intern2): unconstify cast.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-27 17:05:03 +00:00
akr d9987aa704 * parse.y (rb_intern2): don't allocate a string object at first.
[ruby-dev:31064]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-27 16:45:56 +00:00
ko1 fd78c2193e * include/ruby/node.h, parse.y, gc.c, iseq.c: remove NODE_CREF.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-27 16:23:49 +00:00
ko1 ed4e57690c * insnhelper.ci, vm.c: complete block parameter support.
post arguments, optional arguments, block argument.
* compile.c, parse.y: fix {|a|} parameter.
* insnshelper.ci, insns.def: revert caller_setup_args() option
  (need_block_check) parameter.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-25 16:05:17 +00:00
ko1 f58eb1e276 * eval.c: remove ruby_current_node and change eval() prototype.
fix to use rb_sourcefile/line() instead of ruby_sourcefile/line.
* error.c, eval_error.ci, eval_load.c, eval_safe.ci, gc.c,
  include/ruby/intern.h, parse.y, process.c, ruby.c: ditto.
* vm.c: fix spaces.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-24 20:33:04 +00:00
ko1 97ba019c94 * vm.c: some refactoring.
* rename th_* to vm_*.
  * remove unused variables functions.
  * add prototypes.
* blockinlining.c, compile.c, cont.c, eval.c, eval_intern.h,
  eval_jump.h, eval_load.c, inits.c, insns.def, iseq.c, parse.y,
  proc.c, process.c, signal.c, thread.c, vm.c, vm_dump.c,
  vm_evalbody.ci, yarvcore.c, yarvcore.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-24 15:42:41 +00:00
matz 967cca2f8d * parse.y (rb_intern2): ID_JUNK test based on len, not by NUL.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-21 14:16:00 +00:00
nobu 3fc180ebeb * parse.y (rb_intern2): name may not be NUL-terminated.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-21 08:12:14 +00:00
nobu 9a7a11564c * parse.y (rb_intern2): use rb_intern2 to intern without trailing
equal sign.

* parse.y (rb_intern2, ripper_id2sym): fixed indent.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-19 19:43:59 +00:00
nobu 942a54302d * parse.y (yycompile): disable trace while creating ruby_debug_lines.
[ruby-talk:253586]

* thread.c (ruby_suppress_tracing): new function to call a function
  with suppressing trace.

* lib/debug.rb, lib/tracer.rb: for YARV.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-18 07:55:45 +00:00
ko1 7567fbf080 * vm.c (th_yield_setup_args): |v| should work as |v,|.
ex) def m;yield 1, 2; end; m{|v| p v} #=> 1
* parse.y: apply above change for "for" statement.
* test/ruby/test_assignment.rb: ditto
* test/ruby/test_basicinstructions.rb: ditto.
* test/ruby/test_iterator.rb: ditto.
* test/ruby/test_yield.rb: ditto.
* compile.c (iseq_compile_each): fix debug.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-15 03:27:33 +00:00
matz 89c2418467 * parse.y (call_args): no allow splat after assocs. takes
consistency over compatibility.

* parse.y (call_args2): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-13 13:25:39 +00:00
nobu 30dbd2a6ba * parse.y (do_block, brace_block): fix line numbers. [ruby-dev:30831]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-10 07:58:09 +00:00
nobu 2b592580bf * include/ruby: moved public headers.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-10 03:06:15 +00:00
matz 4d43632852 * parse.y (call_args): allow splat argument after unpacked
assocs like 1.8 does.

* parse.y (call_args): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-08 05:58:06 +00:00
ko1 78029f00d5 * parse.y (new_yield), compile.c (iseq_compile_each): fix
passing parameter.
* eval.c, eval_jump.h: simplify rb_yield*.
* proc.c (proc_mark): fix to mark proc->block.proc.
* proc.c (Init_Proc): add Proc#lambda?
* test/ruby/test_lambda.rb: add some tests.
* vm.c (invoke_block): fix to check lambda block or not.
* vm.c (th_yield_setup_args): fix to check arguments size
  when lambda block.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-05 17:26:00 +00:00
nobu 194a01a484 * compile.c: fixed indentation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12434 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-05 04:49:54 +00:00
nobu 99d65b14b4 * compile.c, dir.c, eval.c, eval_jump.h, eval_method.h, numeric.c,
pack.c, parse.y, re.c, thread.c, vm.c, vm_dump.c, call_cfunc.ci,
  thread_pthread.ci, thread_win32.ci: fixed indentation.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-05 04:25:10 +00:00
nobu 0d2109239d * parse.y (open_args, arg_ambiguous, parser_warning): should not use
rb_warning in the parser.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12403 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-29 15:22:49 +00:00
matz 2d239b4745 * parse.y (f_arg): remove typo from ripper description.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-17 04:31:05 +00:00
ko1 ebaec402a7 * parse.y, compile.c (set_arguments): fix to support in-paren
parameter (ex: def foo((a, b))).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-17 04:25:18 +00:00
nobu a1295b0f79 * iseq.c (iseq_data_to_ary): internal IDs must not be exposed.
[ruby-core:11073]

* parse.y (internal_id_gen): now returns scope local ID instead of
  global one.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-11 06:26:06 +00:00
nobu dc2a434cf2 * parse.y (POINTER_P): pointer may be larger than long.
* parse.y (vtable_size, vtable_included, vtable_tblcpy,
  vtable_to_tbl): constified.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-10 06:08:20 +00:00
nobu 0cc90b3865 * parse.y: removed garbage spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-02 00:39:34 +00:00
nobu 50e6933b09 * error.c, parse.y, ruby.h (rb_compile_warn, rb_compile_warning): warn
for compilation.  the parser should no longer use rb_warn() and
  rb_warning().  [ruby-dev:30121]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-01 21:45:48 +00:00
nobu f8c2658700 * parse.y (assoc): result of assoc_new needs to be an assoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-01 20:44:25 +00:00
nobu f70f8173cd * parse.y: fixes for ripper.
* parse.y (primary): reduced duplcated code.

* parse.y (f_arg_item): should not override by meaningless value.

* parse.y (f_arg, assocs): should not use $$ before assigned.

* parse.y (assoc_list): dispatch assoclist_from_args for assocs as
  well as args.

* parse.y (assoc): return assoc if dispatched result is $1.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-04-26 08:18:00 +00:00
matz 138362834f * parse.y (symbol): symbols should be followed by EXPR_ENDARG.
* parse.y (dsym): ditto.

* parse.y (parser_yylex): strings should be followed by
  EXPR_ENDARG.

* parse.y (parser_yylex): ditto for numbers.

* parse.y (parser_yylex): EXPR_ENDARG after ']' and '}'.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-04-20 09:38:16 +00:00
matz 380ea10dfa * parse.y (parser_yylex): should set command_start after block
starting "do"s and braces.  [ruby-core:10916]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-04-16 08:12:51 +00:00
ko1 bb7a2d40ff * compile.c, parse.y, eval.c, intern.h, iseq.c, lex.c, node.h,
proc.c, vm.c, vm_macro.def, vm_macro.def, yarvcore.c, yarvcore.h,
  debug.c, debug.h: merge half-baked-1.9 changes.  The biggest change
  is to change node structure around NODE_SCOPE, NODE_ARGS.  Every
  scope (method/class/block) has own NODE_SCOPE node and NODE_ARGS
  represents more details of arguments information.  I'll write a
  document about detail of node structure.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-21 11:15:15 +00:00
nobu da3558fddb * parse.y (parser_yylex), win32/win32.c (rb_w32_utime): fixed
indentation broken at YARV merger.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-04 16:36:36 +00:00
nobu cd725929d7 * parse.y (stmt, arg): should not omit lhs of OP_ASGN1 even if
empty.  [ruby-dev:30452]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-01 12:38:05 +00:00
aamine b0d8301744 * parse.y (f_arg, opt_f_block_arg): ripper should export VALUE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-24 08:45:58 +00:00
matz 02c147f04e * parse.y (struct local_vars): remove unused nofree member from
struct.

* parse.y (parser_free): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-24 07:05:48 +00:00
aamine dfd5c685c1 * parse.y (program): remove useless assignment to reduce warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-24 06:51:59 +00:00
matz b2035db684 * parse.y (lambda): remove unused clause from the rule to stop
warning.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-24 06:48:05 +00:00
ko1 0fe72040e4 * parse.y, node.h, compile.c: change node tree structure. a purpose
of this change is to unify argument structure of method and block.
  this change prohibits duplicate block parameter name.
  new argument infromation:
  NODE_ARGS     [m: int, o: NODE_OPT_ARG, ->]
  NODE_ARGS_AUX [r: ID, b: ID, ->]
  NODE_ARGS_AUX [Pst: id, Plen: int, init: NODE*]
  optarg information:
  NODE_OPT_ARGS [idx, expr, ->]
* vm_macro.def: ditto.
* gc.c: ditto.
* iseq.c: ditto.
* compile.h: fix debug function name.
* test/ripper/test_scanner_events.rb: |_,_,foo| -> |_1,_2,foo|
* test/ruby/test_lambda.rb: disalbe test temporarily.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-24 02:07:05 +00:00
aamine 67c94cae96 * parse.y (lambda): add ripper event. This fixes bus error on "make test-all".
* ext/ripper/extconf.rb: do not stop build.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-23 03:25:26 +00:00
matz 606734f0b1 * parse.y: remove dyna_check_gen() prototype.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11814 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-23 03:16:57 +00:00
matz b83ed6d1bd * parse.y, compile.c, gc.c, insns.def, intern.h, iseq.c, node.h,
object.c, string.c, variable.c, vm_macro.def: revert private
  instance variable feature, which is postponed until next major
  release.

* marshal.c: TYPE_SYMBOL2 removed; MARSHAL_MINOR reverted back to
  8th version.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-23 02:49:41 +00:00
matz 163163afdf * parse.y (mrhs): need to append by arg_append().
[ruby-talk:239385]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-16 10:58:04 +00:00
matz 3e874eae07 * parse.y (struct local_vars): no need to warn out-of-scope
variables; remove dnames member from struct.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-13 23:44:26 +00:00
matz 66a26a2367 * parse.y: RVarmap no longer used as yytype; removed.
* parse.y (dyna_push_gen): no longer need return value.

* parse.y (dyna_pop_gen): no longer need argument.

* parse.y (local_push_gen): initialize nofree.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-13 23:41:44 +00:00
ko1 44aef0b53f * this commit is a result of refactoring. only renaming functions,
moving definitions place, add/remove prototypes, deleting
  unused variables and removing yarv.h.
  This commit doesn't change any behavior of ruby/vm.
* yarv.h, common.mk: remove yarv.h (contents are moved to yarvcore.h).
* error.c, eval_intern.h: include yarvcore.h instead yarv.h
* rename some functions:
  * debug.[ch]: debug_*() -> ruby_debug_*()
  * iseq.c: iseq_*() -> rb_iseq_*(), ruby_iseq_disasm()
  * iseq.c: node_name() -> ruby_node_name()
  * vm.c: yarv_check_redefinition_opt_method() ->
    rb_vm_check_redefinition_opt_method()
* some refactoring with checking -Wall.
* array.c: remove rb_ary_ptr() (unused) and remove unused
  local variables.
* object.c: add a prototype of rb_mod_module_exec().
* eval_intern.h (ruby_cref): set it inline.
* eval_load.c (rb_load), yarvcore.c: yarv_load() -> rb_load_internal().
* parse.y: add a prototype of rb_parse_in_eval() (in eval.c).
* process.c: add a prototype of rb_thread_stop_timer_thread() (in thread.c).
* thread.c: remove raw_gets() function (unused) and fix some format
  mismatch (format mismatchs have remained yet. this is todo).
* thread.c (rb_thread_wait_fd_rw): fix typo on label name.
* thread_pthread.ci: comment out codes with USE_THREAD_CACHE.
* vm.c (rb_svar, rb_backref_get, rb_backref_get,
  rb_lastline_get, rb_lastline_set) : moved from yarvcore.c.
* vm.c (yarv_init_redefined_flag): add a prototype and rename
  yarv_opt_method_table to vm_opt_method_table.
* vm.c (rb_thread_eval): moved from yarvcore.c.
* yarvcore.c: remove unused global variables and fix to use nsdr().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-07 01:25:05 +00:00
ko1 42ce75cdff * compile.c, insns.def: remove (get|set)instancevariable2 and add a
operand is_local to (get|set)instancevariable.
* yarvtest/test_class.rb: add a test for class local instance variable.
* parse.y (rb_decompose_ivar2): remove unused variable oid.
* tool/insns2vm.rb: remove needless require.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 05:22:17 +00:00
matz 72f2d2a00d * parse.y (rb_compose_ivar2): function to create a new ivar2
symbol from a symbol and a class.  back-ported from matzruby.

* parse.y (rb_decompose_ivar2): reverse function of
  rb_compose_ivar2(). 

* marshal.c (w_symbol): support class local instance variables.

* marshal.c (r_object0): ditto.

* compile.c (defined_expr): ditto.

* compile.c (iseq_compile_each): ditto.

* insns.def: add two new instructions: getinstancevariable2 and
  setinstancevariable2.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11630 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-04 19:17:33 +00:00
nobu 205f310c29 * call_cfunc.ci, compile.c, compile.h, debug.h, eval.c,
eval_error.h, eval_jump.h, eval_load.c, eval_thread.c, gc.c,
  insnhelper.h, insns.def, iseq.c, main.c, numeric.c, parse.y,
  range.c, regenc.h, ruby.h, signal.c, thread.c, thread_win32.ci,
  vm.c, vm.h, vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
  fixed indents and non-C90 comments.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-02 16:26:04 +00:00
matz 6e0fed271c * ruby.h (SYMBOL_P): make Symbol immediate again for performance.
* string.c: redesign symbol methods.

* parse.y (rb_id2str): store Strings for operator symbols.
  [ruby-dev:30235]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-02 13:19:44 +00:00
matz 0abfa1c532 * parse.y (assignable_gen): no need to generate NODE_CVDECL.
* compile.c (iseq_compile_each): no NODE_CVDECL.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-02 10:24:06 +00:00
ko1 a3e1b1ce7e * Merge YARV
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-12-31 15:02:22 +00:00
matz 862e723d03 * eval.c (svalue_to_avalue): need to splat but no error.
* eval.c: new macros - YIELD_CALL, YIELD_VALUES.

* eval.c (rb_yield_values): specify YIELD_VALUES.

* eval.c (rb_yield_0): use new macros.

* eval.c (proc_invoke): slightly modified to separate YIELD_CALL
  and YIELD_VALUES from YIELD_ARY_ARGS.

* object.c (Init_Object): add nil.to_splat => [].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11284 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-11-06 10:27:59 +00:00
matz 6d32246b31 * parse.y (arg_dup_check): vid may be nameless internal id.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-11-06 06:37:40 +00:00
nobu c85347f8b1 * parse.y (parser_yylex): use particular enums. [ruby-core:09221]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-17 15:56:28 +00:00
matz c6effd0182 * parse.y (singleton): no need to re-create NODE_SELF() again.
[ruby-core:09177]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-14 14:46:16 +00:00
matz 41f3f0eb66 * parse.y (parser_warning, parser_warn): some error message may
contain format specifiers.  a patch from Akinori MUSHA <knu at
  iDaemons.org>.  [ruby-dev:29657]

* regparse.c (onig_rb_warning, onig_rb_warn): ditto.

* ext/bigdecimal/bigdecimal.c (VpException): ditto.

* ext/dl/handle.c (rb_dlhandle_initialize): ditto.

* ext/gdbm/gdbm.c (rb_gdbm_fatal): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-14 14:33:10 +00:00
matz 2d09685150 * eval.c (rb_yield_0): small refactoring.
* parse.y (bparam_item): fixed bugs in handling parenthesized LHS.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-05 22:32:04 +00:00
matz ffedafffba * parse.y (block_param): should interpret single parenthesized
left hand side expression.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-04 07:17:16 +00:00
matz c4e5ec23d3 * parse.y (block_param): restrict block parameters to be local
variables only.

* test/ruby/test_iterator.rb (TestIterator::test_nested_iterator):
  update test suite to conform the last change.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-03 15:59:45 +00:00
matz eebdfca0b2 * parse.y (mlhs): simplifies the rule a bit.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-03 15:58:17 +00:00
matz c8d3d9ed3d * parse.y (dyna_in_block): inline using macro.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-03 15:09:12 +00:00
matz 5cc2093ccd * hash.c (recursive_hash): remove unused local variable.
* parse.y (parser_yylex): ditto.

* parse.y (rb_gc_mark_symbols): fix unmatched prototype .

* file.c (rb_get_path): check NUL byte in the path string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-25 05:57:37 +00:00
matz 23d2c8b624 * string.c (rb_str_intern): raise SecurityError only when $SAFE
level is greater than zero.  [ruby-core:08862]

* parse.y (rb_interned_p): new function to check if a string is
  already interned.

* string.c (str_to_id): use rb_str_intern().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-14 07:27:14 +00:00
matz 301c9f1265 * parse.y (symbols_i): need to initialize early-created symbols.
[ruby-dev:29496]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-06 04:25:53 +00:00
matz 9e0a2170fd * parse.y (rb_id2sym): intern if id is attrset_id.
[ruby-dev:29420] [ruby-dev:29447]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-04 05:57:35 +00:00
matz ccf5372b25 * object.c (Init_Object): move symbol related code to string.c
* string.c (Init_String): Symbol as subclass of String.

* parse.y (rb_intern2): handle symbol as strings.

* string.c (str_new): substring of symbols are mere strings, not
  symbols.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-02 15:05:27 +00:00
matz 8581164ea6 * eval.c (rb_eval): should handle when in else clause. a patch
from Eric Hodel <drbrain at segment7.net>.  [ruby-core:08662]

* parse.y (primary): wrap with NODE_CASE.  [ruby-core:08663]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-02 14:36:22 +00:00
matz 54af80844f * ruby.h (struct RString): embed small strings.
(RSTRING_LEN): defined for accessing string members.
  (RSTRING_PTR): ditto.

* string.c: use RSTRING_LEN and RSTRING_PTR.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-31 10:47:44 +00:00
drbrain 657b626899 Revert.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-28 02:33:04 +00:00
drbrain 6e83a71d3b Include attribution
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-27 23:03:20 +00:00
nobu 41066ad0b7 * parse.y (arg): allow newlines before ternary colon. [ruby-dev:29189]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-08 03:28:58 +00:00
matz 92077ee687 * parse.y (top_local_setup): local_vars[-1] should point
ruby_scope itself to protect local_tbl from garbage collection.
  [ruby-dev:29049]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-07 03:36:52 +00:00
matz ead9b197be * parse.y (f_args): allow post mandatory arguments after optional
arguments.  [ruby-dev:29014]

* parse.y (new_args_gen): allow post_args without rest_args.

* eval.c (formal_assign): ditto.

* parse.y (new_args_gen): check post argument duplication.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-07-12 11:10:22 +00:00
matz 672549bb47 * eval.c (proc_invoke): should not overwrite block information in
current frame.  [ruby-dev:28957]

* eval.c (rb_yield_0): retrieve proper block object from the frame
  record.

* eval.c (proc_alloc): return preserved block object if it's
  available.

* st.h (st_data_t): use pointer sized integer for st_data_t.
  [ruby-dev:28988]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-07-10 01:08:15 +00:00
matz 4df2cb8053 * parse.y: use ARGSPUSH instead of ARGSCAT to prevent too much
splat expansion.

* eval.c (when_check): need to handle ARGSPUSH as well.

* eval.c (block_orphan): lambda and proc from method are always
  orphan.

* gc.c (gc_mark_children): proper marking for NODE_BLOCK_PASS and
  NODE_LAMBDA.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-29 14:05:40 +00:00
matz b6630a375d * parse.y (primary): remove meaningless else-only case statement
syntax.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-28 00:23:57 +00:00
matz e5f2b421c0 * ext/socket/socket.c (sock_accept): revert to avoid ambiguity of
argument evaluation order.  [ruby-dev:28861]

* ext/socket/socket.c (sock_accept_nonblock): ditto.

* io.c (pipe_open): avoid closing uninitialized file descriptors.
  a patch from <tommy at tmtm.org> [ruby-dev:28600]

* parse.y: replace terminal token names with more descriptive
  name, i.e. kEND to keyword_end.  [ruby-list:42477]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-26 14:15:49 +00:00
akr 6143716587 * parse.y (paren_args): wrap $2 by escape_Qundef because it may be
Qundef.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-25 08:45:44 +00:00
matz 2ca2a4a43b * parse.y (block_param): do not use multiple assignment for a sole
block parameter.  [ruby-dev:28710]

* eval.c (rb_yield_0): pass a raw yielded value to a sole block
  parameter if a value is passed by yield.

* eval.c (proc_invoke): args may not be an array.

* eval.c (rb_proc_yield): pass original value without wrapping
  it in an array.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-21 08:08:36 +00:00
matz 7b5d9d7086 * parse.y (method_call): remove (fn)(args) style lambda
invocation, add fn.(args) instead.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-21 05:13:48 +00:00
nobu e394fed724 * parse.y (reswords): modifier token is no longer returned in fname
state.  fixed: [ruby-dev:28775]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-20 16:40:35 +00:00
matz 7b48490222 * eval.c (Init_eval): add aliases invoke_method and
invoke_functional_method corresponding send and funcall
  respectively.  [ruby-talk:197512]

* parse.y (parser_yylex): returns the most typical keyword token
  on EXPR_FNAME.  [ruby-core:7995]

* ext/socket/socket.c: protoize.

* parse.y (then): remove ':' from 'then' and 'do' rules.

* hash.c (env_aset): raise TypeError on nil with more descriptive
  message.  [ruby-core:07990]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-17 14:50:04 +00:00
nobu 9d07029049 * parse.y (reswords): kDO_BLOCK was missing. fixed: [ruby-core:7995]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-16 15:24:40 +00:00
matz d1a5aa5685 * ext/bigdecimal/lib/bigdecimal/newton.rb (Newton::nlsolve): typo
fixed: raize -> raise.  [ruby-talk:196608]

* string.c (rb_str_ord): new method.

* parse.y (rbracket): allow optional newline before closing
  brackets.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-10 16:09:12 +00:00
nobu 3e5f70a815 * math.c (log2): may be a macro.
* parse.y (args, block_param, f_args): pass f_post_arg to #params.

* util.c (powersOf10): constified.

* ext/readline/readline.c: include extconf.h first.

* ext/ripper/eventids2.c: removed tLAMBDA_ARG.

* ext/tk/tcltklib.c (lib_fromUTF8_core): removed conflict.

* ext/tk/tkutil/tkutil.c (cbsubst_get_subst_arg): rb_id2name() is
  defined as const now.

* ext/win32ole/win32ole.c (fole_missing): ditto.

* lib/mkmf.rb (create_makefile): force to create extconf header.

* lib/optparse.rb (order!): use Proc#yield.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-09 23:18:04 +00:00
matz 9b383bd6cf * sprintf.c (rb_str_format): allow %c to print one character
string (e.g. ?x).

* lib/tempfile.rb (Tempfile::make_tmpname): put dot between
  basename and pid.  [ruby-talk:196272]
* parse.y (do_block): remove -> style block.

* parse.y (parser_yylex): remove tLAMBDA_ARG.

* eval.c (rb_call0): binding for the return event hook should have
  consistent scope.  [ruby-core:07928]

* eval.c (proc_invoke): return behavior should depend whether it
  is surrounded by a lambda or a mere block.

* eval.c (formal_assign): handles post splat arguments.

* eval.c (rb_call0): ditto.

* st.c (strhash): use FNV-1a hash.

* parse.y (parser_yylex): removed experimental ';;' terminator.

* eval.c (rb_node_arity): should be aware of post splat arguments.

* eval.c (rb_proc_arity): ditto.

* parse.y (f_args): syntax rule enhanced to support arguments
  after the splat.

* parse.y (block_param): ditto for block parameters.

* parse.y (f_post_arg): mandatory formal arguments after the splat
  argument.

* parse.y (new_args_gen): generate nodes for mandatory formal
  arguments after the splat argument.

* eval.c (rb_eval): dispatch mandatory formal arguments after the
  splat argument.

* parse.y (args): allow more than one splat in the argument list.

* parse.y (method_call): allow aref [] to accept all kind of
  method argument, including assocs, splat, and block argument.

* eval.c (SETUP_ARGS0): prepare block argument as well.

* lib/mathn.rb (Integer): remove Integer#gcd2. [ruby-core:07931]

* eval.c (error_line): print receivers true/false/nil specially.

* eval.c (rb_proc_yield): handles parameters in yield semantics.

* eval.c (nil_yield): gives LocalJumpError to denote no block
  error.

* io.c (rb_io_getc): now takes one-character string.

* string.c (rb_str_hash): use FNV-1a hash from Fowler/Noll/Vo
  hashing algorithm.

* string.c (rb_str_aref): str[0] now returns 1 character string,
  instead of a fixnum.	[Ruby2]

* parse.y (parser_yylex): ?c now returns 1 character string,
  instead of a fixnum.	[Ruby2]

* string.c (rb_str_aset): no longer support fixnum insertion.

* eval.c (umethod_bind): should not update original class.
  [ruby-dev:28636]

* eval.c (ev_const_get): should support constant access from
  within instance_eval().  [ruby-dev:28327]

* time.c (time_timeval): should round for usec floating
  number.  [ruby-core:07896]

* time.c (time_add): ditto.

* dir.c (sys_warning): should not call a vararg function
  rb_sys_warning() indirectly.	[ruby-core:07886]

* numeric.c (flo_divmod): the first element of Float#divmod should
  be an integer. [ruby-dev:28589]

* test/ruby/test_float.rb: add tests for divmod, div, modulo and remainder.

* re.c (rb_reg_initialize): should not allow modifying literal
  regexps.  frozen check moved from rb_reg_initialize_m as well.

* re.c (rb_reg_initialize): should not modify untainted objects in
  safe levels higher than 3.

* re.c (rb_memcmp): type change from char* to const void*.

* dir.c (dir_close): should not close untainted dir stream.

* dir.c (GetDIR): add tainted/frozen check for each dir operation.

* lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_symbol_arg):
  typo fixed.  a patch from Florian Gross <florg at florg.net>.

* eval.c (EXEC_EVENT_HOOK): trace_func may remove itself from
  event_hooks.	no guarantee for arbitrary hook deletion.
  [ruby-dev:28632]

* util.c (ruby_strtod): differ addition to minimize error.
  [ruby-dev:28619]

* util.c (ruby_strtod): should not raise ERANGE when the input
  string does not have any digits.  [ruby-dev:28629]

* eval.c (proc_invoke): should restore old ruby_frame->block.
  thanks to ts <decoux at moulon.inra.fr>.  [ruby-core:07833]
  also fix [ruby-dev:28614] as well.

* signal.c (trap): sig should be less then NSIG.  Coverity found
  this bug.  a patch from Kevin Tew <tewk at tewk.com>.
  [ruby-core:07823]

* math.c (math_log2): add new method inspired by
  [ruby-talk:191237].

* math.c (math_log): add optional base argument to Math::log().
  [ruby-talk:191308]

* ext/syck/emitter.c (syck_scan_scalar): avoid accessing
  uninitialized array element.	a patch from Pat Eyler
  <rubypate at gmail.com>.  [ruby-core:07809]

* array.c (rb_ary_fill): initialize local variables first.  a
  patch from Pat Eyler <rubypate at gmail.com>.	 [ruby-core:07810]

* ext/syck/yaml2byte.c (syck_yaml2byte_handler): need to free
  type_tag.  a patch from Pat Eyler <rubypate at gmail.com>.
  [ruby-core:07808]

* ext/socket/socket.c (make_hostent_internal): accept ai_family
  check from Sam Roberts <sroberts at uniserve.com>.
  [ruby-core:07691]

* util.c (ruby_strtod): should not cut off 18 digits for no
  reason.  [ruby-core:07796]

* array.c (rb_ary_fill): internalize local variable "beg" to
  pacify Coverity.  [ruby-core:07770]

* pack.c (pack_unpack): now supports CRLF newlines.  a patch from
  <tommy at tmtm.org>.	[ruby-dev:28601]

* applied code clean-up patch from Stefan Huehner
  <stefan at huehner.org>.  [ruby-core:07764]

* lib/jcode.rb (String::tr_s): should have translated non
  squeezing character sequence (i.e. a character) as well.  thanks
  to Hiroshi Ichikawa <gimite at gimite.ddo.jp> [ruby-list:42090]

* ext/socket/socket.c: document update patch from Sam Roberts
  <sroberts at uniserve.com>.  [ruby-core:07701]

* lib/mathn.rb (Integer): need not to remove gcd2.  a patch from
  NARUSE, Yui <naruse at airemix.com>.	[ruby-dev:28570]

* parse.y (arg): too much NEW_LIST()

* eval.c (SETUP_ARGS0): remove unnecessary access to nd_alen.

* eval.c (rb_eval): use ARGSCAT for NODE_OP_ASGN1.
  [ruby-dev:28585]

* parse.y (arg): use NODE_ARGSCAT for placeholder.

* lib/getoptlong.rb (GetoptLong::get): RDoc update patch from
  mathew <meta at pobox.com>.  [ruby-core:07738]

* variable.c (rb_const_set): raise error when no target klass is
  supplied.  [ruby-dev:28582]

* prec.c (prec_prec_f): documentation patch from
  <gerardo.santana at gmail.com>.  [ruby-core:07689]

* bignum.c (rb_big_pow): second operand may be too big even if
  it's a Fixnum.  [ruby-talk:187984]

* README.EXT: update symbol description.  [ruby-talk:188104]

* COPYING: explicitly note GPLv2.  [ruby-talk:187922]

* parse.y: remove some obsolete syntax rules (unparenthesized
  method calls in argument list).

* eval.c (rb_call0): insecure calling should be checked for non
  NODE_SCOPE method invocations too.

* eval.c (rb_alias): should preserve the current safe level as
  well as method definition.

* process.c (rb_f_sleep): remove RDoc description about SIGALRM
  which is not valid on the current implementation. [ruby-dev:28464]

 Thu Mar 23 21:40:47 2006  K.Kosako  <sndgk393 AT ybb.ne.jp>

* eval.c (method_missing): should support argument splat in
  super.  a bug in combination of super, splat and
  method_missing.  [ruby-talk:185438]

* configure.in: Solaris SunPro compiler -rapth patch from
  <kuwa at labs.fujitsu.com>.  [ruby-dev:28443]

* configure.in: remove enable_rpath=no for Solaris.
  [ruby-dev:28440]

* ext/win32ole/win32ole.c (ole_val2olevariantdata): change behavior
  of converting  OLE Variant object with VT_ARRAY|VT_UI1 and Ruby
  String object.

* ruby.1: a clarification patch from David Lutterkort
  <dlutter at redhat.com>.  [ruby-core:7508]

* lib/rdoc/ri/ri_paths.rb (RI::Paths): adding paths from rubygems
  directories.	a patch from Eric Hodel <drbrain at segment7.net>.
  [ruby-core:07423]

* eval.c (rb_clear_cache_by_class): clearing wrong cache.

* ext/extmk.rb: use :remove_destination to install extension libraries
  to avoid SEGV.  [ruby-dev:28417]

* eval.c (rb_thread_fd_writable): should not re-schedule output
  from KILLED thread (must be error printing).

* array.c (rb_ary_flatten_bang): allow specifying recursion
  level.  [ruby-talk:182170]

* array.c (rb_ary_flatten): ditto.

* gc.c (add_heap): a heap_slots may overflow.  a patch from Stefan
  Weil <weil at mail.berlios.de>.

* eval.c (rb_call): use separate cache for fcall/vcall
  invocation.

* eval.c (rb_eval): NODE_FCALL, NODE_VCALL can call local
  functions.

* eval.c (rb_mod_local): a new method to specify newly added
  visibility "local".

* eval.c (search_method): search for local methods which are
  visible only from the current class.

* class.c (rb_class_local_methods): a method to list local methods.

* object.c (Init_Object): add BasicObject class as a top level
  BlankSlate class.

* ruby.h (SYM2ID): should not cast to signed long.
  [ruby-core:07414]

* class.c (rb_include_module): allow module duplication.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-09 21:20:17 +00:00
akr 2d80e59b76 unused variable removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-05-13 08:55:39 +00:00
kosako 6e154b9743 refactoring for options
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-03-26 13:04:13 +00:00
matz 2507699bb8 * parse.y (f_arglist): should set command_start = Qtrue for
command body.  [ruby-talk:180648]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-02-20 17:12:56 +00:00
matz 8f5278b525 * eval.c (rb_eval): NODE_OP_ASGN1 should allow splat in its
argument list.  [ruby-core:07366]

* parse.y (arg): avoid unnecessary extra argument.
  [ruby-core:07366]

* eval.c (rb_eval): honor visibility on OP_ASGN1 and
  OP_ASGN2. [ruby-core:07366]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-02-15 08:46:55 +00:00
matz 7f72360259 * parse.y (parser_parse_string): mention "regexp" in a error
message.  a patch from Mauricio Fernandez <mfp at acm.org>
  [ruby-core:07340]

* eval.c (rb_f_autoload): check if ruby_cbase is nil (during
  instance_eval for objects cannot have singleton classes,
  e.g. fixnums and symbols).  [ruby-dev:28178]

* gc.c (rb_gc_call_finalizer_at_exit): turn on during_gc while
  invoking finalizers.

* gc.c (rb_gc_finalize_deferred): ditto.

* io.c (rb_write_error2): use fwrite(3) if rb_stderr is not
  updated or is already freed.  [ruby-dev:28313]

* eval.c (error_line): include the class name of a surrounding
  method in error position description.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-02-13 04:53:22 +00:00
matz 5675cdbd41 * eval.c: unify ruby_class (for method definition) and ruby_cbase
(for constant reference).

* eval.c (rb_call0): use TMP_ALLOC() instead of allocating
  a temporary array object.

* eval.c (eval): need not to protect $SAFE value.
  [ruby-core:07177]

* error.c (Init_Exception): change NameError to direct subclass of
  Exception so that default rescue do not handle it silently.

* struct.c (rb_struct_select): update RDoc description.
  [ruby-core:7254]

* numeric.c (int_upto): return an enumerator if no block is
  attached to the method.

* numeric.c (int_downto): ditto.

* numeric.c (int_dotimes): ditto.

* enum.c (enum_first): new method Enumerable#first to take first n
  element from an enumerable.

* enum.c (enum_group_by): new method Enumerable#group_by that
  groups enumerable values according to their block values.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-02-03 09:15:42 +00:00
nobu b1860ba7dc * parse.y (singleton): get rid of segfault on syntax error.
fixed: [ruby-core:07070]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-01-07 06:41:24 +00:00