mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-16 23:56:49 -05:00
6 lines
No EOL
20 KiB
HTML
6 lines
No EOL
20 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Ast_iterator (ocaml.Ast_iterator)</title><link rel="stylesheet" href="../../_odoc-theme/odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 2.2.1"/><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">ocaml</a> » Ast_iterator</nav><header class="odoc-preamble"><h1>Module <code><span>Ast_iterator</span></code></h1><p><a href="#type-iterator"><code>Ast_iterator.iterator</code></a> enables AST inspection using open recursion. A typical mapper would be based on <a href="#val-default_iterator"><code>Ast_iterator.default_iterator</code></a>, a trivial iterator, and will fall back on it for handling the syntax it does not modify.</p><p><b>Warning:</b> this module is unstable and part of <span class="xref-unresolved">compiler-libs</span>.</p></header><nav class="odoc-toc"><ul><li><a href="#a-generic-parsetree-iterator">A generic Parsetree iterator</a></li></ul></nav><div class="odoc-content"><h2 id="a-generic-parsetree-iterator"><a href="#a-generic-parsetree-iterator" class="anchor"></a>A generic Parsetree iterator</h2><div class="odoc-spec"><div class="spec type anchored" id="type-iterator"><a href="#type-iterator" class="anchor"></a><code><span><span class="keyword">type</span> iterator</span><span> = </span><span>{</span></code><ol><li id="type-iterator.attribute" class="def record field anchored"><a href="#type-iterator.attribute" class="anchor"></a><code><span>attribute : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-attribute">Parsetree.attribute</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.attributes" class="def record field anchored"><a href="#type-iterator.attributes" class="anchor"></a><code><span>attributes : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><span><a href="../Parsetree/index.html#type-attribute">Parsetree.attribute</a> list</span> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.binding_op" class="def record field anchored"><a href="#type-iterator.binding_op" class="anchor"></a><code><span>binding_op : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-binding_op">Parsetree.binding_op</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.case" class="def record field anchored"><a href="#type-iterator.case" class="anchor"></a><code><span>case : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-case">Parsetree.case</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.cases" class="def record field anchored"><a href="#type-iterator.cases" class="anchor"></a><code><span>cases : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><span><a href="../Parsetree/index.html#type-case">Parsetree.case</a> list</span> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.class_declaration" class="def record field anchored"><a href="#type-iterator.class_declaration" class="anchor"></a><code><span>class_declaration : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-class_declaration">Parsetree.class_declaration</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.class_description" class="def record field anchored"><a href="#type-iterator.class_description" class="anchor"></a><code><span>class_description : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-class_description">Parsetree.class_description</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.class_expr" class="def record field anchored"><a href="#type-iterator.class_expr" class="anchor"></a><code><span>class_expr : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-class_expr">Parsetree.class_expr</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.class_field" class="def record field anchored"><a href="#type-iterator.class_field" class="anchor"></a><code><span>class_field : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-class_field">Parsetree.class_field</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.class_signature" class="def record field anchored"><a href="#type-iterator.class_signature" class="anchor"></a><code><span>class_signature : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-class_signature">Parsetree.class_signature</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.class_structure" class="def record field anchored"><a href="#type-iterator.class_structure" class="anchor"></a><code><span>class_structure : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-class_structure">Parsetree.class_structure</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.class_type" class="def record field anchored"><a href="#type-iterator.class_type" class="anchor"></a><code><span>class_type : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-class_type">Parsetree.class_type</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.class_type_declaration" class="def record field anchored"><a href="#type-iterator.class_type_declaration" class="anchor"></a><code><span>class_type_declaration : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-class_type_declaration">Parsetree.class_type_declaration</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.class_type_field" class="def record field anchored"><a href="#type-iterator.class_type_field" class="anchor"></a><code><span>class_type_field : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-class_type_field">Parsetree.class_type_field</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.constructor_declaration" class="def record field anchored"><a href="#type-iterator.constructor_declaration" class="anchor"></a><code><span>constructor_declaration : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span>
|
||
<span><a href="../Parsetree/index.html#type-constructor_declaration">Parsetree.constructor_declaration</a> <span class="arrow">-></span></span>
|
||
unit;</span></code></li><li id="type-iterator.expr" class="def record field anchored"><a href="#type-iterator.expr" class="anchor"></a><code><span>expr : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-expression">Parsetree.expression</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.extension" class="def record field anchored"><a href="#type-iterator.extension" class="anchor"></a><code><span>extension : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-extension">Parsetree.extension</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.extension_constructor" class="def record field anchored"><a href="#type-iterator.extension_constructor" class="anchor"></a><code><span>extension_constructor : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-extension_constructor">Parsetree.extension_constructor</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.include_declaration" class="def record field anchored"><a href="#type-iterator.include_declaration" class="anchor"></a><code><span>include_declaration : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-include_declaration">Parsetree.include_declaration</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.include_description" class="def record field anchored"><a href="#type-iterator.include_description" class="anchor"></a><code><span>include_description : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-include_description">Parsetree.include_description</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.label_declaration" class="def record field anchored"><a href="#type-iterator.label_declaration" class="anchor"></a><code><span>label_declaration : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-label_declaration">Parsetree.label_declaration</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.location" class="def record field anchored"><a href="#type-iterator.location" class="anchor"></a><code><span>location : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Location/index.html#type-t">Location.t</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.module_binding" class="def record field anchored"><a href="#type-iterator.module_binding" class="anchor"></a><code><span>module_binding : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-module_binding">Parsetree.module_binding</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.module_declaration" class="def record field anchored"><a href="#type-iterator.module_declaration" class="anchor"></a><code><span>module_declaration : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-module_declaration">Parsetree.module_declaration</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.module_substitution" class="def record field anchored"><a href="#type-iterator.module_substitution" class="anchor"></a><code><span>module_substitution : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-module_substitution">Parsetree.module_substitution</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.module_expr" class="def record field anchored"><a href="#type-iterator.module_expr" class="anchor"></a><code><span>module_expr : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-module_expr">Parsetree.module_expr</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.module_type" class="def record field anchored"><a href="#type-iterator.module_type" class="anchor"></a><code><span>module_type : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-module_type">Parsetree.module_type</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.module_type_declaration" class="def record field anchored"><a href="#type-iterator.module_type_declaration" class="anchor"></a><code><span>module_type_declaration : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span>
|
||
<span><a href="../Parsetree/index.html#type-module_type_declaration">Parsetree.module_type_declaration</a> <span class="arrow">-></span></span>
|
||
unit;</span></code></li><li id="type-iterator.open_declaration" class="def record field anchored"><a href="#type-iterator.open_declaration" class="anchor"></a><code><span>open_declaration : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-open_declaration">Parsetree.open_declaration</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.open_description" class="def record field anchored"><a href="#type-iterator.open_description" class="anchor"></a><code><span>open_description : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-open_description">Parsetree.open_description</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.pat" class="def record field anchored"><a href="#type-iterator.pat" class="anchor"></a><code><span>pat : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-pattern">Parsetree.pattern</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.payload" class="def record field anchored"><a href="#type-iterator.payload" class="anchor"></a><code><span>payload : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-payload">Parsetree.payload</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.signature" class="def record field anchored"><a href="#type-iterator.signature" class="anchor"></a><code><span>signature : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-signature">Parsetree.signature</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.signature_item" class="def record field anchored"><a href="#type-iterator.signature_item" class="anchor"></a><code><span>signature_item : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-signature_item">Parsetree.signature_item</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.structure" class="def record field anchored"><a href="#type-iterator.structure" class="anchor"></a><code><span>structure : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-structure">Parsetree.structure</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.structure_item" class="def record field anchored"><a href="#type-iterator.structure_item" class="anchor"></a><code><span>structure_item : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-structure_item">Parsetree.structure_item</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.typ" class="def record field anchored"><a href="#type-iterator.typ" class="anchor"></a><code><span>typ : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-core_type">Parsetree.core_type</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.row_field" class="def record field anchored"><a href="#type-iterator.row_field" class="anchor"></a><code><span>row_field : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-row_field">Parsetree.row_field</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.object_field" class="def record field anchored"><a href="#type-iterator.object_field" class="anchor"></a><code><span>object_field : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-object_field">Parsetree.object_field</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.type_declaration" class="def record field anchored"><a href="#type-iterator.type_declaration" class="anchor"></a><code><span>type_declaration : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-type_declaration">Parsetree.type_declaration</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.type_extension" class="def record field anchored"><a href="#type-iterator.type_extension" class="anchor"></a><code><span>type_extension : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-type_extension">Parsetree.type_extension</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.type_exception" class="def record field anchored"><a href="#type-iterator.type_exception" class="anchor"></a><code><span>type_exception : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-type_exception">Parsetree.type_exception</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.type_kind" class="def record field anchored"><a href="#type-iterator.type_kind" class="anchor"></a><code><span>type_kind : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-type_kind">Parsetree.type_kind</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.value_binding" class="def record field anchored"><a href="#type-iterator.value_binding" class="anchor"></a><code><span>value_binding : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-value_binding">Parsetree.value_binding</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.value_description" class="def record field anchored"><a href="#type-iterator.value_description" class="anchor"></a><code><span>value_description : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-value_description">Parsetree.value_description</a> <span class="arrow">-></span></span> unit;</span></code></li><li id="type-iterator.with_constraint" class="def record field anchored"><a href="#type-iterator.with_constraint" class="anchor"></a><code><span>with_constraint : <span><a href="#type-iterator">iterator</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-with_constraint">Parsetree.with_constraint</a> <span class="arrow">-></span></span> unit;</span></code></li></ol><code><span>}</span></code></div><div class="spec-doc"><p>A <code>iterator</code> record implements one "method" per syntactic category, using an open recursion style: each method takes as its first argument the iterator to be applied to children in the syntax tree.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-default_iterator"><a href="#val-default_iterator" class="anchor"></a><code><span><span class="keyword">val</span> default_iterator : <a href="#type-iterator">iterator</a></span></code></div><div class="spec-doc"><p>A default iterator, which implements a "do not do anything" mapping.</p></div></div></div></body></html> |