function parse (path, $refs, options) {
try {
  // Remove the URL fragment, if any
  path = url.stripHash(path);

  // Add a new $Ref for this file, even though we don't have the value yet.
  // This ensures that we don't simultaneously read & parse the same file multiple times
  var $ref = $refs._add(path);

  // This "file object" will be passed to all resolvers and parsers.
  var file = {
    url: path,
    extension: url.getExtension(path),
  };

  // Read the file and then parse the data
  return readFile(file, options)
    .then(function (resolver) {
      $ref.pathType = resolver.plugin.name;
      file.data = resolver.result;
      return parseFile(file, options);
    })
    .then(function (parser) {
      $ref.value = parser.result;
      return parser.result;
    });
}
catch (e) {
  return Promise.reject(e);
}
}
Reads and parses the specified file path or URL.

@param {string} path - This path MUST already be resolved, since `read` doesn't know the resolution context
@param {$Refs} $refs
@param {$RefParserOptions} options

@returns {Promise}
The promise resolves with the parsed file contents, NOT the raw (Buffer) contents.