assign regex to a constant

This commit is contained in:
Ashwin Maroli
2018-03-13 23:36:56 +05:30
parent a0bec1f873
commit e4da4d49d2
4 changed files with 24 additions and 12 deletions
+2 -1
View File
@@ -19,6 +19,7 @@ module Liquid
NUMBER_LITERAL = /-?\d+(\.\d+)?/
DOTDOT = /\.\./
COMPARISON_OPERATOR = /==|!=|<>|<=?|>=?|contains(?=\s)/
WHITESPACE_OR_NOTHING = /\s*/
def initialize(input)
@ss = StringScanner.new(input)
@@ -28,7 +29,7 @@ module Liquid
@output = []
until @ss.eos?
@ss.skip(/\s*/)
@ss.skip(WHITESPACE_OR_NOTHING)
break if @ss.eos?
tok = case
when t = @ss.scan(COMPARISON_OPERATOR) then [:comparison, t]