Пример #1
0
        public static SyntaxToken Normalize(SyntaxToken token, string indentWhitespace, string eolWhitespace, bool useElasticTrivia = false)
        {
            Language language   = token.Language();
            var      normalizer = new SyntaxNormalizer(language, token.FullSpan, language.SyntaxFacts.GetDeclarationDepth(token), indentWhitespace, eolWhitespace, useElasticTrivia);
            var      result     = normalizer.VisitToken(token);

            normalizer.Free();
            return(result);
        }
Пример #2
0
        public static TNode Normalize <TNode>(TNode node, string indentWhitespace, string eolWhitespace, bool useElasticTrivia = false)
            where TNode : SyntaxNode
        {
            Language language   = node.Language();
            var      normalizer = new SyntaxNormalizer(language, node.FullSpan, language.SyntaxFacts.GetDeclarationDepth(node), indentWhitespace, eolWhitespace, useElasticTrivia);
            var      result     = (TNode)normalizer.Visit(node);

            normalizer.Free();
            return(result);
        }
Пример #3
0
        public static SyntaxTriviaList Normalize(SyntaxTriviaList trivia, string indentWhitespace, string eolWhitespace, bool useElasticTrivia = false)
        {
            Language language   = trivia.Node.Language();
            var      normalizer = new SyntaxNormalizer(language, trivia.FullSpan, language.SyntaxFacts.GetDeclarationDepth(trivia.Token), indentWhitespace, eolWhitespace, useElasticTrivia);
            var      result     = normalizer.RewriteTrivia(
                trivia,
                language.SyntaxFacts.GetDeclarationDepth((SyntaxToken)trivia.ElementAt(0).Token),
                isTrailing: false,
                indentAfterLineBreak: false,
                mustHaveSeparator: false,
                lineBreaksAfter: 0);

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