mirror of
https://github.com/github/semantic.git
synced 2024-11-28 10:15:55 +03:00
Info is CustomJSONConvertible.
This commit is contained in:
parent
039ada73bf
commit
53217d03e5
@ -9,10 +9,26 @@ func readFile(path: String) -> String? {
|
||||
|
||||
typealias Term = Cofree<String, Range<Int>>
|
||||
|
||||
struct Info: Equatable {
|
||||
struct Info: CustomJSONConvertible, Equatable {
|
||||
let range: Range<Int>
|
||||
let category: Category
|
||||
|
||||
|
||||
// MARK: CustomJSONConvertible
|
||||
|
||||
var JSON: Doubt.JSON {
|
||||
return [
|
||||
"range": [
|
||||
range.startIndex.JSON,
|
||||
(range.endIndex - range.startIndex).JSON,
|
||||
],
|
||||
"category": category.rawValue.JSON
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
// MARK: Categories
|
||||
|
||||
enum Category: String {
|
||||
case Arguments = "arguments"
|
||||
case Assignment = "assignment"
|
||||
|
Loading…
Reference in New Issue
Block a user