Warning: session_start(): open(/var/lib/php/sessions/sess_7artefsoncpsbvc0marbrio9nr, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
/* input e.g.:
if (a
and b)
bla;
This will yield ("if (a\n and b)", " bla;")
*/
static LS lines_honoringBrackets(S text) {
LS lines = lines(text);
new LS out;
int bracketLevel = 0; // how many open brackets
int start = 0; // line where current block starts
for i over lines: {
LS tok = javaTok(lines.get(i));
for (int j = 1; j < l(tok); j += 2) {
S t = tok.get(j);
if (eqOneOf(t, "(", "{", "[")) ++bracketLevel;
else if (eqOneOf(t, ")", "}", "]")) --bracketLevel;
}
if (bracketLevel == 0) {
out.add(lines_rtrim(subList(lines, start, i+1)));
start = i+1;
}
}
addIfNempty(out, lines_rtrim(subList(lines, start, i)));
ret out;
}