1
1
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:
Rob Rix 2015-10-28 14:27:52 -04:00
parent 039ada73bf
commit 53217d03e5

View File

@ -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"