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
|
# Check if remaining bytes are all whitespace
|
||||||
def rest_blank?
|
def rest_blank?
|
||||||
p = @ss.pos
|
saved = @ss.pos
|
||||||
len = @source.bytesize
|
@ss.skip(/\s*/)
|
||||||
while p < len
|
result = @ss.eos?
|
||||||
b = @source.getbyte(p)
|
@ss.pos = saved
|
||||||
return false unless b == SPACE || b == TAB || b == NL || b == CR || b == FF
|
result
|
||||||
|
|
||||||
p += 1
|
|
||||||
end
|
|
||||||
true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Regex for identifier: [a-zA-Z_][\w-]*\??
|
# Regex for identifier: [a-zA-Z_][\w-]*\??
|
||||||
|
|||||||
Reference in New Issue
Block a user