Implement line numbers without the Liquid::Token class.

This commit is contained in:
Dylan Thacker-Smith
2015-07-08 19:21:59 -04:00
parent afda01adbb
commit cebf75b8d7
19 changed files with 186 additions and 194 deletions
+3 -4
View File
@@ -1,16 +1,15 @@
module Liquid
module ParserSwitching
def parse_with_selected_parser(markup)
case @options[:error_mode] || Template.error_mode
case @options.error_mode
when :strict then strict_parse_with_error_context(markup)
when :lax then lax_parse(markup)
when :warn
begin
return strict_parse_with_error_context(markup)
rescue SyntaxError => e
e.set_line_number_from_token(markup)
@warnings ||= []
@warnings << e
e.line_number = line_number
@options.warnings << e
return lax_parse(markup)
end
end