mutating func visitBlockDirective()

in Sources/SwiftDocC/Semantics/SemanticAnalyzer.swift [102:163]


    mutating func visitBlockDirective(_ blockDirective: BlockDirective) -> Semantic? {
        switch blockDirective.name {
        case Technology.directiveName:
            return Technology(from: blockDirective, source: source, for: bundle, in: context, problems: &problems)
        case Volume.directiveName:
            return Volume(from: blockDirective, source: source, for: bundle, in: context, problems: &problems)
        case Chapter.directiveName:
            return Chapter(from: blockDirective, source: source, for: bundle, in: context, problems: &problems)
        case TutorialReference.directiveName:
            return TutorialReference(from: blockDirective, source: source, for: bundle, in: context, problems: &problems)
        case ContentAndMedia.directiveName:
            return ContentAndMedia(from: blockDirective, source: source, for: bundle, in: context, problems: &problems)
        case Intro.directiveName:
            return Intro(from: blockDirective, source: source, for: bundle, in: context, problems: &problems)
        case ImageMedia.directiveName:
            return ImageMedia(from: blockDirective, source: source, for: bundle, in: context, problems: &problems)
        case VideoMedia.directiveName:
            return VideoMedia(from: blockDirective, source: source, for: bundle, in: context, problems: &problems)
        case Tutorial.directiveName:
            return Tutorial(from: blockDirective, source: source, for: bundle, in: context, problems: &problems)
        case TutorialArticle.directiveName:
            return TutorialArticle(from: blockDirective, source: source, for: bundle, in: context, problems: &problems)
        case XcodeRequirement.directiveName:
            return XcodeRequirement(from: blockDirective, source: source, for: bundle, in: context, problems: &problems)
        case Assessments.directiveName:
            return Assessments(from: blockDirective, source: source, for: bundle, in: context, problems: &problems)
        case MultipleChoice.directiveName:
            return MultipleChoice(from: blockDirective, source: source, for: bundle, in: context, problems: &problems)
        case Choice.directiveName:
            return Choice(from: blockDirective, source: source, for: bundle, in: context, problems: &problems)
        case Justification.directiveName:
            return Justification(from: blockDirective, source: source, for: bundle, in: context, problems: &problems)
        case TutorialSection.directiveName:
            return TutorialSection(from: blockDirective, source: source, for: bundle, in: context, problems: &problems)
        case Step.directiveName:
            return Step(from: blockDirective, source: source, for: bundle, in: context, problems: &problems)
        case Resources.directiveName:
            return Resources(from: blockDirective, source: source, for: bundle, in: context, problems: &problems)
        case Comment.directiveName:
            return Comment(from: blockDirective, source: source, for: bundle, in: context, problems: &problems)
        case DeprecationSummary.directiveName:
            return DeprecationSummary(from: blockDirective, source: source, for: bundle, in: context, problems: &problems)
        case Metadata.directiveName:
            return Metadata(from: blockDirective, source: source, for: bundle, in: context, problems: &problems)
        case Redirect.directiveName:
            return Redirect(from: blockDirective, source: source, for: bundle, in: context, problems: &problems)
        case DocumentationExtension.directiveName:
            return DocumentationExtension(from: blockDirective, source: source, for: bundle, in: context, problems: &problems)
        case Snippet.directiveName:
            // A snippet directive does not need to stay around as a Semantic object.
            // we only need to check the path argument and that it doesn't
            // have any inner content as a convenience to the author.
            // The path will resolve as a symbol link later in the
            // MarkupReferenceResolver.
            _ = Snippet(from: blockDirective, source: source, for: bundle, in: context, problems: &problems)
            return nil
        default:
            let diagnostic = Diagnostic(source: source, severity: .warning, range: blockDirective.range, identifier: "org.swift.docc.unknownDirective", summary: "Unknown directive \(blockDirective.name.singleQuoted); this element will be ignored")
            problems.append(Problem(diagnostic: diagnostic, possibleSolutions: []))
            return nil
        }
    }