Use a case statement in Liquid::Parser#expression

This commit is contained in:
Dylan Thacker-Smith
2020-10-19 11:32:18 -04:00
parent 077bf2a409
commit 6d39050e1e

View File

@@ -46,16 +46,14 @@ module Liquid
tok[0] == type
end
SINGLE_TOKEN_EXPRESSION_TYPES = [:string, :number].freeze
private_constant :SINGLE_TOKEN_EXPRESSION_TYPES
def expression
token = @tokens[@p]
if token[0] == :id
case token[0]
when :id
variable_signature
elsif SINGLE_TOKEN_EXPRESSION_TYPES.include?(token[0])
when :string, :number
consume
elsif token.first == :open_round
when :open_round
consume
first = expression
consume(:dotdot)