mirror of
https://github.com/rm-dr/daisy
synced 2025-10-25 11:34:53 -07:00
33 lines
689 B
Rust
33 lines
689 B
Rust
/// Types of parser errors.
|
|
/// If we cannot parse a string, one of these is returned.
|
|
#[derive(Debug)]
|
|
pub enum ParserError {
|
|
//MissingCloseParen,
|
|
ExtraCloseParen,
|
|
EmptyGroup,
|
|
Syntax,
|
|
BadNumber
|
|
}
|
|
|
|
impl ToString for ParserError {
|
|
fn to_string(&self) -> String {
|
|
match self {
|
|
//ParserError::MissingCloseParen => {
|
|
// String::from("This group is never closed")
|
|
//},
|
|
ParserError::ExtraCloseParen => {
|
|
String::from("Extra close parenthesis")
|
|
},
|
|
ParserError::EmptyGroup => {
|
|
String::from("Groups can't be empty")
|
|
},
|
|
ParserError::Syntax => {
|
|
String::from("Syntax")
|
|
},
|
|
ParserError::BadNumber => {
|
|
String::from("Invalid number")
|
|
}
|
|
}
|
|
}
|
|
}
|