|
|
|
@ -18,16 +18,10 @@ type t = {
|
|
|
|
|
line: int, /** The line number. -1 means "do not know" */
|
|
|
|
|
col: int, /** The column number. -1 means "do not know" */
|
|
|
|
|
file: DB.source_file /** The name of the source file */
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
[@@deriving compare];
|
|
|
|
|
|
|
|
|
|
let compare loc1 loc2 => {
|
|
|
|
|
let n = int_compare loc1.line loc2.line;
|
|
|
|
|
if (n != 0) {
|
|
|
|
|
n
|
|
|
|
|
} else {
|
|
|
|
|
DB.compare_source_file loc1.file loc2.file
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
let equal loc1 loc2 => compare loc1 loc2 == 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Dump a location */
|
|
|
|
@ -37,8 +31,6 @@ let d (loc: t) => L.add_print_action (L.PTloc, Obj.repr loc);
|
|
|
|
|
/** Dummy location */
|
|
|
|
|
let dummy = {line: (-1), col: (-1), file: DB.source_file_empty};
|
|
|
|
|
|
|
|
|
|
let equal loc1 loc2 => compare loc1 loc2 == 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Pretty print a location */
|
|
|
|
|
let pp f (loc: t) => F.fprintf f "[line %d]" loc.line;
|
|
|
|
|