forked from Orchid/orchid
Mainly worked on the rule matcher
Also fixed the name collector, and lambda parameters are no longer resolved at parsing to support planned macro-based pattern matching. The rule matcher clones a lot, the number of clones could be zero.
This commit is contained in:
18
src/rule/rule_error.rs
Normal file
18
src/rule/rule_error.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
use std::{fmt, error::Error};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum RuleError {
|
||||
BadState(String),
|
||||
ScalarVecMismatch(String)
|
||||
}
|
||||
|
||||
impl fmt::Display for RuleError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::BadState(key) => write!(f, "Key {:?} not in match pattern", key),
|
||||
Self::ScalarVecMismatch(key) =>
|
||||
write!(f, "Key {:?} used inconsistently with and without ellipsis", key)
|
||||
}
|
||||
}
|
||||
}
|
||||
impl Error for RuleError {}
|
||||
Reference in New Issue
Block a user