mirror of
https://github.com/ocaml-tracing/ocaml-trace.git
synced 2026-03-09 12:23:32 -04:00
2 lines
4.3 KiB
HTML
2 lines
4.3 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Extension (ppxlib.Ppxlib.Expansion_context.Extension)</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">Ppxlib</a> » <a href="../index.html">Expansion_context</a> » Extension</nav><header class="odoc-preamble"><h1>Module <code><span>Expansion_context.Extension</span></code></h1></header><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></code></div><div class="spec-doc"><p>Type of expansion contexts for extensions</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-extension_point_loc"><a href="#val-extension_point_loc" class="anchor"></a><code><span><span class="keyword">val</span> extension_point_loc : <span><a href="#type-t">t</a> <span class="arrow">-></span></span> <a href="../../Location/index.html#type-t">Location.t</a></span></code></div><div class="spec-doc"><p>Return the location of the extension point being expanded</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-code_path"><a href="#val-code_path" class="anchor"></a><code><span><span class="keyword">val</span> code_path : <span><a href="#type-t">t</a> <span class="arrow">-></span></span> <a href="../../Code_path/index.html#type-t">Code_path.t</a></span></code></div><div class="spec-doc"><p>Return the code path for the given context In Driver, Deriving and Extension, the context is initialized so that the <code>file_path</code> component of the <code>code_path</code> is determined from the first location found in the input AST. That means that:</p><ul><li>It's the empty string in empty structures or signatures</li><li>It can be altered by line directives</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-input_name"><a href="#val-input_name" class="anchor"></a><code><span><span class="keyword">val</span> input_name : <span><a href="#type-t">t</a> <span class="arrow">-></span></span> string</span></code></div><div class="spec-doc"><p>Return the input name for the given context. In Driver, Deriving and Extension, the context argument is initialized so that the <code>input_name</code> matches the input filename passed to the driver on the command line. That means that:</p><ul><li>It has a value even for empty files</li><li>It is not affected by line directives</li><li>It is <code>"_none_"</code> when using <code>Driver.map_structure</code> or <code>Driver.map_signature</code></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-tool_name"><a href="#val-tool_name" class="anchor"></a><code><span><span class="keyword">val</span> tool_name : <span><a href="#type-t">t</a> <span class="arrow">-></span></span> string</span></code></div><div class="spec-doc"><p>Can be used within a ppx preprocessor to know which tool is calling it <code>"ocamlc"</code>, <code>"ocamlopt"</code>, <code>"ocamldep"</code>, <code>"ocaml"</code>, ... .</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-with_loc_and_path"><a href="#val-with_loc_and_path" class="anchor"></a><code><span><span class="keyword">val</span> with_loc_and_path : <span><span>(<span><span class="label">loc</span>:<a href="../../Location/index.html#type-t">Location.t</a> <span class="arrow">-></span></span> <span><span class="label">path</span>:string <span class="arrow">-></span></span> <span class="type-var">'a</span>)</span> <span class="arrow">-></span></span> <span><span class="label">ctxt</span>:<a href="#type-t">t</a> <span class="arrow">-></span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p>Wrap a <code>fun ~loc ~path</code> into a <code>fun ~ctxt</code></p></div></div></div></body></html>
|