Documentation
¶
Overview ¶
Package minitoml parses a restricted TOML subset into a flat intermediate key/value form. Arrays of tables are the one nested shape: a [[key]] array holds one sub-document per element, each itself flat.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
Document is a flat map of dotted hierarchical keys to intermediate values.
func Parse ¶
Parse parses restricted TOML bytes into an intermediate Document.
Allowed: standard tables, nested tables, dotted bare keys, bare keys only, scalar values, arrays of primitive scalars, and arrays of tables ([[key]]). Forbidden: quoted keys, inline tables, arrays of inline tables.
func ParseString ¶
ParseString parses restricted TOML from a string.
func (Document) Clone ¶
Clone returns a shallow copy of the document map. Table-array elements are shared with the original, not copied.
type Kind ¶
type Kind int
Kind classifies an intermediate value.
const ( // KindString is a string scalar. KindString Kind = iota // KindBool is a boolean scalar. KindBool // KindInt is an integer scalar. KindInt // KindFloat is a floating-point scalar. KindFloat // KindArray is an array of primitive scalars. KindArray // KindTableArray is an array of tables written as repeated [[key]] headers. KindTableArray )
type Value ¶
type Value struct {
Kind Kind
Str string
Bool bool
Int int64
Float float64
Array []Value
// Tables holds one Document per [[key]] element when Kind is KindTableArray.
// Each element's keys are relative to the table-array key itself.
Tables []Document
}
Value is one intermediate scalar, primitive array, or array of tables.
func (Value) AsStringSlice ¶
AsStringSlice returns a primitive array as []string.
func (Value) AsTables ¶ added in v0.2.0
AsTables returns the per-element documents of an array of tables.