lexer::{LexToken, TokenSlice},
token::{Punct, Token},
},
- message::Diagnostic,
+ message::{Diagnostic, Diagnostics},
};
flags! {
#[derive(Debug)]
enum ParseError {
- Error(Diagnostic),
- Mismatch(Diagnostic),
+ Error(Diagnostics),
+ Mismatch(Diagnostics),
}
-type ParseResult<'a, T> = Result<(T, TokenSlice<'a>), ParseError>;
+type ParseResult<'a, T> = Result<(T, TokenSlice<'a>, Diagnostics), ParseError>;
trait MismatchToError {
fn mismatch_to_error(self) -> Self;
Self: Sized,
{
match T::from_tokens(input) {
- Ok((value, rest)) => Ok((Some(value), rest)),
+ Ok((value, rest, diagnostics)) => Ok((Some(value), rest, diagnostics)),
Err(ParseError::Mismatch(_)) => Ok((None, input)),
Err(ParseError::Error(error)) => Err(ParseError::Error(error)),
}