From 8d1f030825360c1b57cbdbea2ff04f2e38c8e78f Mon Sep 17 00:00:00 2001 From: Tobi Lutke Date: Wed, 11 Mar 2026 10:41:20 -0400 Subject: [PATCH] =?UTF-8?q?Replace=20manual=20rest=5Fblank=3F=20with=20reg?= =?UTF-8?q?ex=20skip=20+=20eos=3F=20check\n\nResult:=20{"status":"keep","c?= =?UTF-8?q?ombined=5F=C2=B5s":4047,"parse=5F=C2=B5s":2795,"render=5F=C2=B5?= =?UTF-8?q?s":1252,"allocations":25535}?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/liquid/cursor.rb | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/liquid/cursor.rb b/lib/liquid/cursor.rb index acd39444..5ec82876 100644 --- a/lib/liquid/cursor.rb +++ b/lib/liquid/cursor.rb @@ -79,15 +79,11 @@ module Liquid # Check if remaining bytes are all whitespace def rest_blank? - p = @ss.pos - len = @source.bytesize - while p < len - b = @source.getbyte(p) - return false unless b == SPACE || b == TAB || b == NL || b == CR || b == FF - - p += 1 - end - true + saved = @ss.pos + @ss.skip(/\s*/) + result = @ss.eos? + @ss.pos = saved + result end # Regex for identifier: [a-zA-Z_][\w-]*\??