diff options
| author | Matthew Lugg <mlugg@mlugg.co.uk> | 2025-02-03 16:38:35 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-03 16:38:35 +0000 |
| commit | 317722b37b201e393aed60045f4bf9649103e63e (patch) | |
| tree | d0485fccbcfd0d2951ac373bbd5d483cc8539ca2 /lib/std/zon.zig | |
| parent | e61acd8eb563d3c233202ef3a1a63df384d09943 (diff) | |
| parent | dc5c8278474f998360bc48e3dd0fe9a2929b4374 (diff) | |
| download | zig-317722b37b201e393aed60045f4bf9649103e63e.tar.gz zig-317722b37b201e393aed60045f4bf9649103e63e.zip | |
Merge pull request #20271 from MasonRemaley/zon
ZON
Diffstat (limited to 'lib/std/zon.zig')
| -rw-r--r-- | lib/std/zon.zig | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/std/zon.zig b/lib/std/zon.zig new file mode 100644 index 0000000000..252331057a --- /dev/null +++ b/lib/std/zon.zig @@ -0,0 +1,45 @@ +//! ZON parsing and stringification. +//! +//! ZON ("Zig Object Notation") is a textual file format. Outside of `nan` and `inf` literals, ZON's +//! grammar is a subset of Zig's. +//! +//! Supported Zig primitives: +//! * boolean literals +//! * number literals (including `nan` and `inf`) +//! * character literals +//! * enum literals +//! * `null` literals +//! * string literals +//! * multiline string literals +//! +//! Supported Zig container types: +//! * anonymous struct literals +//! * anonymous tuple literals +//! +//! Here is an example ZON object: +//! ``` +//! .{ +//! .a = 1.5, +//! .b = "hello, world!", +//! .c = .{ true, false }, +//! .d = .{ 1, 2, 3 }, +//! } +//! ``` +//! +//! Individual primitives are also valid ZON, for example: +//! ``` +//! "This string is a valid ZON object." +//! ``` +//! +//! ZON may not contain type names. +//! +//! ZON does not have syntax for pointers, but the parsers will allocate as needed to match the +//! given Zig types. Similarly, the serializer will traverse pointers. + +pub const parse = @import("zon/parse.zig"); +pub const stringify = @import("zon/stringify.zig"); + +test { + _ = parse; + _ = stringify; +} |
