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

Function yaml_parser_unroll_indent

xs/tools/yaml/scanner.c:1281–1308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1279
1280
1281static int
1282yaml_parser_unroll_indent(yaml_parser_t *parser, ptrdiff_t column)
1283{
1284 yaml_token_t token;
1285
1286 /* In the flow context, do nothing. */
1287
1288 if (parser->flow_level)
1289 return 1;
1290
1291 /* Loop through the intendation levels in the stack. */
1292
1293 while (parser->indent > column)
1294 {
1295 /* Create a token and append it to the queue. */
1296
1297 TOKEN_INIT(token, YAML_BLOCK_END_TOKEN, parser->mark, parser->mark);
1298
1299 if (!ENQUEUE(parser, parser->tokens, token))
1300 return 0;
1301
1302 /* Pop the indentation level. */
1303
1304 parser->indent = POP(parser, parser->indents);
1305 }
1306
1307 return 1;
1308}
1309
1310/*
1311 * Initialize the scanner and produce the STREAM-START token.

Calls

no outgoing calls

Tested by

no test coverage detected