ocaml-trace/ppxlib/Ppxlib/Location/index.html
2024-03-08 16:51:12 +00:00

18 lines
No EOL
10 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Location (ppxlib.Ppxlib.Location)</title><link rel="stylesheet" href="../../../_odoc-theme/odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 2.2.2"/><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">ppxlib</a> &#x00BB; <a href="../index.html">Ppxlib</a> &#x00BB; Location</nav><header class="odoc-preamble"><h1>Module <code><span>Ppxlib.Location</span></code></h1><p>Overrides the <code>Location</code> module of OCaml</p></header><div class="odoc-content"><p>There are less functions in this module. However the API should be more stable than the Location module of OCaml.</p><p>For a detailled presentation of good practices regarding locations, refer to the <a href="../../good-practices.html#resp_loc">section</a> in the manual.</p><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="../../Astlib/Location/index.html#type-t">Astlib.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><div class="odoc-spec"><div class="spec value anchored" id="val-in_file"><a href="#val-in_file" class="anchor"></a><code><span><span class="keyword">val</span> in_file : <span>string <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Return an empty ghost range located in a given file.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-set_filename"><a href="#val-set_filename" class="anchor"></a><code><span><span class="keyword">val</span> set_filename : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span>string <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Set the <code>pos_fname</code> both in <code>loc_start</code> and <code>loc_end</code>. Leave the rest as is.</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><div class="odoc-spec"><div class="spec value anchored" id="val-init"><a href="#val-init" class="anchor"></a><code><span><span class="keyword">val</span> init : <span><a href="../../../ocaml/Stdlib/Lexing/index.html#type-lexbuf">Stdlib.Lexing.lexbuf</a> <span class="arrow">&#45;&gt;</span></span> <span>string <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Set the file name and line number of the <code>lexbuf</code> to be the start of the named file.</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>?loc:<a href="#type-t">t</a> <span class="arrow">&#45;&gt;</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">&#45;&gt;</span></span>
<span class="type-var">'a</span></span></code></div><div class="spec-doc"><p>Raise a located error. Should be avoided as much as possible, in favor of <a href="#val-error_extensionf"><code>error_extensionf</code></a>. See the <a href="../../good-practices.html#handling_errors">relevant</a> part of the tutorial.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-of_lexbuf"><a href="#val-of_lexbuf" class="anchor"></a><code><span><span class="keyword">val</span> of_lexbuf : <span><a href="../../../ocaml/Stdlib/Lexing/index.html#type-lexbuf">Stdlib.Lexing.lexbuf</a> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Return the location corresponding to the last matched regular expression</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">&#45;&gt;</span></span> <span>exn <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Report an exception on the given formatter</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-print"><a href="#val-print" class="anchor"></a><code><span><span class="keyword">val</span> print : <span><a href="../../../ocaml/Stdlib/Format/index.html#type-formatter">Stdlib.Format.formatter</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Prints <code>File &quot;...&quot;, line ..., characters ...-...:</code></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 class="keyword">nonrec</span> <span>'a loc</span></span><span> = <span><span class="type-var">'a</span> <a href="../../Astlib/Location/index.html#type-loc">Astlib.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><div class="odoc-spec"><div class="spec value anchored" id="val-compare_pos"><a href="#val-compare_pos" class="anchor"></a><code><span><span class="keyword">val</span> compare_pos : <span><a href="../../../ocaml/Stdlib/Lexing/index.html#type-position">Stdlib.Lexing.position</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../../../ocaml/Stdlib/Lexing/index.html#type-position">Stdlib.Lexing.position</a> <span class="arrow">&#45;&gt;</span></span> int</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-min_pos"><a href="#val-min_pos" class="anchor"></a><code><span><span class="keyword">val</span> min_pos :
<span><a href="../../../ocaml/Stdlib/Lexing/index.html#type-position">Stdlib.Lexing.position</a> <span class="arrow">&#45;&gt;</span></span>
<span><a href="../../../ocaml/Stdlib/Lexing/index.html#type-position">Stdlib.Lexing.position</a> <span class="arrow">&#45;&gt;</span></span>
<a href="../../../ocaml/Stdlib/Lexing/index.html#type-position">Stdlib.Lexing.position</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-max_pos"><a href="#val-max_pos" class="anchor"></a><code><span><span class="keyword">val</span> max_pos :
<span><a href="../../../ocaml/Stdlib/Lexing/index.html#type-position">Stdlib.Lexing.position</a> <span class="arrow">&#45;&gt;</span></span>
<span><a href="../../../ocaml/Stdlib/Lexing/index.html#type-position">Stdlib.Lexing.position</a> <span class="arrow">&#45;&gt;</span></span>
<a href="../../../ocaml/Stdlib/Lexing/index.html#type-position">Stdlib.Lexing.position</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-compare"><a href="#val-compare" class="anchor"></a><code><span><span class="keyword">val</span> compare : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> int</span></code></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-error_extensionf"><a href="#val-error_extensionf" class="anchor"></a><code><span><span class="keyword">val</span> error_extensionf :
<span>loc:<a href="#type-t">t</a> <span class="arrow">&#45;&gt;</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>string <a href="../../Astlib/Location/index.html#type-loc">Astlib.Location.loc</a></span> * <a href="../../Astlib/Ast_500/Parsetree/index.html#type-payload">Astlib.Ast_500.Parsetree.payload</a>)</span>
<a href="../../../ocaml/Stdlib/index.html#type-format4">format4</a></span> <span class="arrow">&#45;&gt;</span></span>
<span class="type-var">'a</span></span></code></div><div class="spec-doc"><p>Returns an error extension node. When encountered in the AST, the compiler recognizes it and displays the error properly.</p><p>For a detailed explanation on error reporting, refer to the <a href="../../good-practices.html#handling_errors">relevant</a> part of the tutorial.</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></div></body></html>