class RDoc::Parser

def self.for top_level, file_name, content, options, stats

def self.for top_level, file_name, content, options, stats
  return if binary? file_name
  parser = use_markup content
  unless parser then
    parse_name = file_name
    # If no extension, look for shebang
    if file_name !~ /\.\w+$/ && content =~ %r{\A#!(.+)} then
      shebang = $1
      case shebang
      when %r{env\s+ruby}, %r{/ruby}
        parse_name = 'dummy.rb'
      end
    end
    parser = can_parse parse_name
  end
  return unless parser
  content = remove_modeline content
  parser.new top_level, file_name, content, options, stats
rescue SystemCallError
  nil
end