Skip to content

Provide an alternative format for error/warning messages; eg: file:line:col instead of file(line, col) #690

@ziotom78

Description

@ziotom78

Currently the Nimrod compiler produces error messages using a format string similar to the one used by Free Pascal, i.e., with the line and column numbers enclosed in parentheses:

  test.nim(5, 0) Error: invalid indentation

However, this kind of syntax is not recognized by Emacs. When you run the compiler using Emacs' compile function, you cannot highlight the errors and move from one to another using next-error, because such functions expect something in the form

  test.nim:5:0: Error: invalid indentation

(see http://www.gnu.org/prep/standards/html_node/Errors.html#Errors).

The Free Pascal compiler fpc solves this by accepting the (scarcely documented) command-line flag -vr ("Rhide/GCC compatibility mode"):

  $ fpc test.pas
  ...
  test.pas(4,6) Error: Identifier not found "X"
  ...
  $ fpc -vr test.pas
  ...
  test.pas:4: error 6: Error: Identifier not found "X"
  ...

which is not perfect but at least allows Emacs to find the right line in the source code.

Since I am an avid Emacs user, would somebody be interested in having this feature implemented in Nimrod? I can fork the repository and try to implement it by myself, but first I would know if it is sensible to add such a patch, and if there is anything I must be aware of.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions