package wax-lib
All checked builds passInstall
dune-project
Dependency
Authors
Maintainers
Sources
sha256=cc19989d0db930d9300d7356c8f127309424a82767dd3c91ffd19a0bfd20e3a6
sha512=14ff9219dc6c4e8855c3cb895bd1af6fd81d1c521afefe1e7f69208a2e37abc7ec0946f188198a26780aa405fd43a526b938158334a019f7a5d991d8efc437c3
doc/wax-lib.utils/Wax_utils/Parser_error_runtime/index.html
Module Wax_utils.Parser_error_runtimeSource
Runtime resolution of the <N> / <^N> markers stele's generated messages carry.
A stele-generated message may embed marker lines of two kinds, both anchored at a 1-based stack cell index N (decimal digits) resolved against the running parser; a marker starts its line:
- a delimiter hint
<N>This '(' opens the enclosing construct.— underlines the opening delimiter of the construct at cellN, spanning the full alias the label names (one character for a plain(, both characters of a compound opener like[|); - a hedge subject
<^N>this expression— underlines the whole construct that cellNproduced, the one a hedge ("Assuming that the X is complete, …") assumes finished.
Resolving either needs the running parser's environment, so the generator (a build-time tool) cannot do it — the adopter's error handler must, at the point it holds the incremental engine's env. This library is that resolution, extracted once so every adopter shares the subtle half (the walk-back-over-blanks-to-the-opening-delimiter refinement, the epsilon subject handling) rather than reimplementing it.
A consumer reading an older generator's output sees only <N> markers; a generator carrying <^N> markers stays readable to a resolver that predates them (the ^-tagged depth fails the plain integer parse and the line is left inline), so the marker vocabulary extends compatibly.
It depends on menhirLib and the standard library only, so it compiles under wasm_of_ocaml / js_of_ocaml as well as native.
The minimal slice of a Menhir INCREMENTAL_ENGINE the resolution needs: reaching a stack cell by depth and reading its source span. Instantiate it from the parser's MenhirInterpreter — get is MenhirInterpreter.get and positions destructures MenhirInterpreter.Element.