Skip to content

Commit 5879146

Browse files
Rename pretty_print_* to scan_* to follow naming in the paper
This is also easier to understand because the scan and print "tasks" are separate, but previously were both called "print" or "pretty print."
1 parent 4783d9e commit 5879146

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/libsyntax/print/pp.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
//! it.
132132
//!
133133
//! In this implementation (following the paper, again) the SCAN process is the
134-
//! methods called `Printer::pretty_print_*`, and the 'PRINT' process is the
134+
//! methods called `Printer::scan_*`, and the 'PRINT' process is the
135135
//! method called `Printer::print`.
136136
137137
use std::collections::VecDeque;
@@ -310,14 +310,14 @@ impl Printer {
310310
self.buf[self.right].token = t;
311311
}
312312

313-
fn pretty_print_eof(&mut self) {
313+
fn scan_eof(&mut self) {
314314
if !self.scan_stack.is_empty() {
315315
self.check_stack(0);
316316
self.advance_left();
317317
}
318318
}
319319

320-
fn pretty_print_begin(&mut self, b: BeginToken) {
320+
fn scan_begin(&mut self, b: BeginToken) {
321321
if self.scan_stack.is_empty() {
322322
self.left_total = 1;
323323
self.right_total = 1;
@@ -331,7 +331,7 @@ impl Printer {
331331
self.scan_push(BufEntry { token: Token::Begin(b), size: -self.right_total });
332332
}
333333

334-
fn pretty_print_end(&mut self) {
334+
fn scan_end(&mut self) {
335335
if self.scan_stack.is_empty() {
336336
debug!("pp End/print Vec<{},{}>", self.left, self.right);
337337
self.print_end();
@@ -342,7 +342,7 @@ impl Printer {
342342
}
343343
}
344344

345-
fn pretty_print_break(&mut self, b: BreakToken) {
345+
fn scan_break(&mut self, b: BreakToken) {
346346
if self.scan_stack.is_empty() {
347347
self.left_total = 1;
348348
self.right_total = 1;
@@ -358,7 +358,7 @@ impl Printer {
358358
self.right_total += b.blank_space;
359359
}
360360

361-
fn pretty_print_string(&mut self, s: Cow<'static, str>, len: isize) {
361+
fn scan_string(&mut self, s: Cow<'static, str>, len: isize) {
362362
if self.scan_stack.is_empty() {
363363
debug!("pp String('{}')/print Vec<{},{}>",
364364
s, self.left, self.right);
@@ -594,7 +594,7 @@ impl Printer {
594594

595595
/// "raw box"
596596
crate fn rbox(&mut self, indent: usize, b: Breaks) {
597-
self.pretty_print_begin(BeginToken {
597+
self.scan_begin(BeginToken {
598598
offset: indent as isize,
599599
breaks: b
600600
})
@@ -611,25 +611,25 @@ impl Printer {
611611
}
612612

613613
pub fn break_offset(&mut self, n: usize, off: isize) {
614-
self.pretty_print_break(BreakToken {
614+
self.scan_break(BreakToken {
615615
offset: off,
616616
blank_space: n as isize
617617
})
618618
}
619619

620620
crate fn end(&mut self) {
621-
self.pretty_print_end()
621+
self.scan_end()
622622
}
623623

624624
pub fn eof(mut self) -> String {
625-
self.pretty_print_eof();
625+
self.scan_eof();
626626
self.out
627627
}
628628

629629
pub fn word<S: Into<Cow<'static, str>>>(&mut self, wrd: S) {
630630
let s = wrd.into();
631631
let len = s.len() as isize;
632-
self.pretty_print_string(s, len)
632+
self.scan_string(s, len)
633633
}
634634

635635
fn spaces(&mut self, n: usize) {

0 commit comments

Comments
 (0)