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

Method scalar

decode.go:224–252  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

222}
223
224func (p *parser) scalar() *Node {
225 var parsedStyle = p.event.scalar_style()
226 var nodeStyle Style
227 switch {
228 case parsedStyle&yaml_DOUBLE_QUOTED_SCALAR_STYLE != 0:
229 nodeStyle = DoubleQuotedStyle
230 case parsedStyle&yaml_SINGLE_QUOTED_SCALAR_STYLE != 0:
231 nodeStyle = SingleQuotedStyle
232 case parsedStyle&yaml_LITERAL_SCALAR_STYLE != 0:
233 nodeStyle = LiteralStyle
234 case parsedStyle&yaml_FOLDED_SCALAR_STYLE != 0:
235 nodeStyle = FoldedStyle
236 }
237 var nodeValue = string(p.event.value)
238 var nodeTag = string(p.event.tag)
239 var defaultTag string
240 if nodeStyle == 0 {
241 if nodeValue == "<<" {
242 defaultTag = mergeTag
243 }
244 } else {
245 defaultTag = strTag
246 }
247 n := p.node(ScalarNode, defaultTag, nodeTag, nodeValue)
248 n.Style |= nodeStyle
249 p.anchor(n, p.event.anchor)
250 p.expect(yaml_SCALAR_EVENT)
251 return n
252}
253
254func (p *parser) sequence() *Node {
255 n := p.node(SequenceNode, seqTag, string(p.event.tag), "")

Callers 1

parseMethod · 0.95

Calls 4

nodeMethod · 0.95
anchorMethod · 0.95
expectMethod · 0.95
scalar_styleMethod · 0.80

Tested by

no test coverage detected