pub fn to_diagnostic(&self) -> Diagnostic {
        match *self {
            ParseError::Lexer(ref err) => err.to_diagnostic(),
            ParseError::IdentifierExpectedInPiType { span } => {
                Diagnostic::new_error("identifier expected when parsing dependent function type")
                    .with_label(
                        Label::new_primary(span).with_message("ill-formed dependent function type"),
                    )
            },
            ParseError::UnknownReplCommand { span, ref command } => {
                Diagnostic::new_error(format!("unknown repl command `:{}`", command))
                    .with_label(Label::new_primary(span).with_message("unexpected command"))
            },
            ParseError::IntegerLiteralOverflow { span, ref value } => {
                Diagnostic::new_error(format!("integer literal overflow with value `{}`", value))
                    .with_label(Label::new_primary(span).with_message("overflowing literal"))
            },
            ParseError::UnexpectedToken {
                span,
                ref token,
                ref expected,
            } => Diagnostic::new_error(format!("expected one {}, found `{}`", expected, token))
                .with_label(Label::new_primary(span).with_message("unexpected token")),
            ParseError::UnexpectedE { end, ref expected } => {
                Diagnostic::new_error(format!("expected one {}, found `EOF`", expected)).with_label(
                    Label::new_primary(ByteSpan::new(end, end)).with_message("unexpected EOF"),
                )
            },
            ParseError::ExtraToken { span, ref token } => {
                Diagnostic::new_error(format!("extra token `{}`", token))
                    .with_label(Label::new_primary(span).with_message("extra token"))
            },
        }
    }
/// Convert the error into a diagnostic message
Convert the error into a diagnostic message
Convert the error into a diagnostic message
pub fn to_diagnostic(&self) -> Diagnostic {
        match *self {
            ParseError::Lexer(ref err) => err.to_diagnostic(),
            ParseError::IdentifierExpectedInPiType { span } => {
                Diagnostic::new_error("identifier expected when parsing dependent function type")
                    .with_label(
                        Label::new_primary(span).with_message("ill-formed dependent function type"),
                    )
            },
            ParseError::UnknownReplCommand { span, ref command } => {
                Diagnostic::new_error(format!("unknown repl command `:{}`", command))
                    .with_label(Label::new_primary(span).with_message("unexpected command"))
            },
            ParseError::IntegerLiteralOverflow { span, ref value } => {
                Diagnostic::new_error(format!("integer literal overflow with value `{}`", value))
                    .with_label(Label::new_primary(span).with_message("overflowing literal"))
            },
            ParseError::UnexpectedToken {
                span,
                ref token,
                ref expected,
            } => Diagnostic::new_error(format!("expected one {}, found `{}`", expected, token))
                .with_label(Label::new_primary(span).with_message("unexpected token")),
            ParseError::UnexpectedE { end, ref expected } => {
                Diagnostic::new_error(format!("expected one {}, found `EOF`", expected)).with_label(
                    Label::new_primary(ByteSpan::new(end, end)).with_message("unexpected EOF"),
                )
            },
            ParseError::ExtraToken { span, ref token } => {
                Diagnostic::new_error(format!("extra token `{}`", token))
                    .with_label(Label::new_primary(span).with_message("extra token"))
            },
        }
    }
pub fn to_diagnostic ( & self ) -> Diagnostic { match * self { ParseError :: Lexer ( ref err ) => err . to_diagnostic ( ) , ParseError :: IdentifierExpectedInPiType { span } => { Diagnostic :: new_error ( " " ) . with_label ( Label :: new_primary ( span ) . with_message ( " " ) , ) } , ParseError :: UnknownReplCommand { span , ref command } => { Diagnostic :: new_error ( format ! ( " " command ) ) . with_label ( Label :: new_primary ( span ) . with_message ( " " ) ) } , ParseError :: IntegerLiteralOverflow { span , ref value } => { Diagnostic :: new_error ( format ! ( " " value ) ) . with_label ( Label :: new_primary ( span ) . with_message ( " " ) ) } , ParseError :: UnexpectedToken { span , ref token , ref expected , } => Diagnostic :: new_error ( format ! ( " " expected token ) ) . with_label ( Label :: new_primary ( span ) . with_message ( " " ) ) , ParseError :: UnexpectedE { end , ref expected } => { Diagnostic :: new_error ( format ! ( " " expected ) ) . with_label ( Label :: new_primary ( ByteSpan :: new ( end , end ) ) . with_message ( " " ) , ) } , ParseError :: ExtraToken { span , ref token } => { Diagnostic :: new_error ( format ! ( " " token ) ) . with_label ( Label :: new_primary ( span ) . with_message ( " " ) ) } , } }
Convert the error into a diagnostic message
Convert the error into a diagnostic message
&self
&self