private static void AnalyzeSwitchStatement(SyntaxNodeAnalysisContext context)
        {
            var switchStatement = (SwitchStatementSyntax)context.Node;

            SyntaxList<SwitchSectionSyntax> sections = switchStatement.Sections;

            if (sections.Any())
            {
                AnalyzeStart(context, sections[0], switchStatement.OpenBraceToken);
                AnalyzeEnd(context, sections.Last(), switchStatement.CloseBraceToken);

                if (sections.Count > 1
                    && context.GetBlankLineBetweenClosingBraceAndSwitchSection() == false)
                {
                    SwitchSectionSyntax prevSection = sections[0];

                    for (int i = 1; i < sections.Count; i++)
                    {
                        SwitchSectionSyntax section = sections[i];

                        if (prevSection.Statements.LastOrDefault() is BlockSyntax block)
                            Analyze(context, block.CloseBraceToken, section);

                        prevSection = section;
                    }
                }
            }
        }
        private static void AnalyzeSwitchStatement(SyntaxNodeAnalysisContext context)
        {
            var switchStatement = (SwitchStatementSyntax)context.Node;

            SyntaxList <SwitchSectionSyntax> sections = switchStatement.Sections;

            SyntaxList <SwitchSectionSyntax> .Enumerator en = sections.GetEnumerator();

            if (!en.MoveNext())
            {
                return;
            }

            SwitchSectionSyntax previousSection = en.Current;

            var previousBlock = previousSection.Statements.SingleOrDefault(shouldThrow: false) as BlockSyntax;

            while (en.MoveNext())
            {
                SyntaxTriviaList leadingTrivia = en.Current.Labels[0].GetLeadingTrivia();

                if (SyntaxTriviaAnalysis.IsEmptyOrSingleWhitespaceTrivia(leadingTrivia))
                {
                    SyntaxTriviaList trailingTrivia = previousSection.GetTrailingTrivia();

                    if (SyntaxTriviaAnalysis.IsOptionalWhitespaceThenOptionalSingleLineCommentThenEndOfLineTrivia(trailingTrivia) &&
                        (context.GetBlankLineBetweenClosingBraceAndSwitchSection() != false ||
                         previousBlock == null))
                    {
                        DiagnosticHelpers.ReportDiagnostic(
                            context,
                            DiagnosticRules.AddBlankLineBetweenSwitchSections,
                            Location.Create(switchStatement.SyntaxTree, trailingTrivia.Last().Span.WithLength(0)));
                    }
                }

                previousSection = en.Current;

                previousBlock = en.Current.Statements.SingleOrDefault(shouldThrow: false) as BlockSyntax;
            }
        }