| 275 | } |
| 276 | |
| 277 | trace_format* parse_pattern_in_brackets(agent* thisAgent, bool read_opening_bracket) |
| 278 | { |
| 279 | trace_format* first, *prev, *New; |
| 280 | |
| 281 | /* --- look for opening bracket --- */ |
| 282 | if (read_opening_bracket) |
| 283 | { |
| 284 | if (*format != '[') |
| 285 | { |
| 286 | format_string_error_message = "Expected '[' followed by attribute path"; |
| 287 | return NIL; |
| 288 | } |
| 289 | format++; |
| 290 | } |
| 291 | |
| 292 | /* --- read pattern --- */ |
| 293 | prev = NIL; |
| 294 | first = NIL; /* unnecessary, but gcc -Wall warns without it */ |
| 295 | while ((*format != 0) && (*format != ']')) |
| 296 | { |
| 297 | New = parse_item_from_format_string(thisAgent); |
| 298 | if (!New) |
| 299 | { |
| 300 | if (prev) |
| 301 | { |
| 302 | prev->next = NIL; |
| 303 | } |
| 304 | else |
| 305 | { |
| 306 | first = NIL; |
| 307 | } |
| 308 | deallocate_trace_format_list(thisAgent, first); |
| 309 | return NIL; |
| 310 | } |
| 311 | if (prev) |
| 312 | { |
| 313 | prev->next = New; |
| 314 | } |
| 315 | else |
| 316 | { |
| 317 | first = New; |
| 318 | } |
| 319 | prev = New; |
| 320 | } |
| 321 | if (prev) |
| 322 | { |
| 323 | prev->next = NIL; |
| 324 | } |
| 325 | else |
| 326 | { |
| 327 | first = NIL; |
| 328 | } |
| 329 | |
| 330 | /* --- look for closing bracket --- */ |
| 331 | if (*format != ']') |
| 332 | { |
| 333 | format_string_error_message = "'[' without closing ']'"; |
| 334 | deallocate_trace_format_list(thisAgent, first); |
no test coverage detected