eb-local.toml

module eb-local.toml  src/toml.zig[source][autodoc]

The part of TOML 1.0 that eb-local’s configuration uses: tables ([a.b]), dotted keys, basic and literal strings, integers, booleans and arrays, which may span lines. Floats, dates, inline tables and arrays of tables are refused by name rather than misread. A duplicate key, a table defined twice, or a key used both as a value and as a table is an error naming its line.

Types

pub const Value = union(enum)[source][autodoc]

A value as the file wrote it: one of the kinds this parser accepts.

string: []const u8[source]
int: i64[source]
boolean: bool[source]
array: []const Value[source]
table: *Table[source]
pub fn kindName(v: Value) []const u8[source][autodoc]

The kind of v with its article, as an error message names it: “a string”, “an integer”.

pub const Entry = struct[source][autodoc]

One key of a table, its value, and the line that set it.

key: []const u8[source]
value: Value[source]
line: usize[source]
pub const Table = struct[source][autodoc]

A table’s keys in the order the file gives them.

entries: std.ArrayList(Entry) = .empty[source]
explicit: bool = false[source]

Defined by a [header] (not only implied by a dotted name).

dotted: bool = false[source]

Defined via dotted keys (cannot be reopened by [header]).

line: usize = 0[source]
pub fn get(t: *const Table, key: []const u8) ?*const Entry[source][autodoc]

The entry for key, or null when the table has none.

pub const Diagnostic = struct[source][autodoc]

Where and why the text is not accepted.

line: usize = 0[source]
message: []const u8 = ""[source]

Error sets

pub const Error = error{Invalid} || Allocator.Error[source][autodoc]

error.Invalid when the text is not accepted, with the line and reason in the Diagnostic.

Functions

pub fn parse(a: Allocator, src: []const u8, diag: *Diagnostic) Error!*Table[source][autodoc]

Parse src. Everything is allocated with a (an arena is expected).

Constants

pub const max_depth = 32[source][autodoc]

Deepest nesting of arrays accepted.

pub const max_entries = 10_000[source][autodoc]

Most keys and array items, counted together, one file may hold.