Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(71)

Delta Between Two Patch Sets: src/cmd/gofmt/gofmt.go

Issue 2319041: code review 2319041: go ast/parser/printer: permit elision of composite lite... (Closed)
Left Patch Set: code review 2319041: go ast/parser/printer: permit elision of composite lite... Created 13 years, 5 months ago
Right Patch Set: code review 2319041: go ast/parser/printer: permit elision of composite lite... Created 13 years, 5 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/cmd/gofmt/doc.go ('k') | src/cmd/gofmt/simplify.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package main 5 package main
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "flag" 9 "flag"
10 "fmt" 10 "fmt"
11 "go/ast" 11 "go/ast"
12 "go/parser" 12 "go/parser"
13 "go/printer" 13 "go/printer"
14 "go/scanner" 14 "go/scanner"
15 "io/ioutil" 15 "io/ioutil"
16 "os" 16 "os"
17 pathutil "path" 17 pathutil "path"
18 "strings" 18 "strings"
19 ) 19 )
20 20
21 21
22 var ( 22 var (
23 // main operation modes 23 // main operation modes
24 list = flag.Bool("l", false, "list files whose formatting differs from gofmt's") 24 list = flag.Bool("l", false, "list files whose formatting differs from gofmt's")
25 write = flag.Bool("w", false, "write result to (source) file inste ad of stdout") 25 write = flag.Bool("w", false, "write result to (source) file inste ad of stdout")
26 rewriteRule = flag.String("r", "", "rewrite rule (e.g., 'α[β:len(α)] -> α[β:]')") 26 rewriteRule = flag.String("r", "", "rewrite rule (e.g., 'α[β:len(α)] -> α[β:]')")
27 » simplifyAST = flag.Bool("s", false, "simplify source by removing some re dundent code") 27 » simplifyAST = flag.Bool("s", false, "simplify code")
rsc1 2010/10/22 02:27:53 maybe just "simplify code" and leave it open-ended
28 28
29 // debugging support 29 // debugging support
30 comments = flag.Bool("comments", true, "print comments") 30 comments = flag.Bool("comments", true, "print comments")
31 trace = flag.Bool("trace", false, "print parse trace") 31 trace = flag.Bool("trace", false, "print parse trace")
32 printAST = flag.Bool("ast", false, "print AST (before rewrites)") 32 printAST = flag.Bool("ast", false, "print AST (before rewrites)")
33 33
34 // layout control 34 // layout control
35 tabWidth = flag.Int("tabwidth", 8, "tab width") 35 tabWidth = flag.Int("tabwidth", 8, "tab width")
36 tabIndent = flag.Bool("tabindent", true, "indent with tabs independent o f -spaces") 36 tabIndent = flag.Bool("tabindent", true, "indent with tabs independent o f -spaces")
37 useSpaces = flag.Bool("spaces", true, "align with spaces instead of tabs ") 37 useSpaces = flag.Bool("spaces", true, "align with spaces instead of tabs ")
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 if err := processFileByName(path); err != nil { 211 if err := processFileByName(path); err != nil {
212 report(err) 212 report(err)
213 } 213 }
214 case dir.IsDirectory(): 214 case dir.IsDirectory():
215 walkDir(path) 215 walkDir(path)
216 } 216 }
217 } 217 }
218 218
219 os.Exit(exitCode) 219 os.Exit(exitCode)
220 } 220 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b