jon.recoil.org

Module Odoc_parser.LocSource

Locations in files.

This module concerns locations in source files, both points indicating a specific character and spans between two points.

Basic types

Sourcetype point = {
  1. line : int;
  2. column : int;
}

A specific character

Sourcetype span = {
  1. file : string;
  2. start : Odoc_parser.Loc.point;
  3. end_ : Odoc_parser.Loc.point;
}

A range of characters between start and end_ in a particular file

span spans takes a list of spans and returns a single span starting at the start of the first span and ending at the end of the final span

This adjusts only the column number, implicitly assuming that the offset does not move the location across a newline character.

This adjusts only the column number, implicitly assuming that the offset does not move the location across a newline character.

Located values

Sourcetype +'a with_location = {
  1. location : Odoc_parser.Loc.span;
  2. value : 'a;
}

Describes values located at a particular span

Returns the location of a located value

Returns the value of a located value

Map over a located value without changing its location

same x y retuns the value y wrapped in a with_location whose location is that of x

Sourceval spans_multiple_lines : _ Odoc_parser.Loc.with_location -> bool

spans_multiple_lines x checks to see whether x is located on a single line or whether it covers more than one.