feat: add error information in the progress callback

This allows users to bail parsing if an error was *definitely* detected
using the progress callback, as all possible stack versions have a
non-zero error cost.

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
This commit is contained in:
Allan Clements 2025-01-25 01:21:04 -05:00 committed by Amaan Qureshi
parent ca087d2c07
commit cda634a1c4
9 changed files with 87 additions and 4 deletions

View file

@ -53,6 +53,9 @@ export interface ParseOptions {
export interface ParseState {
/** The byte offset in the document that the parser is at. */
currentOffset: number;
/** Indicates whether the parser has encountered an error during parsing. */
hasError: boolean;
}
/**