r7rs_parser/parser/
syntax_error.rs1use std::fmt;
2
3#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)]
4pub enum SyntaxError {
5 Empty,
6 ClosingParenthesisMissing,
7 UnexpectedClosingParenthesis,
8 UnexpectedDot,
9 NotAByteValue,
10 SyntaxNotYetSupported
11}
12
13impl fmt::Display for SyntaxError {
14 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
15 use SyntaxError::*;
16 f.write_str(match self {
17 Empty => "empty input",
18 ClosingParenthesisMissing => "closing parenthesis missing",
19 UnexpectedClosingParenthesis => "unexpected closing parenthesis",
20 UnexpectedDot => "unexpected dot",
21 NotAByteValue => "not a byte value",
22 SyntaxNotYetSupported => "syntax not yet supported"
23 })
24 }
25}
26
27impl std::error::Error for SyntaxError {}