minor adjustments to switches text

R=r
DELTA=16  (5 added, 1 deleted, 10 changed)
OCL=26530
CL=26543
This commit is contained in:
Robert Griesemer 2009-03-19 08:39:40 -07:00
parent 37ab838d3a
commit 091cba8d03
1 changed files with 15 additions and 11 deletions

View File

@ -3133,6 +3133,11 @@ if x := f(); x < y {
An expression or type specifier is compared to the "cases" An expression or type specifier is compared to the "cases"
inside the "switch" to determine which branch inside the "switch" to determine which branch
to execute. to execute.
<pre class="grammar">
SwitchStat = ExprSwitchStat | TypeSwitchStat .
</pre>
There are two forms: expression switches and type switches. There are two forms: expression switches and type switches.
In an expression switch, the cases contain expressions that are compared In an expression switch, the cases contain expressions that are compared
against the value of the switch expression. against the value of the switch expression.
@ -3159,10 +3164,9 @@ the expression <code>true</code>.
</p> </p>
<pre class="grammar"> <pre class="grammar">
SwitchStat = ExprSwitchStat | TypeSwitchStat . ExprSwitchStat = "switch" [ [ SimpleStat ] ";" ] [ Expression ] "{" { ExprCaseClause } "}" .
ExprSwitchStat = "switch" [ [ SimpleStat ] ";" ] [ Expression ] "{" { ExprCaseClause } "}" . ExprCaseClause = ExprSwitchCase ":" [ StatementList ] .
ExprCaseClause = ExprSwitchCase ":" [ StatementList ] . ExprSwitchCase = "case" ExpressionList | "default" .
ExprSwitchCase = "case" ExpressionList | "default" .
</pre> </pre>
<p> <p>
@ -3217,10 +3221,10 @@ in the type guard.
</p> </p>
<pre class="grammar"> <pre class="grammar">
TypeSwitchStat = "switch" [ [ SimpleStat ] ";" ] TypeSwitchGuard "{" { TypeCaseClause } "}" . TypeSwitchStat = "switch" [ [ SimpleStat ] ";" ] TypeSwitchGuard "{" { TypeCaseClause } "}" .
TypeSwitchGuard = identifier ":=" Expression "." "(" "type" ")" . TypeSwitchGuard = identifier ":=" Expression "." "(" "type" ")" .
TypeCaseClause = TypeSwitchCase ":" [ StatementList ] . TypeCaseClause = TypeSwitchCase ":" [ StatementList ] .
TypeSwitchCase = "case" type | "default" . TypeSwitchCase = "case" type | "default" .
</pre> </pre>
<p> <p>
@ -3642,9 +3646,9 @@ the creation of <code>v</code>.
<p> <p>
A "fallthrough" statement transfers control to the first statement of the A "fallthrough" statement transfers control to the first statement of the
next case clause in a "switch" statement (§Switch statements). It may next case clause in a expression "switch" statement (§Expression switches). It may
be used only as the final non-empty statement in a case or default clause in a be used only as the final non-empty statement in a case or default clause in an
"switch" statement. expression "switch" statement.
</p> </p>
<pre class="grammar"> <pre class="grammar">