code: func (p *parser) expect(e yaml_event_type_t) {
  	if p.event.typ == yaml_NO_EVENT {
  		if !yaml_parser_parse(&p.parser, &p.event) {
  			p.fail()
  		}
  	}
  	if p.event.typ == yaml_STREAM_END_EVENT {
  		failf("attempted to go past the end of stream; corrupted value?")
  	}
  	if p.event.typ != e {
  		p.parser.problem = fmt.Sprintf("expected %s event but got %s", e, p.event.typ)
  		p.fail()
  	}
  	yaml_event_delete(&p.event)
  	p.event.typ = yaml_NO_EVENT
  }
docs: // expect consumes an event from the event stream and
  // checks that it's of the expected type.