int position = getPosition(expression) - corrections.peek();
//
// DELETE clause
//
DeleteClause deleteClause = expression.getDeleteClause();
int length = length(deleteClause);
// At the end of the DELETE clause, check for adding proposals based
// on possible incomplete information
if ((position == length) && isAppendable(deleteClause)) {
addIdentifier(WHERE);
}
// Right after the DELETE clause, the space is owned by JPQLExpression
else if ((position == length + SPACE_LENGTH) && expression.hasSpaceAfterDeleteClause()) {
virtualSpaces.add(SPACE_LENGTH);
corrections.add(-length - 2);
deleteClause.accept(this);
corrections.pop();
virtualSpaces.pop();
}
// Nothing else to do
if ((position == length) && !expression.hasSpaceAfterDeleteClause()) {
return;
}
if (expression.hasSpaceAfterDeleteClause()) {
length++;
}
// Nothing else to do
if ((position == length) && !deleteClause.hasRangeVariableDeclaration()) {
return;
}
//
// WHERE clause
//
// Right before "WHERE"
if (position == length) {
if (expression.hasSpaceAfterDeleteClause() &&
isComplete(deleteClause.getRangeVariableDeclaration())) {
addIdentifier(WHERE);
}
}