diff options
Diffstat (limited to 'perl_checker.src/info.ml')
-rw-r--r-- | perl_checker.src/info.ml | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/perl_checker.src/info.ml b/perl_checker.src/info.ml index 5c002ae..8e27bd3 100644 --- a/perl_checker.src/info.ml +++ b/perl_checker.src/info.ml @@ -4,6 +4,7 @@ open Common let (lines_starts : (string * int list ref) list ref) = ref [] let current_file_lines_starts = ref [] +let current_file_current_line = ref 0 let current_file = ref "" let start_a_new_file file = @@ -11,9 +12,13 @@ let start_a_new_file file = current_file_lines_starts := [0] ; lines_starts := (file, current_file_lines_starts) :: !lines_starts -let pos2line (file, a, b) = +let raw_pos2raw_line file a = let starts = map_index (fun a b -> a,b) (rev !(assoc file !lines_starts)) in let ((offset, line), _) = find (fun (_,(e,_)) -> e > a) (combine starts (tl starts @ [99999, 99999])) in + line, offset + +let pos2line (file, a, b) = + let line, offset = raw_pos2raw_line file a in file, line, a - offset, b - offset let pos2sfull pos = |