public static bool Run(TexlNode node) { ChainTrackerVisitor visitor = new ChainTrackerVisitor(); node.Accept(visitor); return(visitor._usesChains); }
// 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))); }
// 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))); }
public static HashSet <string> FindDependencies(TexlNode node, TexlBinding binding) { var v = new DependencyFinder { _binding = binding }; node.Accept(v); return(v._vars); }
public static BinderNodesVisitor Run(TexlNode node) { Contracts.AssertValue(node); var instance = new BinderNodesVisitor(node); node.Accept(instance); return(instance); }
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); }
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)))); }
// 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)); }