[前][次][番号順一覧][スレッド一覧]

ruby-changes:47915

From: nobu <ko1@a...>
Date: Tue, 26 Sep 2017 22:40:19 +0900 (JST)
Subject: [ruby-changes:47915] nobu:r60034 (trunk): parse.y: moved duplicate conditions

nobu	2017-09-26 22:40:14 +0900 (Tue, 26 Sep 2017)

  New Revision: 60034

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60034

  Log:
    parse.y: moved duplicate conditions

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 60033)
+++ parse.y	(revision 60034)
@@ -8458,16 +8458,16 @@ parser_yylex(struct parser_params *parse https://github.com/ruby/ruby/blob/trunk/parse.y#L8458
 	if (IS_BEG()) {
 	    c = tLPAREN;
 	}
-	else if (IS_SPCARG(-1)) {
+	else if (!space_seen) {
+	    /* foo( ... ) => method call, no ambiguity */
+	}
+	else if (IS_ARG() || IS_lex_state_all(EXPR_END|EXPR_LABEL)) {
 	    c = tLPAREN_ARG;
 	}
-	else if (IS_lex_state(EXPR_ENDFN) && space_seen && !lambda_beginning_p()) {
+	else if (IS_lex_state(EXPR_ENDFN) && !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) {
-	    c = tLPAREN_ARG;
-	}
 	paren_nest++;
 	COND_PUSH(0);
 	CMDARG_PUSH(0);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]