MCPcopy
hub / github.com/pelletier/go-toml / rawKeySuffix

Method rawKeySuffix

unmarshaler.go:1122–1137  ·  view source on GitHub ↗

rawKeySuffix returns the raw bytes of the key of the expression, skipping the first n parts.

(expr *unstable.Node, n int)

Source from the content-addressed store, hash-verified

1120// rawKeySuffix returns the raw bytes of the key of the expression, skipping
1121// the first n parts.
1122func (d *decoder) rawKeySuffix(expr *unstable.Node, n int) []byte {
1123 it := expr.Key()
1124 idx := 0
1125 var start, end unstable.Range
1126 for it.Next() {
1127 if idx >= n {
1128 r := it.Node().Raw
1129 if start.Length == 0 && start.Offset == 0 && idx == n {
1130 start = r
1131 }
1132 end = r
1133 }
1134 idx++
1135 }
1136 return d.p.Data()[start.Offset : end.Offset+end.Length]
1137}
1138
1139// startCapture registers a new capture for the table at the given path
1140// (prefix of tableKey).

Callers 1

appendCaptureHeaderMethod · 0.95

Calls 4

NodeMethod · 0.80
DataMethod · 0.80
KeyMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected