https://github.com/lunjon/gokdl
A parser implementation for the KDL document language in Go.
https://github.com/lunjon/gokdl
golang hacktoberfest kdl
Last synced: 21 days ago
JSON representation
A parser implementation for the KDL document language in Go.
- Host: GitHub
- URL: https://github.com/lunjon/gokdl
- Owner: lunjon
- License: mit
- Archived: true
- Created: 2023-09-22T22:09:23.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-03T19:15:02.000Z (4 months ago)
- Last Synced: 2025-02-03T20:25:28.722Z (4 months ago)
- Topics: golang, hacktoberfest, kdl
- Language: Go
- Homepage:
- Size: 55.7 KB
- Stars: 19
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
> [!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](https://github.com/sblinch/kdl-go) instead!# GoKDL
A parser implementation for the [KDL](https://kdl.dev/) document language in Go.
## Example
The following code shows a minimal example of parsing a KDL document:
```go
package mainimport (
"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!