]> Cypherpunks repositories - gostls13.git/commitdiff
- Implemented simple rule for optional semicolons:
authorRobert Griesemer <gri@golang.org>
Wed, 19 Mar 2008 22:45:07 +0000 (15:45 -0700)
committerRobert Griesemer <gri@golang.org>
Wed, 19 Mar 2008 22:45:07 +0000 (15:45 -0700)
  Semicolons are terminators for statements as in C,
  but if followed by a "}" they are not required.
  This is easy to understand and produces the desired
  result for statements.
- Updated todo.txt.

SVN=113198

tests/char_lit.go [new file with mode: 0644]
tests/float_lit.go [new file with mode: 0644]
tests/hashmap.go
tests/int_lit.go [new file with mode: 0644]
tests/string_lit.go [new file with mode: 0644]
tests/test0.go

diff --git a/tests/char_lit.go b/tests/char_lit.go
new file mode 100644 (file)
index 0000000..66ffec2
--- /dev/null
@@ -0,0 +1,35 @@
+// $G $F.go && $L $F.$A &&./$A.out
+
+// 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
+
+func main() {
+  [ ' ',
+    'a',
+    // need to fix Coco/R scanner to read Unicode.
+    // 'ä',
+    //'本',
+    '\a',
+    '\b',
+    '\f',
+    '\n',
+    '\r',
+    '\t',
+    '\v',
+    '\\',
+    '\'',
+    '\"',
+    '\000',
+    '\123',
+    '\x00',
+    '\xca',
+    '\xFE',
+    '\u0123',
+    '\ubabe',
+    '\U0123ABCD',
+    '\Ucafebabe'
+  ]
+}
diff --git a/tests/float_lit.go b/tests/float_lit.go
new file mode 100644 (file)
index 0000000..11decaf
--- /dev/null
@@ -0,0 +1,70 @@
+// $G $F.go && $L $F.$A && ./$A.out
+
+// 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
+
+func main() {
+  [ 0.,
+    +10.,
+    -210.,
+        
+    .0,
+    +.01,
+    -.012,
+       
+    0.0,
+    +10.01,
+    -210.012,
+
+    0E+1,
+    +10e2,
+    -210e3,
+    
+    0E-1,
+    +0e23,
+    -0e345,
+
+    0E1,
+    +10e23,
+    -210e345,
+
+    0.E1,
+    +10.e+2,
+    -210.e-3,
+        
+    .0E1,
+    +.01e2,
+    -.012e3,
+       
+    0.0E1,
+    +10.01e2,
+    -210.012e3,
+
+    0.E+12,
+    +10.e23,
+    -210.e34,
+        
+    .0E-12,
+    +.01e23,
+    -.012e34,
+       
+    0.0E12,
+    +10.01e23,
+    -210.012e34,
+
+    0.E123,
+    +10.e+234,
+    -210.e-345,
+        
+    .0E123,
+    +.01e234,
+    -.012e345,
+       
+    0.0E123,
+    +10.01e234,
+    -210.012e345
+  ]
+}
index 8d5d5167d5c1016563ae86640a06af860a499e9c..daa0d43748720e0dbebf3bb803fd976b04ee8b77 100755 (executable)
@@ -58,9 +58,9 @@ func (m *HashMap) Clear() {
   var i uint32 = m.capacity() - 1;
   for i > 0 {
     m.map_[i].key = nil;
-    i = i - 1;
+    i = i - 1
   }
-  m.occupancy_ = 0;
+  m.occupancy_ = 0
 }
 
 
diff --git a/tests/int_lit.go b/tests/int_lit.go
new file mode 100644 (file)
index 0000000..ef74370
--- /dev/null
@@ -0,0 +1,19 @@
+// $G $F.go && $L $F.$A && ./$A.out
+
+// 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
+
+func main() {
+  [ 0,
+    123,
+    0123,
+    0000,
+    0x0,
+    0x123,
+    0X0,
+    0X123
+  ];
+}
diff --git a/tests/string_lit.go b/tests/string_lit.go
new file mode 100644 (file)
index 0000000..568e7a5
--- /dev/null
@@ -0,0 +1,29 @@
+// $G $F.go && $L $F.$A && ./$A.out
+
+// 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
+
+func main() {
+  [ "",
+    " ",
+    "'`",
+    "a",
+    //"ä",
+    //"本",
+    "\a\b\f\n\r\t\v\\\'\"",
+    "\000\123\x00\xca\xFE\u0123\ubabe\U0123ABCD\Ucafebabe",
+    
+    ``,
+    ` `,
+    `'"`,
+    `a`,
+    //`ä`,
+    //`本`,
+    `\a\b\f\n\r\t\v\\\'\"`,
+    `\000\123\x00\xca\xFE\u0123\ubabe\U0123ABCD\Ucafebabe`,
+    `\x\u\U\`
+  ]
+}
index 9201c16685eeb7d08f6242ed3f86d57db1e56b0b..0d9585ed6bd55530532d4a089680e30b72b35d8c 100644 (file)
@@ -69,7 +69,7 @@ func control_structs() {
   foo:  // a label
   switch {
   case i < y:
-    fallthrough
+    fallthrough;
   case i < j:
   case i == 0, i == 1, i == j:
     i++; i++;