mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
expose expression_cache/string_scanner via attr_reader, skip regex in filter args without colon
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
module Liquid
|
||||
class ParseContext
|
||||
attr_accessor :locale, :line_number, :trim_whitespace, :depth
|
||||
attr_reader :partial, :warnings, :error_mode, :environment
|
||||
attr_reader :partial, :warnings, :error_mode, :environment, :expression_cache, :string_scanner
|
||||
|
||||
def initialize(options = Const::EMPTY_HASH)
|
||||
@environment = options.fetch(:environment, Environment.default)
|
||||
|
||||
@@ -143,8 +143,8 @@ module Liquid
|
||||
|
||||
# Resolve the name expression
|
||||
expr_markup = markup.byteslice(name_start, name_end - name_start)
|
||||
cache = parse_context.instance_variable_get(:@expression_cache)
|
||||
ss = parse_context.instance_variable_get(:@string_scanner)
|
||||
cache = parse_context.expression_cache
|
||||
ss = parse_context.string_scanner
|
||||
|
||||
if Expression::LITERALS.key?(expr_markup)
|
||||
@name = Expression::LITERALS[expr_markup]
|
||||
@@ -300,7 +300,8 @@ module Liquid
|
||||
filter_args = []
|
||||
keyword_args = nil
|
||||
unparsed_args.each do |a|
|
||||
if (matches = a.match(JustTagAttributes))
|
||||
# Fast check: keyword args must contain ':'
|
||||
if a.include?(':') && (matches = a.match(JustTagAttributes))
|
||||
keyword_args ||= {}
|
||||
keyword_args[matches[1]] = parse_context.parse_expression(matches[2])
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user