sml-lang 0.1.0

A fast CFG-style markup/config language parser written in Rust
Documentation
use std::fmt;

#[derive(Debug)]
pub enum ErrorType {
    IllegalCharacterError,
    SyntaxError,
}

#[derive(Debug)]
pub struct Error {
    pub error_type: ErrorType,
    pub description: String,
}

impl fmt::Display for ErrorType {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            ErrorType::IllegalCharacterError => write!(f, "IllegalCharacterError"),
            ErrorType::SyntaxError => write!(f, "SyntaxError"),
        }
    }
}

impl fmt::Display for Error {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}: {}", self.error_type, self.description)
    }
}