Commit 738c58ca authored by Robert Griesemer's avatar Robert Griesemer

improved handling of expression lists

R=rsc
DELTA=189  (118 added, 9 deleted, 62 changed)
OCL=35816
CL=35821
parent 4f7aa318
This diff is collapsed.
......@@ -308,6 +308,50 @@ func _() {
}
func _() {
var Universe = Scope {
Names: map[string]*Ident {
// basic types
"bool": nil,
"byte": nil,
"int8": nil,
"int16": nil,
"int32": nil,
"int64": nil,
"uint8": nil,
"uint16": nil,
"uint32": nil,
"uint64": nil,
"float32": nil,
"float64": nil,
"string": nil,
// convenience types
"int": nil,
"uint": nil,
"uintptr": nil,
"float": nil,
// constants
"false": nil,
"true": nil,
"iota": nil,
"nil": nil,
// functions
"cap": nil,
"len": nil,
"new": nil,
"make": nil,
"panic": nil,
"panicln": nil,
"print": nil,
"println": nil,
}
}
}
// formatting of consecutive single-line functions
func _() {}
func _() {}
......
......@@ -174,10 +174,13 @@ func _() {
f, ff, fff, ffff int = 0, 1, 2, 3; // comment
)
// respect original line breaks
var _ = []T{T{0x20, "Telugu"}};
var _ = []T{
// respect original line breaks
T{0x20, "Telugu"}};
T{0x20, "Telugu"},
};
var _ = []T{
// respect original line breaks
T{0x20, "Telugu"},
};
}
func _() {
......@@ -305,6 +308,50 @@ func _() {
}
func _() {
var Universe = Scope{
Names: map[string]*Ident{
// basic types
"bool": nil,
"byte": nil,
"int8": nil,
"int16": nil,
"int32": nil,
"int64": nil,
"uint8": nil,
"uint16": nil,
"uint32": nil,
"uint64": nil,
"float32": nil,
"float64": nil,
"string": nil,
// convenience types
"int": nil,
"uint": nil,
"uintptr": nil,
"float": nil,
// constants
"false": nil,
"true": nil,
"iota": nil,
"nil": nil,
// functions
"cap": nil,
"len": nil,
"new": nil,
"make": nil,
"panic": nil,
"panicln": nil,
"print": nil,
"println": nil,
},
};
}
// formatting of consecutive single-line functions
func _() {}
func _() {}
......
......@@ -172,8 +172,7 @@ func (p *parser) charClass() {
func addState(s []state, inst instr, match []int) {
// handle comments correctly in multi-line expressions
for i := 0; i < l; i++ {
if s[i].inst.index() == index &&
// same instruction
if s[i].inst.index() == index && // same instruction
s[i].match[0] < pos { // earlier match already going; leftmost wins
return s;
}
......
......@@ -172,8 +172,7 @@ func (p *parser) charClass() {
func addState(s []state, inst instr, match []int) {
// handle comments correctly in multi-line expressions
for i := 0; i < l; i++ {
if s[i].inst.index() == index &&
// same instruction
if s[i].inst.index() == index && // same instruction
s[i].match[0] < pos { // earlier match already going; leftmost wins
return s;
}
......
......@@ -63,19 +63,22 @@ var writerTests = []*writerTest{
// tar -b 1 -c -f- /tmp/16gig.txt | dd bs=512 count=8 > writer-big.tar
&writerTest{
file: "testdata/writer-big.tar",
entries: []*writerTestEntry{&writerTestEntry{header: &Header{
Name: "tmp/16gig.txt",
Mode: 0640,
Uid: 73025,
Gid: 5000,
Size: 16<<30,
Mtime: 1254699560,
Typeflag: '0',
Uname: "dsymonds",
Gname: "eng",
}
// no contents
}},
entries: []*writerTestEntry{
&writerTestEntry{
header: &Header{
Name: "tmp/16gig.txt",
Mode: 0640,
Uid: 73025,
Gid: 5000,
Size: 16<<30,
Mtime: 1254699560,
Typeflag: '0',
Uname: "dsymonds",
Gname: "eng",
},
// no contents
},
},
},
}
......@@ -181,9 +184,7 @@ var facts = map[int]string{
func usage() {
fmt.Fprintf(os.Stderr,
// TODO(gri): the 2nd string of this string list should not be indented
// TODO(gri): the 2nd string of this string list should not be indented
"usage: godoc package [name ...]\n"
" godoc -http=:6060\n");
flag.PrintDefaults();
......
......@@ -35,7 +35,8 @@ func _() {
switch expr {} // no semicolon and parens printed
switch x := expr; {
default:
use(x);
use(
x);
}
switch x := expr; expr {
default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment