in core/src/main/java/com/datastax/oss/driver/internal/core/type/codec/ParseUtils.java [43:96]
public static int skipCQLValue(String toParse, int idx) {
if (idx >= toParse.length()) throw new IllegalArgumentException();
if (isBlank(toParse.charAt(idx))) throw new IllegalArgumentException();
int cbrackets = 0;
int sbrackets = 0;
int parens = 0;
boolean inString = false;
do {
char c = toParse.charAt(idx);
if (inString) {
if (c == '\'') {
if (idx + 1 < toParse.length() && toParse.charAt(idx + 1) == '\'') {
++idx; // this is an escaped quote, skip it
} else {
inString = false;
if (cbrackets == 0 && sbrackets == 0 && parens == 0) return idx + 1;
}
}
// Skip any other character
} else if (c == '\'') {
inString = true;
} else if (c == '{') {
++cbrackets;
} else if (c == '[') {
++sbrackets;
} else if (c == '(') {
++parens;
} else if (c == '}') {
if (cbrackets == 0) return idx;
--cbrackets;
if (cbrackets == 0 && sbrackets == 0 && parens == 0) return idx + 1;
} else if (c == ']') {
if (sbrackets == 0) return idx;
--sbrackets;
if (cbrackets == 0 && sbrackets == 0 && parens == 0) return idx + 1;
} else if (c == ')') {
if (parens == 0) return idx;
--parens;
if (cbrackets == 0 && sbrackets == 0 && parens == 0) return idx + 1;
} else if (isBlank(c) || !isCqlIdentifierChar(c)) {
if (cbrackets == 0 && sbrackets == 0 && parens == 0) return idx;
}
} while (++idx < toParse.length());
if (inString || cbrackets != 0 || sbrackets != 0 || parens != 0)
throw new IllegalArgumentException();
return idx;
}