// NOTE: it would be nice to have constants for OmittedArraySizeException and OmittedTypeArgument,
        // but it's non-trivial to introduce such constants, since they would make this class take a dependency
        // on the static fields of SyntaxToken (specifically, TokensWithNoTrivia via SyntaxToken.Create).  That
        // could cause unpredictable behavior, since SyntaxToken's static constructor already depends on the
        // static fields of this class (specifically, ElasticZeroSpace).

        public InternalSyntaxTrivia EndOfLine(string text, bool elastic = false)
        {
            InternalSyntaxTrivia trivia = null;

            // use predefined trivia
            switch (text)
            {
            case "\r":
                trivia = elastic ? ElasticCarriageReturn : CarriageReturn;
                break;

            case "\n":
                trivia = elastic ? ElasticLineFeed : LineFeed;
                break;

            case "\r\n":
                trivia = elastic ? ElasticCarriageReturnLineFeed : CarriageReturnLineFeed;
                break;
            }

            // note: predefined trivia might not yet be defined during initialization
            if (trivia != null)
            {
                return(trivia);
            }

            trivia = this.Trivia(DefaultEndOfLineKind, text);
            if (!elastic)
            {
                return(trivia);
            }

            return(trivia.WithAnnotationsGreen(new[] { Microsoft.CodeAnalysis.SyntaxAnnotation.ElasticAnnotation }));
        }
        protected InternalSyntaxFactory(SyntaxFacts syntaxFacts)
        {
            _syntaxKind           = syntaxFacts.SyntaxKindType;
            DefaultSeparatorKind  = ToLanguageSyntaxKind(syntaxFacts.DefaultSeparatorKind);
            DefaultEndOfLineKind  = ToLanguageSyntaxKind(syntaxFacts.DefaultEndOfLineKind);
            DefaultWhitespaceKind = ToLanguageSyntaxKind(syntaxFacts.DefaultWhitespaceKind);
            EofKind = ToLanguageSyntaxKind(SyntaxKind.Eof);

            CarriageReturnLineFeed = EndOfLine(CrLf);
            LineFeed       = EndOfLine("\n");
            CarriageReturn = EndOfLine("\r");
            Space          = Whitespace(" ");
            Tab            = Whitespace("\t");

            ElasticCarriageReturnLineFeed = EndOfLine(CrLf, elastic: true);
            ElasticLineFeed       = EndOfLine("\n", elastic: true);
            ElasticCarriageReturn = EndOfLine("\r", elastic: true);
            ElasticSpace          = Whitespace(" ", elastic: true);
            ElasticTab            = Whitespace("\t", elastic: true);

            ElasticZeroSpace = Whitespace(string.Empty, elastic: true);
        }