MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / yaml_parser_fetch_key

Function yaml_parser_fetch_key

external/libyaml/src/scanner.c:1648–1695  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1646 */
1647
1648static int
1649yaml_parser_fetch_key(yaml_parser_t *parser)
1650{
1651 yaml_mark_t start_mark, end_mark;
1652 yaml_token_t token;
1653
1654 /* In the block context, additional checks are required. */
1655
1656 if (!parser->flow_level)
1657 {
1658 /* Check if we are allowed to start a new key (not necessary simple). */
1659
1660 if (!parser->simple_key_allowed) {
1661 return yaml_parser_set_scanner_error(parser, NULL, parser->mark,
1662 "mapping keys are not allowed in this context");
1663 }
1664
1665 /* Add the BLOCK-MAPPING-START token if needed. */
1666
1667 if (!yaml_parser_roll_indent(parser, parser->mark.column, -1,
1668 YAML_BLOCK_MAPPING_START_TOKEN, parser->mark))
1669 return 0;
1670 }
1671
1672 /* Reset any potential simple keys on the current flow level. */
1673
1674 if (!yaml_parser_remove_simple_key(parser))
1675 return 0;
1676
1677 /* Simple keys are allowed after '?' in the block context. */
1678
1679 parser->simple_key_allowed = (!parser->flow_level);
1680
1681 /* Consume the token. */
1682
1683 start_mark = parser->mark;
1684 SKIP(parser);
1685 end_mark = parser->mark;
1686
1687 /* Create the KEY token and append it to the queue. */
1688
1689 TOKEN_INIT(token, YAML_KEY_TOKEN, start_mark, end_mark);
1690
1691 if (!ENQUEUE(parser, parser->tokens, token))
1692 return 0;
1693
1694 return 1;
1695}
1696
1697/*
1698 * Produce the VALUE token.

Callers 1

Calls 3

yaml_parser_roll_indentFunction · 0.85

Tested by

no test coverage detected