ruby-changes:45294
From: nobu <ko1@a...>
Date: Thu, 19 Jan 2017 10:39:06 +0900 (JST)
Subject: [ruby-changes:45294] nobu:r57367 (trunk): parse.y: warn space
nobu 2017-01-19 10:38:59 +0900 (Thu, 19 Jan 2017) New Revision: 57367 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57367 Log: parse.y: warn space * parse.y (parser_yylex): warn parentheses after space. Modified files: trunk/parse.y Index: parse.y =================================================================== --- parse.y (revision 57366) +++ parse.y (revision 57367) @@ -8536,11 +8536,18 @@ parser_yylex(struct parser_params *parse https://github.com/ruby/ruby/blob/trunk/parse.y#L8536 } else if (IS_SPCARG(-1)) { c = tLPAREN_ARG; + if (lex_state == EXPR_ARG) { + rb_warning0("parentheses after method name and a space is interpreted as " + "an argument list, not a parenthesed argument"); + } } else if (IS_lex_state(EXPR_ENDFN) && space_seen && !lambda_beginning_p()) { rb_warning0("parentheses after method name is interpreted as " "an argument list, not a decomposed argument"); } + else if (lex_state == (EXPR_END|EXPR_LABEL) && space_seen) { + rb_warning0("don't put space before argument parentheses"); + } paren_nest++; COND_PUSH(0); CMDARG_PUSH(0); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/