| 1226 | */ |
| 1227 | |
| 1228 | static int |
| 1229 | yaml_parser_roll_indent(yaml_parser_t *parser, ptrdiff_t column, |
| 1230 | ptrdiff_t number, yaml_token_type_t type, yaml_mark_t mark) |
| 1231 | { |
| 1232 | yaml_token_t token; |
| 1233 | |
| 1234 | /* In the flow context, do nothing. */ |
| 1235 | |
| 1236 | if (parser->flow_level) |
| 1237 | return 1; |
| 1238 | |
| 1239 | if (parser->indent < column) |
| 1240 | { |
| 1241 | /* |
| 1242 | * Push the current indentation level to the stack and set the new |
| 1243 | * indentation level. |
| 1244 | */ |
| 1245 | |
| 1246 | if (!PUSH(parser, parser->indents, parser->indent)) |
| 1247 | return 0; |
| 1248 | |
| 1249 | if (column > INT_MAX) { |
| 1250 | parser->error = YAML_MEMORY_ERROR; |
| 1251 | return 0; |
| 1252 | } |
| 1253 | |
| 1254 | parser->indent = (int)column; |
| 1255 | |
| 1256 | /* Create a token and insert it into the queue. */ |
| 1257 | |
| 1258 | TOKEN_INIT(token, type, mark, mark); |
| 1259 | |
| 1260 | if (number == -1) { |
| 1261 | if (!ENQUEUE(parser, parser->tokens, token)) |
| 1262 | return 0; |
| 1263 | } |
| 1264 | else { |
| 1265 | if (!QUEUE_INSERT(parser, |
| 1266 | parser->tokens, number - parser->tokens_parsed, token)) |
| 1267 | return 0; |
| 1268 | } |
| 1269 | } |
| 1270 | |
| 1271 | return 1; |
| 1272 | } |
| 1273 | |
| 1274 | /* |
| 1275 | * Pop indentation levels from the indents stack until the current level |
no outgoing calls
no test coverage detected