public class ParseArrayInitEntry extends ElementListParseHelper<ArrayInitEntry> {
@Override
protected ArrayInitEntry parseElement(boolean createMissing) {
Expression index = null;
IInitializer initializer = null;
if(lookAhead() == DeeTokens.COLON) {
index = parseAssignExpression_toMissing();
consumeLookAhead(DeeTokens.COLON);
initializer = parseNonVoidInitializer(true).node;
} else {
initializer = parseNonVoidInitializer(createMissing).node;
if(initializer == null)
return null;
if(lookAhead() == DeeTokens.COLON && initializerCanParseAsExp(initializer)) {
if(initializer instanceof InitializerArray) {
index = (InitializerArray) initializer;
} else {
index = (Expression) initializer;
}
consumeLookAhead(DeeTokens.COLON);
initializer = parseNonVoidInitializer(true).node;
}
}
ASTNode startNode = index != null ? index : initializer.asNode();
return concludeNode(srToPosition(startNode, new ArrayInitEntry(index, initializer)));
}