From d7904f7a137196b582b47b2e2d1b24f183ec7dd0 Mon Sep 17 00:00:00 2001 From: myerspat Date: Fri, 29 Jul 2022 13:29:21 -0500 Subject: [PATCH] now can handle multiple depths of parenthesis --- src/cell.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/cell.cpp b/src/cell.cpp index f2e4444d4e..fc19c1c496 100644 --- a/src/cell.cpp +++ b/src/cell.cpp @@ -866,8 +866,17 @@ bool CSGCell::contains_complex( // skip a section or break if (next_token >= OP_UNION && token != next_token) { if (next_token == OP_LEFT_PAREN) { - it = - std::find(it, region_no_complements_.end() - 1, OP_RIGHT_PAREN); + int depth = 1; + while (depth > 0) { + it++; + if (*it > OP_COMPLEMENT) { + if (*it == OP_RIGHT_PAREN) { + depth--; + } else { + depth++; + } + } + } } else { break; }