summaryrefslogtreecommitdiffstats
path: root/perl_checker.src/info.ml
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-11-12 14:07:28 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-11-12 14:07:28 +0000
commitd6cab570487003dcdb3bcfb207fe9f9afd9b478b (patch)
treea9fc734568eb4d674a0d4d4b873c8bdbb22e36e8 /perl_checker.src/info.ml
parentbe344c9ed676859feddde5c24ef78ac78ab5d570 (diff)
downloadperl_checker-d6cab570487003dcdb3bcfb207fe9f9afd9b478b.tar
perl_checker-d6cab570487003dcdb3bcfb207fe9f9afd9b478b.tar.gz
perl_checker-d6cab570487003dcdb3bcfb207fe9f9afd9b478b.tar.bz2
perl_checker-d6cab570487003dcdb3bcfb207fe9f9afd9b478b.tar.xz
perl_checker-d6cab570487003dcdb3bcfb207fe9f9afd9b478b.zip
*** empty log message ***
Diffstat (limited to 'perl_checker.src/info.ml')
-rw-r--r--perl_checker.src/info.ml8
1 files changed, 5 insertions, 3 deletions
diff --git a/perl_checker.src/info.ml b/perl_checker.src/info.ml
index 8e27bd3..3d68439 100644
--- a/perl_checker.src/info.ml
+++ b/perl_checker.src/info.ml
@@ -14,17 +14,19 @@ let start_a_new_file file =
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
+ let ((offset, line), _) = find (fun (_,(e,_)) -> e > a) (combine starts (tl starts @ [999999999, 999999999])) in
line, offset
let pos2line (file, a, b) =
let line, offset = raw_pos2raw_line file a in
- file, line, a - offset, b - offset
+ file, line, a - offset + 1, b - offset + 1
+
+let pos2s (file, a, b) = sprintf "(%s, %d, %d)" file a b
let pos2sfull pos =
try
let (file, line, n1,n2) = pos2line pos in
sprintf "File \"%s\", line %d, character %d-%d\n" file (line + 1) n1 n2
- with Not_found -> ""
+ with Not_found -> failwith ("bad position " ^ pos2s pos)
let pos2sfull_current a b = pos2sfull (!current_file, a, b)