use crate::{ParseError, ParseErrorKind, Token};

/// Error handling extension trait.
pub trait ParseErrorExt {
    /// Generate an error based on the current state of the parser.
    fn error(
        &self,
        token: Option<&Token>,
        kind: ParseErrorKind,
        message: Option<&str>,
    ) -> ParseError;

    /// Generate an error with a cause based on the current state of the parser.
    fn error_with_cause(
        &self,
        token: Option<&Token>,
        kind: ParseErrorKind,
        message: Option<&str>,
        source: ParseError,
        help: Option<&str>,
    ) -> ParseError;
}
