| 1101 | */ |
| 1102 | |
| 1103 | static int |
| 1104 | yaml_parser_save_simple_key(yaml_parser_t *parser) |
| 1105 | { |
| 1106 | /* |
| 1107 | * A simple key is required at the current position if the scanner is in |
| 1108 | * the block context and the current column coincides with the indentation |
| 1109 | * level. |
| 1110 | */ |
| 1111 | |
| 1112 | int required = (!parser->flow_level |
| 1113 | && parser->indent == (ptrdiff_t)parser->mark.column); |
| 1114 | |
| 1115 | /* |
| 1116 | * If the current position may start a simple key, save it. |
| 1117 | */ |
| 1118 | |
| 1119 | if (parser->simple_key_allowed) |
| 1120 | { |
| 1121 | yaml_simple_key_t simple_key; |
| 1122 | simple_key.possible = 1; |
| 1123 | simple_key.required = required; |
| 1124 | simple_key.token_number = |
| 1125 | parser->tokens_parsed + (parser->tokens.tail - parser->tokens.head); |
| 1126 | simple_key.mark = parser->mark; |
| 1127 | |
| 1128 | if (!yaml_parser_remove_simple_key(parser)) return 0; |
| 1129 | |
| 1130 | *(parser->simple_keys.top-1) = simple_key; |
| 1131 | } |
| 1132 | |
| 1133 | return 1; |
| 1134 | } |
| 1135 | |
| 1136 | /* |
| 1137 | * Remove a potential simple key at the current flow level. |
no test coverage detected