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

Function yaml_parser_fetch_stream_start

xs/tools/yaml/scanner.c:1314–1346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1312 */
1313
1314static int
1315yaml_parser_fetch_stream_start(yaml_parser_t *parser)
1316{
1317 yaml_simple_key_t simple_key = { 0, 0, 0, { 0, 0, 0 } };
1318 yaml_token_t token;
1319
1320 /* Set the initial indentation. */
1321
1322 parser->indent = -1;
1323
1324 /* Initialize the simple key stack. */
1325
1326 if (!PUSH(parser, parser->simple_keys, simple_key))
1327 return 0;
1328
1329 /* A simple key is allowed at the beginning of the stream. */
1330
1331 parser->simple_key_allowed = 1;
1332
1333 /* We have started. */
1334
1335 parser->stream_start_produced = 1;
1336
1337 /* Create the STREAM-START token and append it to the queue. */
1338
1339 STREAM_START_TOKEN_INIT(token, parser->encoding,
1340 parser->mark, parser->mark);
1341
1342 if (!ENQUEUE(parser, parser->tokens, token))
1343 return 0;
1344
1345 return 1;
1346}
1347
1348/*
1349 * Produce the STREAM-END token and shut down the scanner.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected