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: about 8 hours 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 (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-04T10:44:32.000Z (10 months ago)
- Last Synced: 2024-08-03T09:03:42.474Z (4 months ago)
- Topics: golang, hacktoberfest, kdl
- Language: Go
- Homepage:
- Size: 59.6 KB
- Stars: 18
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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!