Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Generate ¶
func Generate(w io.Writer, doc *Document, opts GenerateOptions) error
Generate writes a Document to the given writer as KDL.
func GenerateString ¶
func GenerateString(doc *Document, opts GenerateOptions) (string, error)
GenerateString returns a KDL string for the document.
Types ¶
type GenerateOptions ¶
type GenerateOptions struct {
Indent string
Compact bool
Version Version // Output version. Defaults to Version2.
}
GenerateOptions controls the output format.
func DefaultGenerateOptions ¶
func DefaultGenerateOptions() GenerateOptions
DefaultGenerateOptions returns sensible defaults.
type Node ¶
type Node struct {
Name string
Type string // type annotation, empty if none
Arguments []*Value
Properties []*Property // ordered
Children []*Node
}
Node represents a KDL node.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser parses KDL tokens into a Document.
type TokenType ¶
type TokenType int
TokenType represents the type of a KDL token.
const ( TokenEOF TokenType = iota TokenNewline TokenIdentifier TokenQuotedString TokenRawString TokenMultiLineString TokenInteger TokenFloat TokenHexInt TokenOctalInt TokenBinaryInt TokenTrue TokenFalse TokenNull TokenInf TokenNegInf TokenNaN TokenOpenBrace TokenCloseBrace TokenOpenParen TokenCloseParen TokenEquals TokenSemicolon TokenSlashDash )
type Tokenizer ¶
type Tokenizer struct {
Version Version
// contains filtered or unexported fields
}
Tokenizer is a KDL tokenizer supporting both v1 and v2.
func NewTokenizer ¶
NewTokenizer creates a new tokenizer for the given input.
Click to show internal directories.
Click to hide internal directories.