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

Function yaml_parser_fetch_document_indicator

scannerc.go:1166–1197  ·  view source on GitHub ↗

Produce the DOCUMENT-START or DOCUMENT-END token.

(parser *yaml_parser_t, typ yaml_token_type_t)

Source from the content-addressed store, hash-verified

1164
1165// Produce the DOCUMENT-START or DOCUMENT-END token.
1166func yaml_parser_fetch_document_indicator(parser *yaml_parser_t, typ yaml_token_type_t) bool {
1167 // Reset the indentation level.
1168 if !yaml_parser_unroll_indent(parser, -1, parser.mark) {
1169 return false
1170 }
1171
1172 // Reset simple keys.
1173 if !yaml_parser_remove_simple_key(parser) {
1174 return false
1175 }
1176
1177 parser.simple_key_allowed = false
1178
1179 // Consume the token.
1180 start_mark := parser.mark
1181
1182 skip(parser)
1183 skip(parser)
1184 skip(parser)
1185
1186 end_mark := parser.mark
1187
1188 // Create the DOCUMENT-START or DOCUMENT-END token.
1189 token := yaml_token_t{
1190 typ: typ,
1191 start_mark: start_mark,
1192 end_mark: end_mark,
1193 }
1194 // Append the token to the queue.
1195 yaml_insert_token(parser, -1, &token)
1196 return true
1197}
1198
1199// Produce the FLOW-SEQUENCE-START or FLOW-MAPPING-START token.
1200func yaml_parser_fetch_flow_collection_start(parser *yaml_parser_t, typ yaml_token_type_t) bool {

Callers 1

Calls 4

skipFunction · 0.85
yaml_insert_tokenFunction · 0.85

Tested by

no test coverage detected