1
0
mirror of https://github.com/golang/go synced 2024-10-04 06:31:22 -06:00
go/src/cmd/gofmt
Robert Griesemer 2210a643b7 Intersperse comments nicely when printing an AST.
gofmt formatted source code looks pretty good already;
with a bit more fine-tuning it should be great.

printer.go:
- Implemented comment intersperse algorithm.
  The approach is a result of many trial-and-error
  experiments but at this point reasonably simple
  and open to arbitrary fine-tuning.

parser.go:
- Simplified handling of lead and line comments
  (formerly called leading and trailing comments).
- Use a comments list instead of an array (I may
  change this back - this is not obviously better
  and uses more space).

doc.go:
- Remove comments from AST nodes that have been
  'consumed' in the documentation to avoid duplicate
  printing of them. Allows for better control of
  what is printed w/o use of printing control flags
  (which are hard to use and not fine-grained enough).

Corresponding adjustments to various clients of these
files.

R=rsc
DELTA=478  (275 added, 108 deleted, 95 changed)
OCL=32185
CL=32380
2009-07-28 16:38:59 -07:00
..
gofmt.go Intersperse comments nicely when printing an AST. 2009-07-28 16:38:59 -07:00
Makefile Support use of $GOBINDIR to override $HOME/bin 2009-07-28 11:23:24 -07:00
test.sh Intersperse comments nicely when printing an AST. 2009-07-28 16:38:59 -07:00