Skip to content

Commit afee90b

Browse files
committed
Strict parsing only on Liquid::Variable
1 parent c5711c0 commit afee90b

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

lib/liquid/variable.rb

+7-17
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def initialize(markup, parse_context)
3030
@parse_context = parse_context
3131
@line_number = parse_context.line_number
3232

33-
strict_parse_with_error_mode_fallback(markup)
33+
strict_parse_with_error_context(markup)
3434
end
3535

3636
def raw
@@ -41,22 +41,12 @@ def markup_context(markup)
4141
"in \"{{#{markup}}}\""
4242
end
4343

44-
def lax_parse(markup)
45-
@filters = []
46-
return unless markup =~ MarkupWithQuotedFragment
47-
48-
name_markup = Regexp.last_match(1)
49-
filter_markup = Regexp.last_match(2)
50-
@name = parse_context.parse_expression(name_markup)
51-
if filter_markup =~ FilterMarkupRegex
52-
filters = Regexp.last_match(1).scan(FilterParser)
53-
filters.each do |f|
54-
next unless f =~ /\w+/
55-
filtername = Regexp.last_match(0)
56-
filterargs = f.scan(FilterArgsRegex).flatten
57-
@filters << parse_filter_expressions(filtername, filterargs)
58-
end
59-
end
44+
def strict_parse_with_error_context(markup)
45+
strict_parse(markup)
46+
rescue SyntaxError => e
47+
e.line_number = line_number
48+
e.markup_context = markup_context(markup)
49+
raise e
6050
end
6151

6252
def strict_parse(markup)

0 commit comments

Comments
 (0)