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

Function yaml_parser_stale_simple_keys

xs/tools/yaml/scanner.c:1077–1111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1075 */
1076
1077static int
1078yaml_parser_stale_simple_keys(yaml_parser_t *parser)
1079{
1080 yaml_simple_key_t *simple_key;
1081
1082 /* Check for a potential simple key for each flow level. */
1083
1084 for (simple_key = parser->simple_keys.start;
1085 simple_key != parser->simple_keys.top; simple_key ++)
1086 {
1087 /*
1088 * The specification requires that a simple key
1089 *
1090 * - is limited to a single line,
1091 * - is shorter than 1024 characters.
1092 */
1093
1094 if (simple_key->possible
1095 && (simple_key->mark.line < parser->mark.line
1096 || simple_key->mark.index+1024 < parser->mark.index)) {
1097
1098 /* Check if the potential simple key to be removed is required. */
1099
1100 if (simple_key->required) {
1101 return yaml_parser_set_scanner_error(parser,
1102 "while scanning a simple key", simple_key->mark,
1103 "could not find expected ':'");
1104 }
1105
1106 simple_key->possible = 0;
1107 }
1108 }
1109
1110 return 1;
1111}
1112
1113/*
1114 * Check if a simple key may start at the current position and add it if

Callers 2

Calls 1

Tested by

no test coverage detected