Simplifications from review

This commit is contained in:
Justin Li
2019-04-09 15:19:47 -04:00
parent e6ed804ca5
commit 7dc488a73b
2 changed files with 2 additions and 7 deletions

View File

@@ -26,11 +26,7 @@ module Liquid
private def parse_for_liquid_tag(tokenizer, parse_context)
while token = tokenizer.shift
case
when token.empty? || token =~ WhitespaceOrNothing
# pass, but assign line_number below, since it could change even when
# the token is empty
else
unless token.empty? || token =~ WhitespaceOrNothing
unless token =~ LiquidTagToken
# line isn't empty but didn't match tag syntax, yield and let the
# caller raise a syntax error
@@ -73,7 +69,7 @@ module Liquid
if tag_name == 'liquid'.freeze
liquid_tag_tokenizer = Tokenizer.new(markup, line_number: parse_context.line_number, for_liquid_tag: true)
next parse(liquid_tag_tokenizer, parse_context, &block)
next parse_for_liquid_tag(liquid_tag_tokenizer, parse_context, &block)
end
unless tag = registered_tags[tag_name]

View File

@@ -3,7 +3,6 @@
syntax:
tag_unexpected_args: "Syntax Error in '%{tag}' - Valid syntax: %{tag}"
assign: "Syntax Error in 'assign' - Valid syntax: assign [var] = [source]"
local: "Syntax Error in 'local' - Valid syntax: local [var] = [source]"
capture: "Syntax Error in 'capture' - Valid syntax: capture [var]"
case: "Syntax Error in 'case' - Valid syntax: case [condition]"
case_invalid_when: "Syntax Error in tag 'case' - Valid when condition: {% when [condition] [or condition2...] %}"