MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / yaml_parser_parse_flow_mapping_value

Function yaml_parser_parse_flow_mapping_value

xs/tools/yaml/parser.c:1195–1225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1193 */
1194
1195static int
1196yaml_parser_parse_flow_mapping_value(yaml_parser_t *parser,
1197 yaml_event_t *event, int empty)
1198{
1199 yaml_token_t *token;
1200
1201 token = PEEK_TOKEN(parser);
1202 if (!token) return 0;
1203
1204 if (empty) {
1205 parser->state = YAML_PARSE_FLOW_MAPPING_KEY_STATE;
1206 return yaml_parser_process_empty_scalar(parser, event,
1207 token->start_mark);
1208 }
1209
1210 if (token->type == YAML_VALUE_TOKEN) {
1211 SKIP_TOKEN(parser);
1212 token = PEEK_TOKEN(parser);
1213 if (!token) return 0;
1214 if (token->type != YAML_FLOW_ENTRY_TOKEN
1215 && token->type != YAML_FLOW_MAPPING_END_TOKEN) {
1216 if (!PUSH(parser, parser->states,
1217 YAML_PARSE_FLOW_MAPPING_KEY_STATE))
1218 return 0;
1219 return yaml_parser_parse_node(parser, event, 0, 0);
1220 }
1221 }
1222
1223 parser->state = YAML_PARSE_FLOW_MAPPING_KEY_STATE;
1224 return yaml_parser_process_empty_scalar(parser, event, token->start_mark);
1225}
1226
1227/*
1228 * Generate an empty scalar event.

Callers 1

Calls 2

yaml_parser_parse_nodeFunction · 0.85

Tested by

no test coverage detected