]> Cypherpunks repositories - gostls13.git/commitdiff
- fixed typo in go_lang.txt
authorRobert Griesemer <gri@golang.org>
Wed, 12 Mar 2008 20:12:40 +0000 (13:12 -0700)
committerRobert Griesemer <gri@golang.org>
Wed, 12 Mar 2008 20:12:40 +0000 (13:12 -0700)
- changed go.atg to make optional semicolons work for statements
- expanded a test case

SVN=112242

doc/go_lang.txt
tests/test0.go

index b0d717e0ec9bd92fb413fe7e14561d3bd44c5dfb..651e5f82dbb999cb29734ee9071940846b0291b5 100644 (file)
@@ -603,7 +603,7 @@ Each field of a struct represents a variable within the data
 structure.
 
   StructType = "struct" "{" [ FieldDeclList [ ";" ] ] "}" .
-  FieldDeclList = FieldDecl { ";" FieldDeclList } .
+  FieldDeclList = FieldDecl { ";" FieldDecl } .
   FieldDecl = IdentifierList Type .
 
     // An empty struct.
index 215601ee8516b27d413d7f6d844d52e8c3d61f05..ab58bc8572af6feba5cd6caa59d1d4485fc8aa0b 100644 (file)
@@ -13,13 +13,16 @@ const
   
 const (
   pi = /* the usual */ 3.14159265358979323;
-  e = 2.718281828
+  e = 2.718281828;
 )
 
-type
+type (
+  Empty interface {};
   Point struct {
-    x, y int
-  }
+    x, y int;
+  };
+  Point2 Point
+)
   
 var (
   x1 int;
@@ -42,7 +45,19 @@ func swap(x, y int) (u, v int) {
 
 func control_structs() {
   i := 0;
-  for {
-    i++
+  for {}
+  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
   }
 }