diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-06-12 16:56:06 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-06-12 16:56:06 +0000 |
commit | 8db3dc39d60870e07cbdfec5e594e0f49b0733c7 (patch) | |
tree | 356b9a30124e0d1344837717aba71d50ed4b49f3 /parse.y | |
parent | 4169e76d14556864dca6bdef05d54f89651efc0b (diff) | |
download | ruby-8db3dc39d60870e07cbdfec5e594e0f49b0733c7.tar.gz |
* signal.c (sigexit): call rb_thread_signal_exit() instead of
rb_exit(). [ruby-dev:26347]
* eval.c (rb_thread_signal_exit): a new function to exit on main
thread.
* eval.c (rb_thread_switch): exit status should be retrieved from
ruby_errinfo.
* eval.c (rb_f_exit): ensure exit(0) should call
exit(EXIT_SUCCESS).
* missing/mkdir.c: remove. [ruby-core:05177]
* hash.c (env_aset): do not treat nil as key-removing value.
[ruby-list:40865]
* parse.y (method_call): allow aref expression ([]) to take a
block.
* parse.y (block_dup_check): a function to check duplication of
a block argument and an actual block.
* lib/delegate.rb (SimpleDelegator::__setobj__): need check for
recursive delegation. [ruby-core:04940]
* lib/cgi.rb: add underscore aliases CGI::escape_html,
CGI::unescape_html, CGI::escape_element, CGI::unescape_element.
[ruby-core:05058]
* misc/ruby-mode.el (ruby-expr-beg): fix looking point drift.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 60 |
1 files changed, 31 insertions, 29 deletions
@@ -230,6 +230,7 @@ static NODE *remove_begin _((NODE*)); static void void_stmts_gen _((struct parser_params*,NODE*)); #define void_stmts(node) void_stmts_gen(parser, node) static void reduce_nodes _((NODE**)); +static void block_dup_check _((NODE*)); static NODE *block_append _((NODE*,NODE*)); static NODE *list_append _((NODE*,NODE*)); @@ -1136,9 +1137,7 @@ command : operation command_args %prec tLOWEST /*%%%*/ $$ = new_fcall($1, $2); if ($3) { - if (nd_type($$) == NODE_BLOCK_PASS) { - compile_error(PARSER_ARG "both block arg and actual block given"); - } + block_dup_check($$); $3->nd_iter = $$; $$ = $3; } @@ -1162,9 +1161,7 @@ command : operation command_args %prec tLOWEST /*%%%*/ $$ = new_call($1, $3, $4); if ($5) { - if (nd_type($$) == NODE_BLOCK_PASS) { - compile_error(PARSER_ARG "both block arg and actual block given"); - } + block_dup_check($$); $5->nd_iter = $$; $$ = $5; } @@ -1188,9 +1185,7 @@ command : operation command_args %prec tLOWEST /*%%%*/ $$ = new_call($1, $3, $4); if ($5) { - if (nd_type($$) == NODE_BLOCK_PASS) { - compile_error(PARSER_ARG "both block arg and actual block given"); - } + block_dup_check($$); $5->nd_iter = $$; $$ = $5; } @@ -2513,18 +2508,6 @@ primary : literal $$ = dispatch1(topconst_ref, $2); %*/ } - | primary_value '[' aref_args ']' - { - /*%%%*/ - if ($1 && nd_type($1) == NODE_SELF) - $$ = NEW_FCALL(tAREF, $3); - else - $$ = NEW_CALL($1, tAREF, $3); - fixpos($$, $1); - /*% - $$ = dispatch2(aref, $1, $3); - %*/ - } | tLBRACK aref_args ']' { /*%%%*/ @@ -2626,9 +2609,7 @@ primary : literal | method_call brace_block { /*%%%*/ - if ($1 && nd_type($1) == NODE_BLOCK_PASS) { - compile_error(PARSER_ARG "both block arg and actual block given"); - } + block_dup_check($$); $2->nd_iter = $1; $$ = $2; fixpos($$, $1); @@ -3233,9 +3214,7 @@ do_block : kDO_BLOCK block_call : command do_block { /*%%%*/ - if ($1 && nd_type($1) == NODE_BLOCK_PASS) { - compile_error(PARSER_ARG "both block arg and actual block given"); - } + block_dup_check($1); $2->nd_iter = $1; $$ = $2; fixpos($$, $1); @@ -3328,6 +3307,18 @@ method_call : operation paren_args $$ = method_optarg($$, $4); %*/ } + | primary_value '[' aref_args ']' + { + /*%%%*/ + if ($1 && nd_type($1) == NODE_SELF) + $$ = NEW_FCALL(tAREF, $3); + else + $$ = NEW_CALL($1, tAREF, $3); + fixpos($$, $1); + /*% + $$ = dispatch2(aref, $1, $3); + %*/ + } ; brace_block : '{' @@ -6309,11 +6300,13 @@ parser_yylex(parser) return kEND; } pushback(c); - c = ';'; + lex_state = EXPR_BEG; command_start = Qtrue; + return ';'; + case ',': lex_state = EXPR_BEG; - return c; + return ','; case '~': if (lex_state == EXPR_FNAME || lex_state == EXPR_DOT) { @@ -7218,6 +7211,15 @@ aryset_gen(parser, recv, idx) return NEW_ATTRASGN(recv, tASET, idx); } +static void +block_dup_check(node) + NODE *node; +{ + if (node && nd_type(node) == NODE_BLOCK_PASS) { + compile_error(PARSER_ARG "both block arg and actual block given"); + } +} + ID rb_id_attrset(id) ID id; |