class Sass::Tree::Node

def <<(child)

def <<(child)
  if msg = invalid_child?(child)
    raise Sass::SyntaxError.new(msg, child.line)
  end
  @children << child
end

def initialize(style)

def initialize(style)
  @style = style
  @children = []
end

def invalid_child?(child)

and false or nil otherwise.
if the given child node is invalid,
This method should be overridden by subclasses to return an error message
def invalid_child?(child)
  false
end

def to_s

def to_s
  result = String.new
  children.each do |child|
    if child.is_a? AttrNode
      raise SyntaxError.new('Attributes aren\'t allowed at the root of a document.', child.line)
    else
      result << "#{child.to_s(1)}" + (@style == :compressed ? '' : "\n")
    end
  end
  @style == :compressed ? result+"\n" : result[0...-1]
end

def to_sass(opts = {})

def to_sass(opts = {})
  result = ''
  children.each do |child|
    result << "#{child.to_sass(0, opts)}\n"
  end
  result
end