More examples, better defaults

grammar_separated is grammar but with all functions exposed
This commit is contained in:
elvis
2025-10-17 19:45:20 +02:00
parent 164e1d883c
commit 08d195ab06
30 changed files with 8698 additions and 49 deletions

View File

@ -0,0 +1,30 @@
use std::fmt::Display;
pub enum UserErrorTypes {
NumberTooBigUsize,
NumberTooBigi64,
}
impl Display for UserErrorTypes {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
| Self::NumberTooBigUsize => write!(
f,
"Specified number is too big (greater than {})",
usize::MAX
),
| Self::NumberTooBigi64 => write!(
f,
"Specified number is too big (lesser than {} or \
greater than {})",
i64::MIN,
i64::MAX
),
}
}
}
pub struct UserError {
pub token: (usize, String, usize),
pub error: UserErrorTypes,
}