in src/main/java/org/apache/commons/jexl3/parser/StringParser.java [206:260]
private static int read(final StringBuilder strb, final CharSequence str, final int begin, final int end, final char sep, final boolean esc) {
boolean escape = false;
int index = begin;
for (; index < end; ++index) {
final char c = str.charAt(index);
if (escape) {
if (c == 'u' && index + UCHAR_LEN < end && readUnicodeChar(strb, str, index + 1) > 0) {
index += UCHAR_LEN;
} else {
// if c is not an escapable character, re-emmit the backslash before it
final boolean notSeparator = sep == 0 ? c != '\'' && c != '"' : c != sep;
if (notSeparator && c != '\\') {
if (!esc) {
strb.append('\\').append(c);
} else {
switch (c) {
// https://es5.github.io/x7.html#x7.8.4
case 'b':
strb.append('\b');
break; // backspace \u0008
case 't':
strb.append('\t');
break; // horizontal tab \u0009
case 'n':
strb.append('\n');
break; // line feed \u000A
// We don't support vertical tab. If needed, the unicode (\u000B) should be used instead
case 'f':
strb.append('\f');
break; // form feed \u000C
case 'r':
strb.append('\r');
break; // carriage return \u000D
default:
strb.append('\\').append(c);
}
}
} else {
strb.append(c);
}
}
escape = false;
continue;
}
if (c == '\\') {
escape = true;
continue;
}
strb.append(c);
if (c == sep) {
break;
}
}
return index;
}