mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-19 02:40:41 -07:00
Use a case statement in Liquid::Parser#expression
This commit is contained in:
@@ -46,16 +46,14 @@ module Liquid
|
|||||||
tok[0] == type
|
tok[0] == type
|
||||||
end
|
end
|
||||||
|
|
||||||
SINGLE_TOKEN_EXPRESSION_TYPES = [:string, :number].freeze
|
|
||||||
private_constant :SINGLE_TOKEN_EXPRESSION_TYPES
|
|
||||||
|
|
||||||
def expression
|
def expression
|
||||||
token = @tokens[@p]
|
token = @tokens[@p]
|
||||||
if token[0] == :id
|
case token[0]
|
||||||
|
when :id
|
||||||
variable_signature
|
variable_signature
|
||||||
elsif SINGLE_TOKEN_EXPRESSION_TYPES.include?(token[0])
|
when :string, :number
|
||||||
consume
|
consume
|
||||||
elsif token.first == :open_round
|
when :open_round
|
||||||
consume
|
consume
|
||||||
first = expression
|
first = expression
|
||||||
consume(:dotdot)
|
consume(:dotdot)
|
||||||
|
|||||||
Reference in New Issue
Block a user