Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005070OCamlOCaml generalpublic2010-06-13 19:452012-08-08 17:21
Reporterpalomer 
Assigned Todoligez 
PrioritynormalSeverityfeatureReproducibilityalways
StatusassignedResolutionopen 
PlatformOSOS Version
Product Version3.11.2 
Target VersionFixed in Version 
Summary0005070: Error location output not supported by emacs
Descriptionif 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 Informationan 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
TagsNo tags attached.
Attached Files

- Relationships
related to 0004659resolvedfrisch wrong error message (parser seems to interpret many lines as one line) (3.10.2 and 3.10.0) 
related to 0005044acknowledged Emacs doesn't recognize the backtrace error location format 

-  Notes
(0005957)
doligez (administrator)
2011-06-01 23:13

Now that emacs supports character positions in error messages, I guess we should change our format, but we will also need to change the corresponding regexp in caml.el.

In the meantime, you should consider using caml-mode in your emacs.
(0007935)
doligez (administrator)
2012-08-08 16:53
edited on: 2012-08-08 17:26

First step toward fixing this: I have defined a new format for the error messages:

File "foo", line 1, char 2 to line 3, char 4:
blah

Where "4" is the char number within line 3 (not a char offset from line 1).
I have added to caml.el the corresponding regexp, in addition to the old one. (r 12840 and 12843 in trunk)

OCaml still outputs the old format for the moment.


- Issue History
Date Modified Username Field Change
2010-06-13 19:45 palomer New Issue
2011-06-01 23:13 doligez Note Added: 0005957
2011-06-01 23:13 doligez Severity minor => feature
2011-06-01 23:13 doligez Status new => acknowledged
2012-02-13 18:01 doligez Relationship added related to 0004659
2012-02-14 10:16 gasche Relationship added related to 0005044
2012-08-08 16:53 doligez Note Added: 0007935
2012-08-08 16:53 doligez Note Edited: 0007935 View Revisions
2012-08-08 17:21 doligez Assigned To => doligez
2012-08-08 17:21 doligez Status acknowledged => assigned
2012-08-08 17:26 doligez Note Edited: 0007935 View Revisions


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker