Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 15 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
- Created: 2023-09-22T22:09:23.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-02-04T10:44:32.000Z (5 months ago)
- Last Synced: 2024-02-04T12:11:02.762Z (5 months ago)
- Topics: golang, hacktoberfest, kdl
- Language: Go
- Homepage:
- Size: 59.6 KB
- Stars: 13
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-stars - lunjon/gokdl - A parser implementation for the KDL document language in Go. (Go)
README
# 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!