parse static method

({List<String> errors, DartFileIndex index}) parse(
  1. String path,
  2. String content
)

The index of content, the file at path, and its parse errors, each with its offset.

Implementation

static ({DartFileIndex index, List<String> errors}) parse(
  String path,
  String content,
) {
  final result = parseString(content: content, throwIfDiagnostics: false);
  return (
    index: _indexOf(path, result.unit),
    errors: [
      for (final error in result.errors)
        '${error.message} (at ${error.offset})',
    ],
  );
}