コード例 #1
0
        internal static SyntaxToken Normalize(SyntaxToken token, string indentWhitespace, string eolWhitespace, bool useElasticTrivia = false)
        {
            var normalizer = new SyntaxNormalizer(token.FullSpan, indentWhitespace, eolWhitespace, useElasticTrivia);
            var result     = normalizer.VisitToken(token);

            normalizer.Free();
            return(result);
        }
コード例 #2
0
        internal static TNode Normalize <TNode>(TNode node, string indentWhitespace, string eolWhitespace, bool useElasticTrivia = false)
            where TNode : SyntaxNode
        {
            var normalizer = new SyntaxNormalizer(node.FullSpan, indentWhitespace, eolWhitespace, useElasticTrivia);
            var result     = (TNode)normalizer.Visit(node);

            normalizer.Free();
            return(result);
        }
コード例 #3
0
        internal static SyntaxTriviaList Normalize(SyntaxTriviaList trivia, string indentWhitespace, string eolWhitespace, bool useElasticTrivia = false)
        {
            var normalizer = new SyntaxNormalizer(trivia.FullSpan, indentWhitespace, eolWhitespace, useElasticTrivia);
            var result     = normalizer.RewriteTrivia(
                trivia,
                normalizer.GetIndentationDepth(),
                isTrailing: false,
                mustBeIndented: false,
                mustHaveSeparator: false,
                lineBreaksAfter: 0, lineBreaksBefore: 0);

            normalizer.Free();
            return(result);
        }