helper.addProposals(expression, 0);
}
// Within the encapsulated expressions
else {
// Create a collection representation of the encapsulated expression(s)
CollectionExpression collectionExpression = helper.buildCollectionExpression(expression);
boolean hasComma = false;
// Determine the maximum children count, it is possible the query contains more children
// than the expession's grammar would actually allow. The content assist will only
// provide assistance from the first child to the last allowed child
int count = Math.min(collectionExpression.childrenSize(), helper.maxCollectionSize(expression));
for (int index = 0; index < count; index++) {
Expression child = collectionExpression.getChild(index);
int childLength = 0;
// At the beginning of the child expression
if (position == length) {
helper.addProposals(expression, index);
break;
}
else {
childLength = length(child);
// At the end of the child expression
if ((position == length + childLength + virtualSpaces.peek()) &&
isComplete(child)) {
helper.addAtTheEndOfChild(expression, child, index);
break;
}
}
// Now add the child's length and length used by the comma and space
length += childLength;
// Move after the comma
hasComma = collectionExpression.hasComma(index);
if (hasComma) {
length++;
// After ',', the proposals can be added
if (position == length) {
helper.addProposals(expression, index + 1);
break;
}
}
// Move after the space that follows the comma
if (collectionExpression.hasSpace(index)) {
length++;
}
// Nothing more can be looked at
if (position < length) {