Inline Printer's scan_pop method
This commit is contained in:
parent
50d722a691
commit
e20d5abdfb
1 changed files with 3 additions and 7 deletions
|
@ -347,10 +347,6 @@ impl Printer {
|
|||
}
|
||||
}
|
||||
|
||||
fn scan_pop(&mut self) -> usize {
|
||||
self.scan_stack.pop_front().unwrap()
|
||||
}
|
||||
|
||||
fn scan_top(&self) -> usize {
|
||||
*self.scan_stack.front().unwrap()
|
||||
}
|
||||
|
@ -396,19 +392,19 @@ impl Printer {
|
|||
match self.buf[x].token {
|
||||
Token::Begin(_) => {
|
||||
if k > 0 {
|
||||
self.scan_pop();
|
||||
self.scan_stack.pop_front().unwrap();
|
||||
self.buf[x].size += self.right_total;
|
||||
self.check_stack(k - 1);
|
||||
}
|
||||
}
|
||||
Token::End => {
|
||||
// paper says + not =, but that makes no sense.
|
||||
self.scan_pop();
|
||||
self.scan_stack.pop_front().unwrap();
|
||||
self.buf[x].size = 1;
|
||||
self.check_stack(k + 1);
|
||||
}
|
||||
_ => {
|
||||
self.scan_pop();
|
||||
self.scan_stack.pop_front().unwrap();
|
||||
self.buf[x].size += self.right_total;
|
||||
if k > 0 {
|
||||
self.check_stack(k);
|
||||
|
|
Loading…
Reference in a new issue