aboutsummaryrefslogtreecommitdiff
path: root/examples/zon-examples/full-types.zon
diff options
context:
space:
mode:
Diffstat (limited to 'examples/zon-examples/full-types.zon')
-rw-r--r--examples/zon-examples/full-types.zon74
1 files changed, 74 insertions, 0 deletions
diff --git a/examples/zon-examples/full-types.zon b/examples/zon-examples/full-types.zon
new file mode 100644
index 0000000..5a06044
--- /dev/null
+++ b/examples/zon-examples/full-types.zon
@@ -0,0 +1,74 @@
+// ZON full-type showcase — exercises all value forms the ZON grammar supports.
+// Open in Nova to verify syntax highlighting across every literal kind.
+.{
+ // String (double-quoted)
+ .name = "nova-zig-full",
+
+ // Integers — decimal, hex, octal, binary, with digit separators
+ .decimal = 42,
+ .hex = 0xFF,
+ .octal = 0o77,
+ .binary = 0b1010_1010,
+ .large = 1_000_000,
+
+ // Floats
+ .pi = 3.14159,
+ .scientific = 1.5e10,
+ .negative_float = -0.001,
+
+ // Booleans
+ .flag_on = true,
+ .flag_off = false,
+
+ // Null
+ .optional = null,
+
+ // Enum tag / identifier literal (dot-prefixed)
+ .level = .info,
+ .theme = .solarized,
+
+ // Negative integer
+ .offset = -7,
+
+ // Nested struct
+ .metadata = .{
+ .author = "David",
+ .year = 2025,
+ .prerelease = false,
+ },
+
+ // Array of strings
+ .targets = .{
+ "x86_64-linux",
+ "aarch64-macos",
+ "wasm32-wasi",
+ },
+
+ // Array of nested structs
+ .rules = .{
+ .{ .name = "lint", .enabled = true },
+ .{ .name = "format", .enabled = false },
+ .{ .name = "test", .enabled = true },
+ },
+
+ // Deeply nested
+ .config = .{
+ .server = .{
+ .host = "localhost",
+ .port = 8080,
+ .tls = .{
+ .enabled = false,
+ .cert = null,
+ },
+ },
+ },
+
+ // Unicode string
+ .label = "Zig \u{2744} Nova",
+
+ // Empty struct
+ .empty = .{},
+
+ // Empty array
+ .no_items = .{},
+}