@@ -69,8 +69,8 @@ class LocationMap(val input: String) {
6969 */
7070 def toLineCol (offset : Int ): Option [(Int , Int )] =
7171 if (isValidOffset(offset)) {
72- val Caret (_, row , col) = toCaretUnsafeImpl(offset)
73- Some ((row , col))
72+ val Caret (_, line , col) = toCaretUnsafeImpl(offset)
73+ Some ((line , col))
7474 } else None
7575
7676 // This does not do bounds checking because we
@@ -94,20 +94,18 @@ class LocationMap(val input: String) {
9494 // the key, or a.length if all elements in the array are less than the specified key.
9595 //
9696 // so insertion pos = ~(idx + 1)
97- val row = ~ (idx + 1 )
98- // so we are pointing into a row
99- val rowStart = firstPos(row )
100- val col = offset - rowStart
101- Caret (offset, row , col)
97+ val line = ~ (idx + 1 )
98+ // so we are pointing into a line
99+ val lineStart = firstPos(line )
100+ val col = offset - lineStart
101+ Caret (offset, line , col)
102102 } else {
103103 // idx is exactly the right value because offset is beginning of a line
104104 Caret (offset, idx, 0 )
105105 }
106106 }
107107
108- /** Convert an offset to a Caret.
109- * @throws IllegalArgumentException
110- * if offset is longer than input
108+ /** Convert an offset to a Caret. throws IllegalArgumentException if offset is longer than input
111109 */
112110 def toCaretUnsafe (offset : Int ): Caret =
113111 if (isValidOffset(offset)) toCaretUnsafeImpl(offset)
@@ -123,7 +121,7 @@ class LocationMap(val input: String) {
123121 if (i >= 0 && i < lines.length) Some (lines(i))
124122 else None
125123
126- /** Return the offset for a given row /col. if we return Some(input.length) this means EOF if we
124+ /** Return the offset for a given line /col. if we return Some(input.length) this means EOF if we
127125 * return Some(i) for 0 <= i < input.length it is a valid item else offset < 0 or offset >
128126 * input.length we return None
129127 */
0 commit comments