ruby-changes:58559
From: Yusuke <ko1@a...>
Date: Mon, 4 Nov 2019 22:28:29 +0900 (JST)
Subject: [ruby-changes:58559] c303854e13 (master): Revert "Warn `if` and `elsif` at EOL [EXPERIMENTAL]"
https://git.ruby-lang.org/ruby.git/commit/?id=c303854e13 From c303854e134043d905baff2385add44cc2c28756 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh <mame@r...> Date: Mon, 4 Nov 2019 22:27:37 +0900 Subject: Revert "Warn `if` and `elsif` at EOL [EXPERIMENTAL]" This reverts commit ba35c14325ebbf1da8f200df83c45ee9937ff8a1. This is because ripper fails symbol lookup error. diff --git a/parse.y b/parse.y index 8fd2b05..e1fe38e 100644 --- a/parse.y +++ b/parse.y @@ -395,12 +395,6 @@ set_line_body(NODE *body, int line) https://github.com/ruby/ruby/blob/trunk/parse.y#L395 #define yyparse ruby_yyparse -#define WARN_EOL(tok) \ - (looking_at_eol_p(p) ? \ - rb_warning0("`" tok "' at the end of line without an expression") : \ - (void)0) -static int looking_at_eol_p(struct parser_params *p); - static NODE* cond(struct parser_params *p, NODE *node, const YYLTYPE *loc); static NODE* method_cond(struct parser_params *p, NODE *node, const YYLTYPE *loc); #define new_nil(loc) NEW_NIL(loc) @@ -3076,7 +3070,6 @@ k_begin : keyword_begin https://github.com/ruby/ruby/blob/trunk/parse.y#L3070 k_if : keyword_if { - WARN_EOL("if"); token_info_push(p, "if", &@$); if (p->token_info && p->token_info->nonspc && p->token_info->next && !strcmp(p->token_info->next->token, "else")) { @@ -3186,7 +3179,6 @@ k_else : keyword_else https://github.com/ruby/ruby/blob/trunk/parse.y#L3179 k_elsif : keyword_elsif { - WARN_EOL("elisif"); token_info_warn(p, "elsif", p->token_info, 1, &@$); } ; @@ -6280,20 +6272,6 @@ pushback(struct parser_params *p, int c) https://github.com/ruby/ruby/blob/trunk/parse.y#L6272 #define tok(p) (p)->tokenbuf #define toklen(p) (p)->tokidx -static int -looking_at_eol_p(struct parser_params *p) -{ - int c; - while ((c = nextc(p)) != -1) { - int eol = (c == '\n' || c == '#'); - if (eol || !ISSPACE(c)) { - pushback(p, c); - return eol; - } - } - return TRUE; -} - static char* newtok(struct parser_params *p) { -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/