mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
31 lines
1.2 KiB
Swift
31 lines
1.2 KiB
Swift
//
|
|
// SyntaxKind+SwiftLint.swift
|
|
// SwiftLint
|
|
//
|
|
// Created by JP Simard on 11/17/15.
|
|
// Copyright © 2015 Realm. All rights reserved.
|
|
//
|
|
|
|
import SourceKittenFramework
|
|
|
|
extension SyntaxKind {
|
|
init(shortName: Swift.String) throws {
|
|
let prefix = "source.lang.swift.syntaxtype."
|
|
guard let kind = SyntaxKind(rawValue: prefix + shortName.lowercased()) else {
|
|
throw ConfigurationError.unknownConfiguration
|
|
}
|
|
self = kind
|
|
}
|
|
|
|
static let commentAndStringKinds: Set<SyntaxKind> = commentKinds.union([.string])
|
|
|
|
static let commentKinds: Set<SyntaxKind> = [.comment, .commentMark, .commentURL,
|
|
.docComment, .docCommentField]
|
|
|
|
static let allKinds: Set<SyntaxKind> = [.argument, .attributeBuiltin, .attributeID, .buildconfigID,
|
|
.buildconfigKeyword, .comment, .commentMark, .commentURL,
|
|
.docComment, .docCommentField, .identifier, .keyword, .number,
|
|
.objectLiteral, .parameter, .placeholder, .string,
|
|
.stringInterpolationAnchor, .typeidentifier]
|
|
}
|