STL rework

- fixed lots of bugs
- overlay libraries work correctly and reliably
- the STL is an overlay library
- examples updated
This commit is contained in:
2023-06-17 21:12:23 +01:00
parent 5bb8a12fc2
commit aebbf51228
91 changed files with 1444 additions and 1395 deletions

View File

@@ -114,29 +114,25 @@ impl<M: Matcher> Repository<M> {
/// Attempt to run each rule in priority order `limit` times. Returns
/// the final tree and the number of iterations left to the limit.
#[allow(unused)]
pub fn long_step(
&self,
code: &Expr,
mut limit: usize,
) -> Result<(Expr, usize), RuleError> {
pub fn long_step(&self, code: &Expr, mut limit: usize) -> (Expr, usize) {
if limit == 0 {
return Ok((code.clone(), 0));
return (code.clone(), 0);
}
if let Some(mut processed) = self.step(code) {
limit -= 1;
if limit == 0 {
return Ok((processed, 0));
return (processed, 0);
}
while let Some(out) = self.step(&processed) {
limit -= 1;
if limit == 0 {
return Ok((out, 0));
return (out, 0);
}
processed = out;
}
Ok((processed, limit))
(processed, limit)
} else {
Ok((code.clone(), limit))
(code.clone(), limit)
}
}
}