- added experimental flag '-def': will print (not parse!)

'def' instead of 'func', 'const', or 'type'

R=r
OCL=24092
CL=24094
This commit is contained in:
Robert Griesemer 2009-02-02 11:51:07 -08:00
parent 6e395cfecf
commit b67603dfef
1 changed files with 6 additions and 1 deletions

View File

@ -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;
}