package loc

  1. Overview
  2. Docs
Representing ranges of lexing positions from parsed files

Install

dune-project
 Dependency

Authors

Maintainers

Sources

loc-0.3.3.tbz
sha256=d1894623628948203f77a932d7a41a2730b17894cc79b6a7488e55f254b0bb3c
sha512=e7a4a0380687d6f06277e3c08977278f4ef1e8ab1a226b1665295ae9fd94ba080576fe9d3ae46c071132326a25fb0793b190e8ca80c958c66c16b808323f779e

doc/README.html

loc

CI Status Coverage Status

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:

  1. Attach locations to the nodes of an AST. See bopkit.
  2. Apply surgical patches to a file. See file-rewriter.
  3. Emit located messages to the console. See cmdlang's Err module.

See also

Similar libraries or modules: