Skip to content

Commit 3a47bc7

Browse files
marler8997Vexu
authored andcommitted
Grammar: Use ContainerDeclaration* instead of ContainerDeclarations
`ContainerDeclarations` is an abstraction of `ContainerDeclaration*`. Removing this abstraction allows the `ContainerMembers` rule to contain more concrete information without having to look at the definition of `ContainerDeclarations`.
1 parent 9e341a6 commit 3a47bc7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

doc/langref.html.in

+2-2
Original file line numberDiff line numberDiff line change
@@ -12371,9 +12371,9 @@ fn readU32Be() u32 {}
1237112371
Root <- skip container_doc_comment? ContainerMembers eof
1237212372

1237312373
# *** Top level ***
12374-
ContainerMembers <- ContainerDeclarations (ContainerField COMMA)* (ContainerField / ContainerDeclarations)
12374+
ContainerMembers <- ContainerDeclaration* (ContainerField COMMA)* (ContainerField / ContainerDeclaration*)
1237512375

12376-
ContainerDeclarations <- (TestDecl / ComptimeDecl / doc_comment? KEYWORD_pub? Decl)*
12376+
ContainerDeclaration <- TestDecl / ComptimeDecl / doc_comment? KEYWORD_pub? Decl
1237712377

1237812378
TestDecl <- KEYWORD_test (STRINGLITERALSINGLE / IDENTIFIER)? Block
1237912379

lib/std/zig/Parse.zig

+2-2
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,9 @@ pub fn parseZon(p: *Parse) !void {
205205
};
206206
}
207207

208-
/// ContainerMembers <- ContainerDeclarations (ContainerField COMMA)* (ContainerField / ContainerDeclarations)
208+
/// ContainerMembers <- ContainerDeclaration* (ContainerField COMMA)* (ContainerField / ContainerDeclaration*)
209209
///
210-
/// ContainerDeclarations <- (TestDecl / ComptimeDecl / doc_comment? KEYWORD_pub? Decl)*
210+
/// ContainerDeclaration <- TestDecl / ComptimeDecl / doc_comment? KEYWORD_pub? Decl
211211
///
212212
/// ComptimeDecl <- KEYWORD_comptime Block
213213
fn parseContainerMembers(p: *Parse) !Members {

0 commit comments

Comments
 (0)