mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-19 10:52:48 -07:00
more micro optimization
This commit is contained in:
+16
-8
@@ -50,16 +50,24 @@ module Liquid
|
|||||||
|
|
||||||
def next_token
|
def next_token
|
||||||
# possible states: :text, :tag, :variable
|
# possible states: :text, :tag, :variable
|
||||||
c_list = @ss.peek(2)
|
byte_a = @ss.scan_byte
|
||||||
|
|
||||||
case c_list
|
if byte_a == OPEN_CURLEY
|
||||||
when "{%"
|
byte_b = @ss.scan_byte
|
||||||
next_tag_token
|
|
||||||
when "{{"
|
if byte_b == PERCENTAGE
|
||||||
next_variable_token
|
@ss.pos -= 2
|
||||||
else
|
return next_tag_token
|
||||||
next_text_token
|
elsif byte_b == OPEN_CURLEY
|
||||||
|
@ss.pos -= 2
|
||||||
|
return next_variable_token
|
||||||
|
end
|
||||||
|
|
||||||
|
@ss.pos -= 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ss.pos -= 1
|
||||||
|
next_text_token
|
||||||
end
|
end
|
||||||
|
|
||||||
def next_text_token
|
def next_text_token
|
||||||
|
|||||||
Reference in New Issue
Block a user