-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.frontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.
Milestone
Description
Extracted from #14523.
Given a foo.zon file:
.{
.bar = "hello",
}it should be possible to @import it as a comptime-known value:
const data = @import("foo.zon");
comptime {
assert(std.mem.eql(u8, data.bar, "hello"));
}One motivating use case in particular is, inside build.zig, one should be able to @import("build.zig.zon") and access those values.
Note that the top level expression of a zon file is not necessarily an anonymous struct literal. It can be:
- string literal
- boolean literal
- integer literal
- null literal
- undefined literal
- anonymous struct literal
- tuple literal
- anonymous enum literal
silversquirl, tauoverpi, maxmilton, trufae, booniepepper and 26 moreSuperAuguste, kassane, lin72h, silversquirl, prajwalch and 20 moreInKryption, lin72h, naeu, Lamby777, silver-signal and 3 moreArnau478, PanSashko, SeanTUT and gustavojoaquin
Metadata
Metadata
Assignees
Labels
enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.frontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.