1
0
mirror of https://github.com/golang/go synced 2024-11-25 04:57:56 -07:00

- added missing case for opt. semicolons (labels)

- 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
This commit is contained in:
Robert Griesemer 2008-10-09 20:05:24 -07:00
parent 8f5b277cac
commit 7271e048fc

View 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