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

Method peek

decode.go:99–110  ·  view source on GitHub ↗

peek peeks at the next event in the event stream, puts the results into p.event and returns the event type.

()

Source from the content-addressed store, hash-verified

97// peek peeks at the next event in the event stream,
98// puts the results into p.event and returns the event type.
99func (p *parser) peek() yaml_event_type_t {
100 if p.event.typ != yaml_NO_EVENT {
101 return p.event.typ
102 }
103 // It's curious choice from the underlying API to generally return a
104 // positive result on success, but on this case return true in an error
105 // scenario. This was the source of bugs in the past (issue #666).
106 if !yaml_parser_parse(&p.parser, &p.event) || p.parser.error != yaml_NO_ERROR {
107 p.fail()
108 }
109 return p.event.typ
110}
111
112func (p *parser) fail() {
113 var where string

Callers 4

parseMethod · 0.95
documentMethod · 0.95
sequenceMethod · 0.95
mappingMethod · 0.95

Calls 2

failMethod · 0.95
yaml_parser_parseFunction · 0.85

Tested by

no test coverage detected