private void parseAVTemplate(final int start, String text, Parser parser) { String str;
private void parseAVTemplate(String text, Parser parser) { StringTokenizer tokenizer = new StringTokenizer(text, "{}\"\'", true);   String t = null; String lookahead = null; StringBuffer buffer = new StringBuffer(); int state = OUT_EXPR;  while (tokenizer.hasMoreTokens()) {  if (lookahead != null) { t = lookahead; lookahead = null; } else { t = tokenizer.nextToken(); }  if (t.length() == 1) { switch (t.charAt(0)) { case '{': switch (state) { case OUT_EXPR: lookahead = tokenizer.nextToken(); if (lookahead.equals("{")) { buffer.append(lookahead); lookahead = null; } else { buffer.append(DELIMITER); state = IN_EXPR; } break; case IN_EXPR: case IN_EXPR_SQUOTES: case IN_EXPR_DQUOTES: reportError(getParent(), parser, ErrorMsg.ATTR_VAL_TEMPLATE_ERR, text); break; } break; case '}': switch (state) { case OUT_EXPR: lookahead = tokenizer.nextToken(); if (lookahead.equals("}")) { buffer.append(lookahead); lookahead = null; } else { reportError(getParent(), parser, ErrorMsg.ATTR_VAL_TEMPLATE_ERR, text); } break; case IN_EXPR: buffer.append(DELIMITER); state = OUT_EXPR; break; case IN_EXPR_SQUOTES: case IN_EXPR_DQUOTES: buffer.append(t); break; } break; case '\'': switch (state) { case IN_EXPR: state = IN_EXPR_SQUOTES; break; case IN_EXPR_SQUOTES: state = IN_EXPR; break; case OUT_EXPR: case IN_EXPR_DQUOTES: break; } buffer.append(t); break; case '\"': switch (state) { case IN_EXPR: state = IN_EXPR_DQUOTES; break; case IN_EXPR_DQUOTES: state = IN_EXPR; break; case OUT_EXPR: case IN_EXPR_SQUOTES: break; } buffer.append(t); break; default: buffer.append(t); break; } } else { buffer.append(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));	}    }