mirror of
https://github.com/Shopify/liquid.git
synced 2026-10-04 01:25:14 -07:00
Simplify lexer logic.
This commit is contained in:
+1
-5
@@ -26,9 +26,9 @@ module Liquid
|
|||||||
|
|
||||||
loop do
|
loop do
|
||||||
@ss.skip(/\s*/)
|
@ss.skip(/\s*/)
|
||||||
|
return @output.push([:end_of_string]) if @ss.eos?
|
||||||
|
|
||||||
tok = case
|
tok = case
|
||||||
when @ss.eos? then nil
|
|
||||||
when t = @ss.scan(COMPARISON_OPERATOR) then [:comparison, t]
|
when t = @ss.scan(COMPARISON_OPERATOR) then [:comparison, t]
|
||||||
when t = @ss.scan(SINGLE_STRING_LITERAL) then [:string, t]
|
when t = @ss.scan(SINGLE_STRING_LITERAL) then [:string, t]
|
||||||
when t = @ss.scan(DOUBLE_STRING_LITERAL) then [:string, t]
|
when t = @ss.scan(DOUBLE_STRING_LITERAL) then [:string, t]
|
||||||
@@ -43,10 +43,6 @@ module Liquid
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
unless tok
|
|
||||||
@output << [:end_of_string]
|
|
||||||
return @output
|
|
||||||
end
|
|
||||||
@output << tok
|
@output << tok
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user