allium_parser/
diagnostic.rs1use crate::Span;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq)]
4pub enum Severity {
5 Error,
6 Warning,
7}
8
9#[derive(Debug, Clone)]
10pub struct Diagnostic {
11 pub span: Span,
12 pub message: String,
13 pub severity: Severity,
14}
15
16impl Diagnostic {
17 pub fn error(span: Span, message: impl Into<String>) -> Self {
18 Self { span, message: message.into(), severity: Severity::Error }
19 }
20
21 pub fn warning(span: Span, message: impl Into<String>) -> Self {
22 Self { span, message: message.into(), severity: Severity::Warning }
23 }
24}