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

696 Коммитов

Автор SHA1 Сообщение Дата
knu 9bfc01ea17 * parse.y (debug_lines): Always prepare a new array for each
file's SCRIPT_LINES__ storage, instead of appending source lines
  every time a file is re-loaded; submitted by Rocky Bernstein in
  #18517.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-24 10:43:56 +00:00
nobu 91a761b4d0 * parse.y (literal_concat_gen): bail out at different encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-18 07:24:55 +00:00
matz 6c76a2577a * parse.y (parser_yylex): disallow non digits '0o' expression.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-04 07:29:38 +00:00
matz daa622aed0 * time.c (time_strftime): format should be ascii compatible.
* parse.y (rb_intern3): non ASCII compatible symbols.

* re.c (rb_reg_regsub): add encoding check.

* string.c (rb_str_chomp_bang): ditto.

* test/ruby/test_utf16.rb (TestUTF16::test_chomp): raises exception.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-29 09:19:15 +00:00
nobu d14c3eb4b8 * parse.y (opt_block_param): command can start just after block param
definition.  [ruby-list:44479]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-29 06:12:46 +00:00
nobu 43b1b0e16a * parse.y (value_expr_gen): removed inappropriate warning.
[ruby-core:15660]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-26 06:50:12 +00:00
akr fbee9ba6ea * parse.y (tokadd_escape): refactored. [ruby-core:15657]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-26 06:44:53 +00:00
matz 588d870234 * include/ruby/node.h (NODE_FL_NEWLINE): renamed from NODE_NEWLINE
to denote its a flag.  [ruby-core:15529]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-18 05:33:01 +00:00
naruse 7a257b0110 * encoding.c (ENC_CODERANGE_AND): added.
* string.c (rb_str_plus, srb_str_times): keep coderange.

* parse.y (STR_NEW0) use rb_usascii_str_new.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-17 06:49:11 +00:00
nobu 04e7cc6411 * parse.y (reg_compile_gen): reg_fragment_setenc might not raise an
exception before rb_reg_compile.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 00:44:13 +00:00
nobu 67d0ce36f5 * parse.y (reg_compile_gen): appends error message from
rb_reg_compile() to one from reg_fragment_setenc().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15475 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-14 14:56:40 +00:00
nobu 4660cc6fb9 * parse.y (stmt, arg): reverted r15450. [ruby-core:15526]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-12 19:15:46 +00:00
nobu 4aa1d12937 * parse.y (arg_append_gen): optimize only for array push.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-12 18:13:01 +00:00
nobu 552fa153f0 * parse.y (stmt, arg): concat opt_call_args only if non-null.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-12 16:27:22 +00:00
nobu 813fcf768e * parse.y (arg_concat_gen, arg_append_gen): optimize for array concat.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-12 16:26:47 +00:00
nobu 8a87655162 * parse.y (arg_add_gen): removed since identical to arg_append_gen.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-12 16:23:02 +00:00
nobu 55c4937048 * parse.y (exc_list): should use mrhs if non array.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-12 12:04:53 +00:00
nobu 7d4defbe1b * parse.y (exc_list): splat literal array.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-12 07:48:37 +00:00
nobu 126297de15 * parse.y (args, mrhs): flattens literal array splats.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-12 07:18:49 +00:00
matz 38694016bc * string.c (rb_str_hash_cmp): lighter version of rb_str_cmp() for
hash comparison function.

* hash.c (rb_any_cmp): use rb_str_hash_cmp().

* string.c (rb_str_casecmp): should return nil for incompatible
  comparison.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-12 03:17:43 +00:00
matz 0472db84c5 * range.c (range_include): specialize single character string
case (e.g. (?a ..?z).include(?x)) for performance.
  [ruby-core:15481]

* string.c (rb_str_upto): specialize single character case.

* string.c (rb_str_hash): omit coderange scan for performance.

* object.c (rb_check_to_integer): check Fixnum first.

* object.c (rb_to_integer): ditto.

* string.c (rb_str_equal): inline memcmp to avoid unnecessary
  rb_str_comparable(). 

* parse.y (rb_intern2): use US-ASCII encoding.

* parse.y (rb_intern_str): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-11 17:46:52 +00:00
nobu d739fc5a77 * trunk/parse.y (rb_enc_symname2_p): support "!", "!=" and "!~".
[ruby-dev:33592]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-04 05:51:21 +00:00
matz dd7bcfc072 * parse.y (dsym): allow empty symbols. [ruby-core:15248]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-30 17:20:48 +00:00
usa 34387d1a02 * parse.y (reg_fragment_setenc_gen): US-ASCII script special code.
* parse.y (reg_fragment_check_len, reg_compile_gen): no need such
	  trick.
	  [ruby-dev:33399]

	* test/ruby/test_m17n.rb (test_regexp_usacii_literal): add tests.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-28 18:04:39 +00:00
naruse 4d961eb8a6 * parse.y (rb_id2str, ripper_initialize, Init_ripper): use rb_usascii_str_new2.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-28 14:51:23 +00:00
naruse 3c6969ec11 * string.c, parse.y, re.c: use rb_ascii8bit_encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-28 09:03:09 +00:00
usa 4a94863244 * parse.y (parser_str_new): encoding of UTF-8 literal string in
US-ASCII script is UTF-8. [ruby-dev:33406]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-28 02:26:23 +00:00
nobu 7c69f166bd * parse.y (parser_set_encode): check if encoding is ASCII compatible.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-27 15:39:14 +00:00
akr fc208c1bd5 * include/ruby/oniguruma.h: precise mbclen API redesigned to avoid
inline functions.
  (onigenc_mbclen_charfound): removed.
  (onigenc_mbclen_needmore): removed.
  (onigenc_mbclen_recover): removed.
  (ONIGENC_MBCLEN_CHARFOUND): removed.
  (ONIGENC_MBCLEN_CHARFOUND_P): defined.
  (ONIGENC_MBCLEN_CHARFOUND_LEN): defined.
  (ONIGENC_MBCLEN_INVALID): removed.
  (ONIGENC_MBCLEN_INVALID_P): defined.
  (ONIGENC_MBCLEN_NEEDMORE): removed.
  (ONIGENC_MBCLEN_NEEDMORE_P): defined.
  (ONIGENC_MBCLEN_NEEDMORE_LEN): defined.
  (ONIGENC_MBC_ENC_LEN): use onigenc_mbclen_approximate.

* regenc.c (onigenc_mbclen_approximate): defined.

* include/ruby/encoding.h (MBCLEN_CHARFOUND): removed.
  (MBCLEN_INVALID): removed.
  (MBCLEN_NEEDMORE): removed.
  (MBCLEN_CHARFOUND_P): defined.
  (MBCLEN_INVALID_P): defined.
  (MBCLEN_NEEDMORE_P): defined.
  (MBCLEN_CHARFOUND_LEN): defined.
  (MBCLEN_NEEDMORE_LEN): defined.

* encoding.c: use new API.

* re.c: ditto.

* string.c: ditto.

* parse.y: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-27 14:27:07 +00:00
nobu 526ab1f0d1 * parse.y (value_expr_gen): reverted r12880. [ruby-dev:33388]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-27 13:55:29 +00:00
nobu 259526006e * parse.y (assignable_gen, keyword_to_name): __ENCODING__ was missing.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-26 14:42:17 +00:00
usa 2160c40fb2 * parse.y (parser_initialize): set default script encoding as US-ASCII.
* ruby.c (load_file): ditto.

	* ruby.c (process_options): set script encoding of -e from locale
	  except when -K is specified.

	* ruby.c (load_file): set script encoding of stdin from locale except
	  when -K is specified. [ruby-dev:33375]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-25 18:49:28 +00:00
akr 14b9d47ae0 * parse.y (reg_fragment_setenc_gen): associate ASCII-8BIT only if
str has only ASCII characters.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-24 13:11:00 +00:00
usa 439fab8459 * parser.y (parser_str_new): automatically update string literal's
encoding from US-ASCII to ASCII-8BIT when script encoding is US-ASCII
	  and the string includes non-ascii bytes. [ruby-dev:33348]

	* parser.y (reg_fragment_check_gen, reg_compile_gen): automatically
	  update regexp literal's encoding from US-ASCII to ASCII-8BIT when
	  script encoding is US-ASCII, the regexp has no kcode option and the
	  regexp includes non-ascii bytes. [ruby-dev:33353]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-24 11:43:40 +00:00
usa e36dd52291 * parse.y (reg_fragment_setenc_gen): recognize regexp with option n as
as ASCII-8BIT instead of US-ASCII. [ruby-dev:33339]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-24 07:25:46 +00:00
naruse e336136d8a * parse.y (STR_NEW0): set encoding as US-ASCII.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-23 22:35:27 +00:00
naruse 5e3bb6c3ae * parse.y (parser_str_new, rb_intern3): ascii only string literal is US-ASCII.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-23 16:05:57 +00:00
matz 56be84e293 * parse.y (rb_intern3): do not call rb_enc_mbclen() if *m is
ASCII.  [ruby-talk:287225]

* string.c (rb_str_each_line): use rb_enc_is_newline() to gain
  performance if the record separator ($/) is not modified.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-21 19:47:26 +00:00
naruse 54a230bf7a * common.mk: use -Ks when read insns.def. [ruby-dev#33185]
* parse.y: fix -e and stdin strings aren't set encoding.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-20 00:15:20 +00:00
nobu 9872d4d600 * parse.y (parser_prepare): get encoding from the first line.
[ruby-dev:33168]

* ruby.c (load_file): set encoding to input with set_encoding.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-18 23:35:38 +00:00
usa 956666cf5a * parse.y (ripper_initialize): too early to set parser->enc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-18 11:20:30 +00:00
matz 15baeee701 * parse.y (ripper_initialize): move parser->enc initialization.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-18 00:38:44 +00:00
matz 231ab57f6f * parse.y (parser_initialize): explicitly call rb_ascii8bit_encoding().
* parse.y (parser_prepare): lex_input may not be have encoding (e.g. IO).

* parse.y (rb_parser_compile_string): set encoding from input string. 

* encoding.c (rb_enc_find_index): use ASCII-8BIT if loading known
  encoding failed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-18 00:23:18 +00:00
usa ff1cd79d08 * parse.y (yycompile0): remove setting parser->enc because it is set
in parser_prepare() by previous change of parser_prepare().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-09 05:57:29 +00:00
usa 3f2d1892df * parse.y (parser_prepare): set parser->enc from lex_input for ripper.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-09 05:46:35 +00:00
akr 063beac343 * encoding.c (rb_enc_internal_get_index): extracted from
rb_enc_get_index.
  (rb_enc_internal_set_index): extracted from rb_enc_associate_index

* include/ruby/encoding.h (ENCODING_SET): work over ENCODING_INLINE_MAX.
  (ENCODING_GET): ditto.
  (ENCODING_IS_ASCII8BIT): defined.
  (ENCODING_CODERANGE_SET): defined.

* re.c (rb_reg_fixed_encoding_p): use ENCODING_IS_ASCII8BIT.

* string.c (rb_enc_str_buf_cat): use ENCODING_IS_ASCII8BIT.

* parse.y (reg_fragment_setenc_gen): use ENCODING_IS_ASCII8BIT.

* marshal.c (has_ivars): use ENCODING_IS_ASCII8BIT.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-07 02:49:01 +00:00
akr 6cdef2dc7e * $Date$ keyword removed to avoid inclusion of locale dependent
string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-06 15:49:38 +00:00
akr 9eab58ee03 * include/ruby/ruby.h (rb_intern): memorize interned ID for constant
string, using gcc's __builtin_constant_p and statement expression.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-04 17:21:53 +00:00
akr df4f37bca3 * parse.y (parser_magic_comment): use STRNCASECMP.
(set_file_encoding): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-03 05:37:47 +00:00
nobu b75c2a939d * parse.y (program, yycompile0): too early to drop lex_lastline in
rules.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-30 12:54:29 +00:00