public List <Tuple <LambdaExpression, SortOrder> > ParseOrderBy(Type thisType, string odataExpression) { var expressions = new List <Tuple <LambdaExpression, SortOrder> >(); var parser = CreateParser(odataExpression); var tree = (CommonTree)parser.parse().Tree; foreach (var node in tree.Children) { if (node.Type != PomonaQueryParser.ORDERBY_ASC) { throw new InvalidOperationException("Unexpected node in parser tree."); } var tempTree = PomonaQueryTreeParser.ParseTree(node.GetChild(0), 0, odataExpression); var sortOrder = node.ChildCount > 1 && string.Equals(node.GetChild(1).Text, "desc", StringComparison.InvariantCultureIgnoreCase) ? SortOrder.Descending : SortOrder.Ascending; expressions.Add( new Tuple <LambdaExpression, SortOrder>(TransformTreeNodeToExpression(thisType, odataExpression, tempTree), sortOrder)); } return(expressions); }
private static NodeBase ParseSymbolTree(string odataExpression) { if (odataExpression == null) { throw new ArgumentNullException(nameof(odataExpression)); } var parser = CreateParser(odataExpression); var parseReturn = parser.parse(); var tree = (CommonTree)parseReturn.Tree; var tempTree = PomonaQueryTreeParser.ParseTree(tree, 0, odataExpression); return(tempTree); }