in freemarker-docgen-core/src/main/java/org/freemarker/docgen/core/CJSONInterpreter.java [1153:1267]
private void skipExpression() throws EvaluationException {
char c;
if (p >= ln) { //!!a
throw new BugException("Calling fetchExpression when p >= ln.");
}
c = tx.charAt(p);
// Map:
if (c == '{') {
p++;
skipListing('}');
p++;
return;
}
// List:
if (c == '[') {
p++;
skipListing(']');
p++;
return;
}
// Unresolved object in a dump:
if (c == '<') {
p++;
skipListing('>');
p++;
return;
}
// Just for durability:
if (c == '(') {
p++;
skipListing(')');
p++;
return;
}
int b = p;
// Quoted string:
if (c == '"' || c == '\'') {
char q = c;
p++;
while (p < ln) {
c = tx.charAt(p);
if (c == '\\') {
if (p != ln - 1) {
p++;
}
}
p++;
if (c == q) {
return; //!
}
}
throw newSyntaxError(
"The closing " + TextUtil.jQuoteOrName(q)
+ " of the string is missing.",
b);
} // if quoted string
// Raw string:
char c2;
if (p < ln - 1) {
c2 = tx.charAt(p + 1);
} else {
c2 = 0x20;
}
if (c == 'r' && (c2 == '"' || c2 == '\'')) {
char q = c2;
p += 2;
while (p < ln) {
c = tx.charAt(p);
p++;
if (c == q) {
return; //!
}
}
throw newSyntaxError(
"The closing " + TextUtil.jQuoteOrName(q)
+ " of the string is missing.",
b);
}
// Unquoted string, boolean or number, or function call
uqsLoop: while (true) {
c = tx.charAt(p);
if (!isUnquotedStringChar(c)
&& !(p == b && c == '+')) {
break uqsLoop;
}
p++;
if (p == ln) {
break uqsLoop;
}
}
if (b == p) {
throw newSyntaxError("Unexpected character.", b);
} else {
int oldP = p;
c = skipWS();
if (c == '(') {
p++;
skipListing(')');
p++;
} else {
p = oldP;
} // if not '('
} // if b == p
}