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

619 Коммитов

Автор SHA1 Сообщение Дата
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