private bool IsLiteralAttributeValue(SyntaxTreeNode node) { if (node.IsBlock) { return false; } Span span = node as Span; Debug.Assert(span != null); LiteralAttributeCodeGenerator litGen = span.CodeGenerator as LiteralAttributeCodeGenerator; return span != null && ((litGen != null && litGen.ValueGenerator == null) || span.CodeGenerator == SpanCodeGenerator.Null || span.CodeGenerator is MarkupCodeGenerator); }
/// <summary> /// Determines if the specified node is equivalent to this node /// </summary> /// <param name="node">The node to compare this node with</param> /// <returns> /// true if the provided node has all the same content and metadata, though the specific quantity and type of symbols may be different. /// </returns> public abstract bool EquivalentTo(SyntaxTreeNode node);
/// <summary> /// Checks that the specified span is equivalent to the other in that it has the same start point and content. /// </summary> public override bool EquivalentTo(SyntaxTreeNode node) { Span other = node as Span; return other != null && Kind.Equals(other.Kind) && Start.Equals(other.Start) && EditHandler.Equals(other.EditHandler) && String.Equals(other.Content, Content, StringComparison.Ordinal); }
private static void WriteTree(SyntaxTreeNode node, StringBuilder treeBuilder, int depth = 0) { if (node == null) { return; } if (depth > 1) { WriteIndent(treeBuilder, depth); } if (depth > 0) { treeBuilder.Append("|-- "); } treeBuilder.AppendLine(ConvertEscapseSequences(node.ToString())); if (node.IsBlock) { foreach (SyntaxTreeNode child in ((Block)node).Children) { WriteTree(child, treeBuilder, depth + 1); } } }
public override bool EquivalentTo(SyntaxTreeNode node) { Block other = node as Block; if (other == null || other.Type != Type) { return false; } return Enumerable.SequenceEqual(Children, other.Children, new EquivalenceComparer()); }