summaryrefslogtreecommitdiff
path: root/src/cmd/gofmt
AgeCommit message (Collapse)AuthorFilesLines
2009-10-20remove superfluous tracing supportRobert Griesemer1-5/+1
R=rsc DELTA=5 (0 added, 4 deleted, 1 changed) OCL=35930 CL=35930
2009-10-20Updated and simplified gofmt.Robert Griesemer2-89/+120
- operates on stdin, a single file, or all files in a file tree - setting -w flag writes to (source) file instead of stdout - setting -l flag lists files whose formatting has changed R=rsc DELTA=201 (102 added, 71 deleted, 28 changed) OCL=35890 CL=35926
2009-10-06apply gofmt to the LGTM-marked files from 34501Russ Cox1-19/+19
that have not changed since I applied gofmt. R=gri DELTA=456 (77 added, 3 deleted, 376 changed) OCL=35378 CL=35383
2009-10-05remove a file from idempotency test so that the entire suite passesRobert Griesemer1-2/+2
R=rsc DELTA=2 (0 added, 0 deleted, 2 changed) OCL=35355 CL=35358
2009-09-17unused importsRuss Cox1-2/+0
R=r OCL=34731 CL=34731
2009-09-15go/printer:Robert Griesemer1-1/+1
- printing of expressions: put spaces only where "needed" - printing of import statements: no double indentation if there are no renames - print labels on separate lines - added extra test files go/ast: - unified basic literal nodes and as a result deleted duplicated code - added initial code to track scopes (not fully used yet) replaces CL 34553 R=rsc DELTA=881 (579 added, 223 deleted, 79 changed) OCL=34623 CL=34651
2009-09-10better gofmt formatting:Robert Griesemer2-12/+3
- first cut a better line breaks in expr lists - trailing commas and semis printed where we tend to write them - fixed a couple of minor spacing issues (interface{}, chan<-, map[x]y, x: y) - removed some formatting flags from gofmt: no need to change default - removed option to reverse declaration order when printing - excluded files from test that cause trouble with idempotency test for now R=rsc DELTA=497 (364 added, 83 deleted, 50 changed) OCL=34539 CL=34544
2009-08-27add and use Make.cmdRuss Cox1-13/+3
R=r DELTA=63 (23 added, 31 deleted, 9 changed) OCL=33932 CL=33959
2009-08-06- allow more general type switch syntaxRobert Griesemer1-0/+4
- support for reverse printing of AST (for compiler testing) - added -reverse flag to gofmt R=rsc DELTA=163 (125 added, 11 deleted, 27 changed) OCL=32808 CL=32853
2009-07-31printer:Robert Griesemer1-16/+19
- prepare for generation of HTML id tags and links - do HTML-escaping in central print routine - move tabwriter setup into printer - fixed various TODOs godoc: - removed tabwriter setup, need for various HTML-escaping R=rsc DELTA=210 (107 added, 36 deleted, 67 changed) OCL=32612 CL=32616
2009-07-30go/ast/filter.go:Robert Griesemer1-2/+2
- more orthogonal functionality of filter functions for better re-use go/doc/doc.go: - simplified interface - collect filenames of packages so that they can be shown godoc: - removed TODO, show list of package (linked) files used to create documentation R=rsc DELTA=130 (68 added, 24 deleted, 38 changed) OCL=32549 CL=32552
2009-07-29parser:Robert Griesemer1-4/+4
- Changed filter function for parser.ParsePackage to take an *os.Dir instead of a filename for more powerful filters - Removed TODO in ast.PackageInterface: Now collect package comments from all package files - Cleanups in godoc: Use the new ParsePackage and PackageInterface functions; as a result computing package information is much simpler now. R=rsc DELTA=285 (80 added, 110 deleted, 95 changed) OCL=32473 CL=32486
2009-07-28Intersperse comments nicely when printing an AST.Robert Griesemer2-4/+12
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-28Support use of $GOBINDIR to override $HOME/binPhil Pennock1-1/+2
R=r,gri,rsc APPROVED=rsc DELTA=53 (12 added, 6 deleted, 35 changed) OCL=31822 CL=32282
2009-07-16ast:Robert Griesemer1-16/+68
- renamed Program -> SourceFile - added Package node representing the AST for an entire package - added filter function to create a source file mimicking the interface of an entire package parser: - parser entry to parse entire packages - unified naming of parser entry points - factored out entry points into new file (interface.go) gofmt: - extended to accept single .go files, and package paths: gofmt file.go // formatting of a single file gofmt -x file.go // interface of a single file gofmt -x ./MyPackage // interface of a local package gofmt -x math // interface of a $GOROOT relative package Various adjustments in dependent files, documentation. R=rsc DELTA=634 (369 added, 153 deleted, 112 changed) OCL=31743 CL=31748
2009-07-14update remaining files to match new scanner/parser interfaceRobert Griesemer1-10/+4
and use shared error handling infrastructure R=rsc DELTA=109 (3 added, 86 deleted, 20 changed) OCL=31600 CL=31605
2009-07-10mention file name only once in error messageRobert Griesemer1-1/+1
R=r DELTA=1 (0 added, 0 deleted, 1 changed) OCL=31450 CL=31452
2009-07-09Show BUG comments in godoc:Robert Griesemer1-1/+1
ast.go: - rename Comments -> CommentGroup (less confusion) - change all comments/docs to be *CommentGroup filter.go: - do not remove unassociated comments from program as part of export filtering (they are needed by doc.go for BUG comments) scanner.go: - exclude '\n' from //-style comments parser.go: - rewrote collection of comments: now all collected comments are *ast.CommentGroups - clarified distinction between leading and trailing comments - fixed a bug in comment collection (parseGenDecl); corresponding test case is in printer/testdata - extra documentation doc.go: - collect BUG comments - corresponding fix for parser bug in comment collection comment.go: - simplified regex printer.go: - adjust comment printing to new representation printer_test.go, testdata/*: - enable printing of doc comments - extended tests package.html, package.txt: - added Bugs section gofmt: - enable printing of doc comments R=rsc DELTA=339 (126 added, 38 deleted, 175 changed) OCL=31403 CL=31416
2009-07-07- ast.FilterExports: filter non-exported anonymous fieldsRobert Griesemer1-1/+1
- fixed typo in parser.go - removed test w/ syntax errors from gofmt test script R=rsc DELTA=25 (21 added, 0 deleted, 4 changed) OCL=31296 CL=31298
2009-07-06- ast.FilterExports: strips all non-exported nodes from an ASTRobert Griesemer1-3/+4
- use FilterExports instead of the various predicates in printer.go and doc.go which simplifies a lot of code and makes it easier to deal with complex cases R=rsc DELTA=445 (197 added, 190 deleted, 58 changed) OCL=31110 CL=31196
2009-07-02- store trailing comments after top-level declarations in astRobert Griesemer1-1/+2
- remove a test case w/ syntax errors from test suite R=rsc DELTA=104 (44 added, 5 deleted, 55 changed) OCL=31078 CL=31085
2009-06-16- install gofmt in src/cmd/gofmtRobert Griesemer3-0/+286
- remove some left-over files R=rsc DELTA=1465 (281 added, 1181 deleted, 3 changed) OCL=30350 CL=30353