mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Replace manual rest_blank? with regex skip + eos? check\n\nResult: {"status":"keep","combined_µs":4047,"parse_µs":2795,"render_µs":1252,"allocations":25535}
This commit is contained in:
@@ -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-]*\??
|
||||
|
||||
Reference in New Issue
Block a user