mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-10 05:53:10 +00:00
utilities for indented logs
This commit is contained in:
parent
ef566acb8e
commit
f1afb0b3e2
17
src/etc/indenter
Executable file
17
src/etc/indenter
Executable file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
$ident = 0;
|
||||
while (<>) {
|
||||
if (/^rust: ">>/) {
|
||||
$indent += 1;
|
||||
} elsif (/^rust: "<</) {
|
||||
$indent -= 1;
|
||||
}
|
||||
|
||||
printf "%03d ", $indent;
|
||||
for ($i = 0; $i < $indent; $i++) {
|
||||
printf(" ");
|
||||
}
|
||||
print;
|
||||
}
|
||||
|
@ -5,6 +5,24 @@ import syntax::codemap::{span};
|
||||
import syntax::visit;
|
||||
import syntax::print;
|
||||
|
||||
fn indent<R>(op: fn() -> R) -> R {
|
||||
// Use in conjunction with the log post-processor like `src/etc/indenter`
|
||||
// to make debug output more readable.
|
||||
#debug[">>"];
|
||||
let r <- op();
|
||||
#debug["<< (Result = %?)", r];
|
||||
ret r;
|
||||
}
|
||||
|
||||
resource _indenter(_i: ()) {
|
||||
#debug["<<"];
|
||||
}
|
||||
|
||||
fn indenter() -> _indenter {
|
||||
#debug[">>"];
|
||||
_indenter(())
|
||||
}
|
||||
|
||||
type flag = hashmap<str, ()>;
|
||||
|
||||
fn def_eq(a: ast::def_id, b: ast::def_id) -> bool {
|
||||
|
Loading…
Reference in New Issue
Block a user