MCPcopy
hub / github.com/go-yaml/yaml / node

Method node

decode.go:170–194  ·  view source on GitHub ↗
(kind Kind, defaultTag, tag, value string)

Source from the content-addressed store, hash-verified

168}
169
170func (p *parser) node(kind Kind, defaultTag, tag, value string) *Node {
171 var style Style
172 if tag != "" && tag != "!" {
173 tag = shortTag(tag)
174 style = TaggedStyle
175 } else if defaultTag != "" {
176 tag = defaultTag
177 } else if kind == ScalarNode {
178 tag, _ = resolve("", value)
179 }
180 n := &Node{
181 Kind: kind,
182 Tag: tag,
183 Value: value,
184 Style: style,
185 }
186 if !p.textless {
187 n.Line = p.event.start_mark.line + 1
188 n.Column = p.event.start_mark.column + 1
189 n.HeadComment = string(p.event.head_comment)
190 n.LineComment = string(p.event.line_comment)
191 n.FootComment = string(p.event.foot_comment)
192 }
193 return n
194}
195
196func (p *parser) parseChild(parent *Node) *Node {
197 child := p.parse()

Callers 5

documentMethod · 0.95
aliasMethod · 0.95
scalarMethod · 0.95
sequenceMethod · 0.95
mappingMethod · 0.95

Calls 2

shortTagFunction · 0.85
resolveFunction · 0.85

Tested by

no test coverage detected