1
0
mirror of https://github.com/golang/go synced 2024-11-22 02:44:39 -07:00

gofmt'ed parts of go

R=rsc
http://go/go-review/1023001
This commit is contained in:
Robert Griesemer 2009-11-05 15:58:28 -08:00
parent 65063bc61d
commit 10242e806f
3 changed files with 136 additions and 126 deletions

View File

@ -37,8 +37,10 @@ const (
func (p *printer) linebreak(line, min, max int, ws whiteSpace, newSection bool) (printedBreak bool) {
n := line - p.pos.Line;
switch {
case n < min: n = min;
case n > max: n = max;
case n < min:
n = min;
case n > max:
n = max;
}
if n > 0 {
p.print(ws);
@ -118,7 +120,8 @@ func (p *printer) stringList(list []*ast.BasicLit, multiLine *bool) {
}
type exprListMode uint;
type exprListMode uint
const (
blankStart exprListMode = 1<<iota; // print a blank before the list
commaSep; // elements are separated by commas
@ -353,7 +356,7 @@ func needsBlanks(expr ast.Expr) bool {
return false;
case *ast.IndexExpr:
// index expressions don't need blanks if the indexed expressions are simple
return needsBlanks(x.X)
return needsBlanks(x.X);
case *ast.CallExpr:
// call expressions need blanks if they have more than one
// argument or if the function expression needs blanks
@ -862,7 +865,8 @@ func (p *printer) stmt(stmt ast.Stmt, multiLine *bool) (optSemi bool) {
// ----------------------------------------------------------------------------
// Declarations
type declContext uint;
type declContext uint
const (
atTop declContext = iota;
inGroup;

View File

@ -57,7 +57,7 @@ var noPos token.Position
// Use ignoreMultiLine if the multiLine information is not important.
var ignoreMultiLine = new(bool);
var ignoreMultiLine = new(bool)
type printer struct {
@ -156,11 +156,16 @@ func (p *printer) write(data []byte) {
// write HTML-escaped b
var esc []byte;
switch b {
case '"': esc = esc_quot;
case '\'': esc = esc_apos;
case '&': esc = esc_amp;
case '<': esc = esc_lt;
case '>': esc = esc_gt;
case '"':
esc = esc_quot;
case '\'':
esc = esc_apos;
case '&':
esc = esc_amp;
case '<':
esc = esc_lt;
case '>':
esc = esc_gt;
}
p.write0(esc);

View File

@ -21,7 +21,7 @@ const (
)
var update = flag.Bool("update", false, "update golden files");
var update = flag.Bool("update", false, "update golden files")
func lineString(text []byte, i int) string {
@ -33,7 +33,8 @@ func lineString(text []byte, i int) string {
}
type checkMode uint;
type checkMode uint
const (
export checkMode = 1<<iota;
rawFormat;