Interface AsyncParser

Async parser that allows cancellation of the current parsing process.

The sync parser implementation is blocking the event loop, which can become quite problematic for large files. The default implementation is not actually async. It just wraps the sync parser in a promise. A real implementation would create worker threads or web workers to offload the parsing work.

interface AsyncParser {
    parse<T>(text: string, cancelToken: CancellationToken): Promise<ParseResult<T>>;
}

Implemented by

Methods

Methods