Commit graph

773 commits

Author SHA1 Message Date
yugui
2f3fa385db merges r24579 and r24581 from trunk into ruby_1_9_1.
--
* compile.c (NODE_RETURN): fire return event at explicit return.
  [ruby-dev:38701]
--
* test/ruby/test_settracefunc.rb (test_return, test_return2): add two
  tests for [ruby-dev:38701] and [ruby-core:24463].
--
* 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/branches/ruby_1_9_1@25537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-28 14:15:24 +00:00
yugui
60a8777de7 merges r24569 from trunk into ruby_1_9_1.
--
* 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/branches/ruby_1_9_1@25535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-28 14:15:07 +00:00
yugui
046ac45ac1 merges r24557 from trunk into ruby_1_9_1.
--
* 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/branches/ruby_1_9_1@25534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-28 14:14:59 +00:00
yugui
a97190548f merges r24332 and r24333 from trunk into ruby_1_9_1.
--
* 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.
--
* 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/branches/ruby_1_9_1@24453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-08 15:28:03 +00:00
yugui
b6a98140d5 merges r24243 from trunk into ruby_1_9_1.
--
* 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/branches/ruby_1_9_1@24446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-08 10:52:38 +00:00
yugui
e0e429321e merges r23932 from trunk into ruby_1_9_1.
--
* parse.y (parser_yylex): fixed wrong variable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@24052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-12 14:46:22 +00:00
yugui
6b6e71e9a3 merges r23837 from trunk into ruby_1_9_1.
--
* 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/branches/ruby_1_9_1@23845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-24 16:08:16 +00:00
yugui
68a2b3cf7f merges r23474 from trunk into ruby_1_9_1.
--
* 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/branches/ruby_1_9_1@23535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-22 09:49:28 +00:00
yugui
642ca17bdf merges r23435 from trunk into ruby_1_9_1.
--
* 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/branches/ruby_1_9_1@23522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-21 14:48:16 +00:00
mame
7c6feec335 * 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/branches/ruby_1_9_1@21876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-29 16:51:19 +00:00
yugui
ba7c2f1e14 merges r21588 from trunk into ruby_1_9_1.
* parse.y (rb_parse_in_main): fixed typo.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@21595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-16 04:07:16 +00:00
yugui
1bf3fe1d60 merges r21571 from trunk into ruby_1_9_1.
* 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/branches/ruby_1_9_1@21576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-15 16:33:06 +00:00
yugui
846ca98acf merges r21079 from trunk into ruby_1_9_1.
* 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/branches/ruby_1_9_1@21083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-27 02:16:28 +00:00
yugui
a8b2bda760 merges r20952 from trunk into ruby_1_9_1.
* 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/branches/ruby_1_9_1@21072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-26 11:16:35 +00:00
yugui
cad814b548 merges r20905 from trunk into ruby_1_9_1.
* 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/branches/ruby_1_9_1@21071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-26 11:16:23 +00:00
yugui
2ea63eebcc merges r20782 from trunk into ruby_1_9_1.
* parse.y (stmt): returns dispatched result.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20828 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-17 06:18:00 +00:00
yugui
677668eace merges r20781 from trunk into ruby_1_9_1.
* parse.y (primary): also in ripper, saves in_def before restoring.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-17 06:17:51 +00:00
yugui
d3ab1b9c27 merges r20770 from trunk into ruby_1_9_1.
* parse.y (block_call): block should not be given to yield.
  [ruby-core:20583]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-17 06:17:11 +00:00
yugui
3a3d9ace57 merges r20684 from trunk into ruby_1_9_1.
must be typos.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-13 01:59:26 +00:00
yugui
2e52bda3c8 merges r20593 from trunk into ruby_1_9_1.
* 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/branches/ruby_1_9_1@20687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-13 01:01:02 +00:00
yugui
bc2c2f915c merges r20469 from trunk into ruby_1_9_1.
* parse.y (expr): keyword_not can continue across newline.
  [ruby-core:20252]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-04 08:54:56 +00:00
mame
c0f168f5db * parse.y (parser_yylex): check EOF explicitly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@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