mirror of
https://github.com/golang/go
synced 2024-11-22 05:54:40 -07:00
make SimpleStmt include EmptyStmt and the grammar simplifies a bit.
SimpleStmt was always used as an option. fix bug: divide is a right shift DELTA=8 (0 added, 0 deleted, 8 changed) OCL=34612 CL=34614
This commit is contained in:
parent
28eba4877b
commit
f3a33bca40
@ -2557,7 +2557,7 @@ Examples:
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
If the dividend is positive and the divisor is a constant power of 2,
|
If the dividend is positive and the divisor is a constant power of 2,
|
||||||
the division may be replaced by a left shift, and computing the remainder may
|
the division may be replaced by a right shift, and computing the remainder may
|
||||||
be replaced by a bitwise "and" operation:
|
be replaced by a bitwise "and" operation:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -3011,12 +3011,12 @@ Statements control execution.
|
|||||||
|
|
||||||
<pre class="ebnf">
|
<pre class="ebnf">
|
||||||
Statement =
|
Statement =
|
||||||
Declaration | EmptyStmt | LabeledStmt |
|
Declaration | LabeledStmt | SimpleStmt |
|
||||||
SimpleStmt | GoStmt | ReturnStmt | BreakStmt | ContinueStmt | GotoStmt |
|
GoStmt | ReturnStmt | BreakStmt | ContinueStmt | GotoStmt |
|
||||||
FallthroughStmt | Block | IfStmt | SwitchStmt | SelectStmt | ForStmt |
|
FallthroughStmt | Block | IfStmt | SwitchStmt | SelectStmt | ForStmt |
|
||||||
DeferStmt .
|
DeferStmt .
|
||||||
|
|
||||||
SimpleStmt = ExpressionStmt | IncDecStmt | Assignment | ShortVarDecl .
|
SimpleStmt = EmptyStmt | ExpressionStmt | IncDecStmt | Assignment | ShortVarDecl .
|
||||||
|
|
||||||
StatementList = Statement { Separator Statement } .
|
StatementList = Statement { Separator Statement } .
|
||||||
Separator = [ ";" ] .
|
Separator = [ ";" ] .
|
||||||
@ -3196,7 +3196,7 @@ is equivalent to <code>true</code>.
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre class="ebnf">
|
<pre class="ebnf">
|
||||||
IfStmt = "if" [ [ SimpleStmt ] ";" ] [ Expression ] Block [ "else" Statement ] .
|
IfStmt = "if" [ SimpleStmt ";" ] [ Expression ] Block [ "else" Statement ] .
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
@ -3261,7 +3261,7 @@ the expression <code>true</code>.
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre class="ebnf">
|
<pre class="ebnf">
|
||||||
ExprSwitchStmt = "switch" [ [ SimpleStmt ] ";" ] [ Expression ] "{" { ExprCaseClause } "}" .
|
ExprSwitchStmt = "switch" [ SimpleStmt ";" ] [ Expression ] "{" { ExprCaseClause } "}" .
|
||||||
ExprCaseClause = ExprSwitchCase ":" [ StatementList ] .
|
ExprCaseClause = ExprSwitchCase ":" [ StatementList ] .
|
||||||
ExprSwitchCase = "case" ExpressionList | "default" .
|
ExprSwitchCase = "case" ExpressionList | "default" .
|
||||||
</pre>
|
</pre>
|
||||||
@ -3311,7 +3311,7 @@ in the type assertion.
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre class="ebnf">
|
<pre class="ebnf">
|
||||||
TypeSwitchStmt = "switch" [ [ SimpleStmt ] ";" ] TypeSwitchGuard "{" { TypeCaseClause } "}" .
|
TypeSwitchStmt = "switch" [ SimpleStmt ";" ] TypeSwitchGuard "{" { TypeCaseClause } "}" .
|
||||||
TypeSwitchGuard = [ identifier ":=" ] Expression "." "(" "type" ")" .
|
TypeSwitchGuard = [ identifier ":=" ] Expression "." "(" "type" ")" .
|
||||||
TypeCaseClause = TypeSwitchCase ":" [ StatementList ] .
|
TypeCaseClause = TypeSwitchCase ":" [ StatementList ] .
|
||||||
TypeSwitchCase = "case" Type | "default" .
|
TypeSwitchCase = "case" Type | "default" .
|
||||||
@ -3426,7 +3426,7 @@ an increment or decrement statement. The init statement may be a
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre class="ebnf">
|
<pre class="ebnf">
|
||||||
ForClause = [ InitStmt ] ";" [ Condition ] ";" [ PostStmt ] .
|
ForClause = InitStmt ";" [ Condition ] ";" PostStmt .
|
||||||
InitStmt = SimpleStmt .
|
InitStmt = SimpleStmt .
|
||||||
PostStmt = SimpleStmt .
|
PostStmt = SimpleStmt .
|
||||||
</pre>
|
</pre>
|
||||||
|
Loading…
Reference in New Issue
Block a user