liquid
liquid copied to clipboard
Change Parser#expression to build the expression during strict parsing
Currently, the strict parser uses Parser#expression to build the string and then uses Expression.parse to parse the built string. Since Expression.parse is regex based, it has trouble parsing certain things (especially statements with parenthesis for order of operations).
An example of different behaviour between liquid and liquid-c is the (invalid) range (1..(1..5)). Liquid-c will correctly parse the range as from 1 to 1..5, and will raise a NoMethodError on 1..5 (due to calling to_i). But liquid parses it as a range of 1..(1 to 5). These two endpoints of the range will be treated as variables and passed to RangeLookup, which resolves both as nil, which Ruby resolves to the range 0..0.