From d2c3d9dd0b9ed4d587654ce68bdbc8663a77b9df Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 21 Jun 2008 07:29:05 +0000 Subject: * 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 --- parse.y | 82 ++++------------------------------------------------------------- 1 file changed, 4 insertions(+), 78 deletions(-) (limited to 'parse.y') diff --git a/parse.y b/parse.y index 48a777eb72..022d947414 100644 --- a/parse.y +++ b/parse.y @@ -662,8 +662,8 @@ static void ripper_compile_error(struct parser_params*, const char *fmt, ...); %type bodystmt compstmt stmts stmt expr arg primary command command_call method_call %type expr_value arg_value primary_value %type if_tail opt_else case_body cases opt_rescue exc_list exc_var opt_ensure -%type args call_args call_args2 opt_call_args -%type open_args paren_args opt_paren_args +%type args call_args opt_call_args +%type paren_args opt_paren_args %type command_args aref_args opt_block_arg block_arg var_ref var_lhs %type mrhs superclass block_call block_command %type f_arglist f_args f_arg f_arg_item f_optarg f_marg f_marg_list f_margs @@ -2358,60 +2358,11 @@ call_args : command %*/ ; -call_args2 : arg_value ',' args opt_block_arg - { - /*%%%*/ - $$ = arg_blk_pass(list_concat(NEW_LIST($1),$3), $4); - /*% - $$ = arg_add_optblock(arg_prepend($3, $1), $4); - %*/ - } - | arg_value ',' block_arg - { - /*%%%*/ - $$ = arg_blk_pass(NEW_LIST($1), $3); - /*% - $$ = arg_add_block(arg_add(arg_new(), $1), $3); - %*/ - } - | assocs opt_block_arg - { - /*%%%*/ - $$ = NEW_LIST(NEW_HASH($1)); - $$ = arg_blk_pass($$, $2); - /*% - $$ = arg_add_assocs(arg_new(), $1); - $$ = arg_add_optblock($$, $2); - %*/ - } - | arg_value ',' assocs opt_block_arg - { - /*%%%*/ - $$ = arg_append(NEW_LIST($1), NEW_HASH($3)); - $$ = arg_blk_pass($$, $4); - /*% - $$ = arg_add_assocs(arg_add(arg_new(), $1), $3); - $$ = arg_add_optblock($$, $4); - %*/ - } - | arg_value ',' args ',' assocs opt_block_arg - { - /*%%%*/ - $$ = arg_append(list_concat(NEW_LIST($1),$3), NEW_HASH($5)); - $$ = arg_blk_pass($$, $6); - /*% - $$ = arg_add_assocs(arg_prepend($3, $1), $5); - $$ = arg_add_optblock($$, $6); - %*/ - } - | block_arg - ; - command_args : { $$ = cmdarg_stack; CMDARG_PUSH(1); } - open_args + call_args { /* CMDARG_POP() */ cmdarg_stack = $1; @@ -2419,27 +2370,6 @@ command_args : { } ; -open_args : call_args - | tLPAREN_ARG {lex_state = EXPR_ENDARG;} rparen - { - /*%%%*/ - rb_warning0("don't put space before argument parentheses"); - $$ = 0; - /*% - $$ = dispatch1(space, dispatch1(arg_paren, arg_new())); - %*/ - } - | tLPAREN_ARG call_args2 {lex_state = EXPR_ENDARG;} rparen - { - /*%%%*/ - rb_warning0("don't put space before argument parentheses"); - $$ = $2; - /*% - $$ = dispatch1(space, dispatch1(arg_paren, $2)); - %*/ - } - ; - block_arg : tAMPER arg_value { /*%%%*/ @@ -6897,13 +6827,9 @@ parser_yylex(struct parser_params *parser) c = tLPAREN; } else if (space_seen) { - if (lex_state == EXPR_CMDARG) { + if (IS_ARG()) { c = tLPAREN_ARG; } - else if (lex_state == EXPR_ARG) { - rb_warning0("don't put space before argument parentheses"); - c = '('; - } } paren_nest++; COND_PUSH(0); -- cgit v1.2.3