summaryrefslogtreecommitdiff
path: root/usr/gri/pretty/printer.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2008-11-21 09:35:49 -0800
committerRobert Griesemer <gri@golang.org>2008-11-21 09:35:49 -0800
commitfc6f93615ea007a4b4556ff7f67573cd70d24c7c (patch)
tree20b1ffc34e6fbb572cf8913004edaf7e90bda538 /usr/gri/pretty/printer.go
parent14f6458bf0ce326cd147c6f17140713a1e098964 (diff)
downloadgolang-fc6f93615ea007a4b4556ff7f67573cd70d24c7c.tar.gz
- implemented arbitrary padding char for tabwriter
- implemented right-to-left alignment (numerical results) - better comments and error handling - added more tests - updated dependent files R=r DELTA=232 (175 added, 11 deleted, 46 changed) OCL=19761 CL=19780
Diffstat (limited to 'usr/gri/pretty/printer.go')
-rw-r--r--usr/gri/pretty/printer.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr/gri/pretty/printer.go b/usr/gri/pretty/printer.go
index cefabb66f..6bb755b4b 100644
--- a/usr/gri/pretty/printer.go
+++ b/usr/gri/pretty/printer.go
@@ -604,7 +604,11 @@ func (P *Printer) Declaration(d *AST.Decl, parenthesized bool) {
func (P *Printer) Program(p *AST.Program) {
// TODO should initialize all fields?
- P.writer = TabWriter.New(OS.Stdout, int(tabwidth.IVal()), 1, usetabs.BVal());
+ padchar := byte(' ');
+ if usetabs.BVal() {
+ padchar = '\t';
+ }
+ P.writer = TabWriter.New(OS.Stdout, int(tabwidth.IVal()), 1, padchar, true);
P.clist = p.comments;
P.cindex = 0;