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:
2022-08-06 18:12:51 +02:00
parent 119f41076e
commit 329dea72b7
24 changed files with 777 additions and 134 deletions

18
src/rule/rule_error.rs Normal file
View 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 {}