int afterPrefixIndex = prefixIndex + prefix.length();
int suffixIndex = skipToCorrectEndSuffix(prefix, suffix,
expressionString, afterPrefixIndex);
if (suffixIndex == -1) {
throw new ParseException(expressionString, prefixIndex,
"No ending suffix '" + suffix
+ "' for expression starting at character "
+ prefixIndex + ": "
+ expressionString.substring(prefixIndex));
}
if (suffixIndex == afterPrefixIndex) {
throw new ParseException(expressionString, prefixIndex,
"No expression defined within delimiter '" + prefix + suffix
+ "' at character " + prefixIndex);
}
String expr = expressionString.substring(prefixIndex + prefix.length(),
suffixIndex);
expr = expr.trim();
if (expr.length() == 0) {
throw new ParseException(expressionString, prefixIndex,
"No expression defined within delimiter '" + prefix + suffix
+ "' at character " + prefixIndex);
}
expressions.add(doParseExpression(expr, context));