mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-20 19:30:47 -07:00
clean up filter parsing: Lexer fallback for args, no-arg fast scan stays
This commit is contained in:
@@ -202,12 +202,10 @@ module Liquid
|
|||||||
# Skip whitespace
|
# Skip whitespace
|
||||||
filter_pos += 1 while filter_pos < len && markup.getbyte(filter_pos) == 32
|
filter_pos += 1 while filter_pos < len && markup.getbyte(filter_pos) == 32
|
||||||
|
|
||||||
# Check for colon (has arguments) — use Lexer for the remaining filter chain
|
# Has arguments — use Lexer-based parser for this and remaining filters
|
||||||
if filter_pos < len && markup.getbyte(filter_pos) == 58 # ':'
|
if filter_pos < len && markup.getbyte(filter_pos) == 58 # ':'
|
||||||
# Rewind to the '|' before this filter and use Lexer for the rest
|
# Rewind to the '|' before this filter for the Lexer
|
||||||
# We already have filters parsed so far as no-arg filters
|
|
||||||
rest_start = fname_start
|
rest_start = fname_start
|
||||||
# Go back to find the '|' before this filter name
|
|
||||||
rest_start -= 1 while rest_start > pos && markup.getbyte(rest_start) != 124
|
rest_start -= 1 while rest_start > pos && markup.getbyte(rest_start) != 124
|
||||||
rest_markup = markup.byteslice(rest_start, len - rest_start)
|
rest_markup = markup.byteslice(rest_start, len - rest_start)
|
||||||
p = parse_context.new_parser(rest_markup)
|
p = parse_context.new_parser(rest_markup)
|
||||||
|
|||||||
Reference in New Issue
Block a user