package loc
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=3823c82f10c16278eb4b660a5621c59f4e920151c6d4c6a37976bbe9ba3a7934
sha512=aca370c2387e2afb6b116f911671f872cbc44713297713e98573dda5dcad0974bd7f22df4ad8a59243b19ba24a675d1ec98c66453176298baaaa3fdb56c5e1e4
Description
Loc is an OCaml library for manipulating code locations, which are ranges of lexing positions from a parsed file.
Attaching locations to nodes manipulated by programs can be useful for various applications such as compilers, interpreters, linters, and refactoring tools.
README
loc
Loc is an OCaml library to manipulate code locations, which are ranges of lexing positions from a parsed file.
It is inspired by dune's Loc.t
, and uses it under the hood. The type equality with Stdune.Loc.t
is currently not exposed and Stdune
not mentioned in the interface of Loc
, with the aim of keeping the signature of Loc
stable across potential internal changes in Stdune
.
Code Documentation
The code documentation of the latest release is built with odoc
and published to GitHub
pages here.
Motivation
Attaching locations to nodes manipulated by programs can be useful for applications such as compilers, interpreters, linters, refactor tools, etc.
Here are 3 kinds of examples using the Loc
library:
Attach locations to the nodes of an AST. See bopkit.
Apply surgical patches to a file. See file-rewriter.
Emit located messages to the console. See cmdlang's Err module.
See also
Similar libraries or modules:
Dune's Loc.t
Parsexp's ranges
Ppxlib's Location.t
Compilerlibs's loc