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

ruby-changes:58561

From: Nobuyoshi <ko1@a...>
Date: Mon, 4 Nov 2019 23:44:59 +0900 (JST)
Subject: [ruby-changes:58561] e91e3274be (master): Keep `lex.pcur` after `looking_at_eol_p`

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

From e91e3274bebc803b97971ad0a6f4ee3a8c646a60 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Mon, 4 Nov 2019 23:37:53 +0900
Subject: Keep `lex.pcur` after `looking_at_eol_p`


diff --git a/parse.y b/parse.y
index e957c06..61c1174 100644
--- a/parse.y
+++ b/parse.y
@@ -6283,11 +6283,11 @@ pushback(struct parser_params *p, int c) https://github.com/ruby/ruby/blob/trunk/parse.y#L6283
 static int
 looking_at_eol_p(struct parser_params *p)
 {
-    int c;
-    while ((c = nextc(p)) != -1) {
+    const char *ptr = p->lex.pcur;
+    while (ptr < p->lex.pend) {
+	int c = (unsigned char)*ptr++;
 	int eol = (c == '\n' || c == '#');
 	if (eol || !ISSPACE(c)) {
-	    pushback(p, c);
 	    return eol;
 	}
     }
-- 
cgit v0.10.2


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

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