Skip to content

Swift lang syntax to unite types #234

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@

##### Enhancements

* None.
* Refactor to unite swift lang syntax types with SwiftLangSyntax protocol
* Make SwiftDocKey public
[Evgeny Suvorov](https://github.com/esuvorov)

##### Bug Fixes

Expand Down
6 changes: 5 additions & 1 deletion Source/SourceKittenFramework/StatementKind.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

/// Swift declaration kinds.
/// Found in `strings SourceKitService | grep source.lang.swift.stmt.`.
public enum StatementKind: String {
public enum StatementKind: String, SwiftLangSyntax {
/// `brace`.
case Brace = "source.lang.swift.stmt.brace"
/// `case`.
Expand All @@ -27,4 +27,8 @@ public enum StatementKind: String {
case Switch = "source.lang.swift.stmt.switch"
/// `while`.
case While = "source.lang.swift.stmt.while"

public var value: String {
return rawValue
}
}
6 changes: 5 additions & 1 deletion Source/SourceKittenFramework/SwiftDeclarationKind.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

/// Swift declaration kinds.
/// Found in `strings SourceKitService | grep source.lang.swift.decl.`.
public enum SwiftDeclarationKind: String {
public enum SwiftDeclarationKind: String, SwiftLangSyntax {
/// `associatedtype`.
case Associatedtype = "source.lang.swift.decl.associatedtype"
/// `class`.
Expand Down Expand Up @@ -85,4 +85,8 @@ public enum SwiftDeclarationKind: String {
case VarParameter = "source.lang.swift.decl.var.parameter"
/// `var.static`.
case VarStatic = "source.lang.swift.decl.var.static"

public var value: String {
return rawValue
}
}
4 changes: 3 additions & 1 deletion Source/SourceKittenFramework/SwiftDocKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Foundation

/// SourceKit response dictionary keys.
internal enum SwiftDocKey: String {
public enum SwiftDocKey: String {
// MARK: SourceKit Keys

/// Annotated declaration (String).
Expand Down Expand Up @@ -42,6 +42,8 @@ internal enum SwiftDocKey: String {
case SyntaxMap = "key.syntaxmap"
/// Type name (String).
case TypeName = "key.typename"
/// Inheritedtype ([SourceKitRepresentable])
case Inheritedtypes = "key.inheritedtypes"

// MARK: Custom Keys

Expand Down
5 changes: 5 additions & 0 deletions Source/SourceKittenFramework/SwiftLangSyntax.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Foundation

public protocol SwiftLangSyntax {
var value: String { get }
}
6 changes: 5 additions & 1 deletion Source/SourceKittenFramework/SyntaxKind.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

/// Syntax kind values.
/// Found in `strings SourceKitService | grep source.lang.swift.syntaxtype.`.
public enum SyntaxKind: String {
public enum SyntaxKind: String, SwiftLangSyntax {
/// `argument`.
case Argument = "source.lang.swift.syntaxtype.argument"
/// `attribute.builtin`.
Expand Down Expand Up @@ -52,4 +52,8 @@ public enum SyntaxKind: String {
internal static func docComments() -> [SyntaxKind] {
return [CommentURL, DocComment, DocCommentField]
}

public var value: Swift.String {
return rawValue
}
}
4 changes: 4 additions & 0 deletions sourcekitten.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
6CCFCE8C1CFECFF1003239EB /* Yaml.framework in Embed Frameworks into SourceKittenFramework.framework */ = {isa = PBXBuildFile; fileRef = E80678041CF2749300AFC816 /* Yaml.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
6CCFCE8E1CFED000003239EB /* Commandant.framework in Embed Frameworks into SourceKittenFramework.framework */ = {isa = PBXBuildFile; fileRef = E8EBAA5D1A5D374B002F1B8E /* Commandant.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
6CCFCE901CFED005003239EB /* Result.framework in Embed Frameworks into SourceKittenFramework.framework */ = {isa = PBXBuildFile; fileRef = E834D61D1B2D054B002AA1FE /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
B2FA87E26BC9C5F774FD694C /* SwiftLangSyntax.swift in Sources */ = {isa = PBXBuildFile; fileRef = B2FA804AA9D4427FF571EFB2 /* SwiftLangSyntax.swift */; };
D0AAAB5019FB0960007B24B3 /* SourceKittenFramework.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D0D1216D19E87B05005E4BAA /* SourceKittenFramework.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
D0D1217219E87B05005E4BAA /* SourceKittenFramework.h in Headers */ = {isa = PBXBuildFile; fileRef = D0D1217119E87B05005E4BAA /* SourceKittenFramework.h */; settings = {ATTRIBUTES = (Public, ); }; };
D0D1217819E87B05005E4BAA /* SourceKittenFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0D1216D19E87B05005E4BAA /* SourceKittenFramework.framework */; };
Expand Down Expand Up @@ -136,6 +137,7 @@
6C4CF6481C79802A008532C5 /* library_wrapper_CXString.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = library_wrapper_CXString.swift; sourceTree = "<group>"; };
6C4CF6491C79802A008532C5 /* library_wrapper_Documentation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = library_wrapper_Documentation.swift; sourceTree = "<group>"; };
6CFC18F01C7F2FB900CD70E1 /* module.modulemap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.module-map"; path = module.modulemap; sourceTree = "<group>"; };
B2FA804AA9D4427FF571EFB2 /* SwiftLangSyntax.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftLangSyntax.swift; sourceTree = "<group>"; };
D0D1211B19E87861005E4BAA /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; usesTabs = 0; };
D0D1212419E878CC005E4BAA /* Common.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Common.xcconfig; sourceTree = "<group>"; };
D0D1212619E878CC005E4BAA /* Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
Expand Down Expand Up @@ -404,6 +406,7 @@
E80F236A1A5CB04100FD2352 /* SyntaxToken.swift */,
E806D28E1BE058B100D1BE41 /* Text.swift */,
E8A9B88F1B56CB5500CD17D4 /* Xcode.swift */,
B2FA804AA9D4427FF571EFB2 /* SwiftLangSyntax.swift */,
);
name = SourceKittenFramework;
path = Source/SourceKittenFramework;
Expand Down Expand Up @@ -667,6 +670,7 @@
6C4CF6581C79808C008532C5 /* library_wrapper_Index.swift in Sources */,
E80F236B1A5CB04100FD2352 /* SyntaxToken.swift in Sources */,
E8A9B8901B56CB5500CD17D4 /* Xcode.swift in Sources */,
B2FA87E26BC9C5F774FD694C /* SwiftLangSyntax.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down