WIP Go parser for the KDL Document Language, version 1.0.0.
- parsing to a kdl.Document model
- serializing a kdl.Document model to a string
- marshalling from a struct
- unmarshalling to a struct
- improve performance?
import (
kdl "github.com/frixuu/kdlgo"
)
// or any of: ParseBytes, ParseFile, ParseReader
document, err := kdl.ParseString(`foo bar="baz"`)
if document.Nodes[0].HasProp("bar") {
n := kdl.NewNode("person")
n.AddArg("known")
// or: n.AddArgValue(kdl.NewStringValue("known", kdl.NoHint()))
n.SetProp("name", "Joe")
// or: n.SetPropValue("name", kdl.NewStringValue("Joe", kdl.NoHint()))
document.AddChild(n)
}
// or Write() to an io.Writer
s, err := document.WriteString()