private static IEnumerable <QueryResult> VisitProgram(ZMI zmi, QueryParser.ProgramContext context) { var toReturn = new QueryVisitor(zmi).Visit(context).ToList(); if (toReturn.Any(maybe => maybe.Match(v => v.Name == null, () => false))) { throw new ArgumentException("All items in top-level SELECT must be aliased"); } return(toReturn.Sequence().Match(list => list, () => new List <QueryResult>())); }