| 1060 | */ |
| 1061 | |
| 1062 | static int |
| 1063 | yaml_parser_stale_simple_keys(yaml_parser_t *parser) |
| 1064 | { |
| 1065 | yaml_simple_key_t *simple_key; |
| 1066 | |
| 1067 | /* Check for a potential simple key for each flow level. */ |
| 1068 | |
| 1069 | for (simple_key = parser->simple_keys.start; |
| 1070 | simple_key != parser->simple_keys.top; simple_key ++) |
| 1071 | { |
| 1072 | /* |
| 1073 | * The specification requires that a simple key |
| 1074 | * |
| 1075 | * - is limited to a single line, |
| 1076 | * - is shorter than 1024 characters. |
| 1077 | */ |
| 1078 | |
| 1079 | if (simple_key->possible |
| 1080 | && (simple_key->mark.line < parser->mark.line |
| 1081 | || simple_key->mark.index+1024 < parser->mark.index)) { |
| 1082 | |
| 1083 | /* Check if the potential simple key to be removed is required. */ |
| 1084 | |
| 1085 | if (simple_key->required) { |
| 1086 | return yaml_parser_set_scanner_error(parser, |
| 1087 | "while scanning a simple key", simple_key->mark, |
| 1088 | "could not find expected ':'"); |
| 1089 | } |
| 1090 | |
| 1091 | simple_key->possible = 0; |
| 1092 | } |
| 1093 | } |
| 1094 | |
| 1095 | return 1; |
| 1096 | } |
| 1097 | |
| 1098 | /* |
| 1099 | * Check if a simple key may start at the current position and add it if |
no test coverage detected