/// <summary> /// Parser /// </summary> /// <returns>An AST</returns> public Query Parse() { Where where = null; OrderBy orderBy = null; GroupBy groupBy = null; _token = _scanner.GetToken(); if (_token.Ttype == TokenType.WHERE) { where = WhereRule(); } if (_token.Ttype == TokenType.ORDERBY) { orderBy = OrderByRule(); } if (_token.Ttype == TokenType.GROUPBY) { groupBy = GroupByRule(); } Sequence sequence = _astFactory.CreateSequence(where, _astFactory.CreateSequence(orderBy, _astFactory.CreateSequence(groupBy, null))); Query expression = _astFactory.CreateQuery(sequence); return(expression); }