Skip to content

Error location output not supported by emacs #5070

@vicuna

Description

@vicuna

Original bug ID: 5070
Reporter: palomer
Assigned to: @damiendoligez
Status: assigned (set by @damiendoligez on 2012-08-08T15:21:00Z)
Resolution: open
Priority: normal
Severity: minor
Version: 3.11.2
Category: compiler driver
Has duplicate: #6518
Related to: #4659 #5044
Monitored by: @Chris00

Bug description

if I compile the following:

let foo : int =
"foo"
^
"bar"

it gives me the error

File "/home/palomer/temp/test.ml", line 2, characters 1-21:
...

when the next-error function in emacs expects the following:

File "/home/palomer/temp/test.ml", line 2-4, characters 1-8:
...

Additional information

an easy fix would be to change the "print" function in "parsing/location.ml" to the following:

let print ppf loc =
let ls = loc.loc_start in
let le = loc.loc_end in
let lines =
if ls.Lexing.pos_lnum = le.Lexing.pos_lnum then
sprintf "line %d" ls.Lexing.pos_lnum
else
sprintf "lines %d-%d" ls.Lexing.pos_lnum le.Lexing.pos_lnum
in
fprintf ppf "File "%s", %s, characters %d-%d:\n" ls.Lexing.pos_fname
lines (ls.Lexing.pos_cnum - ls.Lexing.pos_bol)
(le.Lexing.pos_cnum - le.Lexing.pos_bol)

And the "to_string" function in "camlp4/Camlp4/Struct/Loc.ml" might also have to be similarly changed

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions