int[] (String text, boolean block) { int pos = 1; IntList list = new IntArrayList(); while (true) { pos = text.indexOf('\\', pos); if (pos == -1 || pos == text.length() - 1) break; char next = text.charAt(pos + 1); if (next == 'u') { // unicode escape can contain several 'u', according to the spec pos += 2; while (pos < text.length() && text.charAt(pos) == 'u') pos++; pos += 4; continue; } pos += 2; if (next >= '0' && next <= '9') { // octal escape if (pos < text.length() && text.charAt(pos) >= '0' && text.charAt(pos) <= '9') pos++; if (pos < text.length() && text.charAt(pos) >= '0' && text.charAt(pos) <= '9') pos++; continue; } if (next != 's') { // other escapes continue; } if (pos > 4 && text.startsWith("\\s", pos - 4)) continue; if (text.startsWith("\\s", pos)) continue; if (block && (pos == text.length() || text.charAt(pos) == '\n' || pos == text.length() - 3 && text.endsWith("\"\"\""))) { continue; } list.add(pos - 2); } return list.toIntArray(); }