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

ruby-changes:55877

From: Nobuyoshi <ko1@a...>
Date: Tue, 28 May 2019 14:38:29 +0900 (JST)
Subject: [ruby-changes:55877] Nobuyoshi Nakada: 62b3d4c721 (trunk): Skip following all digits after `@@`

https://git.ruby-lang.org/ruby.git/commit/?id=62b3d4c721

From 62b3d4c721334108f89cd59407ffd910204e7868 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Tue, 28 May 2019 14:36:29 +0900
Subject: Skip following all digits after `@@`


diff --git a/parse.y b/parse.y
index 8a8c2ad..a218819 100644
--- a/parse.y
+++ b/parse.y
@@ -8368,13 +8368,13 @@ parse_atmark(struct parser_params *p, const enum lex_state_e last_state) https://github.com/ruby/ruby/blob/trunk/parse.y#L8368
 	return result;
     }
     else if (ISDIGIT(c)) {
+	const char *ptr = p->lex.pcur - 1;
+	size_t len = p->lex.pend - ptr;
+	int overflow;
+	unsigned long n = ruby_scan_digits(ptr, len, 10, &len, &overflow);
+	p->lex.pcur = ptr + len;
+	RUBY_SET_YYLLOC(loc);
 	if (result == tIVAR) {
-	    const char *ptr = p->lex.pcur - 1;
-	    size_t len = p->lex.pend - ptr;
-	    int overflow;
-	    unsigned long n = ruby_scan_digits(ptr, len, 10, &len, &overflow);
-	    p->lex.pcur = ptr + len;
-	    RUBY_SET_YYLLOC(loc);
 	    if (IS_lex_state(EXPR_FNAME)) {
 		compile_error(p, "`@%c' is not allowed as an instance variable name", c);
 	    }
@@ -8389,8 +8389,6 @@ parse_atmark(struct parser_params *p, const enum lex_state_e last_state) https://github.com/ruby/ruby/blob/trunk/parse.y#L8389
 	    }
 	}
 	else {
-	    RUBY_SET_YYLLOC(loc);
-	    pushback(p, c);
 	    compile_error(p, "`@@%c' is not allowed as a class variable name", c);
 	}
 	parser_show_error_line(p, &loc);
-- 
cgit v0.10.2


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

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