diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2002-11-09 21:31:59 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2002-11-09 21:31:59 +0000 |
commit | c8ff668a19bfca65bbcd8f72f939729034c138c2 (patch) | |
tree | e2c178203dcd2337ee026278a470c2ab042ccceb /perl_checker.src/info.ml | |
parent | 4747b0022a0b9d8b4a631428c4a157f056af823c (diff) | |
download | perl_checker-c8ff668a19bfca65bbcd8f72f939729034c138c2.tar perl_checker-c8ff668a19bfca65bbcd8f72f939729034c138c2.tar.gz perl_checker-c8ff668a19bfca65bbcd8f72f939729034c138c2.tar.bz2 perl_checker-c8ff668a19bfca65bbcd8f72f939729034c138c2.tar.xz perl_checker-c8ff668a19bfca65bbcd8f72f939729034c138c2.zip |
*** empty log message ***
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 = |