mirror of
https://github.com/ocaml-tracing/ocaml-trace.git
synced 2026-03-09 20:33:34 -04:00
5 lines
6.8 KiB
HTML
5 lines
6.8 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Location (ppxlib.Astlib.Location)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../_odoc-theme/odoc.css"/><meta name="generator" content="odoc 3.1.0"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> – <a href="../../../index.html">Index</a> » <a href="../../index.html">ppxlib</a> » <a href="../index.html">Astlib</a> » Location</nav><header class="odoc-preamble"><h1>Module <code><span>Astlib.Location</span></code></h1><p>Source code locations (ranges of positions), used in parsetrees</p></header><div class="odoc-tocs"><nav class="odoc-toc odoc-local-toc"><ul><li><a href="#automatically-reporting-errors-for-raised-exceptions">Automatically reporting errors for raised exceptions</a></li></ul></nav></div><div class="odoc-content"><div class="odoc-spec"><div class="spec type anchored" id="type-t"><a href="#type-t" class="anchor"></a><code><span><span class="keyword">type</span> t</span><span> = <a href="../../../ocaml/Location/index.html#type-t">Ocaml_common.Location.t</a></span><span> = </span><span>{</span></code><ol><li id="type-t.loc_start" class="def record field anchored"><a href="#type-t.loc_start" class="anchor"></a><code><span>loc_start : <a href="../../../ocaml/Stdlib/Lexing/index.html#type-position">Stdlib.Lexing.position</a>;</span></code></li><li id="type-t.loc_end" class="def record field anchored"><a href="#type-t.loc_end" class="anchor"></a><code><span>loc_end : <a href="../../../ocaml/Stdlib/Lexing/index.html#type-position">Stdlib.Lexing.position</a>;</span></code></li><li id="type-t.loc_ghost" class="def record field anchored"><a href="#type-t.loc_ghost" class="anchor"></a><code><span>loc_ghost : bool;</span></code></li></ol><code><span>}</span></code></div><div class="spec-doc"><p>The location type</p></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-loc"><a href="#type-loc" class="anchor"></a><code><span><span class="keyword">type</span> <span>'a loc</span></span><span> = <span><span class="type-var">'a</span> <a href="../../../ocaml/Location/index.html#type-loc">Ocaml_common.Location.loc</a></span></span><span> = </span><span>{</span></code><ol><li id="type-loc.txt" class="def record field anchored"><a href="#type-loc.txt" class="anchor"></a><code><span>txt : <span class="type-var">'a</span>;</span></code></li><li id="type-loc.loc" class="def record field anchored"><a href="#type-loc.loc" class="anchor"></a><code><span>loc : <a href="#type-t">t</a>;</span></code></li></ol><code><span>}</span></code></div><div class="spec-doc"><p>A located type</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Error"><a href="#module-Error" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Error/index.html">Error</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-set_input_name"><a href="#val-set_input_name" class="anchor"></a><code><span><span class="keyword">val</span> set_input_name : <span>string <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p>Set the name of the input source, e.g. the file name.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-set_input_lexbuf"><a href="#val-set_input_lexbuf" class="anchor"></a><code><span><span class="keyword">val</span> set_input_lexbuf : <span><span><a href="../../../ocaml/Stdlib/Lexing/index.html#type-lexbuf">Stdlib.Lexing.lexbuf</a> option</span> <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p>Set the name of the input source, e.g. the file name.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-none"><a href="#val-none" class="anchor"></a><code><span><span class="keyword">val</span> none : <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>An arbitrary value of type <code>t</code>; describes an empty ghost range.</p></div></div><h2 id="automatically-reporting-errors-for-raised-exceptions"><a href="#automatically-reporting-errors-for-raised-exceptions" class="anchor"></a>Automatically reporting errors for raised exceptions</h2><div class="odoc-spec"><div class="spec value anchored" id="val-register_error_of_exn"><a href="#val-register_error_of_exn" class="anchor"></a><code><span><span class="keyword">val</span> register_error_of_exn : <span><span>(<span>exn <span class="arrow">-></span></span> <span><a href="Error/index.html#type-t">Error.t</a> option</span>)</span> <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p>Each compiler module which defines a custom type of exception which can surface as a user-visible error should register a "printer" for this exception using <code>register_error_of_exn</code>. The result of the printer is an <code>error</code> value containing a location, a message, and optionally sub-messages (each of them being located as well).</p></div></div><div class="odoc-spec"><div class="spec exception anchored" id="exception-Error"><a href="#exception-Error" class="anchor"></a><code><span><span class="keyword">exception</span> </span><span><span class="exception">Error</span> <span class="keyword">of</span> <a href="Error/index.html#type-t">Error.t</a></span></code></div><div class="spec-doc"><p>Located exception.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-raise_errorf"><a href="#val-raise_errorf" class="anchor"></a><code><span><span class="keyword">val</span> raise_errorf :
|
||
<span><span class="optlabel">?loc</span>:<a href="#type-t">t</a> <span class="arrow">-></span></span>
|
||
<span><span><span>(<span class="type-var">'a</span>, <a href="../../../ocaml/Stdlib/Format/index.html#type-formatter">Stdlib.Format.formatter</a>, unit, <span class="type-var">'b</span>)</span> <a href="../../../ocaml/Stdlib/index.html#type-format4">format4</a></span> <span class="arrow">-></span></span>
|
||
<span class="type-var">'a</span></span></code></div><div class="spec-doc"><p>Raise a located exception.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-report_exception"><a href="#val-report_exception" class="anchor"></a><code><span><span class="keyword">val</span> report_exception : <span><a href="../../../ocaml/Stdlib/Format/index.html#type-formatter">Stdlib.Format.formatter</a> <span class="arrow">-></span></span> <span>exn <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p>Report an exception on the given formatter</p></div></div></div></body></html>
|