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

1153 Коммитов

Автор SHA1 Сообщение Дата
nobu ae32e9a225 parse.y: debugging stuff
* parse.y (lex_state_name): returns name for lex_state_e, for debug
  use.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-10 01:18:27 +00:00
nobu 9cf2170e78 * parse.y (parser_yylex): allow spaces between lambda arrow and
parenthesis.  [ruby-dev:45605][Feature #6390]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-02 14:21:23 +00:00
nobu 3380974143 * parse.y (assoc, parser_yylex): add syntax to splat keyword hash.
[ruby-core:44591][Feature #6353]
* compile.c (compile_array_): generate keyword splat insns.
* vm.c (m_core_hash_merge_kwd): merge keyword hash into intermediate
  hash.  leftward argument is prior currently.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35489 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-28 21:12:05 +00:00
nobu 5f34227718 * parse.y (parser_yylex): EXPR_BEG by keywords is a start point of
commands.  [ruby-dev:45563][Bug #6347]
* parse.y (superclass): ditto for superclass.
* parse.y (parser_parse_string, parser_here_document): ditto for
  string interpolation.
* parse.y (parser_yylex): ditto for singleton class.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-24 07:04:41 +00:00
mame 563762f6c5 * parse.y (primary): remove wrong "fixpos" that caused incorrect
source_location of blocks.  [ruby-core:42232] [Bug #5930]

* test/ruby/test_proc.rb: add a test for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-23 15:23:41 +00:00
ko1 ee7f8d4805 * compile.c (compile_array, compile_array_):
Divide big array (or hash) literals into several blocks and
  concatetene them.  There was a problem that a big array (hash)
  literal causes SystemStackError exception (stack overflow)
  because VM push all contents of the literal onto VM stack to
  make an array (or hash).  To solve this issue, we make several
  arrays (hashes) and concatenate them to make a big array (hash)
  object.
  ??
* compile.c (iseq_compile_each, setup_args): use modified
  compile_array.
* vm.c (m_core_hash_from_ary, m_core_hash_merge_ary,
  m_core_hash_merge_ptr): added for above change.
* id.c (Init_id), parse.y: add core method ids.
* bootstraptest/test_literal.rb: add simple tests.
* bootstraptest/test_eval.rb: remove rescue clause to catch
  SystemStackError exception.
* test/ruby/test_literal.rb: add tests to check no stack overflow.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-12 01:33:34 +00:00
nobu db5265a82c * parse.y (rb_check_id_cstr): new function to check if ID is
registered with NUL-terminated C string.
* sprintf.c (rb_str_format): avoid inadvertent symbol creation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-11 13:31:23 +00:00
nobu 41c199130a * parse.y (string_content, parser_yylex): count brace nesting to
dispatch embexpr_end.  [ruby-core:43775][Bug #6211]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-09 06:16:07 +00:00
nobu 7af3e9f08b fix unreachable warning line number
* parse.y (block_append_gen): fix unreachable warning line number.
  should warn at the code, not jump.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-16 08:42:16 +00:00
nobu bf87ec4eb9 * parse.y (parser_yylex): fix warning line number.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-15 06:37:46 +00:00
nobu 375aedbfb4 * parse.y (sym_check_asciionly): check ascii compatibility before
scanning for code range.
* parse.y (intern_str): set to us-ascii if ascii only.
  [ruby-dev:45363][Bug #6146]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-15 06:04:44 +00:00
nobu 08d81f2683 fix ripper
* parse.y (new_args_gen, new_args_tail_gen): fix ripper.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-13 15:26:03 +00:00
nobu 8fe3fb4c0f * compile.c (iseq_set_arguments): keyword rest arg without keyword args.
* node.c (dump_node): dump kw_rest_arg too.
* parse.y (block_param, f_arg): more kwrest patterns.
  [ruby-core:42455][Bug #5989]
* parse.y (new_args_gen): no extra kw_rest_arg if no keyword rest arg.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-13 13:00:17 +00:00
nobu d6a977f667 * parse.y (block_param, f_args): add rules for the case arguments
begin with kwrest.  [ruby-core:42455][Bug #5989]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-13 06:17:08 +00:00
nobu c5feeb9ac1 * node.h (NEW_YIELD), parse.y (new_yield_gen): array-values flags
has been already obsolete.  patch by Thomas Enebo.
  [ruby-core:41929][Bug #5847]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-12 05:56:57 +00:00
nobu bc6dde9420 * parse.y (parser_tokadd_string): escape simple regexp meta
character termninators.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-06 07:24:07 +00:00
nobu c46bdadb84 * parse.y (block_call): rules for block_call after block_call.
based on a patch by pasberth https://github.com/ruby/ruby/pull/102
  [ruby-dev:45308][Bug #6115]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-05 16:34:21 +00:00
nobu 45f3651d1c * parse.y (block_command, block_call): simplified rules.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-05 16:24:15 +00:00
nobu 68a16f9a2d * parse.y (parser_tokadd_string): regexp engine doesn't need
terminators to be escaped.  [ruby-core:40364][Bug #5484]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-04 14:21:13 +00:00
matz f3e1c29b24 * parse.y (opt_bv_decl): allow newline at the end. [ruby-dev:45292]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-27 14:47:02 +00:00
nobu 785521bd51 * parse.y (parser_tokadd_string): insert a backslash only if
quoted by single quotes.  [ruby-dev:45281] [Bug #6069]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-24 22:54:00 +00:00
nobu 45c6daeed7 * parse.y (parser_tokadd_string, parser_yylex): insert a backslash
if the next character is non-ascii.  [ruby-dev:45278] [Bug #6069]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-23 23:52:12 +00:00
mame 8107587039 * parse.y (debug_lines, coverage): set file path encoding for coverage
result.  [ruby-dev:44950]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-01 16:28:14 +00:00
nobu bb19bcf93e * parse.y (rb_intern3): split to registration check and new
registration.
* parse.y (rb_intern_str): make interned string shared with the
  given string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-22 06:41:29 +00:00
nobu f1dc132b41 * parse.y (rb_intern3, rb_intern_str): check the coderange first.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-22 06:23:38 +00:00
nobu 731e45216a * node.h (rb_args_info): change pre_args_num and post_args_num as
int, to match with rb_iseq_t.
* parse.y (new_args_gen): check overflow.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-27 12:17:36 +00:00
mame 1ab3974b0e * node.h, node.c, parse.y: implement a parser part for keyword arguments. This is a preparation for keyword argument (see [ruby-core:40290]).
* gc.c (gc_mark_children): bookkeeping.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34135 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-26 14:20:03 +00:00
mame afb10c62c2 * node.h, parse.y (new_args_gen), compile.c (iseq_set_arguments): use struct rb_args_info instead of NODEs. This is a preparation for keyword argument (see [ruby-core:40290]).
* node.c (dump_node), gc.c (gc_mark_children, obj_free): bookkeeping.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-26 14:19:58 +00:00
mame 90b1afa310 * node.h, parse.y (lambda, f_larglist): remove NEW_LAMBDA hack. This is a preparation for keyword argument (see [ruby-core:40290]).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-26 14:19:52 +00:00
nobu d62f56b041 * parse.y (primary): point method name line. [ruby-core:40936]
[Bug #5614]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-13 15:01:20 +00:00
nobu 0f9662f366 * parse.y (parser_magic_comment): should pass the proper value.
[ruby-dev:44984][Bug #5753]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-12 21:29:53 +00:00
shugo 900b4a6db6 * parse.y (stmt_or_begin): changed the error message for BEGIN not
at toplevel.  [ruby-dev:44963] [Bug #5738]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-12 13:43:56 +00:00
nobu b526738c3b * bignum.c (big_rshift), compile.c (validate_label,
iseq_build_from_ary_exception), cont.c (cont_capture), dir.c
  (dir_open_dir), gc.c (objspace_each_objects), io.c (pipe_open)
  (rb_io_advise), parse.y (parser_compile_string)
  (rb_parser_compile_file), proc.c (binding_free), process.c
  (rb_proc_exec_n, rb_seteuid_core, proc_setegid, rb_setegid_core)
  (p_uid_exchange, p_gid_exchange), regparse.c (strdup_with_null),
  signal.c (sig_dfl), vm.c (rb_iseq_eval, rb_iseq_eval_main),
  vm_insnhelper.c (vm_expandarray): suppress
  unused-but-set-variable warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-05 09:57:00 +00:00
nobu 4659b00b9a * parse.y (nodetype, nodeline): suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-29 00:51:37 +00:00
usa 4d6de2f7c4 * parse.y (nodetype, nodeline): static. these functions are for
debugging, and not intend to be public.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33883 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-28 03:49:00 +00:00
naruse 615d5068d2 * parse.y (parser_nextc): set encoding for the buffer of ripper.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-28 02:30:22 +00:00
nobu 560a6c6ffa * ext/ripper/eventids2.c (ripper_init_eventids2): separate
initializations of IDs and objects.
* ext/ripper/tools/generate.rb (generate_eventids1): ditto.
* parse.y (Init_ripper, InitVM_ripper): fix inversed roles.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-18 14:05:51 +00:00
nobu 8e6e8e6288 * use RB_TYPE_P which is optimized for constant types, instead of
comparison with TYPE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-29 11:07:45 +00:00
nobu c4d77cb4ad * parse.y (parser_data_type): inherit the core type in ripper so
that checks in core would work.  [ruby-core:39591] [Bug #5331]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-17 14:34:13 +00:00
nobu 4705fcc3c0 * README.EXT, README.EXT.ja (2.2.2), parse.y (rb_check_id): add
documents for rb_check_id().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-12 04:38:15 +00:00
matz 6126c50add * parse.y (bv_decls): parse.y relies on $$ = $1 before action
routines.  a patch from Michael Edgar.  [Bug #5303]
  [ruby-core:39429]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-09 23:32:56 +00:00
nobu 5e14b97947 * parse.y (parser_tokadd_string, parser_yylex): ignore a backslash
which prefixes an non-ascii character, which has no escape
  syntax.  [ruby-core:39222] [Ruby 1.9 - Bug #5262]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-02 00:58:10 +00:00
nobu 3fbc65d47f * parse.y (rb_check_id): make the given name a symbol or a string.
based on the second patch by Jeremy Evans at [ruby-core:38447]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-26 16:05:27 +00:00
naruse 65658ea0d4 * parse.y (rb_enc_symname_type): :$a!, @a! and so on are not
valid symbols, so they should be inspected with quotes.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-23 10:03:30 +00:00
nobu 12d9be6b72 * parse.y (rb_check_id): take care of attrset ID created
implicitly by local ID.  [Bug #5084]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-23 03:19:07 +00:00
nobu d9242d5966 * parse.y (rb_check_id): conversion condition was inverse.
[Bug #5084]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-23 03:12:28 +00:00
nobu 34918aa832 * object.c (rb_mod_{const,cvar}_defined, rb_obj_ivar_defined):
avoid inadvertent symbol creation in reflection methods.  based
  on a patch by Jeremy Evans at [ruby-core:38367].  [Feature #5072]
* vm_method.c (rb_mod_method_defined)
  (rb_mod_{public,private,protected}_method_defined)
  (obj_respond_to): ditto.
* parse.y (rb_check_id): new function returns already interned ID
  or 0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-22 12:06:42 +00:00
nobu c276b73804 * parse.y (rb_is_global_id, rb_is_attrset_id): add missing
predicates.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-22 11:44:53 +00:00
nobu e0060732f1 * parse.y (rb_enc_symname2_p): get rid of potential out-of-bound
access.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-22 10:05:49 +00:00
nobu 577c03c713 * parse.y (var_ref): distinguish vcall from local variable
references.  based on a patch by Michael Edgar michael.j.edgar
  AT dartmouth.edu.  Bug #5002

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-10 13:38:17 +00:00
mame b0f115da1a * parse.y (reduce_nodes_gen): NODE_RETURN in rescue body must not be
reduced when there is an else clause.  This caused bizarre behavior
  in [Bug #4473] [ruby-core:35629] [ruby-core:37884].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-10 02:42:07 +00:00
nobu cfa0035962 * encoding.c (rb_enc_set_index, rb_enc_associate_index): should
check if frozen.
* parse.y (rb_intern3), ruby.c (process_options, ruby_script):
  defer freezing after associating encodings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-07 06:44:46 +00:00
nobu c1d84bfcdb * parse.y (arg): rescue_mod is in inverse order from other
modifiers.  patched by michael.j.edgar AT dartmouth.edu at
  [ruby-core:36248].  fixed #4716.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-06 19:31:33 +00:00
matz aab018f8fe * parse.y (opt_call_args): allow trailing comma after assoc
argument e.g. 'foo(bar:1,)'.  fixed #3456

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-06 15:39:27 +00:00
nobu 2ac460af94 * parse.y (parser_here_document): should dispatch heredoc_end
scanner event on an empty here document.  fixed Bug#4543.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-05 06:28:07 +00:00
nobu 198c2570e7 * sytle fixes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-30 20:20:32 +00:00
drbrain 926301969f * math.c: Attach documentation for Math.
* object.c:  Document NIL, TRUE, FALSE.
	* io.c:  Improve grammar in ARGF comment.  Document STDIN/OUT/ERR.
	  Document ARGF global constant.
	* lib/rake:  Hide deprecated toplevel constants from RDoc (import from
	  rake trunk).
	* lib/thwait.rb:  Document ThWait.
	* lib/mathn.rb:  Hide Math redefinition from RDoc
	* lib/sync.rb:  Add a basic comment for Sync_m, Synchronizer_m, Sync,
	  Synchronizer.
	* parse.y:  Document SCRIPT_LINES__.
	* hash.c:  Document ENV class and global constant.
	* vm.c:  Document TOPLEVEL_BINDING.
	* version.c:  Document RUBY_* constants.
	* ruby.c:  Document DATA and ARGV.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-29 03:09:34 +00:00
naruse 8d00a7c274 * parse.y (rb_parser_end_seen_p): fix documentation about return
value. patched by Sho Hashimoto. [Bug #4511]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-26 15:45:49 +00:00
shyouhei d6e89e0c4e * parse.y: comma at the end of line is no longer allowed.
A patch from Yukihiro Matsumoto  <matz AT ruby-lang.org>.
  (fixed #3456).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-26 09:09:49 +00:00
akr 7da3ea811e * method.h, internal.h iseq.h: declare internal functions.
* compile.c, eval.c, iseq.c, object.c, parse.y, proc.c, process.c,
  thread.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_method.c: don't
  declare internal functions.

  Note that rb_method_entry_eq() is defined in vm_method.c but
  there was a declaration in proc.c with different const-ness.
  Now it is declared in method.h with same const-ness to the
  definition.

* object.c (rb_mod_module_exec): don't declare functions declared in
  include/ruby/intern.h.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-18 03:49:33 +00:00
akr afd7e4668f * internal.h: declare more internal functions.
* iseq.h (rb_method_get_iseq): declared.

* compile.c, eval.c, eval_error.c, iseq.c, parse.y, proc.c, range.c,
  ruby.c, time.c, util.c, vm.c: don't declare internal functions.

* eval.c, parse.y, thread_pthread.c: non-existing function declarations
  removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-18 01:54:57 +00:00
akr e7996eb3cc * internal.h: declare internal functions here.
* node.h: declare NODE dependent internal functions here.

* iseq.h: declare rb_iseq_t dependent internal functions here.

* vm_core.h: declare rb_thread_t dependent internal functions here.

* bignum.c, class.c, compile.c, complex.c, cont.c, dir.c, encoding.c,
  enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c, io.c,
  iseq.c, load.c, marshal.c, math.c, numeric.c, object.c, parse.y,
  proc.c, process.c, range.c, rational.c, re.c, ruby.c, string.c,
  thread.c, time.c, transcode.c, variable.c, vm.c,
  tool/compile_prelude.rb: don't declare internal functions declared
  in above headers.  include above headers if required.

  Note that rb_thread_mark() was declared as
  void rb_thread_mark(rb_thread_t *th) in cont.c but defined as
  void rb_thread_mark(void *ptr) in vm.c.  Now it is declared as
  the later in internal.h.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-17 22:43:38 +00:00
nobu ce90fcdbbd * parse.y (parser_parse_string): flush delayed token. based on a
patch by Masaya Tarui in [ruby-dev:43762].  Bug #4544
* parse.y (yylex): revert r24557.  delayed token at the end of
  string should be flushed already by the above change.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-13 14:38:26 +00:00
nobu 402cbc870d * parse.y (peek_n): new macro to see next nth char.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-01 06:42:23 +00:00
naruse 78df33a0c1 * enc/utf_16le.c: surpress warning: shorten-64-to-32.
* ext/dbm/dbm.c: ditto.

* ext/gdbm/gdbm.c: ditto.

* parse.y (Init_ripper): surpress warning: unused value.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-21 21:23:42 +00:00
naruse f1b2fb6706 * parse.y (parser_encode_length): add exception as UTF8-MAC for
magic comment's emacs newline specifier
  patched by James M. Lawrence [ruby-core:35476] fixes #4489

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-10 13:07:03 +00:00
naruse eb778a7b6b * parse.y (parser_encode_length): fix typo: the length of
"-dos" and "-mac" is not 5 but 4.
  patched by James M. Lawrence [ruby-core:35476] fixes #4489

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-10 08:07:56 +00:00
nobu b1986003bd * parse.y (words, qwords): dispatch array events. based on a
patch from Michael Edgar.  [Bug #4365].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-06 03:18:44 +00:00
nobu 476ba90835 * parse.y (mlhs_basic): include mlhs_post for ripper. a patch
from Michael Edgar at [ruby-core:35078].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-05 12:47:16 +00:00
nobu f6b4cba666 * parse.y (lex_getline, parser_set_encode): set encoding of lines
in SCRIPT_LINES__ as source encoding.  [ruby-dev:43168]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-04 17:09:45 +00:00
mame a525f4d5fb * parse.y: avoid NULL reference. [ruby-dev:43067]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-18 18:17:29 +00:00
usa 90d5bcf910 * re.c (rb_reg_expr_str): need to escape if the coderage is invalid.
* error.c, include/ruby/intern.h (rb_compile_error_with_enc): new
	  function to raise syntax error, with source encoding'ed message.

	* parse.y (compile_error): use above function.
	  [ruby-core:33951] (#4217)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-28 09:43:49 +00:00
nobu cc479b25ba * parse.y (stmt): missing ripper rule. i.e., `a::B ||= c 1'.
http://twitter.com/#!/wannabe53/status/18797576396472321
  http://twitter.com/#!/wannabe53/status/18798416150663168

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-26 02:39:14 +00:00
akr 462f3626fc * parse.y: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-23 02:17:13 +00:00
nobu 2dc98cd0f3 * parse.y (lvar_defined_gen, shadowing_lvar_gen, dvar_defined): no
warnings for unused method and block arguments.
  [ruby-dev:42718] [ruby-dev:42724]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-09 11:14:42 +00:00
nobu 2f26014e38 * parse.y (shadowing_lvar_gen): fix line number. [ruby-dev:42718]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-08 12:36:20 +00:00
shyouhei 87a826b8c2 reverted to r30124; r30124 breaks test
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-08 10:55:36 +00:00
nobu 2e65b0d8bb * parse.y (LVAR_USED): should be int same as ruby_sourceline.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-08 00:52:38 +00:00
nobu 43cfe6c63e * parse.y (struct vtable, struct local_vars, vtable_add):
restructued to add declared line.  [ruby-dev:42718]
* parse.y (shadowing_lvar_gen): should not add dvar to vars.
* parse.y (local_push_gen, local_id_gen, dvar_defined_gen): check
  local variable usage for args and vars respectedly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-07 22:29:47 +00:00
nobu b5c3fb2465 * parse.y (parser_set_token_info): turn on/off with directives.
[ruby-core:25442]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-14 07:49:06 +00:00
nobu a176b065d2 * io.c (rb_io_ctl), parse.y (LVAR_USED): suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 15:10:04 +00:00
nobu d3dabbca71 * parse.y (regexp): dregexp has literal string only at the head
and successors are array.  [ruby-core:32682]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-04 03:43:50 +00:00
matz b602f6516f * parse.y (command_asgn): allow command_call to be right hand side
expression of chained assignment.  [ruby-dev:42313]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-30 14:17:31 +00:00
nobu 3bf1afbdd8 * include/ruby/intern.h (rb_make_backtrace, rb_make_exception):
used in ripper.

* node.h (rb_parser_{malloc,realloc,calloc,free}): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-14 04:20:59 +00:00
nobu 2b1f8574c7 * include/ruby/encoding.h (rb_char_to_option_kcode): used in
ripper.

* node.h (rb_reserved_word): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-11 20:58:11 +00:00
nobu aac4f022e2 * parse.y (parser_tokadd_escape): no similar messages twice.
[ruby-core:31048]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-08 03:41:30 +00:00
matz b35f5db57e * parse.y (void_expr_gen): add 'possibly' to warning message.
[ruby-core:31611]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-05 08:18:32 +00:00
naruse 7175a9073e * class.c, compile.c, dir.c, file.c, iseq.c, parse.y, random.c:
clean unused-value warnings.

* cont.c, process.c, vm_exec.h: clean cast warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-27 07:13:43 +00:00
nobu 3f606b9aca * parse.y (local_push_gen): disable unused variable warnings in
eval.  [ruby-dev:41869]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-21 06:00:25 +00:00
nobu 25b9eb5e57 * include/ruby/ruby.h (rb_data_type_t): restructured. [ruby-dev:41862]
add parent member.

* error.c (rb_typeddata_inherited_p): new function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-18 07:31:54 +00:00
nobu 2926a585ff * parse.y (shadowing_lvar_gen): should add lvar to vars and
used.  [ruby-dev:41666]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28386 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-22 10:57:40 +00:00
nobu d31350f827 * id.c (Init_id): add underscore name.
* parse.y (warn_unused_var): ignore underscore name.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-20 07:17:46 +00:00
nobu 14a15f8b7f * parse.y (warn_unused_var): use same format as shadowing local
variable.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-20 06:14:22 +00:00
nobu 47fb01e35b * parse.y (shadowing_lvar_gen): get rid of adding extra name for
shadowing local variable.  [ruby-dev:41628]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-20 05:41:07 +00:00
naruse 86d72ac7cf Revert "* parse.y (warn_unused_var): warn unused variables."
This reverts commit r28339 and r28340
because they prevents test-all on boron.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-17 01:04:09 +00:00
usa 4ac263ce68 * parse.y: ripper needs warn_unused_var(), too.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-16 09:35:35 +00:00
nobu cf79bdc6d0 * parse.y (warn_unused_var): warn unused variables.
[ruby-dev:41620]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-16 09:20:14 +00:00
matz 276fb7e77b * compile.c (iseq_compile_each): should consider block on stack,
if block argument is passed.  [ruby-core:30534]

* parse.c (arg_concat_gen): should append to nd_head, not to
  nd_iter for NODE_BLOCK_PASS.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-02 03:05:06 +00:00
nobu 5d394118ff * parse.y (parser_tokadd_utf8, parser_tokadd_string): allow NUL
containing symbol literals, as well as String#to_sym.
  [ruby-dev:41447]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-29 18:40:48 +00:00
nobu bf36feb76d * parse.y (warn_balanced, parser_yylex): no warnings after closing
parens.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-24 10:00:36 +00:00
nobu 39f09ca13f * parse.y (warn_balanced): no warning for singleton class.
[ruby-core:30366]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-23 08:40:36 +00:00
mame 3cd67ce505 * parse.y (parser_read_escape, parser_tokadd_escape): allow a hex or
octal encoded character after \c.  This seemed to be prohibited at
  r13836, but its ChangeLog mentions nothing about this prohibition.
  So I assume this prohibition is not intended.  [ruby-core:27229]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-16 12:54:37 +00:00
nobu 8939436f24 * parse.y (warn_balanced): do not warn for EXPR_ENDFN.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-28 00:43:27 +00:00
nobu 422efe5352 * parse.y (parser_read_escape): deny extra character escapes.
[ruby-core:27228]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-27 01:54:23 +00:00
mame 56a18860da * parse.y (program): check void_expr when rb_parse_in_main().
[ruby-dev:38717]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-26 15:09:26 +00:00
nobu b0018f6859 * parse.y (ripper_get_value): escape Qundef.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-26 04:11:59 +00:00
nobu 3cbb849bbb * parse.y (warn_balanced): warn according to last state.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-26 03:42:45 +00:00
nobu 36f8540a2b * parse.y (warn_balanced): removed false warning.
* parse.y (parser_yylex): skip whitespaces after method name.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27436 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-22 07:43:33 +00:00
nobu 2976ec58a4 * parse.y (regexp): check each fragments. [ruby-core:27374]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-21 04:44:58 +00:00
nobu 82ba40b434 * parse.y (parser_yylex): reverted r27388 due to backward
compatibility.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-21 04:36:05 +00:00
nobu 2e1efa9499 * parse.y (parser_yylex): warn confusing binary operators after
local variable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-21 03:15:49 +00:00
nobu f8e51f7e59 * parse.y (parser_yylex): abandoned EXPR_VCALL.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-21 02:31:40 +00:00
nobu f0f87d6eeb * parse.y (parser_yylex): fix for tLPAREN_ARG.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-20 10:25:52 +00:00
nobu e63df53198 * parse.y (lex_state_e, IS_END, IS_SPCARG, parser_yylex): separate
the state after vcall.  [ruby-core:29578]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-20 03:24:59 +00:00
nobu 85cb4ee236 * parse.y (parser_yylex): simplified with IS_ARG and IS_END.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-20 03:09:57 +00:00
nobu 04247ab5b4 * parse.y (parser_yylex): reduced duplicated conditions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-19 10:18:56 +00:00
nobu f25e99c55f * parse.y (IS_END, IS_SPCARG): macros for simplification.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-18 13:16:30 +00:00
nobu 9f8b036123 * parse.y (string_content): cond_stack and cmdarg_stack are VALUE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-18 13:13:23 +00:00
nobu e70a308c75 * parse.y (parser_yylex): seems like a symbol-literal when spaces
are unbalanced.  [ruby-core:29578]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27388 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-18 03:48:54 +00:00
nobu cfab29b7db * parse.y (string_content): preserve cond_stack and cmdarg_stack.
[ruby-core:29579]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-18 03:32:06 +00:00
mame fd9c3fef0b * parse.y (string_content, etc): counts of CMDARG_PUSH and POP were
inconsistent.  [ruby-core:22637]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-16 12:57:28 +00:00
nobu 83b8f94f4e * parse.y (rb_intern3): get rid of type-punning cast.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-17 19:41:00 +00:00
mame 4f78e7fff4 * parse.y (rb_intern3): prohibit Symbol with an invalid encoding.
[ruby-core:24621]

* test/ruby/test_m17n_comb.rb: modify a test for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-16 16:26:04 +00:00
mame 6b438bee04 * parse.y (top_compstmt, top_stmts, top_stmt): prohibit BEGIN {} in
non-toplevel scope.  [ruby-core:21657]

* test/ruby/test_beginendblock.rb (test_begininclass): add a test for
  above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-18 16:43:29 +00:00
nobu 770b05dd9b * parse.y (dyna_pop_gen): pop dvars. [ruby-dev:39861]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26055 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-09 16:12:57 +00:00
nobu 9ad065375f * parse.y (k_def): adjust the location of method definition to the
line of def.  [Bug #2427]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-04 07:50:15 +00:00
nobu 8f6cdd7927 * parse.y (dyna_push_gen, dyna_pop_gen): no needs to save both of
args and vars.  [ruby-core:26961]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-01 03:01:15 +00:00
nobu 79446bfb70 * parse.y (dyna_push_gen): use rb_node_newnode() for ripper.
[ruby-core:26961]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-30 21:51:08 +00:00
nobu 9b02e165d3 * parse.y (dyna_push_gen, dyna_pop_gen): adjust local vtable level
for the case of syntax errors in method name or argument inside
  do block.   [ruby-core:26961]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-30 21:16:31 +00:00
nobu b19b496248 * parse.y (parser_yylex): suppress an extra error message after
numeric literal without digits.  based on a patch from ujihisa .
  in [ruby-dev:39811].  [ruby-dev:39798]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-30 02:00:14 +00:00
nobu 746eb4a45b * parse.y (BEGIN): now local_push are local_pop are necessary in
ripper.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-04 22:47:33 +00:00
kazu ab77f00b04 * parse.y (ripper_filename): add Ripper#filename. [ruby-dev:37856] * test/ripper/test_filter.rb: add more tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-26 23:11:59 +00:00
nobu 6221d16ffb * parse.y (arg_prepend): removed. a patch from Mikhail T. in
[ruby-core:26217].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-22 08:29:53 +00:00
nobu 7bf5211220 * parse.y (ripper_intern): enable literal optimization.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-20 06:38:03 +00:00
nobu e3e93bb53e * parse.y (method_call): dispatch symbols. a patch from Andy Keep in
[ruby-core:26169].  [ruby-core:26165]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-20 06:28:51 +00:00
nobu 14f13abb85 * parse.y (mlhs_basic): fixed handling splat in middle of mlhs. a
patch from Andy Keep in [ruby-core:26163]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-20 06:07:39 +00:00
nobu b907ee320d * parse.y (parser_here_document): dispatch delayed heredoc
contents.  based on a patch from Andy Keep in [ruby-core:24855].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25402 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-20 05:50:53 +00:00
akr 7db062cdc0 * parse.y (is_special_global_name): add boundary check.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-18 10:19:45 +00:00
akr 859a985715 * parse.y (parser_yylex): fix token even after trailing under score.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-17 07:35:39 +00:00
nobu e5e49b3a27 * parse.y (rb_intern3): check symbol table overflow before generate
next id.  [ruby-core:26092]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-15 09:26:15 +00:00
nobu 37531934e6 * parse.y (rb_intern3): check symbol table overflow.
[ruby-core:26092]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-15 07:57:40 +00:00
nobu 475bdfee7c * parse.y (token_info_push, token_info_pop): reduced ifdefs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-13 09:23:19 +00:00
nobu 525f6818fa * parse.y (parser_magic_comment): fixed normalization.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-13 09:20:59 +00:00
nobu 72ad8595f2 * parse.y (bv_decls, bvar): fix for block variables.
[ruby-dev:39423]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-03 13:14:19 +00:00
nobu b3525ae1e7 * parse.y (assignable_gen): parser_yyerror takes two arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-02 19:34:28 +00:00
nobu a0f667c33e * parse.y (assignable_gen): get rid of macro collision.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25198 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-02 17:59:25 +00:00
nobu aec8a4b0a4 * parse.y (ripper_yylval_id, ripper_get_{id,value}): wrap ID by
NODE to track local variable assignment.

* parse.y (lvar_defined_gen, assignable_gen): enable local
  variable check.  [ruby-core:24923]

* parse.y (validate): use value only.

* test/ripper/test_parser_events.rb (test_local_variables): tests
  based on a patch from Magnus Holm in [ruby-core:25885].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-02 11:37:44 +00:00
usa 438b28d3f7 * parse.y (parser_tokadd_string): the byte after ``\'' may be a part of
multibyte character, so pushback it. [ruby-list:46416]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-28 02:40:30 +00:00
nobu bda0b012a8 * parse.y (assign_in_cond): also should warn assignment to dvar in
conditional.  [ruby-dev:39363]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-23 08:08:32 +00:00
nobu 8686840960 * compile.c (iseq_compile_each), parse.y (stmt, arg): arg_concat()
on op_asgn was inversed.  [ruby-core:25629] [Bug #2050]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-18 07:15:06 +00:00
nobu 4f041dafbe * debug.c, parse.y: fixed types.
* node.h (nd_line): limit to int.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-14 07:39:16 +00:00
naruse e13ca98198 * parse.y (rb_char_to_option_kcode): ASCII-8BIT should also delay.
* re.c (parser_regx_options): return rb_ascii8bit_encindex on
  ASCII-8BIT. [ruby-dev:39300]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-10 17:07:38 +00:00
naruse ba6e61d6f5 Only 1 kcode effects options [ruby-core:25411]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-09 08:19:06 +00:00
nobu b46cd0e400 * include/ruby/ruby.h (rb_data_type_struct): constified dsize.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-09 02:11:35 +00:00
nobu fb03cb8275 * parse.y (literal_concat_gen): concat body from dstr instead of
nd_next.  [ruby-core:25284]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-03 08:57:28 +00:00
nobu 9691894b86 * parse.y (fname): removed duplication.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-03 08:47:11 +00:00
naruse 6ab36c6e19 *regparse.c (CC_DUP_WARN): use rb_compile_warn if ScanEnv has source
information. [ruby-dev:39105]

*re.c (rb_reg_compile): add sourcefile and sourceline to the arguments.

*re.c (make_regexp): ditto.

*re.c (rb_reg_initialize): ditto.

*re.c (rb_reg_initialize_str): ditto.

*re.c (rb_reg_compile): ditto.

*regcomp.c (onig_compile): ditto.

*regint.h (onig_compile): ditto.

*re.c (reg_compile_gen): follow above.

*re.c (rb_reg_to_s): ditto.

*re.c (make_regexp): ditto.

*re.c (rb_reg_initialize): ditto.

*re.c (rb_reg_initialize_str): ditto.

*re.c (rb_reg_new_str): ditto.

*re.c (rb_enc_reg_new): ditto.

*re.c (rb_reg_initialize_m): ditto.

*re.c (rb_reg_init_copy): ditto.

*regcomp.c (onig_new): ditto.

*regcomp.c (onig_compile): set sourcefile and sourceline to scan_env.

*regparse.h (ScanEnv): add sourcefile and sourceline.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-30 08:00:31 +00:00
nobu 4119b54854 * parse.y (rb_enc_symname2_p): not depend on nul terminator.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-30 07:39:10 +00:00
mame 4c5d7d53b2 * parse.y (reduce_nodes_gen): preserve NODE_FL_NEWLINE flag during
node reducing.  [ruby-core:24463]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-20 14:42:16 +00:00
nobu bfc94fde25 * parse.y (ENABLE_SELECTOR_NAMESPACE): defaulted to 0.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-20 03:11:01 +00:00
nobu 4a7cf7638c * parse.y (ivar2_hash_type): disabled for now.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-20 03:09:08 +00:00
nobu b5e6b46e90 * parse.y (lex_get_str, lex_io_gets, rb_parser_compile_string):
must be ascii compatible.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-17 05:35:10 +00:00
nobu 114f01bd9d * parse.y (yylex): should dispatch scan-event even when follows
just after delayed-token.  [ruby-dev:37855] [Bug #1071]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-16 14:58:27 +00:00
nobu f93bdaed62 * parse.y (fname, string_dvar, sym, dsym, f_arglist): removed
duplications.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-15 01:40:10 +00:00
nobu 6a26b59600 * parse.y (literal_concat0): tail can be nil. [ruby-dev:38980]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-02 12:04:43 +00:00
nobu 5004e33f8d * parse.y (literal_concat_gen): reduced unnecessary node at string
literal concatenation with empty head dstr.  [ruby-dev:38968]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-31 01:54:14 +00:00
mame 3129ed327e * parse.y (literal_concat_gen): NODE_DSTR was incorrectly handled as
NODE_STR.  [ruby-dev:38968]

* bootstraptest/test_syntax.rb: add a test for above.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-30 18:02:37 +00:00
naruse 3ca25b5a29 * parse.y (regexp): regexp literal at the top of dstr is still needed even if it is empty.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-28 23:11:29 +00:00
mame 31c561f66a * vm_core.h (struct rb_iseq_t): add a new field line_no. This field
represents line number from which the original code of the iseq
  starts.  [ruby-dev:38698]

* iseq.c, compile.c: ditto.

* parse.y: line number hack (for Proc#source_location) is no longer
  needed.

* test/ruby/test_settracefunc.rb: line number of set_trace_func is now
  compatible with 1.8's.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-22 13:37:26 +00:00
nobu 5a392c71db * compile.c (compile_dstr_fragments): reduced needless literal.
* parse.y (xstring, regexp, dsym, literal_concat, evstr2dstr):
  literal at the top of dstr is no longer needed if it is empty,
  since concatstrings and toregexp always create new strings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-20 10:01:05 +00:00
nobu 415d5ebc2f * id.c (Init_id), vm.c (vm_exec): @#__ThrowState__ is no longer
used.  [ruby-dev:38760]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-16 09:28:12 +00:00
nobu b16c326d5e * parse.y (parser_data_type): typed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-09 22:22:33 +00:00
nobu fc5f0cafa1 * parse.y (parser_yylex): fixed wrong variable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-01 22:53:51 +00:00
nobu 37138a2a93 * parse.y (parser_set_encode): show the erred file name instead of
the file that requires it.  [ruby-core:24006]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-24 06:02:33 +00:00
takano32 bc4c51ecce Tue Jun 16 16:09:59 2009 TAKANO Mitsuhiro (takano32) <tak@no32.tk>
* parse.y (parser_read_escape, parser_tokadd_escape):
	  replace scan_oct as ruby_scan_oct.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-16 07:14:48 +00:00
nobu 51bf0388aa * parse.y (struct parser_params): lex_gets_ptr should be long.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-27 14:00:40 +00:00
nobu 064057166b * parse.y (parser_yyerror): get rid of possible overflow.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-26 00:22:20 +00:00
nobu f91b0dc811 * compile.c (rb_parse_in_eval): returns true in true eval, not in
main.  [ruby-dev:38382]

* parse.y (program): inherits dvars in eval or main.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-17 05:23:10 +00:00
nobu f29235378d * parse.y (magic_comment_encoding): ignores unused emacs-style
encoding comment, as like Vim styles.  [ruby-core:23470]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-16 00:49:10 +00:00
nobu 78e376a3ee * defs/keywords (reserved_word): made inline function static.
[ruby-core:23210]

* parse.y (rb_reserved_word): ordinary function for ripper.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23436 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-16 00:30:16 +00:00
nobu d2c07ecb88 * parse.y (magic_comment_encoding): use rb_compile_warning() to
show the currently parsing file name.  [ruby-core:23469]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-16 00:19:18 +00:00
matz ab2119fc3d * parse.y: add semicolons to some grammar rules not terminated
with them.  a patch from Dave B in [ruby-core:23422].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-11 13:54:59 +00:00
nobu 22cde7b682 * dir.c, dln.c, parse.y, re.c, ruby.c, sprintf.c, strftime.c,
string.c, util.c, variable.c: use strlcpy, memcpy and snprintf
  instead of strcpy, strncpy and sprintf.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-17 01:29:17 +00:00
nobu 4de12b6ae9 * util.c (ruby_scan_oct, ruby_scan_hex): use size_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-14 09:25:20 +00:00
nobu 315ee838bc * parse.y (stack_type): uses VALUE which is able to be stored
parser stack.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-11 04:27:11 +00:00
nobu 12d2c8ba41 stripped trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 14:23:33 +00:00
nobu 3b817f834a * parse.y (debug_lines): calls rb_intern() once.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-21 05:32:08 +00:00
nobu 8b392f4d4c * parse.y (rb_parse_in_main): fixed typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-16 02:47:58 +00:00
ko1 e40928733d * ruby.c (process_options): decrement parse_in_eval to recognize
parsing main or normal eval script.
* compile.c (rb_parse_in_main): return 1 if parsing main script.
  (if parse_in_eval is negative value, it means main script)
* parse.y (yycompile0): check rb_parse_in_main() to accumulate
  script text.  Bug #848 [ruby-core:20450]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-15 16:14:43 +00:00
matz 2a0b6280bb * parse.y (command): moved return/break/next from command_call for
better error message.

* parse.y (call_args): void value check added.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-15 06:06:47 +00:00
matz 1fc5fb2b7b * parse.y (stmt): explicit error for "Object::Far += foo 1" just
as "Object::Far += 1".

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-15 05:23:51 +00:00
ko1 597220ef0c * vm.c (Init_VM): create and define TOPLEVEL_BINDING at first.
* vm.c (vm_set_main_stack, rb_iseq_eval_main): added.
* parse.y (rb_parser_compile_file): fix to check parse_in_eval flag.
* eval.c (ruby_exec_node): use rb_iseq_eval_main()
  instead of rb_iseq_eval().
* iseq.c (rb_iseq_new_main), vm_core.h: added.
  main script (specified by -e or script name) should be run
  under TOPLEVEL_BINDING using Kernel#eval.  Above changes
  simulate Kernel#eval behaviour.  [ruby-dev:37240]
* compile.c (make_name_for_block): skip iseq except block type.
  this fix is needed for [ruby-dev:37240], and also fixes
  [ruby-dev:35392].



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-27 01:15:56 +00:00
matz 5e62997245 * string.c (rb_external_str_new_with_enc): set ASCII-8BIT if
encoding is US-ASCII and string contains 8bit characters.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-23 15:13:18 +00:00
matz 1d4c164581 * parse.y (gettable_gen): the encoding of __FILE__ should be
rb_filesystem_encoding().  [ruby-list:45733]

* parse.y (gettable_gen): __FILE__ should be ASCII-8BIT when
  filesystem encoding is US-ASCII and __FILE__ contains non 7bit
  characters.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-22 01:43:16 +00:00
nobu a04d12b188 * parse.y (stmt): returns dispatched result.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-16 07:41:54 +00:00
nobu b315664f2b * parse.y (primary): also in ripper, saves in_def before restoring.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-16 07:29:47 +00:00
matz 587afe728b * parse.y (block_call): block should not be given to yield.
[ruby-core:20583]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-16 00:16:46 +00:00
tadf 2209f072fc must be typos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-12 23:59:36 +00:00
nobu 303c28d49b * parse.y (yycompile0): ruby_eval_tree_begin is always 0 when
ruby_eval_tree is 0.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-12 07:23:24 +00:00
nobu 541915b239 * compile.c (iseq_compile_each), gc.c (assign_heap_slot),
(gc_mark_children), parse.y (vtable_alloc, vtable_free, vtable_add),
  proc.c (proc_to_s), thread.c (terminate_i, rb_thread_terminate_all),
  (thread_start_func_2, blocking_region_begin, blocking_region_end),
  (rb_thread_kill), thread_pthread.c (native_thread_create),
  (ubf_pthread_cond_signal), vm.c (check_env, thread_free), vm_dump.c
  (vm_env_dump_raw, vm_stack_dump_each, vm_thread_dump_state),
  (vm_call0): use void pointer for %p.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-09 04:33:55 +00:00
nobu 8c01ec883a * parse.y (expr): keyword_not can continue across newline.
[ruby-core:20252]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-03 13:54:42 +00:00
mame d563f1680c * parse.y (parser_yylex): check EOF explicitly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-28 12:34:13 +00:00
nobu a26b7a0c82 * parse.y (lambda): need to adjust lpar_beg for both of the parser and
ripper.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-24 18:43:27 +00:00
matz aed0c718db * parse.y (lambda): need to adjust lpar_beg for ripper as well.
[ruby-dev:36702]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-24 09:08:43 +00:00
matz e8a71e64a1 * parse.y (f_larglist): should not allow semicolon separated local
variable declarations if formal argument list is not surrounded
  by parentheses, mostly because semicolon outside of parentheses
  appears to terminate the expression.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-22 06:03:12 +00:00
ko1 3337185ed6 * parse.y (arg_concat_gen): concat target node should be NODE_ARRAY.
[ruby-core:19413]
* bootstraptest/test_method.rb: add tests.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-21 20:45:35 +00:00
matz d3546e79ae * parse.y (opt_block_arg): allow trailing comma after usual
arguments.  not after block argument.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-18 11:49:39 +00:00
nobu b025ce4678 * common.mk (ID_H_TARGET): phony target to update id.h.
* tool/ifchange, win32/ifchange.bat: --timestamp option added.

* tool/generic_erb.rb: --timestamp, --output and --if-change options
  added.

* template/id.h.tmpl: moved from id.h.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-17 10:46:23 +00:00
matz c196780964 * parse.y (parser_yylex): allow reserved word to be keyword argument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-14 00:36:52 +00:00
naruse 20ed75a639 * parse.y (token_info_pop): show source filename. [ruby-dev:36710]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-13 10:13:40 +00:00
nobu d9fdf58aaa * parse.y (parser_prepare): use utf-8 encoding directly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-11 10:49:56 +00:00
ko1 3f710785f0 * parse.y: optimize 'for' statement when one variable given.
* benchmark/bm_loop_for.rb: added.
* benchmark/bm_loop_times.rb: modified.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-10 19:19:36 +00:00
nobu 4b51662800 * parse.y (comment_at_top): needed for ripper too.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-10 13:16:58 +00:00
nobu a77d088cf6 * parse.y (magic_comment_encoding): warns when ignored.
* parse.y (parser_magic_comment): replaces '-' with '_'.

* parse.y (parser_yylex): allows magic comments indented and the
  second line or later.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-10 10:21:53 +00:00
yugui c86ce094e2 * include/ruby/ruby.h: embeds the elements of an array into its
struct RArray for # of elements <= 3.

	* array.c: ditto.

	* gc.c (gc_mark_children): following the change of struct RArray.

	* ext/tk/tcltklib.c (ip_ruby_cmp): ditto.

	* parse.y (coverage): ditto.

	* proc.c (curry): ditto.

	* .gdbinit: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-09 05:47:04 +00:00
nobu 9bcbc90605 * parse.y (stmt): returns non zero. [ruby-dev:36633]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-30 07:54:02 +00:00
nobu 9480a18411 * parse.y (token_info_push, token_info_pop): do nothing for evaled
source.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-29 16:02:58 +00:00
nobu 77a9d7c32f * parse.y (primary, brace_block): fix for line number.
* proc.c (rb_proc_location, rb_method_location): new methods
  {Proc,Method,UnboundMethod}#source_location.  [ruby-core:18452]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-26 13:47:01 +00:00
ko1 2e311f6bd5 * include/ruby/node.h, node.h: move node.h from include path.
This change stop to install node.h beacuase of saving ABI
  (node.h will be changed. Extensions should not depends on
  this file).
* blockinlining.c, class.c, compile.c, debug.h, enum.c,
  gc.c, iseq.c, parse.y, ruby.c, signal.c, variable.c,
  vm.c, vm_core.h, vm_dump.c: ditto.
* ext/ripper/depend: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 19:52:31 +00:00
ko1 8cd252ac6f * common.mk: clean up
- remove blockinlining.$(OBJEXT) to built
  - make ENCODING_H_INCLDUES variable (include/ruby/encoding.h)
  - make VM_CORE_H_INCLUDES variable (vm_core.h)
  - simplify rules.
  - make depends rule to output depend status using gcc -MM.
* include/ruby/mvm.h, include/ruby/vm.h: rename mvm.h to vm.h.
* include/ruby.h: ditto.
* load.c: add inclusion explicitly.
* enumerator.c, object.c, parse.y, thread.c, vm_dump.c:
  remove useless inclusion.
* eval_intern.h: cleanup inclusion.
* vm_core.h: rb_thread_t should be defined in this file.
* vm_evalbody.c, vm_exec.c: rename vm_evalbody.c to vm_exec.c.
* vm.h, vm_exec.h: rename vm.h to vm_exec.h.
* insnhelper.h, vm_insnhelper.h: rename insnhelper.h to vm_insnhelper.h.
* vm.c, vm_insnhelper.c, vm_insnhelper.h:
  - rename vm_eval() to vm_exec_core().
  - rename vm_eval_body() to vm_exec().
  - cleanup include order.
* vm_method.c: fix comment.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 00:20:28 +00:00
naruse cfadd72532 * parse.y: strings which contain only US-ASCII don't force to have
US-ASCII encoding. [ruby-dev:36400]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19434 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-19 23:09:33 +00:00
akr a953d28e3c * include/ruby/oniguruma.h (onigenc_get_prev_char_head): add end
argument.

* include/ruby/encoding.h (rb_enc_prev_char): ditto.

* regenc.c (onigenc_get_prev_char_head): add end argument.

* regparse.c: follow the interface change.

* regexec.c: ditto.

* string.c: ditto.

* parse.y: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-13 18:22:04 +00:00
matz 929e0b91be * parse.y (f_block_optarg): allow default for block parameters as
long as the value is primary.  a patch from Eric Mahurin
  <eric.mahurin at gmail.com> in [ruby-core:16880].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-06 18:39:36 +00:00
matz 05edaf5090 * parse.y (yylex): "1.upto 2 {|i| p i }" should be syntax error.
[ruby-dev:36008]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-06 16:09:43 +00:00
matz 31b6ea65bb * include/ruby/ruby.h (DBL2NUM): renamed from DOUBLE2NUM.
a patch from Tadashi Saito <shiba at mail2.accsnet.ne.jp>
  in [ruby-dev:36102].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-05 18:24:21 +00:00
akr 2eb763857d * parse.y (parser_encoding_name): defined.
(parser_tokadd_mbchar): show encoding in the message of
  "invalid multibyte char" error.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-03 11:02:11 +00:00
nobu 0075a767e5 * parse.y (struct token_info): constified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-30 09:17:47 +00:00
nobu a442691c9d * parse.y (token_info_get_column, token_info_has_nonspaces),
(token_info_push, token_info_pop): constified.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-30 09:16:38 +00:00
matz 855b594157 * parse.y (token_info_push): -w warns indentation level mismatch.
based on a patch from Yukina Yamano presented at RubyKaigi'07.
  See <http://jp.rubyist.net/RubyKaigi2007/Log0609-LT06.html> and
  <http://www.logic-junction.com/products/rubyend.html> (Japanese).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-30 07:29:41 +00:00
ko1 35617676cb * parse.y: remove include pragma for "ruby/intern.h".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-30 01:43:34 +00:00
yugui d9a1cc2f4e * parse.y (YYSTYPE): struct RVarmap has been no longer
defnied.
  see also r11717 by matz.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-25 05:27:46 +00:00
nobu dc02325fd8 * include/ruby/encoding.h (rb_enc_ispunct): added.
* common.mk (COMMONOBJS), inits.c (rb_call_inits): id.c is now
  included from parse.c.

* id.c (Init_id), id.h (ruby_method_ids): added IDs used by VM.

* parse.y (global_symbols): added rooms for VM IDs.

* parse.y (rb_intern3, rb_id2str): single puctuation symbol is now
  same as char code.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-14 08:57:07 +00:00
nobu c710140216 * parse.y (union tmpyystype): no longer needed, since YYSTYPE is
defined in parse.h now.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-14 08:46:23 +00:00
nobu de0a9f726e * configure.in,parse.y: removed garbage spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-10 03:15:37 +00:00
nobu 8d0fdce468 * parse.y (deferred_nodes, compstmt, arg, fixup_nodes, range_op): fix
up fixnum range literal in conditional as automagical line number
  comparison.  [ruby-core:12124], [ruby-dev:35731]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-04 07:48:52 +00:00
nobu b951952b40 * parse.y (yylex): 8 and 9 in octal integer should cause compile
error.  [ruby-dev:35729]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-02 06:51:53 +00:00
yugui 20486a7f64 * parse.y (parser_yylex): removed an useless conditional, and magic
comment are ignored unless at the first of line.

* test/ruby/test_m17n.rb (test_magic_comment_vim): added.

* test/ruby/test_m17n.rb (test_magic_comment_at_variaous_positions):
  added.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-01 09:38:50 +00:00
mame cf08661141 * parse.y (magic_comment_encoding): remove meaningless null check.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-30 16:18:40 +00:00
mame 728b092442 * parse.y (vtable_free): remove meaningless null check.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-30 13:19:34 +00:00
mame 91c07a5ac6 * thread.c (rb_set_coverages, rb_reset_coverages): enable and disable
coverage measurement.

* thread.c (rb_get_coverages): rename and move from vm.c.

* vm.c (rb_vm_get_coverages): ditto.

* iseq.c (prepare_iseq_build): ditto.

* thread.c (clear_coverage): ditto.

* parse.y (coverage): ditto.

* ext/coverage/coverage.c: use above functions, add new method
  Coverage.start and fix rdoc .


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17961 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-08 15:13:22 +00:00
mame caf3933bab * thread.c (rb_enable_coverages): hide coverage array by setting 0 to
klass during measurement.

* parse.y (coverage, yycompile0): ditto.

* iseq.c (prepare_iseq_build): use rb_hash_lookup instead of
  rb_hash_aref.

* thread.c (rb_coverage_result): restore klass of coverage array and
  return it.

* theaad.c (update_coverage): chcek whether its klass is 0.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-08 13:57:06 +00:00
mame ae3a03eb07 * include/ruby/intern.h: remove prototypes about coverage.
* iseq.c (prepare_iseq_build): add prototype.

* parse.y (coverage): ditto.

* thread.c (clear_coverage): ditto.

* thread.c (update_coverage): use rb_sourceline.

* thread.c (rb_get_coverages): rename and move to vm.c.

* vm.c (rb_vm_get_coverages): ditto.

* ext/coverage/coverage.c: add rdoc.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-03 14:27:43 +00:00
mame f08581c7b6 * ext/coverage/coverage.c, ext/coverage/extconf.rb: eliminate
COVERAGE__ and introduce coverage.so instead.  How to measure
  coverage: (1) require "coverage.so", (2) require or load Ruby source
  file, and (3) Coverage.result will return the same hash as COVERAGE__.
  [ruby-dev:35324]

* thread.c (rb_enable_coverages): start coverage measurement by using
  rb_add_event_hook.

* thread.c (rb_get_coverages): returns current results of coverage
  measurement.

* include/ruby/intern.h: add prototype for above two functions.

* vm_core.h, vm.c: add field of coverages to rb_vm_t.

* insns.def (trace): remove special handling for COVERAGE__.

* iseq.c (prepare_iseq_build): switch COVERAGE__ to
  rb_get_coverages().

* parse.y (coverage): ditto.

* thread.c (clear_coverage): ditto.

* lib/coverage.rb: use coverage.so instead of COVERAGE__.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-03 12:55:12 +00:00
mame 5874de95e8 * Add coverage measurement constant COVERAGE__. This constant is not
for casual use.  Usage: (1) assign {} to COVERAGE__, (2) require or
  load Ruby source file, and (3) COVERAGE__["sourcefilepath"] will
  return an array whose elements represent number of executions per
  line of source code.

* vm_core.h: add field of coverage array to iseq.

* iseq.c (prepare_iseq_build): ditto.

* insns.def (trace): update coverage array.

* parse.y (coverage): create and initialize coverage array.

* compile.h (ADD_TRACE): add trace instruction to update covearge
  array.

* thread.c (clear_coverage): delete coverage array when forking.
  Otherwise, double count of coverage may occur.

* lib/coverage.rb: sample coverage measurement tool.

* error.c: distinguish explicitly between parse_in_eval and
  mild_compile_error.

* load.c: ditto.

* vm_eval.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-01 16:55:30 +00:00
shyouhei 3e69e83a62 * include/ruby/ruby.h (enum ruby_special_consts): ISO C forbids
comma at end of enumerator list

 	* include/ruby/ruby.h (enum ruby_value_type): ditto.

	* eval_intern.h (enum): ditto.

	* vm_core.h (enum rb_thread_status): ditto.

	* parse.y (enum lex_state_e): ditto.

	* parse.y (enum string_type): ditto.

	* process.c (enum): ditto.

	* ruby.c (enum dump_flag_bits): ditto.

	* ruby.c (enum disable_flag_bits): ditto.

	* compile.c (iseq_link_element): ditto

	* debug.c (union): ditto.

	* cont.c (enum context_type): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-01 08:27:58 +00:00
matz 8f03e4d2c5 * parse.y (primary): empty not should call '!' on nil.
cf [ruby-dev:35227]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-27 09:35:53 +00:00
matz d8c930dd06 * parse.y (primary): not operand might be empty. [ruby-dev:35227]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-25 15:49:17 +00:00
matz 89080e0254 * parse.y (primary): make functional-style not operator to act
like function.  see <http://d.hatena.ne.jp/ku-ma-me/20080624/p1>.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-25 12:55:47 +00:00
nobu d2c3d9dd0b * parse.y (call_args2, open_args): removed.
* parse.y (parser_yylex): unified warnings at space between method
  name and argument parenthese.  [ruby-dev:33943]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-21 07:29:05 +00:00
nobu 5a647a3f5f * include/ruby/ruby.h (CONST_ID): constant ID cache for non-gcc.
* *.c: no cache in init functions.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 09:25:32 +00:00