use std::ops::Range;
pub trait RowanNomError<Lang: super::Language> {
fn from_message(message: &str) -> Self;
fn from_expected(position: usize, message: &str) -> Self;
fn from_expected_eof(range: Range<usize>) -> Self;
fn from_unexpected_eof(position: usize) -> Self;
fn from_unexpected_token(span: Range<usize>, expected: Lang::Kind, found: Lang::Kind) -> Self;
fn with_context(self, ctx: &'static str) -> Self;
}
#[derive(Debug, Default, Clone, Copy, thiserror::Error)]
#[error("dummy error used, can't provide further information")]
pub struct DummyError;
impl<Lang: super::Language> RowanNomError<Lang> for DummyError {
fn from_message(_message: &str) -> Self {
Self
}
fn from_expected(_position: usize, _message: &str) -> Self {
Self
}
fn from_expected_eof(_range: Range<usize>) -> Self {
Self
}
fn from_unexpected_eof(_position: usize) -> Self {
Self
}
fn from_unexpected_token(
_span: Range<usize>,
_expected: Lang::Kind,
_found: Lang::Kind,
) -> Self {
Self
}
fn with_context(self, _ctx: &'static str) -> Self {
Self
}
}