use std::ops::Range;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Severity {
Error,
Warning,
Unsupported,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Diagnostic {
pub severity: Severity,
pub code: &'static str,
pub span: Range<usize>,
pub message: String,
}
impl Diagnostic {
pub fn unsupported(code: &'static str, span: Range<usize>, message: impl Into<String>) -> Self {
Diagnostic {
severity: Severity::Unsupported,
code,
span,
message: message.into(),
}
}
pub fn warning(code: &'static str, span: Range<usize>, message: impl Into<String>) -> Self {
Diagnostic {
severity: Severity::Warning,
code,
span,
message: message.into(),
}
}
}