Skip to content

Commit

Permalink
chore(library/init/data/string/basic): remove broken lineColumn obs…
Browse files Browse the repository at this point in the history
…oleted by `FileMap`
  • Loading branch information
Kha committed Sep 19, 2019
1 parent 8cb387e commit f22c17e
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 23 deletions.
11 changes: 0 additions & 11 deletions library/init/data/string/basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -257,17 +257,6 @@ def prevn : Iterator → Nat → Iterator
| it, i+1 => prevn it.prev i
end Iterator

private partial def lineColumnAux (s : String) : Pos → Nat × Nat → Nat × Nat
| i, r@(line, col) =>
if atEnd s i then r
else
let c := s.get i;
if c = '\n' then lineColumnAux (s.next i) (line+1, 0)
else lineColumnAux (s.next i) (line, col+1)

def lineColumn (s : String) (pos : Pos) : Nat × Nat :=
lineColumnAux s 0 (1, 0)

partial def offsetOfPosAux (s : String) (pos : Pos) : Pos → Nat → Nat
| i, offset =>
if i == pos || s.atEnd i then offset
Expand Down
6 changes: 0 additions & 6 deletions tests/lean/string_imp.lean
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,3 @@
#eval "αβcc".mkIterator.next.next.pos
#eval "αβcc".mkIterator.next.setCurr 'a'
#eval "αβcd".mkIterator.toEnd.pos
#eval "ab\n\nfoo bla".lineColumn 0
#eval "ab\n\nfoo bla".lineColumn 1
#eval "ab\n\nfoo bla".lineColumn 2
#eval "ab\n\nfoo bla".lineColumn 3
#eval "ab\n\nfoo bla".lineColumn 8
#eval "ab\n\nfoo bla".lineColumn 100
6 changes: 0 additions & 6 deletions tests/lean/string_imp.lean.expected.out
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,3 @@
4
(String.Iterator.mk "αacc" 2)
6
(3, 7)
(3, 7)
(3, 7)
(3, 7)
(3, 7)
(3, 7)

0 comments on commit f22c17e

Please sign in to comment.