Module: Liquid::ParserSwitching

Included in:
Tag, Variable
Defined in:
lib/liquid/parser_switching.rb

Instance Method Summary collapse

Instance Method Details

#parse_with_selected_parser(markup) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/liquid/parser_switching.rb', line 3

def parse_with_selected_parser(markup)
  case @options[:error_mode] || Template.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
      return lax_parse(markup)
    end
  end
end