summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2009-02-02 11:51:07 -0800
committerRobert Griesemer <gri@golang.org>2009-02-02 11:51:07 -0800
commite66724699cc74f52049466ee72ce7606187642e7 (patch)
treea0131fa694b26bcb2d6119f202c284c2c0abd036
parentd12103b0a99f82e63a27030a41a6539672253340 (diff)
downloadgolang-e66724699cc74f52049466ee72ce7606187642e7.tar.gz
- added experimental flag '-def': will print (not parse!)
'def' instead of 'func', 'const', or 'type' R=r OCL=24092 CL=24094
-rw-r--r--usr/gri/pretty/printer.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr/gri/pretty/printer.go b/usr/gri/pretty/printer.go
index 1168c9c82..002a91a2d 100644
--- a/usr/gri/pretty/printer.go
+++ b/usr/gri/pretty/printer.go
@@ -18,6 +18,7 @@ import (
var (
debug = flag.Bool("debug", false, "print debugging information");
+ def = flag.Bool("def", false, "print 'def' instead of 'const', 'type', 'func' - experimental");
// layout control
tabwidth = flag.Int("tabwidth", 8, "tab width");
@@ -803,7 +804,11 @@ func (P *Printer) Stat(s *AST.Stat) {
func (P *Printer) Declaration(d *AST.Decl, parenthesized bool) {
if !parenthesized {
- P.Token(d.Pos, d.Tok);
+ if !*def || d.Tok == Scanner.IMPORT || d.Tok == Scanner.VAR {
+ P.Token(d.Pos, d.Tok);
+ } else {
+ P.String(d.Pos, "def");
+ }
P.separator = blank;
}