コード例 #1
0
        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);
        }
コード例 #2
0
 /// <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);
コード例 #3
0
ファイル: Span.cs プロジェクト: modulexcite/Transformalize
 /// <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);
 }
コード例 #4
0
 /// <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);
コード例 #5
0
        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);
                }
            }
        }
コード例 #6
0
ファイル: Block.cs プロジェクト: modulexcite/Transformalize
 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());
 }