protected void addSelectExpressionProposals(AbstractSelectClause expression, int length) {
int position = getPosition(expression) - corrections.peek();
// Now check for inside the select expression
CollectionExpression collectionExpression = getCollectionExpression(expression.getSelectExpression());
if (collectionExpression != null) {
for (int index = 0, count = collectionExpression.childrenSize(); index < count; index++) {
Expression child = collectionExpression.getChild(index);
// At the beginning of the child expression
if (position == length) {
addAllIdentificationVariables();
addAllFunctions(expression.selectItemBNF());
break;
}
else {
boolean withinChild = addSelectExpressionProposals(
child,
expression.selectItemBNF(),
length,
index,
index + 1 == count
);
if (withinChild) {
break;
}
}
length += length(child);
if (collectionExpression.hasComma(index)) {
length++;
}
// Cannot do anything more since a comma is missing,
// which means the query is not valid
else {
break;
}
// After ',', the proposals can be added
if (position == length) {
addAllIdentificationVariables();
addAllFunctions(expression.selectItemBNF());
break;
}
if (collectionExpression.hasSpace(index)) {
length++;
}
}
}
else {