class Sass::Engine

def tabulate(string)

def tabulate(string)
  tab_str = nil
  first = true
  lines = []
  string.gsub(/\r|\n|\r\n|\r\n/, "\n").scan(/^.*?$/).each_with_index do |line, index|
    index += (@options[:line] || 1)
    if line.strip.empty?
      lines.last.text << "\n" if lines.last && lines.last.comment?
      next
    end
    line_tab_str = line[/^\s*/]
    unless line_tab_str.empty?
      tab_str ||= line_tab_str
      raise SyntaxError.new("Indenting at the beginning of the document is illegal.", index) if first
      if tab_str.include?(?\s) && tab_str.include?(?\t)
        raise SyntaxError.new("Indentation can't use both tabs and spaces.", index)
      end
    end
    first &&= !tab_str.nil?
    if tab_str.nil?
      lines << Line.new(line.strip, 0, index, 0, @options[:filename], [])
      next
    end
    if lines.last && lines.last.comment? && line =~ /^(?:#{tab_str}){#{lines.last.tabs + 1}}(.*)$/
      lines.last.text << "\n" << $1
      next
    end
    line_tabs = line_tab_str.scan(tab_str).size
    raise SyntaxError.new(<<END.strip.gsub("\n", ' '), index) if tab_str * line_tabs != line_tab_str
nsistent indentation: #{Haml::Shared.human_indentation line_tab_str, true} used for indentation,
the rest of the document was indented using #{Haml::Shared.human_indentation tab_str}.
    lines << Line.new(line.strip, line_tabs, index, tab_str.size, @options[:filename], [])
  end
  lines
end