(&self, parse_stack: &'s mut Vec<StackInfo<'a, 'op>>)
| 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(); |
| 3487 | // debug!(" ..popped len={} op:'{}/{}', operand: {}", |
| 3488 | // top_of_stack.mrow.children().len(), |
| 3489 | // show_invisible_op_char(top_of_stack.op_pair.ch), top_of_stack.op_pair.op.priority, |
| 3490 | // top_of_stack.is_operand); |
| 3491 | let mut mrow = top_of_stack.mrow; |
| 3492 | if mrow.children().len() == 1 && CanonicalizeContext::is_ok_to_merge_mrow_child(mrow) { |
| 3493 | // should have added at least operator and operand, but input might not be well-formed |
| 3494 | // in this case, unwrap the mrow and expose the single child for pushing onto stack |
| 3495 | let single_child = top_of_stack.remove_last_operand_from_mrow(); |
| 3496 | mrow = single_child; |
| 3497 | } |
| 3498 | |
| 3499 | let mut top_of_stack = parse_stack.pop().unwrap(); |
| 3500 | top_of_stack.add_child_to_mrow(mrow, OperatorPair::new()); // mrow on top is "parsed" -- now add it to previous |
| 3501 | let prev_priority = top_of_stack.priority(); |
| 3502 | parse_stack.push(top_of_stack); |
| 3503 | return prev_priority; |
| 3504 | } |
| 3505 | |
| 3506 | fn is_trig_arg<'a, 'op:'a>(&self, previous_child: Element<'a>, current_child: Element<'a>, parse_stack: &mut Vec<StackInfo<'a, 'op>>) -> bool { |
| 3507 | // We have operand-operand and know we want multiplication at this point. |
no test coverage detected