rkgk/crates/haku/src/diagnostic.rs
liquidex 2595bf0d82 syntax v2
introduce a new, more ergonomic syntax for haku
not all features are implemented just yet. still missing:

- custom tags (non-True/False)
- color literals
- lists
2024-09-01 09:29:11 +02:00

27 lines
438 B
Rust

use alloc::string::String;
use crate::source::Span;
#[derive(Debug, Clone)]
pub struct Diagnostic {
span: Span,
message: String,
}
impl Diagnostic {
pub fn error(span: Span, message: impl Into<String>) -> Self {
Self {
span,
message: message.into(),
}
}
pub fn span(&self) -> Span {
self.span
}
pub fn message(&self) -> &str {
&self.message
}
}