package pp_loc
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=2f736505d431e81a4fe851ad310ff29ec4cd20c8fd37ef050d9e6f1050baa7cb
sha512=7e51eeeb29037d1e1db4ebe4d4d14e40cbb45162970773f35ffe43b6107570ee5d6ec21698791fc8cfd79df5ccfd173fb6b2a8108af7bda976368b13b64ea749
Description
Decent error reporting (for example, in a parser, a compiler, ...) typically involves collecting locations, in order to indicate to the user the position of an error in the source file. This library provides support for quoting and highlighting the input fragment that corresponds to a given source location (or set of source locations).
Published: 30 May 2022
README
pp_loc
Decent error reporting (for example, in a parser, a compiler, ...) typically involves collecting locations, in order to indicate to the user the position of an error in the source file.
This library provides support to additionally quote and highlight the input fragment the input that corresponds to a location (or a set of locations).
This is the same code as in the OCaml compiler implementation (as of version 4.08), but extracted as a standalone library.
Examples
Single-line errors: the offending line is printed back, and the error location is highlighted using carets.
2 | let x = 1 + 1 +. 2 in ()
^^^^^
Multi-line error: the lines that span the location are printed, where the input outside of the error location is replaced by ".".
2 | ......(1 + 1
3 | * 3)...
Documentation
https://armael.github.io/pp_loc/pp_loc/
Dev Dependencies (1)
-
odoc
with-doc
Used by (2)
-
dolmen_loop
>= "0.7"
-
gospel
>= "0.2.0"
Conflicts
None