package links

  1. Overview
  2. Docs

A module for keeping track of source code positions.

type t

An unresolved source code position. Also see Position.Resolved.

val pp : Ppx_deriving_runtime.Format.formatter -> t -> Ppx_deriving_runtime.unit
val show : t -> Ppx_deriving_runtime.string
val make : start:Lexpos.t -> finish:Lexpos.t -> code:source_code option -> t
val dummy : t

A dummy position used for when the source code location is unknown.

val start : t -> Lexpos.t

Get start position of the source code position.

val finish : t -> Lexpos.t

Get the end position of the source code position.

val code : t -> source_code option

Get the source code object.

val traverse_map : t -> o:'o -> f_start:('o -> Lexpos.t -> 'a * Lexpos.t) -> f_finish:('a -> Lexpos.t -> 'b * Lexpos.t) -> f_code:('b -> source_code option -> 'c * source_code option) -> 'c * t
val traverse : t -> o:'o -> f_start:('o -> Lexpos.t -> 'a) -> f_finish:('a -> Lexpos.t -> 'b) -> f_code:('b -> source_code option -> 'c) -> 'c
val map_code : t -> f:(source_code option -> source_code option) -> t
exception ASTSyntaxError of t * string
module Resolved : sig ... end

Resolve the source code position to the actual contents of that position.

val resolve_expression : t -> string

Resolve the source code position and return the source expression.

val resolve_start_expr : t -> Lexpos.t * string

Resolve the source code position and return the start position and the source expression.

OCaml

Innovation. Community. Security.