コード例 #1
0
        public static bool Run(TexlNode node)
        {
            ChainTrackerVisitor visitor = new ChainTrackerVisitor();

            node.Accept(visitor);
            return(visitor._usesChains);
        }
コード例 #2
0
        // Public entry point for prettyprinting TEXL parse trees
        public static string PrettyPrint(TexlNode node)
        {
            Contracts.AssertValue(node);

            TexlPretty pretty = new TexlPretty();

            return(string.Concat(node.Accept(pretty, Precedence.None)));
        }
コード例 #3
0
        // Public entry point for prettyprinting TEXL parse trees
        public static string Print(TexlNode node, TexlBinding binding = null)
        {
            Contracts.AssertValue(node);

            var pretty = new StructuralPrint(binding);

            return(string.Concat(node.Accept(pretty, Precedence.None)));
        }
コード例 #4
0
        public static HashSet <string> FindDependencies(TexlNode node, TexlBinding binding)
        {
            var v = new DependencyFinder
            {
                _binding = binding
            };

            node.Accept(v);
            return(v._vars);
        }
コード例 #5
0
        public static BinderNodesVisitor Run(TexlNode node)
        {
            Contracts.AssertValue(node);

            var instance = new BinderNodesVisitor(node);

            node.Accept(instance);

            return(instance);
        }
コード例 #6
0
ファイル: FindNodeVisitor.cs プロジェクト: jgrisham/Power-Fx
        public static TexlNode Run(TexlNode node, int cursorPosition)
        {
            Contracts.AssertValue(node);
            Contracts.Assert(cursorPosition >= 0);

            var visitor = new FindNodeVisitor(cursorPosition);

            node.Accept(visitor);
            return(visitor._result);
        }
コード例 #7
0
        private LazyList <string> PrettyBinary(string strOp, Precedence parentPrecedence, Precedence precLeft, Precedence precRight, TexlNode left, TexlNode right)
        {
            Contracts.AssertNonEmpty(strOp);

            return(ApplyPrecedence(
                       parentPrecedence,
                       precLeft,
                       left.Accept(this, precLeft)
                       .With(strOp)
                       .With(right.Accept(this, precRight))));
        }
コード例 #8
0
        // Public entry point for prettyprinting TEXL parse trees
        public static string Format(TexlNode node, SourceList before, SourceList after, string script)
        {
            Contracts.AssertValue(node);

            var pretty   = new PrettyPrintVisitor(script);
            var preRegex = string.Concat(pretty.CommentsOf(before)
                                         .With(node.Accept(pretty, new Context(0)))
                                         .With(pretty.CommentsOf(after)))
                           .Replace("\n\n", "\n");

            return(new Regex(@"\n +(\n +)").Replace(preRegex, (Match match) => match.Groups[1].Value));
        }