1use std::{
2 convert::Infallible,
3 error::Error,
4 fmt::{Debug, Display, Formatter},
5};
6
7use crate::DuplicateItem;
8use diagnostic::{DiagnosticLevel, FileID, Span};
9
10mod for_std;
11
12pub mod duplicate;
13
14pub type VResult<T = ()> = Result<T, VError>;
16
17pub type Validation<T> = diagnostic::Validation<T, VError>;
19
20#[derive(Debug)]
22pub struct VError {
23 pub kind: Box<VErrorKind>,
25 pub level: DiagnosticLevel,
27 pub file: FileID,
29}
30
31pub enum VErrorKind {
33 IOError(std::io::Error),
35 ParseError(ParseFail),
37 Duplicate(DuplicateItem),
39 Custom(String),
41}
42
43#[derive(Debug)]
44pub struct ParseFail {
45 pub message: String,
46 pub span: Span,
47}