1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 01:47:01 +03:00

Map Range<Index> not Range<Column> to Range<Int>

This commit is contained in:
joshvera 2015-11-09 15:19:34 -05:00
parent 2555ead1a7
commit 5eddc274cb

View File

@ -16,10 +16,10 @@ final class JSONParserTests: XCTestCase {
let expected: Cofree<JSONLeaf, Range<Int>> = Cofree(0..<42, .Keyed(["hello": fixedPairs]))
let actual = Madness.parse(json, input: dictWithArray).right!
let firstIndex = actual.extract.1
let startRange = actual.extract.2
let new: Cofree<JSONLeaf, Range<Int>> = actual.map({ tuple in
let startI: Int = firstIndex.startIndex.distanceTo(tuple.1.startIndex)
let endI: Int = firstIndex.startIndex.distanceTo(tuple.1.endIndex)
let startI: Int = startRange.startIndex.distanceTo(tuple.2.startIndex)
let endI: Int = startRange.startIndex.distanceTo(tuple.2.endIndex)
return Range(start: startI, end: endI)
})