mirror of
https://github.com/golang/go
synced 2024-11-25 03:57:56 -07:00
- fixed typo in go_lang.txt
- changed go.atg to make optional semicolons work for statements - expanded a test case SVN=112242
This commit is contained in:
parent
8152cb8a71
commit
e31ee76dcb
@ -603,7 +603,7 @@ Each field of a struct represents a variable within the data
|
|||||||
structure.
|
structure.
|
||||||
|
|
||||||
StructType = "struct" "{" [ FieldDeclList [ ";" ] ] "}" .
|
StructType = "struct" "{" [ FieldDeclList [ ";" ] ] "}" .
|
||||||
FieldDeclList = FieldDecl { ";" FieldDeclList } .
|
FieldDeclList = FieldDecl { ";" FieldDecl } .
|
||||||
FieldDecl = IdentifierList Type .
|
FieldDecl = IdentifierList Type .
|
||||||
|
|
||||||
// An empty struct.
|
// An empty struct.
|
||||||
|
@ -13,13 +13,16 @@ const
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
pi = /* the usual */ 3.14159265358979323;
|
pi = /* the usual */ 3.14159265358979323;
|
||||||
e = 2.718281828
|
e = 2.718281828;
|
||||||
)
|
)
|
||||||
|
|
||||||
type
|
type (
|
||||||
|
Empty interface {};
|
||||||
Point struct {
|
Point struct {
|
||||||
x, y int
|
x, y int;
|
||||||
}
|
};
|
||||||
|
Point2 Point
|
||||||
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
x1 int;
|
x1 int;
|
||||||
@ -42,7 +45,19 @@ func swap(x, y int) (u, v int) {
|
|||||||
|
|
||||||
func control_structs() {
|
func control_structs() {
|
||||||
i := 0;
|
i := 0;
|
||||||
for {
|
for {}
|
||||||
i++
|
for {};
|
||||||
|
for j := 0; j < i; j++ {
|
||||||
|
if i == 0 {
|
||||||
|
} else i = 0;
|
||||||
|
var x float
|
||||||
|
}
|
||||||
|
foo: switch {
|
||||||
|
case i < y:
|
||||||
|
case i < j:
|
||||||
|
case i == 0, i == 1, i == j:
|
||||||
|
i++; i++;
|
||||||
|
default:
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user