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

str returns the string representation of the key. This is implemented by all the variants of Key.

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.Pos
}

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.Pos
}

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.Pos
}

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.Pos
}

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.Pos
	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.Pos
}

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.Pos
}

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.Pos
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.Pos
	is_multiline bool
	quote        u8
}

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 #

@[heap]
struct Root {
pub:
	input input.Config // User input configuration
pub mut:
	comments []Comment
	table    Value
	// errors           []errors.Error    // all the checker errors in the file
}

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

fn (Root) str #

fn (r Root) str() string

str returns the string representation of the root node.

struct Time #

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

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.