package wax-lib

All checked builds pass
  1. Overview
  2. Docs
Libraries for Wax, a Rust-like syntax for WebAssembly

Install

dune-project
 Dependency

Authors

Maintainers

Sources

wax-v0.3.0.tbz
sha256=cc19989d0db930d9300d7356c8f127309424a82767dd3c91ffd19a0bfd20e3a6
sha512=14ff9219dc6c4e8855c3cb895bd1af6fd81d1c521afefe1e7f69208a2e37abc7ec0946f188198a26780aa405fd43a526b938158334a019f7a5d991d8efc437c3

doc/wax-lib.utils/Wax_utils/Parser_error_runtime/Make/index.html

Module Parser_error_runtime.MakeSource

Parameters

module E : ENGINE

Signature

Sourcetype label = {
  1. loc_start : Lexing.position;
  2. loc_end : Lexing.position;
  3. text : string;
}

A resolved marker and its own label text (the marker prefix and its bounds removed): a delimiter hint gives a span at the opening delimiter as wide as the alias its label names (one character for a plain (, two for a compound [|), a hedge subject the whole construct's true span (rendered as a multi-line spine when it crosses several lines).

Sourceval resolve : source:string -> env:'a E.env -> string -> string * label list

resolve ~source ~env message post-processes a stele-generated message against the error environment env and the whole source text source: it expands any Menhir $i source-slice references, then turns each marker line into a label:

  • <N>… anchors at the N-th stack cell's opening delimiter (walking back over blanks and line breaks to the ( / [ / { when the cell's own start is not itself the delimiter);
  • <^N>… anchors across the N-th stack cell's full span (the whole construct, however many lines it crosses), and dropped when that span is zero-width (an epsilon reduction — no construct to point at).

Returns the main message (marker lines removed) and the located labels in the order the markers appear (subject before delimiter hint, matching the generator's emission). A marker whose depth exceeds the live stack, or whose depth field it does not recognise (anything but decimal digits, after an optional ^), is left inline in the main message.