int numpars = 0;
int spaces = 0;
while (actual._tokenstart > numpars) {
- if (interval_.par[pos+numpars] == ']' && interval_.par[actual._tokenstart-numpars-1] == '[')
+ if (pos+numpars >= interval_.par.size())
+ break;
+ else if (interval_.par[pos+numpars] == ']' && interval_.par[actual._tokenstart-numpars-1] == '[')
numpars++;
else if (interval_.par[pos+numpars] == '}' && interval_.par[actual._tokenstart-numpars-1] == '{')
numpars++;
if (oldStart <= end) {
processRegion(oldStart, end);
}
- if (interval_.par[end] == '}') {
+ if (interval_.par.size() > (size_t) end && interval_.par[end] == '}') {
end += 1;
// This is the normal case.
// But if using the firstlanguage, the closing may be missing
lng -= 2;
open_braces++;
}
- else
+ else
break;
- }
+}
if (lng < par_as_string.size())
par_as_string = par_as_string.substr(0,lng);
/*
mres.match2end = str.size() - pos;
mres.pos = pos;
return mres;
- }
+ }
}
return mres;
}