Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.
/ gokdl Public archive

A parser implementation for the KDL document language in Go.

License

Notifications You must be signed in to change notification settings

lunjon/gokdl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

e3ec970 · Feb 3, 2025

History

37 Commits
Dec 20, 2023
Oct 3, 2023
Oct 1, 2023
Sep 22, 2023
Feb 3, 2025
Dec 20, 2023
Sep 24, 2023
Sep 29, 2023
Sep 29, 2023
Dec 20, 2023
Dec 20, 2023
Dec 11, 2023
Dec 20, 2023
Feb 2, 2024
Feb 2, 2024
Oct 2, 2023
Sep 29, 2023

Repository files navigation

Note

Due to lack of time I can no longer maintain this project. I had a great time implementing it but nowadays the family takes most of my spare time. Checkout kdl-go instead!

GoKDL

A parser implementation for the KDL document language in Go.

Example

The following code shows a minimal example of parsing a KDL document:

package main

import (
    "log"
    "strings"
    "github.com/lunjon/gokdl"
)

func main() {
    kdl := `
MyNode "string arg" myint=1234 awesome=true {
  child-node 
}      

// A node with arbitrary name (in quotes)
"Other node with much cooler name!" { Okay; }
`

    r := strings.NewReader(kdl)
    doc, err := gokdl.Parse(r)
    if err != nil {
        log.Fatal(err)
    }

    // Do something with doc ...
}

API

Although the module can be used, and the API is still very rough, I'm grateful for any feedback and suggestion regarding the API!