Skip to content

toml.ast #

type DateTimeType #

type DateTimeType = Date | DateTime | Time

DateTimeType is a sumtype representing all possible date types found in a TOML document.

fn (DateTimeType) str #

fn (dtt DateTimeType) str() string

str returns the string representation of the DateTimeType type.

type Key #

type Key = Bare | Bool | Null | Number | Quoted

Key is a sumtype representing all types of keys that can be found in a TOML document.

fn (Key) str #

fn (k Key) str() string

type Value #

type Value = Bool
	| Date
	| DateTime
	| Null
	| Number
	| Quoted
	| Time
	| []Value
	| map[string]Value

Value is a sumtype representing all possible value types found in a TOML document.

fn (Value) str #

fn (v Value) str() string

str outputs the value in JSON-like format for eased debugging

struct Bare #

struct Bare {
pub:
	text string
	pos  token.Position
}

Bare is the data representation of a TOML bare type (bare_key = ...).
Bare types can appear only as keys in TOML documents. Otherwise they take the form of Bool or Numbers.

fn (Bare) str #

fn (b Bare) str() string

str returns the string representation of the Bare type.

struct Bool #

struct Bool {
pub:
	text string
	pos  token.Position
}

Bool is the data representation of a TOML boolean type (... = true).
Bool types can appear only as values in TOML documents. Keys named true or false are considered as Bare types.

fn (Bool) str #

fn (b Bool) str() string

str returns the string representation of the Bool type.

struct Comment #

struct Comment {
pub:
	text string
	pos  token.Position
}

Comment is the data representation of a TOML comment (# This is a comment).

fn (Comment) str #

fn (c Comment) str() string

str returns the string representation of the Comment type.

struct Date #

struct Date {
pub:
	text string
	pos  token.Position
}

Date is the data representation of a TOML date type (YYYY-MM-DD).
Date types can appear both as keys and values in TOML documents.
Keys named like dates e.g. 1980-12-29 are considered Bare key types.

fn (Date) str #

fn (d Date) str() string

str returns the string representation of the Date type.

struct DateTime #

struct DateTime {
pub mut:
	text string
pub:
	pos  token.Position
	date Date
	time Time
}

DateTime is the data representation of a TOML date-time type (YYYY-MM-DDTHH:MM:SS.milli).
DateTime types can appear only as values in TOML documents.

fn (DateTime) str #

fn (dt DateTime) str() string

str returns the string representation of the DateTime type.

struct EOF #

struct EOF {
pub:
	pos token.Position
}

EOF is the data representation of the end of the TOML document.

fn (EOF) str #

fn (e EOF) str() string

str returns the string representation of the EOF type.

struct Null #

struct Null {
pub:
	text string
	pos  token.Position
}

Null is used in sumtype checks as a "default" value when nothing else is possible.

fn (Null) str #

fn (n Null) str() string

str returns the string representation of the Null type

struct Number #

struct Number {
pub:
	pos token.Position
pub mut:
	text string
}

Number is the data representation of a TOML number type (25 = 5e2).
Number types can appear both as keys and values in TOML documents.
Number can be integers, floats, infinite, NaN - they can have exponents (5e2) and be sign prefixed (+2).

fn (Number) str #

fn (n Number) str() string

str returns the string representation of the Number type.

fn (Number) i64 #

fn (n Number) i64() i64

i64 returns the n Number as an i64 value.

fn (Number) f64 #

fn (n Number) f64() f64

f64 returns the n Number as an f64 value.

struct Quoted #

struct Quoted {
pub mut:
	text string
pub:
	pos          token.Position
	is_multiline bool
	quote        byte
}

Quoted is the data representation of a TOML quoted type ("quoted-key" = "I'm a quoted value").
Quoted types can appear both as keys and values in TOML documents.

fn (Quoted) str #

fn (q Quoted) str() string

str returns the string representation of the Quoted type.

struct Root #

struct Root {
pub:
	input input.Config
pub mut:
	comments []Comment
	table    Value
}

Root represents the root structure of any parsed TOML text snippet or file.

fn (Root) str #

fn (r Root) str() string

struct Time #

struct Time {
pub:
	text   string
	offset int
	pos    token.Position
}

Time is the data representation of a TOML time type (HH:MM:SS.milli).
Time types can appear only as values in TOML documents.

fn (Time) str #

fn (t Time) str() string

str returns the string representation of the Time type.