mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-26 13:45:13 -07:00
Update the parser to use the new tokens
This commit is contained in:
+16
-1
@@ -48,7 +48,7 @@ module Liquid
|
|||||||
|
|
||||||
def expression
|
def expression
|
||||||
token = @tokens[@p]
|
token = @tokens[@p]
|
||||||
case token[0]
|
expr = case token[0]
|
||||||
when :id
|
when :id
|
||||||
str = consume
|
str = consume
|
||||||
str << variable_lookups
|
str << variable_lookups
|
||||||
@@ -69,6 +69,21 @@ module Liquid
|
|||||||
else
|
else
|
||||||
raise SyntaxError, "#{token} is not a valid expression"
|
raise SyntaxError, "#{token} is not a valid expression"
|
||||||
end
|
end
|
||||||
|
if look(:comparison)
|
||||||
|
operator = consume(:comparison)
|
||||||
|
left = expr
|
||||||
|
right = expression
|
||||||
|
|
||||||
|
"#{left} #{operator} #{right}"
|
||||||
|
elsif look(:boolean_operator)
|
||||||
|
operator = consume(:boolean_operator)
|
||||||
|
left = expr
|
||||||
|
right = expression
|
||||||
|
|
||||||
|
"#{left} #{operator} #{right}"
|
||||||
|
else
|
||||||
|
expr
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def argument
|
def argument
|
||||||
|
|||||||
Reference in New Issue
Block a user