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

Method Key

unstable/ast.go:99–112  ·  view source on GitHub ↗

Key returns the children nodes making the Key on a supported node. Panics otherwise. They are guaranteed to be all be of the Kind Key. A simple key would return just one element.

()

Source from the content-addressed store, hash-verified

97// otherwise. They are guaranteed to be all be of the Kind Key. A simple key
98// would return just one element.
99func (n *Node) Key() Iterator {
100 switch n.Kind {
101 case KeyValue:
102 value := n.Child()
103 if !value.Valid() {
104 panic(errors.New("KeyValue should have at least two children"))
105 }
106 return Iterator{node: value.Next()}
107 case Table, ArrayTable:
108 return Iterator{node: n.Child()}
109 default:
110 panic(fmt.Errorf("Key() is not supported on a %s", n.Kind))
111 }
112}
113
114// Value returns a pointer to the value node of a KeyValue.
115// Guaranteed to be non-nil. Panics if not called on a KeyValue node,

Callers 15

MissingTableMethod · 0.45
MissingFieldMethod · 0.45
keyLocationFunction · 0.45
collectMapEntriesMethod · 0.45
wrapSeenErrorMethod · 0.45
updateTableKeyMethod · 0.45
walkTableMethod · 0.45
rawKeySuffixMethod · 0.45
resolveCaptureMethod · 0.45

Calls 3

ChildMethod · 0.95
ValidMethod · 0.80
NextMethod · 0.45

Tested by 5

TestNodeChainingFunction · 0.36
TestMultipleExpressionsFunction · 0.36
ExampleParserFunction · 0.36