aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-19 01:38:59 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-19 01:38:59 +0000
commita68edc4dec8fa107c5314b19463d419533f31c38 (patch)
tree2dc146af38fc3b4ce9451ff2c7f9ad10225f8bc7 /parse.y
parente72f450d31d588d192a319fd51eb9651180aae00 (diff)
downloadruby-a68edc4dec8fa107c5314b19463d419533f31c38.tar.gz
parse.y: warn space
* parse.y (parser_yylex): warn parentheses after space. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y7
1 files changed, 7 insertions, 0 deletions
diff --git a/parse.y b/parse.y
index 8a800bbd50..0a070ed4bc 100644
--- a/parse.y
+++ b/parse.y
@@ -8536,11 +8536,18 @@ parser_yylex(struct parser_params *parser)
}
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);