mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* parse.y (rparen): ignore preceding newlines to right parentheses.
(ruby-bugs:PR#1221) [ruby-dev:22858] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0b97d6f458
commit
263769b65b
2 changed files with 22 additions and 14 deletions
|
@ -1,3 +1,8 @@
|
|||
Thu Feb 12 15:23:20 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* parse.y (rparen): ignore preceding newlines to right parentheses.
|
||||
(ruby-bugs:PR#1221) [ruby-dev:22858]
|
||||
|
||||
Thu Feb 12 14:17:43 2004 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||
|
||||
* configure.in: set ac_cv_func_link to yes to enable link() on MinGW.
|
||||
|
|
31
parse.y
31
parse.y
|
@ -734,14 +734,14 @@ command : operation command_args %prec tLOWEST
|
|||
;
|
||||
|
||||
mlhs : mlhs_basic
|
||||
| tLPAREN mlhs_entry ')'
|
||||
| tLPAREN mlhs_entry rparen
|
||||
{
|
||||
$$ = $2;
|
||||
}
|
||||
;
|
||||
|
||||
mlhs_entry : mlhs_basic
|
||||
| tLPAREN mlhs_entry ')'
|
||||
| tLPAREN mlhs_entry rparen
|
||||
{
|
||||
$$ = NEW_MASGN(NEW_LIST($2), 0);
|
||||
}
|
||||
|
@ -774,7 +774,7 @@ mlhs_basic : mlhs_head
|
|||
;
|
||||
|
||||
mlhs_item : mlhs_node
|
||||
| tLPAREN mlhs_entry ')'
|
||||
| tLPAREN mlhs_entry rparen
|
||||
{
|
||||
$$ = $2;
|
||||
}
|
||||
|
@ -1242,16 +1242,16 @@ paren_args : '(' none ')'
|
|||
{
|
||||
$$ = $2;
|
||||
}
|
||||
| '(' call_args opt_nl ')'
|
||||
| '(' call_args rparen
|
||||
{
|
||||
$$ = $2;
|
||||
}
|
||||
| '(' block_call opt_nl ')'
|
||||
| '(' block_call rparen
|
||||
{
|
||||
rb_warn("parenthesize argument for future version");
|
||||
$$ = NEW_LIST($2);
|
||||
}
|
||||
| '(' args ',' block_call opt_nl ')'
|
||||
| '(' args ',' block_call rparen
|
||||
{
|
||||
rb_warn("parenthesize argument for future version");
|
||||
$$ = list_append($2, $4);
|
||||
|
@ -1372,12 +1372,12 @@ command_args : {
|
|||
;
|
||||
|
||||
open_args : call_args
|
||||
| tLPAREN_ARG {lex_state = EXPR_ENDARG;} ')'
|
||||
| tLPAREN_ARG {lex_state = EXPR_ENDARG;} rparen
|
||||
{
|
||||
rb_warn("don't put space before argument parentheses");
|
||||
$$ = 0;
|
||||
}
|
||||
| tLPAREN_ARG call_args2 {lex_state = EXPR_ENDARG;} ')'
|
||||
| tLPAREN_ARG call_args2 {lex_state = EXPR_ENDARG;} rparen
|
||||
{
|
||||
rb_warn("don't put space before argument parentheses");
|
||||
$$ = $2;
|
||||
|
@ -1443,7 +1443,7 @@ primary : literal
|
|||
$$ = NEW_BEGIN($3);
|
||||
nd_set_line($$, $<num>1);
|
||||
}
|
||||
| tLPAREN_ARG expr {lex_state = EXPR_ENDARG;} opt_nl ')'
|
||||
| tLPAREN_ARG expr {lex_state = EXPR_ENDARG;} rparen
|
||||
{
|
||||
rb_warning("(...) interpreted as grouped expression");
|
||||
$$ = $2;
|
||||
|
@ -1485,11 +1485,11 @@ primary : literal
|
|||
{
|
||||
$$ = NEW_RETURN(0);
|
||||
}
|
||||
| kYIELD '(' call_args ')'
|
||||
| kYIELD '(' call_args rparen
|
||||
{
|
||||
$$ = new_yield($3);
|
||||
}
|
||||
| kYIELD '(' ')'
|
||||
| kYIELD '(' rparen
|
||||
{
|
||||
$$ = NEW_YIELD(0, Qfalse);
|
||||
}
|
||||
|
@ -1497,7 +1497,7 @@ primary : literal
|
|||
{
|
||||
$$ = NEW_YIELD(0, Qfalse);
|
||||
}
|
||||
| kDEFINED opt_nl '(' {in_defined = 1;} expr ')'
|
||||
| kDEFINED opt_nl '(' {in_defined = 1;} expr rparen
|
||||
{
|
||||
in_defined = 0;
|
||||
$$ = NEW_DEFINED($5);
|
||||
|
@ -2190,7 +2190,7 @@ superclass : term
|
|||
| error term {yyerrok; $$ = 0;}
|
||||
;
|
||||
|
||||
f_arglist : '(' f_args opt_nl ')'
|
||||
f_arglist : '(' f_args rparen
|
||||
{
|
||||
$$ = $2;
|
||||
lex_state = EXPR_BEG;
|
||||
|
@ -2343,7 +2343,7 @@ singleton : var_ref
|
|||
value_expr($$);
|
||||
}
|
||||
}
|
||||
| '(' {lex_state = EXPR_BEG;} expr opt_nl ')'
|
||||
| '(' {lex_state = EXPR_BEG;} expr rparen
|
||||
{
|
||||
if ($3 == 0) {
|
||||
yyerror("can't define singleton method for ().");
|
||||
|
@ -2423,6 +2423,9 @@ opt_nl : /* none */
|
|||
| '\n'
|
||||
;
|
||||
|
||||
rparen : opt_nl ')'
|
||||
;
|
||||
|
||||
trailer : /* none */
|
||||
| '\n'
|
||||
| ','
|
||||
|
|
Loading…
Reference in a new issue