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

588 Коммитов

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