Address comments

This commit is contained in:
Peter Zhu
2020-11-09 12:34:13 -05:00
parent d1a08eacfe
commit 2c0c672df8

View File

@@ -107,14 +107,22 @@ module Liquid
end end
end end
private def parse_for_document(tokenizer, parse_context) private def handle_invalid_tag_token(token, parse_context)
if token.end_with?('%}')
yield token, token
else
BlockBody.raise_missing_tag_terminator(token, parse_context)
end
end
private def parse_for_document(tokenizer, parse_context, &block)
while (token = tokenizer.shift) while (token = tokenizer.shift)
next if token.empty? next if token.empty?
case case
when token.start_with?(TAGSTART) when token.start_with?(TAGSTART)
whitespace_handler(token, parse_context) whitespace_handler(token, parse_context)
unless token =~ FullToken unless token =~ FullToken
return yield token, token return handle_invalid_tag_token(token, parse_context, &block)
end end
tag_name = Regexp.last_match(2) tag_name = Regexp.last_match(2)
markup = Regexp.last_match(4) markup = Regexp.last_match(4)