示例#1
0
        public static LambdaExpression Parse(Type rootType, ParseTreeNode node)
        {
            var visitor    = new ParseTreeVisitor(rootType);
            var expr       = visitor.VisitNode(node);
            var lambdaExpr = Expression.Lambda(expr, visitor._paramExpr);

            return(lambdaExpr);
        }
示例#2
0
        public Expression Parse(Type rootType, String source)
        {
            if (__parser == null)
            {
                var grammar = new ODataFilterGrammar();
                __parser = new Parser(grammar);
            }
            var parseTree = __parser.Parse(source);

            if (parseTree == null || parseTree.Root == null)
            {
                throw new Exception("Unable to parse: " + source);
            }
            var expr = ParseTreeVisitor.Parse(rootType, parseTree.Root);

            return(expr);
        }
 public static LambdaExpression Parse(Type rootType, ParseTreeNode node)
 {
     var visitor = new ParseTreeVisitor(rootType);
       var expr = visitor.VisitNode(node);
       var lambdaExpr = Expression.Lambda(expr, visitor._paramExpr);
       return lambdaExpr;
 }