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

572 Коммитов

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