mirror of
https://github.com/golang/go
synced 2024-11-20 09:44:45 -07:00
d79f687ed8
for end of declarations, blocks, parameter lists, etc. - use extra src positions to more accurately print comments - fine-tuned low-level printing routine for comments - added better debugging support Status: - comments now appear at the right place (inbetween the right tokens) - newline control needs improvement (not very hard) - comment printing disabled for now because pretty is not idempotent with it; to enable: -comments R=r OCL=20079 CL=20079
45 lines
673 B
Go
45 lines
673 B
Go
// Copyright 2009 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package main
|
|
|
|
import Fmt "fmt"
|
|
|
|
|
|
type T struct {
|
|
x, y int;
|
|
s string;
|
|
next_t *T
|
|
}
|
|
|
|
|
|
var (
|
|
A = 5;
|
|
a, b, c int = 0, 0, 0;
|
|
foo = "foo";
|
|
)
|
|
|
|
|
|
func f0(a, b int) int {
|
|
if a < b {
|
|
a = a + 1; // estimate
|
|
}
|
|
return b;
|
|
}
|
|
|
|
|
|
func main() {
|
|
// the prologue
|
|
for i := 0; i <= 10 /* limit */; i++ {
|
|
println(i); // the index
|
|
println(i + 1); // the index + 1
|
|
println(i + 1000); // the index + 1000
|
|
println();
|
|
}
|
|
// the epilogue
|
|
println("foo"); // foo
|
|
println("foobar"); // foobar
|
|
var x int; // declare x
|
|
}
|