Create a Liquid::Tokenizer class in the C extension.

This commit is contained in:
Dylan Thacker-Smith
2014-02-27 15:20:22 -05:00
parent 8bb3bca64a
commit ea8406e36e
9 changed files with 220 additions and 34 deletions
+1 -8
View File
@@ -162,16 +162,9 @@ module Liquid
private
# Uses the <tt>Liquid::TemplateParser</tt> regexp to tokenize the passed source
def tokenize(source)
source = source.source if source.respond_to?(:source)
return [] if source.to_s.empty?
tokens = source.split(TemplateParser)
# removes the rogue empty element at the beginning of the array
tokens.shift if tokens[0] and tokens[0].empty?
tokens
Tokenizer.new(source.to_s)
end
end