use crate::span::Span;
pub const V0001: &str = "V0001";
pub const V0002: &str = "V0002";
pub const V0003: &str = "V0003";
pub const V0010: &str = "V0010";
pub const V0011: &str = "V0011";
pub const V0012: &str = "V0012";
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct FixIt {
pub span: Span,
pub replacement: String,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct SyntaxError {
pub span: Span,
pub message: String,
pub code: &'static str,
pub fix_it: Option<FixIt>,
}
impl SyntaxError {
pub fn new(span: Span, code: &'static str, message: impl Into<String>) -> Self {
Self {
span,
message: message.into(),
code,
fix_it: None,
}
}
pub fn with_fix_it(mut self, fix_it: FixIt) -> Self {
self.fix_it = Some(fix_it);
self
}
}