Merge pull request #570 from Shopify/fix-strict-conditions

Fix condition parse order in strict mode
This commit is contained in:
Justin Li
2015-05-28 16:37:43 -04:00
parent 5d7c00a202
commit 49f2af4209
3 changed files with 31 additions and 10 deletions
+8 -8
View File
@@ -78,16 +78,16 @@ module Liquid
def strict_parse(markup)
p = Parser.new(markup)
condition = parse_comparison(p)
while op = (p.id?('and'.freeze) || p.id?('or'.freeze))
new_cond = parse_comparison(p)
new_cond.send(op, condition)
condition = new_cond
end
condition = parse_binary_comparison(p)
p.consume(:end_of_string)
condition
end
def parse_binary_comparison(p)
condition = parse_comparison(p)
if op = (p.id?('and'.freeze) || p.id?('or'.freeze))
condition.send(op, parse_binary_comparison(p))
end
condition
end