module SyntaxTree

def self.read(filepath)

magic encoding comments.
Returns the source from the given filepath taking into account any potential
def self.read(filepath)
  encoding =
    File.open(filepath, "r") do |file|
      break Encoding.default_external if file.eof?
      header = file.readline
      header += file.readline if !file.eof? && header.start_with?("#!")
      Ripper.new(header).tap(&:parse).encoding
    end
  File.read(filepath, encoding: encoding)
end