fix fix
This commit is contained in:
parent
25cb4747b8
commit
72e80721e8
7
main.cpp
7
main.cpp
@ -149,18 +149,21 @@ Substring readBrackets(Substring &input, const char * brackets) {
|
|||||||
return Substring();
|
return Substring();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input.start++;
|
||||||
|
|
||||||
int depth = 1;
|
int depth = 1;
|
||||||
Substring result(input.start, input.start);
|
Substring result(input.start, input.start);
|
||||||
|
|
||||||
while(depth > 0 && input.size() > 0) {
|
while(depth > 0 && input.size() > 0) {
|
||||||
result.end = ++input.start;
|
|
||||||
|
|
||||||
if (*input.start == brackets[0]) {
|
if (*input.start == brackets[0]) {
|
||||||
depth++;
|
depth++;
|
||||||
}
|
}
|
||||||
if (*input.start == brackets[1]) {
|
if (*input.start == brackets[1]) {
|
||||||
depth--;
|
depth--;
|
||||||
|
|
||||||
|
if(depth==0) break;
|
||||||
}
|
}
|
||||||
|
result.end = ++input.start;
|
||||||
}
|
}
|
||||||
// advance beyond last bracket
|
// advance beyond last bracket
|
||||||
if (input.size())
|
if (input.size())
|
||||||
|
Loading…
Reference in New Issue
Block a user