Fix #1139: refactor return types in selector parsing code.