This commit is contained in:
Julian Daube 2017-10-08 03:53:03 +02:00
parent 25cb4747b8
commit 72e80721e8

View File

@ -149,18 +149,21 @@ Substring readBrackets(Substring &input, const char * brackets) {
return Substring();
}
input.start++;
int depth = 1;
Substring result(input.start, input.start);
while(depth > 0 && input.size() > 0) {
result.end = ++input.start;
if (*input.start == brackets[0]) {
depth++;
}
if (*input.start == brackets[1]) {
depth--;
if(depth==0) break;
}
result.end = ++input.start;
}
// advance beyond last bracket
if (input.size())