From: Rob Pike
Statement =
- Declaration | EmptyStat | LabeledStat |
- SimpleStat | GoStat | ReturnStat | BreakStat | ContinueStat | GotoStat |
- FallthroughStat | Block | IfStat | SwitchStat | SelectStat | ForStat |
- DeferStat .
+ Declaration | EmptyStmt | LabeledStmt |
+ SimpleStmt | GoStmt | ReturnStmt | BreakStmt | ContinueStmt | GotoStmt |
+ FallthroughStmt | Block | IfStmt | SwitchStmt | SelectStmt | ForStmt |
+ DeferStmt .
-SimpleStat = ExpressionStat | IncDecStat | Assignment | SimpleVarDecl .
+SimpleStmt = ExpressionStmt | IncDecStmt | Assignment | SimpleVarDecl .
StatementList = Statement { Separator Statement } .
Separator = [ ";" ]
@@ -2992,7 +2992,7 @@ The empty statement does nothing.
-EmptyStat = . +EmptyStmt = .
@@ -3009,7 +3009,7 @@ A labeled statement may be the target of a goto
,
-LabeledStat = Label ":" Statement . +LabeledStmt = Label ":" Statement . Label = identifier .@@ -3027,7 +3027,7 @@ can appear in statement context.
-ExpressionStat = Expression . +ExpressionStmt = Expression .
@@ -3045,7 +3045,7 @@ must be a variable, pointer indirection, field selector or index expression.-IncDecStat = Expression ( "++" | "--" ) . +IncDecStmt = Expression ( "++" | "--" ) .@@ -3141,7 +3141,7 @@ is equivalent to
true
.-IfStat = "if" [ [ SimpleStat ] ";" ] [ Expression ] Block [ "else" Statement ] . +IfStmt = "if" [ [ SimpleStmt ] ";" ] [ Expression ] Block [ "else" Statement ] .@@ -3178,7 +3178,7 @@ to execute.-SwitchStat = ExprSwitchStat | TypeSwitchStat . +SwitchStmt = ExprSwitchStmt | TypeSwitchStmt .@@ -3208,7 +3208,7 @@ the expression
true
.-ExprSwitchStat = "switch" [ [ SimpleStat ] ";" ] [ Expression ] "{" { ExprCaseClause } "}" . +ExprSwitchStmt = "switch" [ [ SimpleStmt ] ";" ] [ Expression ] "{" { ExprCaseClause } "}" . ExprCaseClause = ExprSwitchCase ":" [ StatementList ] . ExprSwitchCase = "case" ExpressionList | "default" .@@ -3265,7 +3265,7 @@ in the type guard.-TypeSwitchStat = "switch" [ [ SimpleStat ] ";" ] TypeSwitchGuard "{" { TypeCaseClause } "}" . +TypeSwitchStmt = "switch" [ [ SimpleStmt ] ";" ] TypeSwitchGuard "{" { TypeCaseClause } "}" . TypeSwitchGuard = identifier ":=" Expression "." "(" "type" ")" . TypeCaseClause = TypeSwitchCase ":" [ StatementList ] . TypeSwitchCase = "case" ( type | "nil" ) | "default" . @@ -3331,7 +3331,7 @@ controlled by a condition, a "for" clause, or a "range" clause.-ForStat = "for" [ Condition | ForClause | RangeClause ] Block . +ForStmt = "for" [ Condition | ForClause | RangeClause ] Block . Condition = Expression .@@ -3359,9 +3359,9 @@ it declares ends at the end of the statement-ForClause = [ InitStat ] ";" [ Condition ] ";" [ PostStat ] . -InitStat = SimpleStat . -PostStat = SimpleStat . +ForClause = [ InitStmt ] ";" [ Condition ] ";" [ PostStmt ] . +InitStmt = SimpleStmt . +PostStmt = SimpleStmt .@@ -3460,7 +3460,7 @@ within the same address space.-GoStat = "go" Expression . +GoStmt = "go" Expression .@@ -3484,7 +3484,7 @@ cases all referring to communication operations.
-SelectStat = "select" "{" { CommClause } "}" . +SelectStmt = "select" "{" { CommClause } "}" . CommClause = CommCase ":" StatementList . CommCase = "case" ( SendExpr | RecvExpr) | "default" . SendExpr = Expression "<-" Expression . @@ -3557,7 +3557,7 @@ and optionally provides a result value or values to the caller.-ReturnStat = "return" [ ExpressionList ] . +ReturnStmt = "return" [ ExpressionList ] .@@ -3627,7 +3627,7 @@ A "break" statement terminates execution of the innermost-BreakStat = "break" [ Label ]. +BreakStmt = "break" [ Label ].@@ -3653,7 +3653,7 @@ innermost "for" loop at the post statement (§For statements).
-ContinueStat = "continue" [ Label ]. +ContinueStmt = "continue" [ Label ].@@ -3667,7 +3667,7 @@ A "goto" statement transfers control to the statement with the corresponding lab
-GotoStat = "goto" Label . +GotoStmt = "goto" Label .@@ -3702,7 +3702,7 @@ expression "switch" statement.-FallthroughStat = "fallthrough" . +FallthroughStmt = "fallthrough" .@@ -3714,7 +3714,7 @@ the surrounding function returns.-DeferStat = "defer" Expression . +DeferStmt = "defer" Expression .