diff --git a/lib/liquid/expression.rb b/lib/liquid/expression.rb index 0a569e99..0d8a4471 100644 --- a/lib/liquid/expression.rb +++ b/lib/liquid/expression.rb @@ -109,12 +109,6 @@ module Liquid end def parse_number(markup, ss) - ss.string = markup - # the first byte must be a digit, a period, or a dash - byte = ss.scan_byte - - return false if byte != DASH && byte != DOT && (byte < ZERO || byte > NINE) - # check if the markup is simple integer or float case markup when INTEGER_REGEX @@ -123,6 +117,12 @@ module Liquid return markup.to_f end + ss.string = markup + # the first byte must be a digit, a period, or a dash + byte = ss.scan_byte + + return false if byte != DASH && byte != DOT && (byte < ZERO || byte > NINE) + # The markup could be a float with multiple dots first_dot_pos = nil num_end_pos = nil