mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Collapse float and int into 'number'
This commit is contained in:
+2
-4
@@ -12,8 +12,7 @@ module Liquid
|
||||
IDENTIFIER = /[\w\-?!]+/
|
||||
SINGLE_STRING_LITERAL = /'[^\']*'/
|
||||
DOUBLE_STRING_LITERAL = /"[^\"]*"/
|
||||
INTEGER_LITERAL = /-?\d+/
|
||||
FLOAT_LITERAL = /-?\d+\.\d+/
|
||||
NUMBER_LITERAL = /-?\d+(\.\d+)?/
|
||||
COMPARISON_OPERATOR = /==|!=|<>|<=?|>=?|contains/
|
||||
|
||||
def initialize(input)
|
||||
@@ -31,8 +30,7 @@ module Liquid
|
||||
when t = @ss.scan(COMPARISON_OPERATOR) then [:comparison, t]
|
||||
when t = @ss.scan(SINGLE_STRING_LITERAL) then [:string, t]
|
||||
when t = @ss.scan(DOUBLE_STRING_LITERAL) then [:string, t]
|
||||
when t = @ss.scan(FLOAT_LITERAL) then [:float, t]
|
||||
when t = @ss.scan(INTEGER_LITERAL) then [:integer, t]
|
||||
when t = @ss.scan(NUMBER_LITERAL) then [:number, t]
|
||||
when t = @ss.scan(IDENTIFIER) then [:id, t]
|
||||
else
|
||||
c = @ss.getch
|
||||
|
||||
@@ -52,7 +52,7 @@ module Liquid
|
||||
token = @tokens[@p]
|
||||
if token[0] == :id
|
||||
variable_signature
|
||||
elsif [:string, :integer, :float].include? token[0]
|
||||
elsif [:string, :number].include? token[0]
|
||||
consume
|
||||
token[1]
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user