MCPcopy Create free account
hub / github.com/daisy/MathCAT / reduce_stack

Method reduce_stack

src/canonicalize.rs:3474–3483  ·  view source on GitHub ↗
(&self, parse_stack: &'s mut Vec<StackInfo<'a, 'op>>, current_priority: usize)

Source from the content-addressed store, hash-verified

3472
3473
3474 fn reduce_stack<'s, 'a:'s, 'op:'a>(&self, parse_stack: &'s mut Vec<StackInfo<'a, 'op>>, current_priority: usize) {
3475 let mut prev_priority = top(parse_stack).priority();
3476 // debug!(" reduce_stack: stack len={}, priority: prev={}, cur={}", parse_stack.len(), prev_priority, current_priority);
3477 while current_priority < prev_priority { // pop off operators until we are back to the right level
3478 if parse_stack.len() == 1 {
3479 break; // something went wrong -- break before popping too much
3480 }
3481 prev_priority = self.reduce_stack_one_time(parse_stack);
3482 };
3483 }
3484
3485 fn reduce_stack_one_time<'s, 'a:'s, 'op:'a>(&self, parse_stack: &'s mut Vec<StackInfo<'a, 'op>>) -> usize {
3486 let mut top_of_stack = parse_stack.pop().unwrap();

Callers 1

Calls 4

topFunction · 0.85
priorityMethod · 0.80
lenMethod · 0.80
reduce_stack_one_timeMethod · 0.80

Tested by

no test coverage detected