From 3a47bc715404752e7f4156177bfb7975cfa06aec Mon Sep 17 00:00:00 2001 From: Jonathan Marler Date: Mon, 9 Oct 2023 08:26:53 -0600 Subject: [PATCH] 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`. --- doc/langref.html.in | 4 ++-- lib/std/zig/Parse.zig | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/langref.html.in b/doc/langref.html.in index 2c98fae1fc..53a471e36a 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -12371,9 +12371,9 @@ fn readU32Be() u32 {} Root <- skip container_doc_comment? ContainerMembers eof # *** Top level *** -ContainerMembers <- ContainerDeclarations (ContainerField COMMA)* (ContainerField / ContainerDeclarations) +ContainerMembers <- ContainerDeclaration* (ContainerField COMMA)* (ContainerField / ContainerDeclaration*) -ContainerDeclarations <- (TestDecl / ComptimeDecl / doc_comment? KEYWORD_pub? Decl)* +ContainerDeclaration <- TestDecl / ComptimeDecl / doc_comment? KEYWORD_pub? Decl TestDecl <- KEYWORD_test (STRINGLITERALSINGLE / IDENTIFIER)? Block diff --git a/lib/std/zig/Parse.zig b/lib/std/zig/Parse.zig index 67e2939865..b978077404 100644 --- a/lib/std/zig/Parse.zig +++ b/lib/std/zig/Parse.zig @@ -205,9 +205,9 @@ pub fn parseZon(p: *Parse) !void { }; } -/// ContainerMembers <- ContainerDeclarations (ContainerField COMMA)* (ContainerField / ContainerDeclarations) +/// ContainerMembers <- ContainerDeclaration* (ContainerField COMMA)* (ContainerField / ContainerDeclaration*) /// -/// ContainerDeclarations <- (TestDecl / ComptimeDecl / doc_comment? KEYWORD_pub? Decl)* +/// ContainerDeclaration <- TestDecl / ComptimeDecl / doc_comment? KEYWORD_pub? Decl /// /// ComptimeDecl <- KEYWORD_comptime Block fn parseContainerMembers(p: *Parse) !Members {