@@ -34,56 +34,56 @@ public struct CodeLanguage {
34
34
self . additionalHighlights = highlights
35
35
self . additionalIdentifiers = additionalIdentifiers
36
36
}
37
-
37
+
38
38
/// The ID of the language
39
39
public let id : TreeSitterLanguage
40
-
40
+
41
41
/// The display name of the language
42
42
public let tsName : String
43
-
43
+
44
44
/// A set of file extensions for the language
45
45
///
46
46
/// In special cases this can also be a file name
47
47
/// (e.g `Dockerfile`, `Makefile`)
48
48
public let extensions : Set < String >
49
-
49
+
50
50
/// The leading string of a comment line
51
51
public let lineCommentString : String
52
-
52
+
53
53
/// The leading and trailing string of a multi-line comment
54
54
public let rangeCommentStrings : ( String , String )
55
-
55
+
56
56
/// The leading (and trailing, if there is one) string of a documentation comment
57
57
public let documentationCommentStrings : Set < DocumentationComments >
58
-
58
+
59
59
/// The query URL of a language this language inherits from. (e.g.: C for C++)
60
60
public let parentQueryURL : URL ?
61
-
61
+
62
62
/// Additional highlight file names (e.g.: JSX for JavaScript)
63
63
public let additionalHighlights : Set < String > ?
64
-
64
+
65
65
/// The query URL for the language if available
66
66
public var queryURL : URL ? {
67
67
queryURL ( )
68
68
}
69
-
69
+
70
70
/// The bundle's resource URL
71
71
internal var resourceURL : URL ? = Bundle . module. resourceURL
72
-
72
+
73
73
/// A set of aditional identifiers to use for things like shebang matching.
74
74
public let additionalIdentifiers : Set < String >
75
-
75
+
76
76
/// The tree-sitter language for the language if available
77
77
public var language : Language ? {
78
78
guard let tsLanguage = tsLanguage else { return nil }
79
79
return Language ( language: tsLanguage)
80
80
}
81
-
81
+
82
82
internal func queryURL( for highlights: String = " highlights " ) -> URL ? {
83
83
return resourceURL?
84
84
. appendingPathComponent ( " Resources/tree-sitter- \( tsName) / \( highlights) .scm " )
85
85
}
86
-
86
+
87
87
/// Gets the TSLanguage from `tree-sitter`
88
88
private var tsLanguage : UnsafeMutablePointer < TSLanguage > ? {
89
89
switch id {
@@ -179,7 +179,7 @@ extension CodeLanguage: Hashable {
179
179
public static func == ( lhs: CodeLanguage , rhs: CodeLanguage ) -> Bool {
180
180
return lhs. id == rhs. id
181
181
}
182
-
182
+
183
183
public func hash( into hasher: inout Hasher ) {
184
184
hasher. combine ( id)
185
185
}
@@ -204,7 +204,7 @@ public enum DocumentationComments: Hashable {
204
204
}
205
205
}
206
206
}
207
-
207
+
208
208
public func hash( into hasher: inout Hasher ) {
209
209
switch self {
210
210
case . single( let string) :
@@ -214,7 +214,7 @@ public enum DocumentationComments: Hashable {
214
214
hasher. combine ( pair. 1 )
215
215
}
216
216
}
217
-
217
+
218
218
case single( String )
219
219
case pair( ( String , String ) )
220
220
}
0 commit comments