Just Tree Notation support in Go https://treenotation.org/
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Maxim Lebedev 90f9bd2d5b
🏷️ Added Delim type
1 year ago
testdata 🔖 Released v0.1.0 1 year ago
LICENSE.md 📄 Added license file 1 year ago
README.md 📝 Added pkg.go.dev badge in README.md 1 year ago
doc.go 💡 Added import comment in doc.go 1 year ago
go.mod 🎉 Initial commit 1 year ago
go.sum 🔖 Released v0.1.0 1 year ago
tree.go 🏷️ Added Delim type 1 year ago
tree_test.go 🔖 Released v0.1.0 1 year ago



Go Reference

The fast and simple Tree Notation parser.
Clean and unfiltered Go with single memory allocation and without any 3rd party


package main

import (


func main() {
	// For example, load tree content from file.
	file, err := os.Open(filepath.Join(".", "html.example"))
	if err != nil {
		log.Fatalf("cannot open file: %v", err)
	defer file.Close()

	// Parse file contents from plain Tree Notation into *tree.Node with
	// *tree.Node childrens.
	node := tree.Parse(file)

	fmt.Printf("%#v", node)
	// Output:
	// html
	//  body
	//   div おはようございます

See package documentation and another examples
on pkg.go.dev.


$ GOMAXPROCS=1 go test -bench=Parse -benchmem -benchtime=10s
goos: linux
goarch: amd64
pkg: source.toby3d.me/toby3d/tree
cpu: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
BenchmarkParse  37139248           316.9 ns/op      4096 B/op          1 allocs/op




Check my website or just drop email.