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

Method parse

decode.go:147–168  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

145}
146
147func (p *parser) parse() *Node {
148 p.init()
149 switch p.peek() {
150 case yaml_SCALAR_EVENT:
151 return p.scalar()
152 case yaml_ALIAS_EVENT:
153 return p.alias()
154 case yaml_MAPPING_START_EVENT:
155 return p.mapping()
156 case yaml_SEQUENCE_START_EVENT:
157 return p.sequence()
158 case yaml_DOCUMENT_START_EVENT:
159 return p.document()
160 case yaml_STREAM_END_EVENT:
161 // Happens when attempting to decode an empty buffer.
162 return nil
163 case yaml_TAIL_COMMENT_EVENT:
164 panic("internal error: unexpected tail comment event (please report)")
165 default:
166 panic("internal error: attempted to parse unknown event (please report): " + p.event.typ.String())
167 }
168}
169
170func (p *parser) node(kind Kind, defaultTag, tag, value string) *Node {
171 var style Style

Callers 4

parseChildMethod · 0.95
DecodeMethod · 0.80
unmarshalFunction · 0.80
EncodeMethod · 0.80

Calls 8

initMethod · 0.95
peekMethod · 0.95
scalarMethod · 0.95
aliasMethod · 0.95
mappingMethod · 0.95
sequenceMethod · 0.95
documentMethod · 0.95
StringMethod · 0.45

Tested by

no test coverage detected