]> Cypherpunks repositories - gostls13.git/commitdiff
- added missing case for opt. semicolons (labels)
authorRobert Griesemer <gri@golang.org>
Fri, 10 Oct 2008 03:05:24 +0000 (20:05 -0700)
committerRobert Griesemer <gri@golang.org>
Fri, 10 Oct 2008 03:05:24 +0000 (20:05 -0700)
- more precise wording by having an explicit list of cases
- simplified statement list

R=r
DELTA=16  (10 added, 0 deleted, 6 changed)
OCL=16871
CL=16875

doc/go_spec.txt

index d08f0eaee92d4e6516c41c6a0725302b7788c51e..3dbf53058c408c8f53f57feffdecd0bb8ead879c 100644 (file)
@@ -59,6 +59,9 @@ Open issues according to gri:
        variables and the use of '&' to convert methods into function pointers.
 [ ] Conversions: can we say: "type T int; T(3.0)" ?
 [ ] Is . import implemented?
+[ ] Do we allow empty statements? If so, do we allow empty statements after a label?
+    and if so, does a label followed by an empty statement (a semicolon) still denote
+       a for loop that is following, and can break L be used inside it?
 
 
 Decisions in need of integration into the doc:
@@ -1980,14 +1983,21 @@ Statements control execution.
        SimpleStat =
                ExpressionStat | IncDecStat | Assignment | SimpleVarDecl .
 
+
 Statements in a statement list are separated by semicolons, which can be
 omitted in some cases as expressed by the OptSemicolon production.
-They are optional immediately after a closing parenthesis ")" terminating a
-list of declarations, or a closing brace terminating a type declaration or
-a block. Specifically, they cannot be omitted after the closing brace of a
-composite literal.
 
-       StatementList = Statement { OptSemicolon Statement } [ ";" ] .
+       StatementList = Statement { OptSemicolon Statement } .
+
+A semicolon may be omitted immediately following:
+
+       - a closing parenthesis ")" ending a list of declarations (§Declarations and scope rules)
+       - a closing brace "}" ending a type declaration (§Type declarations)
+       - a closing brace "}" ending a block (including switch and select statements)
+       - a label declaration (§Label declarations)
+
+In all other cases a semicolon is required to separate two statements. Since there
+is an empty statement, a statement list can always be ``terminated'' with a semicolon.
 
 
 Label declarations