private int tokenEnd(String prog, int pos) {
		int curpos = pos;
		char curchar = prog.charAt(curpos);
		while ((curchar != ' ') 
				&& (curchar != '\n')
				&& (curchar != '\t')
				&& (curchar != '\r')
				&& (curchar != ')')
				&& (curchar != '(')
				&& (curchar != 0)) {

			curpos++;
			if (curpos >= prog.length())
				return curpos;
			curchar = prog.charAt(curpos);
		}
			
		return curpos;
	}