diff options
| author | Jon French | 2019-04-15 16:18:18 +0100 |
|---|---|---|
| committer | Jon French | 2019-04-15 16:18:18 +0100 |
| commit | a9f0b829507e9882efdb59cce4d83ea7e87f5f71 (patch) | |
| tree | 11cde6c1918bc15f4dda9a8e40afd4a1fe912a0a /src/reporting.ml | |
| parent | 0f6fd188ca232cb539592801fcbb873d59611d81 (diff) | |
| parent | 57443173923e87f33713c99dbab9eba7e3db0660 (diff) | |
Merge branch 'sail2' into rmem_interpreter
Diffstat (limited to 'src/reporting.ml')
| -rw-r--r-- | src/reporting.ml | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/reporting.ml b/src/reporting.ml index 0bc73ed6..20e44c57 100644 --- a/src/reporting.ml +++ b/src/reporting.ml @@ -111,6 +111,20 @@ let loc_to_string ?code:(code=true) l = format_message (Location (l, Line "")) (buffer_formatter b); Buffer.contents b +let rec simp_loc = function + | Parse_ast.Unknown -> None + | Parse_ast.Unique (_, l) -> simp_loc l + | Parse_ast.Generated l -> simp_loc l + | Parse_ast.Range (p1, p2) -> Some (p1, p2) + | Parse_ast.Documented (_, l) -> simp_loc l + +let short_loc_to_string l = + match simp_loc l with + | None -> "unknown location" + | Some (p1, p2) -> + Printf.sprintf "%s %d:%d - %d:%d" + p1.pos_fname p1.pos_lnum (p1.pos_cnum - p1.pos_bol) p2.pos_lnum (p2.pos_cnum - p2.pos_bol) + let print_err l m1 m2 = print_err_internal (Loc l) m1 m2 |
