# Warning about space before argument parentheses

**URL:** <https://www.ruby-forum.com/t/warning-about-space-before-argument-parentheses/130549>\
**Category:** Development\
**Created:** [February 29, 2008, 8:27am UTC](https://www.ruby-forum.com/t/warning-about-space-before-argument-parentheses/130549 "2008-02-29T08:27:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nobu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e9c0ed/32.png) [@nobu](https://www.ruby-forum.com/u/nobu)\
**Post date:** [February 29, 2008, 8:27am UTC](https://www.ruby-forum.com/t/warning-about-space-before-argument-parentheses/130549/1 "2008-02-29T08:27:39Z")

</div>

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++;

---

<div class="post-metadata">

**Author:** ![nobu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e9c0ed/32.png) [@nobu](https://www.ruby-forum.com/u/nobu)\
**Post date:** [March 3, 2008, 12:42am UTC](https://www.ruby-forum.com/t/warning-about-space-before-argument-parentheses/130549/2 "2008-03-03T00:42:20Z")

</div>

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.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

|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

e$B3g8L$rCV$/$3$H$O[#Kf$5$rA}$d$90-$$%9%?%$%k$@$H$O;W$$$^$9$,!"e(B  
e$BJ8K!E\*$K6X;\_$9$Y$-$[$I$@$H$O;W$$$^$;$s!#7Y9p$N$^$^$,$A$g$&$Ie(B  
e$B$$$$$H;W$&$s$G$9$,$I$&$G$7$g$&!)e(B

---

<div class="post-metadata">

**Author:** ![nobu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e9c0ed/32.png) [@nobu](https://www.ruby-forum.com/u/nobu)\
**Post date:** [March 3, 2008, 6:49am UTC](https://www.ruby-forum.com/t/warning-about-space-before-argument-parentheses/130549/3 "2008-03-03T06:49:09Z")

</div>

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

At Mon, 3 Mar 2008 08:41:01 +0900,  
Yukihiro M. wrote in [ruby-dev:33961]:

> |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
> 
> e$B3g8L$rCV$/$3$H$O[#Kf$5$rA}$d$90-$$%9%?%$%k$@$H$O;W$$$^$9$,!"e(B

e$B%9%Z!\<%9$G$9$M!#e(B

> e$BJ8K!E\*$K6X;\_$9$Y$-$[$I$@$H$O;W$$$^$;$s!#7Y9p$N$^$^$,$A$g$&$Ie(B  
> e$B$$$$$H;W$&$s$G$9$,$I$&$G$7$g$&!)e(B

e$B$$$+$K$b0z?tFs$D$N%a%=%C%I8F=P$N$h$&$K8+$($k!Ve(Bfoo (1),  
2e$B!W$,J8K!e(B  
e$B%(%i!\<$K$J$i$J$/$J$k!"$H$$$&%a%j%C%H$O$"$j$^$9!#e(B

---

<div class="post-metadata">

**Author:** ![nobu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e9c0ed/32.png) [@nobu](https://www.ruby-forum.com/u/nobu)\
**Post date:** [March 6, 2008, 4:03am UTC](https://www.ruby-forum.com/t/warning-about-space-before-argument-parentheses/130549/4 "2008-03-06T04:03:44Z")

</div>

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

At Mon, 3 Mar 2008 14:47:39 +0900,  
Nobuyoshi N. wrote in [ruby-dev:33968]:

> e$B$$$+$K$b0z?tFs$D$N%a%=%C%I8F=P$N$h$&$K8+$($k!Ve(Bfoo (1), 2e$B!W$,J8K!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
