Warning about space before argument parentheses

e$B$J$+$@$G$9!#e(B

e$B$3$N7Y9p$Oe(B1.8.0e$B$N$H$-$+$i:#$N7A$G=P$F$$$^$9$7!"$=$m$=$m%a%=%C%Ie(B
e$BL>$H%+%C%3$N4V$K$O%9%Z!<%9$OCV$1$J$/$7$F$b$$$$$s$8$c$J$$$G$7$g$&e(B
e$B$+!#e(B

Index: parse.y

— parse.y (revision 15639)
+++ parse.y (working copy)
@@ -663,6 +663,6 @@ static void ripper_compile_error(struct
%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
@@ -2326,58 +2326,9 @@ 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() */
    

@@ -2387,25 +2338,4 @@ 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
{
@@ -6868,11 +6798,7 @@ parser_yylex(struct parser_params *parse
}
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++;

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:33943] warning about space before argument
parentheses”
on Fri, 29 Feb 2008 16:26:22 +0900, Nobuyoshi N.
[email protected] writes:

|e$B$3$N7Y9p$Oe(B1.8.0e$B$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!e(B
e$B%(%i!<$K$J$i$J$/$J$k!"$H$$$&%a%j%C%H$O$"$j$^$9!#e(B

e$B8m2r$5$l$k$h$&$J=q$-J}$r$7$F$7$^$C$?$3$H$K5$$E$$$?$N$G!"D{@5$7$^e(B
e$B$9!#%a%=%C%IL>$H%+%C%3$N4V$K%9%Z!<%9$rCV$/$3$H$rJ8K!E*$K6X;$9$ke(B
e$B$N$G$O$J$/!"%9%Z!<%9$,$"$k>l9g$O%a%=%C%I$N%+%C%3$G$O$J$/0z?t$r0Oe(B
e$B$`%+%C%3$H$
$J$9$h$&$K$J$k$H$$$&$3$H$G$9!#$D$^$je(Bdon’t put
space…e$B$N7Y9p$NBe$o$j$Ke(Binterpreted as grouped
expressione$B$,=P$ke(B
e$B$h$&$K$J$j$^$9!#e(B

$ ruby18 -wce ‘foo (1)’
-e:1: warning: (…) interpreted as grouped expression
Syntax OK
$ ruby19 -wce ‘foo (1)’
-e:1: warning: (…) interpreted as grouped expression
Syntax OK

$ ruby18 -wce ‘self.foo (1)’
-e:1: warning: don’t put space before argument parentheses
Syntax OK
$ ruby19 -wce ‘self.foo (1)’
-e:1: warning: (…) interpreted as grouped expression
Syntax OK