| 108 | } |
| 109 | |
| 110 | template<class T, class OuputIterator, REQUIRES("T must be a Token class", std::is_convertible<T*, const Token*> )> |
| 111 | static void astFlattenCopy(T* tok, const char* op, OuputIterator out, int depth = 100) |
| 112 | { |
| 113 | --depth; |
| 114 | if (!tok || depth < 0) |
| 115 | return; |
| 116 | if (strcmp(tok->str().c_str(), op) == 0) { |
| 117 | astFlattenCopy(tok->astOperand1(), op, out, depth); |
| 118 | astFlattenCopy(tok->astOperand2(), op, out, depth); |
| 119 | } else { |
| 120 | *out = tok; |
| 121 | ++out; |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | std::vector<const Token*> astFlatten(const Token* tok, const char* op) |
| 126 | { |
no test coverage detected