private static int parseObjectives(int index, List<Word> wordList,
			List<Field> objectives, String comma) throws SQLCompilerException {
		while (index < wordList.size()) {
			ParseExpressionResult result = ExpressionParser.parse(index,
					wordList);
			if (result.getIndex() <= index) {
				break;
			} else {
				Field field = new Field();
				field.setExpression(result.getExpression());
				index = result.getIndex();
				if (index < wordList.size()) {

					Word w = wordList.get(index);
					if (w.getType() == WordDef.KEYWORD
							&& Keywords.AS.equalsIgnoreCase(w.getWord())) {
						index++;
						check(index < wordList.size(), w, ErrorCode.ERROR,
								ErrorCode.SP_INVALID_SENTENCE,
								"Unexpected end.");

						w = wordList.get(index);
						check(w.getType() == WordDef.ID
								|| w.getType() == WordDef.RF, w,
								ErrorCode.ERROR, ErrorCode.SP_INVALID_SENTENCE,
								"Invalid sql sentence, expects alias after 'AS'.");
						field.setName(w.getWord());
						index++;
					}
				}
				objectives.add(field);
				if (index < wordList.size()) {
					Word w = wordList.get(index);
					if (w.getType() == WordDef.DE && comma.equals(w.getWord())) {
						index++;
					}
				}
			}
		}
		return index;
	}