From 51d9b14ac63f4d4f045772ccd006b49e87d8f4bc Mon Sep 17 00:00:00 2001 From: Enrico Tassi Date: Tue, 1 Feb 2005 10:05:14 +0000 Subject: [PATCH] cosmetic fix to pp_location --- helm/ocaml/cic_transformations/cicAst.ml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/helm/ocaml/cic_transformations/cicAst.ml b/helm/ocaml/cic_transformations/cicAst.ml index 9abd07a75..ca4856786 100644 --- a/helm/ocaml/cic_transformations/cicAst.ml +++ b/helm/ocaml/cic_transformations/cicAst.ml @@ -28,11 +28,13 @@ open Printf type location = Lexing.position * Lexing.position let pp_location (loc_begin, loc_end) = - sprintf "(%d,%d)-(%d,%d)" - loc_begin.Lexing.pos_lnum - (loc_begin.Lexing.pos_cnum - loc_begin.Lexing.pos_bol) - loc_end.Lexing.pos_lnum - (loc_end.Lexing.pos_cnum - loc_end.Lexing.pos_bol) + let c_begin = loc_begin.Lexing.pos_cnum - loc_begin.Lexing.pos_bol in + let c_end = loc_end.Lexing.pos_cnum - loc_end.Lexing.pos_bol in + if loc_begin.Lexing.pos_lnum = -1 || loc_end.Lexing.pos_lnum = -1 then + sprintf "%d-%d" c_begin c_end + else + sprintf "(%d,%d)-(%d,%d)" loc_begin.Lexing.pos_lnum c_begin + loc_end.Lexing.pos_lnum c_end let floc_of_loc (loc_begin, loc_end) = let floc_begin = -- 2.39.2