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

Function yaml_parser_scan_directive

external/libyaml/src/scanner.c:2013–2117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2011 */
2012
2013int
2014yaml_parser_scan_directive(yaml_parser_t *parser, yaml_token_t *token)
2015{
2016 yaml_mark_t start_mark, end_mark;
2017 yaml_char_t *name = NULL;
2018 int major, minor;
2019 yaml_char_t *handle = NULL, *prefix = NULL;
2020
2021 /* Eat '%'. */
2022
2023 start_mark = parser->mark;
2024
2025 SKIP(parser);
2026
2027 /* Scan the directive name. */
2028
2029 if (!yaml_parser_scan_directive_name(parser, start_mark, &name))
2030 goto error;
2031
2032 /* Is it a YAML directive? */
2033
2034 if (strcmp((char *)name, "YAML") == 0)
2035 {
2036 /* Scan the VERSION directive value. */
2037
2038 if (!yaml_parser_scan_version_directive_value(parser, start_mark,
2039 &major, &minor))
2040 goto error;
2041
2042 end_mark = parser->mark;
2043
2044 /* Create a VERSION-DIRECTIVE token. */
2045
2046 VERSION_DIRECTIVE_TOKEN_INIT(*token, major, minor,
2047 start_mark, end_mark);
2048 }
2049
2050 /* Is it a TAG directive? */
2051
2052 else if (strcmp((char *)name, "TAG") == 0)
2053 {
2054 /* Scan the TAG directive value. */
2055
2056 if (!yaml_parser_scan_tag_directive_value(parser, start_mark,
2057 &handle, &prefix))
2058 goto error;
2059
2060 end_mark = parser->mark;
2061
2062 /* Create a TAG-DIRECTIVE token. */
2063
2064 TAG_DIRECTIVE_TOKEN_INIT(*token, handle, prefix,
2065 start_mark, end_mark);
2066 }
2067
2068 /* Unknown directive. */
2069
2070 else

Callers 1

Tested by

no test coverage detected