class Sass::Engine

def append_children(parent, children, root)

def append_children(parent, children, root)
  continued_rule = nil
  continued_comment = nil
  children.each do |line|
    child = build_tree(parent, line, root)
    if child.is_a?(Tree::RuleNode) && child.continued?
      raise SyntaxError.new("Rules can't end in commas.",
        :line => child.line) unless child.children.empty?
      if continued_rule
        continued_rule.add_rules child
      else
        continued_rule = child
      end
      next
    end
    if continued_rule
      raise SyntaxError.new("Rules can't end in commas.",
        :line => continued_rule.line) unless child.is_a?(Tree::RuleNode)
      continued_rule.add_rules child
      continued_rule.children = child.children
      continued_rule, child = nil, continued_rule
    end
    if child.is_a?(Tree::CommentNode) && child.silent
      if continued_comment &&
          child.line == continued_comment.line +
          continued_comment.value.count("\n") + 1
        continued_comment.value << "\n" << child.value
        next
      end
      continued_comment = child
    end
    check_for_no_children(child)
    validate_and_append_child(parent, child, line, root)
  end
  raise SyntaxError.new("Rules can't end in commas.",
    :line => continued_rule.line) if continued_rule
  parent
end