-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
268 changed files
with
3,908 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<title>index</title> | ||
<link rel="stylesheet" href="./odoc.support/odoc.css"/> | ||
<meta charset="utf-8"/> | ||
<meta name="viewport" content="width=device-width,initial-scale=1.0"/> | ||
</head> | ||
<body> | ||
<main class="content"> | ||
<div class="by-name"> | ||
<h2>OCaml package documentation</h2> | ||
<ol> | ||
<li><a href="less-power/index.html">less-power</a></li> | ||
</ol> | ||
</div> | ||
</main> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Feature (less-power.Ast_check.Feature)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../odoc.support/odoc.css"/><meta name="generator" content="odoc 2.4.2"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../odoc.support/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">less-power</a> » <a href="../index.html">Ast_check</a> » Feature</nav><header class="odoc-preamble"><h1>Module <code><span>Ast_check.Feature</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><span> = </span></code><ol><li id="type-t.Array" class="def variant constructor anchored"><a href="#type-t.Array" class="anchor"></a><code><span>| </span><span><span class="constructor">Array</span></span></code></li><li id="type-t.Mutable_member" class="def variant constructor anchored"><a href="#type-t.Mutable_member" class="anchor"></a><code><span>| </span><span><span class="constructor">Mutable_member</span></span></code></li><li id="type-t.Object" class="def variant constructor anchored"><a href="#type-t.Object" class="anchor"></a><code><span>| </span><span><span class="constructor">Object</span></span></code></li><li id="type-t.Loop" class="def variant constructor anchored"><a href="#type-t.Loop" class="anchor"></a><code><span>| </span><span><span class="constructor">Loop</span></span></code></li><li id="type-t.Primitive" class="def variant constructor anchored"><a href="#type-t.Primitive" class="anchor"></a><code><span>| </span><span><span class="constructor">Primitive</span></span></code></li><li id="type-t.Internal_name" class="def variant constructor anchored"><a href="#type-t.Internal_name" class="anchor"></a><code><span>| </span><span><span class="constructor">Internal_name</span></span></code></li><li id="type-t.Alert_control" class="def variant constructor anchored"><a href="#type-t.Alert_control" class="anchor"></a><code><span>| </span><span><span class="constructor">Alert_control</span></span></code></li><li id="type-t.Tail_mod_cons" class="def variant constructor anchored"><a href="#type-t.Tail_mod_cons" class="anchor"></a><code><span>| </span><span><span class="constructor">Tail_mod_cons</span></span></code></li></ol></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Set"><a href="#module-Set" class="anchor"></a><code><span><span class="keyword">module</span> Set</span><span> : <span class="xref-unresolved">Stdlib</span>.Set.S <span class="keyword">with</span> <span><span class="keyword">type</span> <span class="xref-unresolved">elt</span> = <span class="xref-unresolved">t</span></span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-to_identifier"><a href="#val-to_identifier" class="anchor"></a><code><span><span class="keyword">val</span> to_identifier : <span><a href="#type-t">t</a> <span class="arrow">-></span></span> string</span></code></div><div class="spec-doc"><p>Unique identifier for this feature.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-of_identifier"><a href="#val-of_identifier" class="anchor"></a><code><span><span class="keyword">val</span> of_identifier : <span>string <span class="arrow">-></span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Provides the feature corresponding to a unique identifier returned by <a href="#val-to_identifier"><code>to_identifier</code></a>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-minimum"><a href="#val-minimum" class="anchor"></a><code><span><span class="keyword">val</span> minimum : <span class="xref-unresolved">Set</span>.t</span></code></div><div class="spec-doc"><p><a href="#type-t.Primitive"><code>Primitive</code></a> and <a href="#type-t.Internal_name"><code>Internal_name</code></a>, required to prevent circumventing restrictions.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-default"><a href="#val-default" class="anchor"></a><code><span><span class="keyword">val</span> default : <span class="xref-unresolved">Set</span>.t</span></code></div><div class="spec-doc"><p>Everything but <a href="#type-t.Tail_mod_cons"><code>Tail_mod_cons</code></a>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-all"><a href="#val-all" class="anchor"></a><code><span><span class="keyword">val</span> all : <span class="xref-unresolved">Set</span>.t</span></code></div><div class="spec-doc"><p>Everything.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-to_message"><a href="#val-to_message" class="anchor"></a><code><span><span class="keyword">val</span> to_message : <span><a href="#type-t">t</a> <span class="arrow">-></span></span> string</span></code></div><div class="spec-doc"><p>Provide a message explaining why a feature is prohibited.</p></div></div></div></body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Ast_check (less-power.Ast_check)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../odoc.support/odoc.css"/><meta name="generator" content="odoc 2.4.2"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../odoc.support/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">less-power</a> » Ast_check</nav><header class="odoc-preamble"><h1>Module <code><span>Ast_check</span></code></h1><p>AST checker.</p><p>Tool to enforce restrictions on what syntax elements are allowed in OCaml code. Restricts use of the following class features and imperative elements:</p><ul><li>class declarations</li><li>class type declarations</li><li>class method calls</li><li>new class expressions</li><li>setting class and record fields</li><li>array literals</li><li><code>while</code> loops</li><li><code>for</code> loops</li><li>declaring records with mutable entries</li><li><code>external</code> declarations</li><li>internal dune modules (<code>Package__Module</code>)</li></ul><p><code>external</code> declarations and internal dune modules are forbidden, as they can be used to circumvent restrictions in the <code>Stdlib</code> replacement. The sequence operator is not forbidden as there would be no point, <code>a; b</code> can be trivially replaced by <code>let _ = a in b</code>.</p><p>An executable is installed as <code>lp-ast-check</code>. All files passed as arguments, and all <code>.ml</code> files contained recursively in directories passed as arguments, are checked. Exits with code <code>0</code> if no violations are detected, <code>1</code> if violations are found, or <code>2</code> if an error occurs.</p></header><nav class="odoc-toc"><ul><li><a href="#ppxlib-transformations">Ppxlib transformations</a></li></ul></nav><div class="odoc-content"><div class="odoc-spec"><div class="spec module anchored" id="module-Feature"><a href="#module-Feature" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Feature/index.html">Feature</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-violation"><a href="#type-violation" class="anchor"></a><code><span><span class="keyword">type</span> violation</span><span> = </span><span>{</span></code><ol><li id="type-violation.location" class="def record field anchored"><a href="#type-violation.location" class="anchor"></a><code><span>location : <span class="xref-unresolved">Ppxlib</span>.Location.t;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>Location of the violation.</p><span class="comment-delim">*)</span></div></li><li id="type-violation.message" class="def record field anchored"><a href="#type-violation.message" class="anchor"></a><code><span>message : <span>string option</span>;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>Error message.</p><span class="comment-delim">*)</span></div></li><li id="type-violation.feature" class="def record field anchored"><a href="#type-violation.feature" class="anchor"></a><code><span>feature : <a href="Feature/index.html#type-t">Feature.t</a>;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>Which prohibited feature was used.</p><span class="comment-delim">*)</span></div></li></ol><code><span>}</span></code></div><div class="spec-doc"><p>A violation that occurred in the AST.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-ast_violations"><a href="#val-ast_violations" class="anchor"></a><code><span><span class="keyword">val</span> ast_violations : | ||
<span><span class="optlabel">?prohibited</span>:<span class="xref-unresolved">Feature</span>.Set.t <span class="arrow">-></span></span> | ||
<span><span class="optlabel">?limit</span>:int <span class="arrow">-></span></span> | ||
<span><span class="xref-unresolved">Ppxlib</span>.structure <span class="arrow">-></span></span> | ||
<span><a href="#type-violation">violation</a> list</span></span></code></div><div class="spec-doc"><p>Return a list of (up to <code>limit</code>) violations for this AST.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-file_violations"><a href="#val-file_violations" class="anchor"></a><code><span><span class="keyword">val</span> file_violations : | ||
<span><span class="optlabel">?prohibited</span>:<span class="xref-unresolved">Feature</span>.Set.t <span class="arrow">-></span></span> | ||
<span><span class="optlabel">?limit</span>:int <span class="arrow">-></span></span> | ||
<span>string <span class="arrow">-></span></span> | ||
<span><a href="#type-violation">violation</a> list</span></span></code></div><div class="spec-doc"><p>As per <a href="#val-ast_violations"><code>ast_violations</code></a>, but first parse a file to an AST.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-path_violations"><a href="#val-path_violations" class="anchor"></a><code><span><span class="keyword">val</span> path_violations : | ||
<span><span class="optlabel">?follow</span>:<span class="xref-unresolved">FileUtil</span>.action_link <span class="arrow">-></span></span> | ||
<span><span class="optlabel">?prohibited</span>:<span class="xref-unresolved">Feature</span>.Set.t <span class="arrow">-></span></span> | ||
<span><span class="optlabel">?limit</span>:int <span class="arrow">-></span></span> | ||
<span><span class="optlabel">?check1</span>:<span class="xref-unresolved">FileUtil</span>.test_file <span class="arrow">-></span></span> | ||
<span><span class="optlabel">?check</span>:<span class="xref-unresolved">FileUtil</span>.test_file <span class="arrow">-></span></span> | ||
<span><span>(<span><span><a href="#type-violation">violation</a> list</span> <span class="arrow">-></span></span> unit)</span> <span class="arrow">-></span></span> | ||
<span>string <span class="arrow">-></span></span> | ||
unit</span></code></div><div class="spec-doc"><p>As per <a href="#val-file_violations"><code>file_violations</code></a>, but scan an entire directory (recursively). If the path designates a regular file, check the file if <code>check1</code> matches (default: always); if a directory is scanned, check each file if <code>check</code> matches (default: <code>.ml</code> ending). Pass each (possibly empty) list of violations to the callback; see the note in <a href="#val-pp_violation"><code>pp_violation</code></a>.</p><p>The <code>follow</code> argument (default: <span class="xref-unresolved" title="FilePath.Follow"><code>Follow</code></span>) only applies to directories; symlinks to files are always read.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-pp_violation_message"><a href="#val-pp_violation_message" class="anchor"></a><code><span><span class="keyword">val</span> pp_violation_message : <span><span class="xref-unresolved">Stdlib</span>.Format.formatter <span class="arrow">-></span></span> <span><a href="#type-violation">violation</a> <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p>Pretty-print the message of a violation, containing a generic message that describes the <a href="#type-violation.feature" title="violation.feature">feature</a> and the specific <a href="#type-violation.message" title="violation.message">message</a> of the violation.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-pp_violation"><a href="#val-pp_violation" class="anchor"></a><code><span><span class="keyword">val</span> pp_violation : <span><span class="xref-unresolved">Stdlib</span>.Format.formatter <span class="arrow">-></span></span> <span><a href="#type-violation">violation</a> <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p>Pretty-print a violation. Violations from a given file should be printed before the next file is parsed, otherwise no context from the source file will be output.</p><p>Breaks pretty-printing, this is a limitation of <code>Location.print_report</code></p></div></div><h3 id="ppxlib-transformations"><a href="#ppxlib-transformations" class="anchor"></a>Ppxlib transformations</h3><p>Transformations intended directly for use with Ppxlib.</p><div class="odoc-spec"><div class="spec type anchored" id="type-transformation"><a href="#type-transformation" class="anchor"></a><code><span><span class="keyword">type</span> <span>'a transformation</span></span><span> = <span><span class="xref-unresolved">Ppxlib</span>.Expansion_context.Base.t <span class="arrow">-></span></span> <span><span class="type-var">'a</span> <span class="arrow">-></span></span> <span class="type-var">'a</span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-ast_violations_transformation"><a href="#val-ast_violations_transformation" class="anchor"></a><code><span><span class="keyword">val</span> ast_violations_transformation : | ||
<span><span class="optlabel">?prohibited</span>:<span class="xref-unresolved">Feature</span>.Set.t <span class="arrow">-></span></span> | ||
<span><span class="optlabel">?limit</span>:int <span class="arrow">-></span></span> | ||
<span><span class="xref-unresolved">Ppxlib</span>.structure <a href="#type-transformation">transformation</a></span></span></code></div><div class="spec-doc"><p>As per <a href="#val-ast_violations"><code>ast_violations</code></a>, but intended directly for use as a Ppxlib transformation. Errors are embedded as extension nodes in the returned AST.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-strip_signatures"><a href="#val-strip_signatures" class="anchor"></a><code><span><span class="keyword">val</span> strip_signatures : <span><span class="xref-unresolved">Ppxlib</span>.Ast.structure <a href="#type-transformation">transformation</a></span></span></code></div><div class="spec-doc"><p>Removes module type annotations on modules. For example, these two definitions:</p><pre class="language-ocaml"><code>module M : S = struct ... end | ||
module M : S with type t = ... = struct ... end</code></pre><p>Both become:</p><pre class="language-ocaml"><code>module M = struct ... end </code></pre><p>Allows testing code that annotated module types but didn't think to add the <code>with</code> constraint to expose the type.</p></div></div></div></body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Ast_check_ppx (less-power.Ast_check_ppx)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../odoc.support/odoc.css"/><meta name="generator" content="odoc 2.4.2"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../odoc.support/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">less-power</a> » Ast_check_ppx</nav><header class="odoc-preamble"><h1>Module <code><span>Ast_check_ppx</span></code></h1><p>Use the AST check as a PPX rewriter, with arguments. If further customization is needed, it's best to define a PPX directly in the given exercise's repository instead.</p></header><div class="odoc-content"><div class="odoc-spec"><div class="spec value anchored" id="val-feature_identifiers"><a href="#val-feature_identifiers" class="anchor"></a><code><span><span class="keyword">val</span> feature_identifiers : <span>string list</span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-prohibited_features"><a href="#val-prohibited_features" class="anchor"></a><code><span><span class="keyword">val</span> prohibited_features : <span><span class="xref-unresolved">Ast_check</span>.Feature.Set.t <span class="xref-unresolved">Stdlib</span>.ref</span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-update_feature"><a href="#val-update_feature" class="anchor"></a><code><span><span class="keyword">val</span> update_feature : <span><span class="label">prohibit</span>:bool <span class="arrow">-></span></span> <span>string <span class="arrow">-></span></span> unit</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-feature_spec"><a href="#val-feature_spec" class="anchor"></a><code><span><span class="keyword">val</span> feature_spec : <span><span class="label">prohibit</span>:bool <span class="arrow">-></span></span> <span class="xref-unresolved">Stdlib</span>.Arg.spec</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-violation_limit"><a href="#val-violation_limit" class="anchor"></a><code><span><span class="keyword">val</span> violation_limit : <span><span>int option</span> <span class="xref-unresolved">Stdlib</span>.ref</span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-strip_signatures"><a href="#val-strip_signatures" class="anchor"></a><code><span><span class="keyword">val</span> strip_signatures : <span>bool <span class="xref-unresolved">Stdlib</span>.ref</span></span></code></div></div></div></body></html> |
Oops, something went wrong.