Example #1
0
            public static string GetExpressionString(Expression node)
            {
                var exprMachine = new ExpressionMachine();

                exprMachine.Visit(node);
                return(exprMachine.s);
            }
Example #2
0
            protected override Expression VisitMethodCall(MethodCallExpression node)
            {
                var functionName = node.Method.Name;

                var machine = new ExpressionMachine();

                machine.Visit(node.Arguments[0]);

                var argString = machine.s;

                s += Indent() + functionName + " " + argString + ";\n";


                return(base.VisitMethodCall(node));
            }
Example #3
0
        string OutputRule(Rule rule)
        {
            var s = rule.type.ToString() + " " + rule.applyingTo.name;

            if (rule.condition != null)
            {
                s += " when ";

                var expr = rule.condition;
                if (expr is Expression <Predicate <Thing> > thingExpr)
                {
                    var visitor = new ExpressionMachine();
                    visitor.Visit(expr);
                    s += visitor.s + ":\n";
                }
            }

            s += OutputRuleBody(rule);

            return(s);
        }