package orsetto

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

A distinguished annotation system for 8-bit ASCII text.

Include the common signature specialized for textual positions.

The following table explains the field categories for structural metadata interchange:

  • `Serial: the .serial field.
  • `Stream: the .stream field.
  • `Offsets: the .octets and .lnadj fields.
  • `Lines: the .number and .column fields.
include Profile with type position := position and type Meta.fields = [ `Serial | `Stream | `Offsets | `Lines ] with type symbol := char
type iota = private
  1. | Iota of {
    1. symbol : char;
    2. position : position;
    }

The type of an input event, comprising a symbol and its position.

type span = private
  1. | Span of {
    1. start : position;
    2. limit : position;
    }

Representation of a span of positions, comprising the pair of a) the position of the first symbol in the span, and b) the position of the symbol immediately following the last symbol in the span. Accordingly, if both the start and limit fields have the same serial number, then the span is empty, comprising no symbols.

type +'a form = private
  1. | Form of {
    1. value : 'a;
    2. span : span option;
    }

A value annotated with its span of text in the input stream.

module Scan_basis : Cf_scan.Basis with type Symbol.t = char and type iota = iota and type position = position and type 'a Form.t = 'a form

A basis module for constructing a

Inclusion of the

f_scan

production form signature.

include Cf_scan.Form with type 'a t := 'a form
val imp : 'a -> 'a form

Scanners use imp value to create a value form with a distinguished implicit position, i.e. not located in the input stream.

val dn : 'a form -> 'a

Scanners use dn form to get the value wrapped in form.

val mv : 'a -> 'b form -> 'a form

Scanners use mv value form to make a form containing value attributed with the same position as form.

val span : 'a form -> 'b form -> 'c -> 'c form

Scanners use span a b value to make a form containing value attributed to the span of positions from a to b.

val up : ?span:span -> 'a -> 'a form

Use up v to lift v into a form. Use the optional ~span argument to specify an explicit span of locations. Otherwise, this function is equivalent to imp v.

val map : ('a -> 'b) -> 'a form -> 'b form

Use map f v to apply f to the value enclosed in v to make the result annotated with the same position as v.

val join : ('a -> 'b -> 'c) -> 'a form -> 'b form -> 'c form

Use join f a b to apply f to the values enclosed in a and b to make the result annotated with the span that covers the overlap of the positions of both a and b.

val collect : 'a form list -> 'a list form

Use collect s to collect all the values enclosed in the forms s to a single list annotated with the span that overlaps all the positions in s.

val force : 'a Lazy.t form -> 'a form

Use force z to force the lazy value enclosed in z.

val to_iotas : ?start:position -> char Seq.t -> iota Seq.t

Use to_iotas s to lift s into a sequence of iota values. Use ~start to provide an explicit starting position.

module Meta : sig ... end

A submodule to facilitate structural interchange of metadata.

val emit_form : Format.formatter -> 'a form -> unit

Use emit_form pp vl to print the span of vl with pp in a mostly readable format.

OCaml

Innovation. Community. Security.