class Object

Public Class Methods

new(source, line_numbers = false) click to toggle source
Calls superclass method
# File lib/liquid/c.rb, line 16
def self.new(source, line_numbers = false)
  if Liquid::C.enabled
    Liquid::C::Tokenizer.new(source.to_s, line_numbers)
  else
    super
  end
end
new(markup, name = nil, lookups = nil, command_flags = nil) click to toggle source
# File lib/liquid/c.rb, line 68
def initialize(markup, name = nil, lookups = nil, command_flags = nil)
  if Liquid::C.enabled && markup == false
    @name = name
    @lookups = lookups
    @command_flags = command_flags
  else
    ruby_initialize(markup)
  end
end
parse(markup) click to toggle source
# File lib/liquid/c.rb, line 83
def parse(markup)
  return nil unless markup

  if Liquid::C.enabled
    begin
      return c_parse(markup)
    rescue Liquid::SyntaxError
    end
  end
  ruby_parse(markup)
end
Also aliased as: ruby_parse
ruby_parse(markup)
Alias for: parse

Public Instance Methods

lax_parse(markup) click to toggle source
# File lib/liquid/c.rb, line 41
def lax_parse(markup)
  stats = options[:stats_callbacks]
  stats[:variable_parse].call if stats

  if Liquid::C.enabled
    begin
      return strict_parse(markup)
    rescue Liquid::SyntaxError
      stats[:variable_fallback].call if stats
    end
  end

  ruby_lax_parse(markup)
end
parse(tokens, options) { |t, m| ... } click to toggle source
# File lib/liquid/c.rb, line 28
def parse(tokens, options)
  if Liquid::C.enabled && !options[:profile]
    c_parse(tokens, options) { |t, m| yield t, m }
  else
    ruby_parse(tokens, options) { |t, m| yield t, m }
  end
end
strict_parse(markup) click to toggle source
# File lib/liquid/c.rb, line 56
def strict_parse(markup)
  if Liquid::C.enabled
    @name = Liquid::Variable.c_strict_parse(markup, @filters = [])
  else
    ruby_strict_parse(markup)
  end
end