Skip to content

Commit 80a2982

Browse files
griesemergopherbot
authored andcommitted
spec: align EBNF rules consistently (cosmetic change)
Change-Id: Ib1b14b8880c6de5606f7f425a5fc1c8749d8a4b7 Reviewed-on: https://go-review.googlesource.com/c/go/+/635799 TryBot-Bypass: Robert Griesemer <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Robert Griesemer <[email protected]> Auto-Submit: Robert Griesemer <[email protected]>
1 parent 38e9a67 commit 80a2982

File tree

1 file changed

+62
-64
lines changed

1 file changed

+62
-64
lines changed

doc/go_spec.html

+62-64
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!--{
22
"Title": "The Go Programming Language Specification",
3-
"Subtitle": "Language version go1.24 (Nov 20, 2024)",
3+
"Subtitle": "Language version go1.24 (Dec 12, 2024)",
44
"Path": "/ref/spec"
55
}-->
66

@@ -810,12 +810,12 @@ <h2 id="Types">Types</h2>
810810
</p>
811811

812812
<pre class="ebnf">
813-
Type = TypeName [ TypeArgs ] | TypeLit | "(" Type ")" .
814-
TypeName = identifier | QualifiedIdent .
815-
TypeArgs = "[" TypeList [ "," ] "]" .
816-
TypeList = Type { "," Type } .
817-
TypeLit = ArrayType | StructType | PointerType | FunctionType | InterfaceType |
818-
SliceType | MapType | ChannelType .
813+
Type = TypeName [ TypeArgs ] | TypeLit | "(" Type ")" .
814+
TypeName = identifier | QualifiedIdent .
815+
TypeArgs = "[" TypeList [ "," ] "]" .
816+
TypeList = Type { "," Type } .
817+
TypeLit = ArrayType | StructType | PointerType | FunctionType | InterfaceType |
818+
SliceType | MapType | ChannelType .
819819
</pre>
820820

821821
<p>
@@ -1222,12 +1222,12 @@ <h3 id="Function_types">Function types</h3>
12221222
</p>
12231223

12241224
<pre class="ebnf">
1225-
FunctionType = "func" Signature .
1226-
Signature = Parameters [ Result ] .
1227-
Result = Parameters | Type .
1228-
Parameters = "(" [ ParameterList [ "," ] ] ")" .
1229-
ParameterList = ParameterDecl { "," ParameterDecl } .
1230-
ParameterDecl = [ IdentifierList ] [ "..." ] Type .
1225+
FunctionType = "func" Signature .
1226+
Signature = Parameters [ Result ] .
1227+
Result = Parameters | Type .
1228+
Parameters = "(" [ ParameterList [ "," ] ] ")" .
1229+
ParameterList = ParameterDecl { "," ParameterDecl } .
1230+
ParameterDecl = [ IdentifierList ] [ "..." ] Type .
12311231
</pre>
12321232

12331233
<p>
@@ -1634,8 +1634,8 @@ <h3 id="Map_types">Map types</h3>
16341634
</p>
16351635

16361636
<pre class="ebnf">
1637-
MapType = "map" "[" KeyType "]" ElementType .
1638-
KeyType = Type .
1637+
MapType = "map" "[" KeyType "]" ElementType .
1638+
KeyType = Type .
16391639
</pre>
16401640

16411641
<p>
@@ -2176,7 +2176,7 @@ <h2 id="Blocks">Blocks</h2>
21762176
</p>
21772177

21782178
<pre class="ebnf">
2179-
Block = "{" StatementList "}" .
2179+
Block = "{" StatementList "}" .
21802180
StatementList = { Statement ";" } .
21812181
</pre>
21822182

@@ -2233,8 +2233,8 @@ <h2 id="Declarations_and_scope">Declarations and scope</h2>
22332233
</p>
22342234

22352235
<pre class="ebnf">
2236-
Declaration = ConstDecl | TypeDecl | VarDecl .
2237-
TopLevelDecl = Declaration | FunctionDecl | MethodDecl .
2236+
Declaration = ConstDecl | TypeDecl | VarDecl .
2237+
TopLevelDecl = Declaration | FunctionDecl | MethodDecl .
22382238
</pre>
22392239

22402240
<p>
@@ -2679,9 +2679,9 @@ <h3 id="Type_parameter_declarations">Type parameter declarations</h3>
26792679
</p>
26802680

26812681
<pre class="ebnf">
2682-
TypeParameters = "[" TypeParamList [ "," ] "]" .
2683-
TypeParamList = TypeParamDecl { "," TypeParamDecl } .
2684-
TypeParamDecl = IdentifierList TypeConstraint .
2682+
TypeParameters = "[" TypeParamList [ "," ] "]" .
2683+
TypeParamList = TypeParamDecl { "," TypeParamDecl } .
2684+
TypeParamDecl = IdentifierList TypeConstraint .
26852685
</pre>
26862686

26872687
<p>
@@ -2869,8 +2869,8 @@ <h3 id="Variable_declarations">Variable declarations</h3>
28692869
</p>
28702870

28712871
<pre class="ebnf">
2872-
VarDecl = "var" ( VarSpec | "(" { VarSpec ";" } ")" ) .
2873-
VarSpec = IdentifierList ( Type [ "=" ExpressionList ] | "=" ExpressionList ) .
2872+
VarDecl = "var" ( VarSpec | "(" { VarSpec ";" } ")" ) .
2873+
VarSpec = IdentifierList ( Type [ "=" ExpressionList ] | "=" ExpressionList ) .
28742874
</pre>
28752875

28762876
<pre>
@@ -3210,15 +3210,15 @@ <h3 id="Composite_literals">Composite literals</h3>
32103210
</p>
32113211

32123212
<pre class="ebnf">
3213-
CompositeLit = LiteralType LiteralValue .
3214-
LiteralType = StructType | ArrayType | "[" "..." "]" ElementType |
3215-
SliceType | MapType | TypeName [ TypeArgs ] .
3216-
LiteralValue = "{" [ ElementList [ "," ] ] "}" .
3217-
ElementList = KeyedElement { "," KeyedElement } .
3218-
KeyedElement = [ Key ":" ] Element .
3219-
Key = FieldName | Expression | LiteralValue .
3220-
FieldName = identifier .
3221-
Element = Expression | LiteralValue .
3213+
CompositeLit = LiteralType LiteralValue .
3214+
LiteralType = StructType | ArrayType | "[" "..." "]" ElementType |
3215+
SliceType | MapType | TypeName [ TypeArgs ] .
3216+
LiteralValue = "{" [ ElementList [ "," ] ] "}" .
3217+
ElementList = KeyedElement { "," KeyedElement } .
3218+
KeyedElement = [ Key ":" ] Element .
3219+
Key = FieldName | Expression | LiteralValue .
3220+
FieldName = identifier .
3221+
Element = Expression | LiteralValue .
32223222
</pre>
32233223

32243224
<p>
@@ -3450,22 +3450,21 @@ <h3 id="Primary_expressions">Primary expressions</h3>
34503450
</p>
34513451

34523452
<pre class="ebnf">
3453-
PrimaryExpr =
3454-
Operand |
3455-
Conversion |
3456-
MethodExpr |
3457-
PrimaryExpr Selector |
3458-
PrimaryExpr Index |
3459-
PrimaryExpr Slice |
3460-
PrimaryExpr TypeAssertion |
3461-
PrimaryExpr Arguments .
3453+
PrimaryExpr = Operand |
3454+
Conversion |
3455+
MethodExpr |
3456+
PrimaryExpr Selector |
3457+
PrimaryExpr Index |
3458+
PrimaryExpr Slice |
3459+
PrimaryExpr TypeAssertion |
3460+
PrimaryExpr Arguments .
34623461

3463-
Selector = "." identifier .
3464-
Index = "[" Expression [ "," ] "]" .
3465-
Slice = "[" [ Expression ] ":" [ Expression ] "]" |
3466-
"[" [ Expression ] ":" Expression ":" Expression "]" .
3467-
TypeAssertion = "." "(" Type ")" .
3468-
Arguments = "(" [ ( ExpressionList | Type [ "," ExpressionList ] ) [ "..." ] [ "," ] ] ")" .
3462+
Selector = "." identifier .
3463+
Index = "[" Expression [ "," ] "]" .
3464+
Slice = "[" [ Expression ] ":" [ Expression ] "]" |
3465+
"[" [ Expression ] ":" Expression ":" Expression "]" .
3466+
TypeAssertion = "." "(" Type ")" .
3467+
Arguments = "(" [ ( ExpressionList | Type [ "," ExpressionList ] ) [ "..." ] [ "," ] ] ")" .
34693468
</pre>
34703469

34713470

@@ -3638,8 +3637,8 @@ <h3 id="Method_expressions">Method expressions</h3>
36383637
</p>
36393638

36403639
<pre class="ebnf">
3641-
MethodExpr = ReceiverType "." MethodName .
3642-
ReceiverType = Type .
3640+
MethodExpr = ReceiverType "." MethodName .
3641+
ReceiverType = Type .
36433642
</pre>
36443643

36453644
<p>
@@ -5916,11 +5915,10 @@ <h2 id="Statements">Statements</h2>
59165915
</p>
59175916

59185917
<pre class="ebnf">
5919-
Statement =
5920-
Declaration | LabeledStmt | SimpleStmt |
5921-
GoStmt | ReturnStmt | BreakStmt | ContinueStmt | GotoStmt |
5922-
FallthroughStmt | Block | IfStmt | SwitchStmt | SelectStmt | ForStmt |
5923-
DeferStmt .
5918+
Statement = Declaration | LabeledStmt | SimpleStmt |
5919+
GoStmt | ReturnStmt | BreakStmt | ContinueStmt | GotoStmt |
5920+
FallthroughStmt | Block | IfStmt | SwitchStmt | SelectStmt | ForStmt |
5921+
DeferStmt .
59245922

59255923
SimpleStmt = EmptyStmt | ExpressionStmt | SendStmt | IncDecStmt | Assignment | ShortVarDecl .
59265924
</pre>
@@ -6132,7 +6130,7 @@ <h3 id="Assignment_statements">Assignment statements</h3>
61326130
<pre class="ebnf">
61336131
Assignment = ExpressionList assign_op ExpressionList .
61346132

6135-
assign_op = [ add_op | mul_op ] "=" .
6133+
assign_op = [ add_op | mul_op ] "=" .
61366134
</pre>
61376135

61386136
<p>
@@ -6548,7 +6546,7 @@ <h3 id="For_statements">For statements</h3>
65486546
</p>
65496547

65506548
<pre class="ebnf">
6551-
ForStmt = "for" [ Condition | ForClause | RangeClause ] Block .
6549+
ForStmt = "for" [ Condition | ForClause | RangeClause ] Block .
65526550
Condition = Expression .
65536551
</pre>
65546552

@@ -6580,8 +6578,8 @@ <h4 id="For_clause">For statements with <code>for</code> clause</h4>
65806578

65816579
<pre class="ebnf">
65826580
ForClause = [ InitStmt ] ";" [ Condition ] ";" [ PostStmt ] .
6583-
InitStmt = SimpleStmt .
6584-
PostStmt = SimpleStmt .
6581+
InitStmt = SimpleStmt .
6582+
PostStmt = SimpleStmt .
65856583
</pre>
65866584

65876585
<pre>
@@ -7909,7 +7907,7 @@ <h3 id="Source_file_organization">Source file organization</h3>
79097907
</p>
79107908

79117909
<pre class="ebnf">
7912-
SourceFile = PackageClause ";" { ImportDecl ";" } { TopLevelDecl ";" } .
7910+
SourceFile = PackageClause ";" { ImportDecl ";" } { TopLevelDecl ";" } .
79137911
</pre>
79147912

79157913
<h3 id="Package_clause">Package clause</h3>
@@ -7920,8 +7918,8 @@ <h3 id="Package_clause">Package clause</h3>
79207918
</p>
79217919

79227920
<pre class="ebnf">
7923-
PackageClause = "package" PackageName .
7924-
PackageName = identifier .
7921+
PackageClause = "package" PackageName .
7922+
PackageName = identifier .
79257923
</pre>
79267924

79277925
<p>
@@ -7950,9 +7948,9 @@ <h3 id="Import_declarations">Import declarations</h3>
79507948
</p>
79517949

79527950
<pre class="ebnf">
7953-
ImportDecl = "import" ( ImportSpec | "(" { ImportSpec ";" } ")" ) .
7954-
ImportSpec = [ "." | PackageName ] ImportPath .
7955-
ImportPath = string_lit .
7951+
ImportDecl = "import" ( ImportSpec | "(" { ImportSpec ";" } ")" ) .
7952+
ImportSpec = [ "." | PackageName ] ImportPath .
7953+
ImportPath = string_lit .
79567954
</pre>
79577955

79587956
<p>

0 commit comments

Comments
 (0)