Build the tokenizer through the parse context for liquid-c (#1386)

This commit is contained in:
Dylan Thacker-Smith
2021-01-07 14:51:41 -05:00
committed by GitHub
parent 42b6c07cd0
commit 260c863e23
4 changed files with 18 additions and 10 deletions
+2 -5
View File
@@ -107,7 +107,8 @@ module Liquid
# Returns self for easy chaining
def parse(source, options = {})
parse_context = configure_options(options)
@root = Document.parse(tokenize(source), parse_context)
tokenizer = parse_context.new_tokenizer(source, start_line_number: @line_numbers && 1)
@root = Document.parse(tokenizer, parse_context)
self
end
@@ -223,10 +224,6 @@ module Liquid
parse_context
end
def tokenize(source)
Tokenizer.new(source, @line_numbers)
end
def apply_options_to_context(context, options)
context.add_filters(options[:filters]) if options[:filters]
context.global_filter = options[:global_filter] if options[:global_filter]