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

Function yaml_parser_fetch_stream_end

xs/tools/yaml/scanner.c:1352–1384  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1350 */
1351
1352static int
1353yaml_parser_fetch_stream_end(yaml_parser_t *parser)
1354{
1355 yaml_token_t token;
1356
1357 /* Force new line. */
1358
1359 if (parser->mark.column != 0) {
1360 parser->mark.column = 0;
1361 parser->mark.line ++;
1362 }
1363
1364 /* Reset the indentation level. */
1365
1366 if (!yaml_parser_unroll_indent(parser, -1))
1367 return 0;
1368
1369 /* Reset simple keys. */
1370
1371 if (!yaml_parser_remove_simple_key(parser))
1372 return 0;
1373
1374 parser->simple_key_allowed = 0;
1375
1376 /* Create the STREAM-END token and append it to the queue. */
1377
1378 STREAM_END_TOKEN_INIT(token, parser->mark, parser->mark);
1379
1380 if (!ENQUEUE(parser, parser->tokens, token))
1381 return 0;
1382
1383 return 1;
1384}
1385
1386/*
1387 * Produce a VERSION-DIRECTIVE or TAG-DIRECTIVE token.

Callers 1

Calls 2

Tested by

no test coverage detected