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

Function yaml_parser_scan

scannerc.go:602–628  ·  view source on GitHub ↗

Get the next token.

(parser *yaml_parser_t, token *yaml_token_t)

Source from the content-addressed store, hash-verified

600
601// Get the next token.
602func yaml_parser_scan(parser *yaml_parser_t, token *yaml_token_t) bool {
603 // Erase the token object.
604 *token = yaml_token_t{} // [Go] Is this necessary?
605
606 // No tokens after STREAM-END or error.
607 if parser.stream_end_produced || parser.error != yaml_NO_ERROR {
608 return true
609 }
610
611 // Ensure that the tokens queue contains enough tokens.
612 if !parser.token_available {
613 if !yaml_parser_fetch_more_tokens(parser) {
614 return false
615 }
616 }
617
618 // Fetch the next token from the queue.
619 *token = parser.tokens[parser.tokens_head]
620 parser.tokens_head++
621 parser.tokens_parsed++
622 parser.token_available = false
623
624 if token.typ == yaml_STREAM_END_TOKEN {
625 parser.stream_end_produced = true
626 }
627 return true
628}
629
630// Set the scanner error and return false.
631func yaml_parser_set_scanner_error(parser *yaml_parser_t, context string, context_mark yaml_mark_t, problem string) bool {

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected