package ppx_expect

  1. Overview
  2. Docs
Cram like framework for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

v0.17.3.tar.gz
md5=a7daa59114638fd80f52b6adbb0db7ed
sha512=d26364f2c7c0a3d83e5ecc144f77875a00887853c72c03e0122d658acb4d1cb4c6d77fabc1222d775663db74f0345be2a33518dffac9feef57ece5e9e40dc709

doc/ppx_expect.runtime/Ppx_expect_runtime/Compact_loc/index.html

Module Ppx_expect_runtime.Compact_locSource

Sourcetype t = {
  1. start_bol : Base.int;
    (*

    Index of the first character of the first line in the range.

    *)
  2. start_pos : Base.int;
    (*

    Index of the first character in the range.

    *)
  3. end_pos : Base.int;
    (*

    Index of the last character in the range.

    *)
}

A range of characters in a source file.

Notably, Compact_loc.t does not store the name of the file itself; it only represents the range of characters.

Consider this diagram, where the characters /[a-b]/ represent the included range, and the characters /[.0]/ represent the surrounding text:

.......
0.........a-----
------------
-----b
.........

Then start_bol is the position of 0, start_pos of a, and end_pos of b.

This record corresponds to a Ppxlib.Location.t restricted to just the loc_start.pos_cbol, loc_start.pos_cnum, and loc_end.pos_cnum fields.

Sourceval equal : t -> t -> Base.bool

Compact_loc.t satisfies the natural definition of equality. We write it by hand only to minimize external dependencies.

Sourceval compare_character_range : t -> t -> Base.int

Compares the range of characters spanned by a Compact_loc.t. Ranges that start earlier are considered smaller. For ranges that start at the same position, ranges that end earlier are considered smaller.

OCaml

Innovation. Community. Security.