* @return index 0 and 1 are the parenthesis delimiters. index 2, 3, 4 are before, middle, and after respectively.
*/
private static String[] parseParenthesis(final String token) throws TagException {
String[] tokenArray = null;
if (token != null && token.length() > 0) {
final TagOptionSingleton option = TagOptionSingleton.getInstance();
String tempOpen;
String open = "";
final String close;
int openIndex = token.length();
int tempIndex;
final int closeIndex;
final Iterator iterator = option.getOpenParenthesisIterator();
// find first parenthesis
while (iterator.hasNext()) {
tempOpen = (String) iterator.next();
tempIndex = token.indexOf(tempOpen);
if (tempIndex >= 0 && tempIndex < openIndex) {
openIndex = tempIndex;
open = tempOpen;
}
}
// we have a parenthesis
if (openIndex >= 0 && openIndex < token.length()) {
close = option.getCloseParenthesis(open);
closeIndex = TagUtility.findMatchingParenthesis(token, openIndex);
if (closeIndex < 0) {
throw new TagException("Unmatched parenthesis in \"" + token + "\" at position : " + openIndex);
}
tokenArray = new String[5];