fig 1.0.0

Parse, edit, and convert config files while preserving comments. Supports JSON, YAML, TOML, and more.
const yaml = @This();
const Document = @import("../document.zig");
const AST = @import("../ast/ast.zig");

pub const Parser = @import("parser.zig");
pub const Tokenizer = @import("tokenizer.zig");
pub const Printer = @import("printer.zig");
pub const Materialize = @import("materialize.zig");
pub const Type = enum {
    v1_2_2,
    // TODO: earlier versions of YAML spec?
};

pub const Language = struct {
    pub const Type = yaml.Type;
    pub const Parser = yaml.Parser;
    pub const default_type: yaml.Type = .v1_2_2;
    pub fn parse(parser: *yaml.Parser, input: []const u8, format: yaml.Type) !Document {
        return yaml.Parser.parse(parser.allocator, input, format);
    }
    pub const print = Printer.print;
    pub const printNode = Printer.printNode;
    /// Collapse the reference layer (aliases/merges/tags/anchors) into a core AST
    /// before handing it to a non-YAML printer. Optional Language decl: callers
    /// gate on `@hasDecl(Lang, "materialize")`.
    pub const materialize = Materialize.materialize;
    pub const TagMode = Materialize.TagMode;
};

// Test discovery: importing `yaml.zig` (from root.zig) pulls in every YAML
// submodule's tests, so the module owns its own test surface. The conformance
// suite is build-option-gated and stays in root.zig.
test {
    _ = @import("tokenizer.zig");
    _ = @import("parser.zig");
    _ = @import("printer.zig");
    _ = @import("materialize.zig");
    _ = @import("editor_helper.zig");
}