Skip to content

Loc.to_string: bad support for multiple lines #4598

@vicuna

Description

@vicuna

Original bug ID: 4598
Reporter: @Chris00
Assigned to: @damiendoligez
Status: closed (set by @damiendoligez on 2015-01-09T18:16:43Z)
Resolution: suspended
Priority: normal
Severity: minor
Version: 3.10.3+dev
Target version: undecided
Category: -for Camlp4 use https://github.com/ocaml/camlp4/issues
Related to: #4659 #6087

Bug description

When the location extends several lines, the format used by Loc.to_string is not compatible with the way Emacs parses locations, it should be of the form

File "xxx", line 12-13, characters 34-23:

The following code maybe shows better what I mean

let (fname, line0, bol0, off0, line1, bol1, off1, _) = Loc.to_tuple loc in
let line =
if line0 = line1 then sprintf "%i" line0
else sprintf "%i-%i" line0 line1 in
sprintf "File "%s", line %s, characters %i-%i"
fname line (off0 - bol0) (off1 - bol1)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions