expanded grammer to handle '[]'