From: Robert Griesemer Date: Mon, 2 Feb 2009 19:51:07 +0000 (-0800) Subject: - added experimental flag '-def': will print (not parse!) X-Git-Tag: weekly.2009-11-06~2250 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=b67603dfef4bd4f0c8e66af41fb461a502bbaebb;p=gostls13.git - added experimental flag '-def': will print (not parse!) 'def' instead of 'func', 'const', or 'type' R=r OCL=24092 CL=24094 --- diff --git a/usr/gri/pretty/printer.go b/usr/gri/pretty/printer.go index 1168c9c82c..002a91a2d5 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; }