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

Function yaml_parser_scan_directive_name

external/libyaml/src/scanner.c:2129–2170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2127 */
2128
2129static int
2130yaml_parser_scan_directive_name(yaml_parser_t *parser,
2131 yaml_mark_t start_mark, yaml_char_t **name)
2132{
2133 yaml_string_t string = NULL_STRING;
2134
2135 if (!STRING_INIT(parser, string, INITIAL_STRING_SIZE)) goto error;
2136
2137 /* Consume the directive name. */
2138
2139 if (!CACHE(parser, 1)) goto error;
2140
2141 while (IS_ALPHA(parser->buffer))
2142 {
2143 if (!READ(parser, string)) goto error;
2144 if (!CACHE(parser, 1)) goto error;
2145 }
2146
2147 /* Check if the name is empty. */
2148
2149 if (string.start == string.pointer) {
2150 yaml_parser_set_scanner_error(parser, "while scanning a directive",
2151 start_mark, "could not find expected directive name");
2152 goto error;
2153 }
2154
2155 /* Check for an blank character after the name. */
2156
2157 if (!IS_BLANKZ(parser->buffer)) {
2158 yaml_parser_set_scanner_error(parser, "while scanning a directive",
2159 start_mark, "found unexpected non-alphabetical character");
2160 goto error;
2161 }
2162
2163 *name = string.start;
2164
2165 return 1;
2166
2167error:
2168 STRING_DEL(parser, string);
2169 return 0;
2170}
2171
2172/*
2173 * Scan the value of VERSION-DIRECTIVE.

Callers 1

Calls 1

Tested by

no test coverage detected