Produce the KEY token.
(parser *yaml_parser_t)
| 1329 | |
| 1330 | // Produce the KEY token. |
| 1331 | func yaml_parser_fetch_key(parser *yaml_parser_t) bool { |
| 1332 | |
| 1333 | // In the block context, additional checks are required. |
| 1334 | if parser.flow_level == 0 { |
| 1335 | // Check if we are allowed to start a new key (not nessesary simple). |
| 1336 | if !parser.simple_key_allowed { |
| 1337 | return yaml_parser_set_scanner_error(parser, "", parser.mark, |
| 1338 | "mapping keys are not allowed in this context") |
| 1339 | } |
| 1340 | // Add the BLOCK-MAPPING-START token if needed. |
| 1341 | if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_MAPPING_START_TOKEN, parser.mark) { |
| 1342 | return false |
| 1343 | } |
| 1344 | } |
| 1345 | |
| 1346 | // Reset any potential simple keys on the current flow level. |
| 1347 | if !yaml_parser_remove_simple_key(parser) { |
| 1348 | return false |
| 1349 | } |
| 1350 | |
| 1351 | // Simple keys are allowed after '?' in the block context. |
| 1352 | parser.simple_key_allowed = parser.flow_level == 0 |
| 1353 | |
| 1354 | // Consume the token. |
| 1355 | start_mark := parser.mark |
| 1356 | skip(parser) |
| 1357 | end_mark := parser.mark |
| 1358 | |
| 1359 | // Create the KEY token and append it to the queue. |
| 1360 | token := yaml_token_t{ |
| 1361 | typ: yaml_KEY_TOKEN, |
| 1362 | start_mark: start_mark, |
| 1363 | end_mark: end_mark, |
| 1364 | } |
| 1365 | yaml_insert_token(parser, -1, &token) |
| 1366 | return true |
| 1367 | } |
| 1368 | |
| 1369 | // Produce the VALUE token. |
| 1370 | func yaml_parser_fetch_value(parser *yaml_parser_t) bool { |
no test coverage detected