Content of a file together with precalculated positions of newlines.
- source : String
The content of the file.
- positions : Array String.Pos
The positions of newline characters. The first entry is always
0
and the last always the index of the last character. In particular, if the last character is a newline, that index will appear twice.
Instances For
The last line should always be positions.size - 1
.
Equations
Instances For
partial def
Lean.FileMap.ofString.loop
(s : String)
(i : String.Pos)
(line : Nat)
(ps : Array String.Pos)
:
Equations
Instances For
partial def
Lean.FileMap.toPosition.toColumn
(pos : String.Pos)
(str : String)
(i : String.Pos)
(c : Nat)
:
partial def
Lean.FileMap.toPosition.loop
(fmap : FileMap)
(pos : String.Pos)
(str : String)
(ps : Array String.Pos)
(b e : Nat)
:
Returns the position of the start of (1-based) line line
.
This gives the same result as map.ofPosition ⟨line, 0⟩
, but is more efficient.