forked from Orchid/orchid
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:
@@ -56,11 +56,8 @@ fn mk_vec(pattern: &[Expr]) -> VecMatcher {
|
||||
pattern.last().map(vec_attrs).is_some(),
|
||||
"pattern must end with a vectorial"
|
||||
);
|
||||
let (left, (key, prio, nonzero), right) = split_at_max_vec(pattern)
|
||||
let (left, (key, _, nonzero), right) = split_at_max_vec(pattern)
|
||||
.expect("pattern must have vectorial placeholders at least at either end");
|
||||
if prio >= 1 {
|
||||
println!("Nondefault priority {} found", prio)
|
||||
}
|
||||
let r_sep_size = scal_cnt(right.iter());
|
||||
let (r_sep, r_side) = right.split_at(r_sep_size);
|
||||
let l_sep_size = scal_cnt(left.iter().rev());
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user