summaryrefslogtreecommitdiff
path: root/vendor/github.com/pelletier/go-toml/v2/internal/tracker/key.go
diff options
context:
space:
mode:
authorLibravatar Terin Stock <terinjokes@gmail.com>2022-04-26 20:30:25 -0700
committerLibravatar Terin Stock <terinjokes@gmail.com>2023-01-31 15:16:42 +0100
commit83b4c9ebc87d0fddf4e638f13e3af1483912e3a5 (patch)
tree47840b84c0fd3cb226eab2ecb3dbce0617163406 /vendor/github.com/pelletier/go-toml/v2/internal/tracker/key.go
parent[chore] update URLs to forked source (diff)
downloadgotosocial-83b4c9ebc87d0fddf4e638f13e3af1483912e3a5.tar.xz
[chore] remove vendor
Diffstat (limited to 'vendor/github.com/pelletier/go-toml/v2/internal/tracker/key.go')
-rw-r--r--vendor/github.com/pelletier/go-toml/v2/internal/tracker/key.go50
1 files changed, 0 insertions, 50 deletions
diff --git a/vendor/github.com/pelletier/go-toml/v2/internal/tracker/key.go b/vendor/github.com/pelletier/go-toml/v2/internal/tracker/key.go
deleted file mode 100644
index 7c148f48d..000000000
--- a/vendor/github.com/pelletier/go-toml/v2/internal/tracker/key.go
+++ /dev/null
@@ -1,50 +0,0 @@
-package tracker
-
-import (
- "github.com/pelletier/go-toml/v2/internal/ast"
-)
-
-// KeyTracker is a tracker that keeps track of the current Key as the AST is
-// walked.
-type KeyTracker struct {
- k []string
-}
-
-// UpdateTable sets the state of the tracker with the AST table node.
-func (t *KeyTracker) UpdateTable(node *ast.Node) {
- t.reset()
- t.Push(node)
-}
-
-// UpdateArrayTable sets the state of the tracker with the AST array table node.
-func (t *KeyTracker) UpdateArrayTable(node *ast.Node) {
- t.reset()
- t.Push(node)
-}
-
-// Push the given key on the stack.
-func (t *KeyTracker) Push(node *ast.Node) {
- it := node.Key()
- for it.Next() {
- t.k = append(t.k, string(it.Node().Data))
- }
-}
-
-// Pop key from stack.
-func (t *KeyTracker) Pop(node *ast.Node) {
- it := node.Key()
- for it.Next() {
- t.k = t.k[:len(t.k)-1]
- }
-}
-
-// Key returns the current key
-func (t *KeyTracker) Key() []string {
- k := make([]string, len(t.k))
- copy(k, t.k)
- return k
-}
-
-func (t *KeyTracker) reset() {
- t.k = t.k[:0]
-}