| 384 | } |
| 385 | |
| 386 | std::string PrefilterTree::DebugNodeString(Prefilter* node) const { |
| 387 | std::string node_string = ""; |
| 388 | if (node->op() == Prefilter::ATOM) { |
| 389 | DCHECK(!node->atom().empty()); |
| 390 | node_string += node->atom(); |
| 391 | } else { |
| 392 | // Adding the operation disambiguates AND and OR nodes. |
| 393 | node_string += node->op() == Prefilter::AND ? "AND" : "OR"; |
| 394 | node_string += "("; |
| 395 | for (size_t i = 0; i < node->subs()->size(); i++) { |
| 396 | if (i > 0) |
| 397 | node_string += ','; |
| 398 | node_string += StringPrintf("%d", (*node->subs())[i]->unique_id()); |
| 399 | node_string += ":"; |
| 400 | node_string += DebugNodeString((*node->subs())[i]); |
| 401 | } |
| 402 | node_string += ")"; |
| 403 | } |
| 404 | return node_string; |
| 405 | } |
| 406 | |
| 407 | } // namespace re2 |