class Less::Node::Expression

def _sass_split(arr)

def _sass_split(arr)
  return arr[0].to_sass_tree, arr[1..-1] unless arr[0] == "("
  parens = 1
  i = arr[1..-1].each_with_index do |e, i|
    parens += 1 if e == "("
    parens -= 1 if e == ")"
    break i if parens == 0
  end
  return _to_sass_tree(arr[1...i+1]), arr[i+2..-1]
end

def _to_sass_tree(arr)

def _to_sass_tree(arr)
  return Sass::Script::UnaryOperation.new(_to_sass_tree(arr[1..-1]), :minus) if arr[0] == "-"
  _to_sass_tree2(*_sass_split(arr))
end

def _to_sass_tree2(first, rest)

def _to_sass_tree2(first, rest)
  return first if rest.empty?
  if rest[0].is_a?(Operator)
    op = LESS_TO_SASS_OPERATORS[rest[0]]
    if op == :times || op == :div
      second, rest = _sass_split(rest[1..-1])
      return _to_sass_tree2(Sass::Script::Operation.new(first, second, op), rest)
    else
      return Sass::Script::Operation.new(first, _to_sass_tree(rest[1..-1]), op)
    end
  end
  Sass::Script::Operation.new(first, _to_sass_tree(rest), :concat)
end

def to_sass_tree

def to_sass_tree
  if first.is_a?(Array)
    val = map {|e| _to_sass_tree(e)}.inject(nil) do |e, i|
      next i unless e
      Sass::Script::Operation.new(e, i, :comma)
    end
  else
    val = _to_sass_tree(self)
  end
  val.options = {}
  val
end