Bug 4139 EC DCR: Code templates feature (1GIVMDV)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/template/TemplateInterpolator.java
* EBNF grammar.
	 *
	 * template := (text | escape)*.
	 * text := character - dollar.
	 * escape := dollar ('{' identifier '}' | dollar).
	 * dollar := '$'.
	 */	 
	
	private static final int TEXT= 0;
	private static final int ESCAPE= 1;
	private static final int IDENTIFIER= 2;
	private static final char ESCAPE_CHARACTER= '$';
	private static final char IDENTIFIER_BEGIN= '{';
	private static final char IDENTIFIER_END= '}';
	
	/**
	 * Interpolates a string.
	 */
	public String interpolate(String string, VariableEvaluator evaluator) {
		StringBuffer buffer= new StringBuffer(string.length());
		StringBuffer identifier= new StringBuffer();
		int state= TEXT;
				
		for (int i= 0; i != string.length(); i++) {
			char ch= string.charAt(i);
			
			switch (state) {
			case TEXT:
				switch (ch) {
				case ESCAPE_CHARACTER: