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

Function yaml_parser_parse_stream_start

parserc.go:231–248  ·  view source on GitHub ↗

Parse the production: stream ::= STREAM-START implicit_document? explicit_document* STREAM-END ************

(parser *yaml_parser_t, event *yaml_event_t)

Source from the content-addressed store, hash-verified

229// stream ::= STREAM-START implicit_document? explicit_document* STREAM-END
230// ************
231func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) bool {
232 token := peek_token(parser)
233 if token == nil {
234 return false
235 }
236 if token.typ != yaml_STREAM_START_TOKEN {
237 return yaml_parser_set_parser_error(parser, "did not find expected <stream-start>", token.start_mark)
238 }
239 parser.state = yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE
240 *event = yaml_event_t{
241 typ: yaml_STREAM_START_EVENT,
242 start_mark: token.start_mark,
243 end_mark: token.end_mark,
244 encoding: token.encoding,
245 }
246 skip_token(parser)
247 return true
248}
249
250// Parse the productions:
251// implicit_document ::= block_node DOCUMENT-END*

Callers 1

Calls 3

peek_tokenFunction · 0.85
skip_tokenFunction · 0.85

Tested by

no test coverage detected