if (text == null) return;   int open = start - 2; do { open = text.indexOf('{', open+2); } while ((open != -1) && (open < (text.length()-1)) && (text.charAt(open+1) == '{'));  if (open != -1) {  int close = open - 2; do { close = text.indexOf('}', close+2); } while ((close != -1) && (close < (text.length()-1)) && (text.charAt(close+1) == '}'));   if (open > start) { str = removeDuplicateBraces(text.substring(start, open)); addElement(new LiteralExpr(str)); }  if (close > open + 1) { str = text.substring(open + 1, close); str = removeDuplicateBraces(text.substring(open+1,close)); addElement(parser.parseExpression(this, str)); }  parseAVTemplate(close + 1, text, parser);  } else if (start < text.length()) {  str = removeDuplicateBraces(text.substring(start)); addElement(new LiteralExpr(str)); }
if (state != OUT_EXPR) { reportError(getParent(), parser, ErrorMsg.ATTR_VAL_TEMPLATE_ERR, text); }   tokenizer = new StringTokenizer(buffer.toString(), DELIMITER, true);  while (tokenizer.hasMoreTokens()) { t = tokenizer.nextToken();  if (t.equals(DELIMITER)) { addElement(parser.parseExpression(this, tokenizer.nextToken())); tokenizer.nextToken(); } else { addElement(new LiteralExpr(t)); } }
    private void parseAVTemplate(final int start, String text, Parser parser) {	String str;	if (text == null) return;	// Get first single opening braces	int open = start - 2;	do {	    open = text.indexOf('{', open+2);	} while ((open != -1) && 		 (open < (text.length()-1)) && 		 (text.charAt(open+1) == '{'));	if (open != -1) {	    // Get first single closing braces	    int close = open - 2;	    do {		close = text.indexOf('}', close+2);	    } while ((close != -1) && 		     (close < (text.length()-1)) && 		     (text.charAt(close+1) == '}'));	    	    // Add literal expressiong before AVT	    if (open > start) {		str = removeDuplicateBraces(text.substring(start, open));		addElement(new LiteralExpr(str));	    }	    // Add the AVT itself	    if (close > open + 1) {		str = text.substring(open + 1, close);		str = removeDuplicateBraces(text.substring(open+1,close));		addElement(parser.parseExpression(this, str));	    }	    // Parse rest of string	    parseAVTemplate(close + 1, text, parser);	    	}	else if (start < text.length()) {	    // Add literal expression following AVT	    str = removeDuplicateBraces(text.substring(start));	    addElement(new LiteralExpr(str));	}    }