-
Notifications
You must be signed in to change notification settings - Fork 29
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
Documenter.jl
committed
Apr 5, 2024
1 parent
569baeb
commit 3c0a0bd
Showing
4 changed files
with
4 additions
and
4 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 |
---|---|---|
@@ -1 +1 @@ | ||
{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-04-05T10:33:53","documenter_version":"1.3.0"}} | ||
{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-04-05T10:43:21","documenter_version":"1.3.0"}} |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Home · StaticLint.jl</title><meta name="title" content="Home · StaticLint.jl"/><meta property="og:title" content="Home · StaticLint.jl"/><meta property="twitter:title" content="Home · StaticLint.jl"/><meta name="description" content="Documentation for StaticLint.jl."/><meta property="og:description" content="Documentation for StaticLint.jl."/><meta property="twitter:description" content="Documentation for StaticLint.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit"><a href>StaticLint.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li class="is-active"><a class="tocitem" href>Home</a><ul class="internal"><li><a class="tocitem" href="#Installation-and-Usage"><span>Installation and Usage</span></a></li><li><a class="tocitem" href="#Description"><span>Description</span></a></li></ul></li><li><a class="tocitem" href="syntax/">Syntax Reference</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href>Home</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Home</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/julia-vscode/StaticLint.jl/blob/master/docs/src/index.md#L" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="StaticLint"><a class="docs-heading-anchor" href="#StaticLint">StaticLint</a><a id="StaticLint-1"></a><a class="docs-heading-anchor-permalink" href="#StaticLint" title="Permalink"></a></h1><p><a href="https://www.julia-vscode.org/StaticLint.jl/dev"><img src="https://img.shields.io/badge/docs-dev-blue.svg" alt="Dev"/></a> <a href="http://www.repostatus.org/#active"><img src="http://www.repostatus.org/badges/latest/active.svg" alt="Project Status: Active - The project has reached a stable, usable state and is being actively developed."/></a> <img src="https://github.com/julia-vscode/StaticLint.jl/workflows/Run%20CI%20on%20master/badge.svg" alt/> <a href="http://codecov.io/github/julia-vscode/StaticLint.jl?branch=master"><img src="http://codecov.io/github/julia-vscode/StaticLint.jl/coverage.svg?branch=master" alt="codecov.io"/></a></p><p>Static Code Analysis for Julia</p><h2 id="Installation-and-Usage"><a class="docs-heading-anchor" href="#Installation-and-Usage">Installation and Usage</a><a id="Installation-and-Usage-1"></a><a class="docs-heading-anchor-permalink" href="#Installation-and-Usage" title="Permalink"></a></h2><pre><code class="language-julia hljs">using Pkg | ||
Pkg.add("StaticLint")</code></pre><pre><code class="language-julia hljs">using StaticLint</code></pre><p><strong>Documentation</strong>: <a href="https://www.julia-vscode.org/StaticLint.jl/dev"><img src="https://img.shields.io/badge/docs-dev-blue.svg" alt="Dev"/></a></p><h2 id="Description"><a class="docs-heading-anchor" href="#Description">Description</a><a id="Description-1"></a><a class="docs-heading-anchor-permalink" href="#Description" title="Permalink"></a></h2><p>This package supports LanguageServer.jl functionality broadly by:</p><ol><li>linking the file tree of a project</li><li>marking scopes/namespaces within the syntax tree (ST)</li><li>marking variable bindings (functions, instances, etc.)</li><li>linking identifiers (i.e. variable names) to the relevant bindings</li><li>marking possible errors within the ST</li></ol><p>Identifying and marking errors (5.) is, in general, dependent on steps 1-4. These are achieved through a single pass over the ST of a project. A pass over a single <code>EXPR</code> is achieved through calling a <code>State</code> object on the ST. This <code>State</code> requires an <code>AbstractServer</code> that determines how files within a project are loaded and makes packages available for loading.</p><h3 id="Passes"><a class="docs-heading-anchor" href="#Passes">Passes</a><a id="Passes-1"></a><a class="docs-heading-anchor-permalink" href="#Passes" title="Permalink"></a></h3><p>For a given experssion <code>x</code> this pass will:</p><ul><li>Handle import statements (<code>resolve_import</code>). This either explicitly imports variables into the current state (for statements such as <code>import/using SomeModule: binding1, binding2</code>) or makes the exported bindings of a modules available more generally (e.g. <code>using SomeOtherModule</code>). The availability of includable packages is handled by the <code>getsymbolserver</code> function called on the <code>state.server</code>.</li><li>Determine whether <code>x</code> introduces a new variable. <code>mark_bindings!</code> performs this and may mark bindings for child nodes of <code>x</code> (e.g. when called on an expression that defines a <code>Function</code> this will mark the arguments of the signature as introducing bindings.)</li><li>Adds any binding associated with <code>x</code> to the variable list of the current scope (<code>add_binding</code>).</li><li>Handles global variables (<code>mark_globals</code>).</li><li>Special handling for macros introducing new bindings as necessary, at the moment limited to <code>deprecate</code>, <code>enum</code>, <code>goto</code>, <code>label</code>, and <code>nospecialize</code>.</li><li>Adds new scopes for the interior of <code>x</code> as needed (<code>scopes</code>).</li><li>Resolves references for identifiers (i.e. a variable name), macro name, keywords in function signatures and dotted names (e.g. <code>A.B.c</code>). A name is first checked against bindings introduced within a scope then against exported variables of modules loaded into the scope. If this fails to resolve the name this is repeated for the parent scope. References that fail to resolve at this point, and are within a delayed scope (i.e. within a function) are added to a list to be resolved later.</li><li>If <code>x</code> is a call to <code>include(path_expr)</code> attempt to resolve <code>path_expr</code> to a loadable file from <code>state.server</code> and pass across the files ST (<code>followinclude</code>).</li><li>Traverse across child nodes of <code>x</code> (<code>traverse</code>) in execution order. This means, for example, that in the expression <code>a = b</code> we traverse <code>b</code> then <code>a</code> (ignoring the operator).</li></ul><h3 id="Server"><a class="docs-heading-anchor" href="#Server">Server</a><a id="Server-1"></a><a class="docs-heading-anchor-permalink" href="#Server" title="Permalink"></a></h3><p>As mentioned, an <code>AbstractServer</code> is required to hold files within a project and provide access to user installed packages. An implementation must support the following functions:</p><p><code>StaticLint.hasfile(server, path)::Bool</code> : Does the server have a file matching the name <code>path</code>.</p><p><code>StaticLint.getfile(server, path)::AbstractFile</code> : Retrieves the file <code>path</code> - assumes the server has the file.</p><p><code>StaticLint.setfile(server, path, file)::AbstractFile</code> : Stores <code>file</code> in the server under the name <code>path</code>, returning the file.</p><p><code>StaticLint.canloadfile(server, path)::Bool</code> : Can the server load the file denoted by <code>path</code>, likely from an external source.</p><p><code>StaticLint.loadfile(server, path)::AbstractFile</code> : Load the file at <code>path</code> from an external source (i.e. the hard drive).</p><p><code>StaticLint.getsymbolserver(server)::Dict{String,SymbolServer.ModuleStore}</code> : Retrieve the server's depot of loadable packages.</p><p>An <code>AbstractFile</code> must support the following:</p><p><code>StaticLint.getpath(file)</code> : Retrieve the path of a file.</p><p><code>StaticLint.getroot(file)</code> : Retrieve the root of a file. The root is the main/first file in a file structure. For example the <code>StaticLint.jl</code> file is the root of all files (including itself) in <code>src/</code>.</p><p><code>StaticLint.setroot(file, root)</code> : Set the root of a file.</p><p><code>StaticLint.getcst(file)</code> : Retrieve the cst of a file.</p><p><code>StaticLint.setcst(file, cst::CSTParser.EXPR)</code> : Set the cst of a file.</p><p><code>StaticLint.getserver(file)</code> : Retrieve the server holding of a file.</p><p><code>StaticLint.setserver(file, server::AbstractServer)</code> : Set the server of a file.</p><p><code>StaticLint.semantic_pass(file, target = nothing(optional))</code> : Run a full pass on the ST of a project (i.e. ST of all linked files). It is expected that <code>file</code> is the root of the project.</p></article><nav class="docs-footer"><a class="docs-footer-nextpage" href="syntax/">Syntax Reference »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.3.0 on <span class="colophon-date" title="Friday 5 April 2024 10:33">Friday 5 April 2024</span>. Using Julia version 1.10.2.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> | ||
Pkg.add("StaticLint")</code></pre><pre><code class="language-julia hljs">using StaticLint</code></pre><p><strong>Documentation</strong>: <a href="https://www.julia-vscode.org/StaticLint.jl/dev"><img src="https://img.shields.io/badge/docs-dev-blue.svg" alt="Dev"/></a></p><h2 id="Description"><a class="docs-heading-anchor" href="#Description">Description</a><a id="Description-1"></a><a class="docs-heading-anchor-permalink" href="#Description" title="Permalink"></a></h2><p>This package supports LanguageServer.jl functionality broadly by:</p><ol><li>linking the file tree of a project</li><li>marking scopes/namespaces within the syntax tree (ST)</li><li>marking variable bindings (functions, instances, etc.)</li><li>linking identifiers (i.e. variable names) to the relevant bindings</li><li>marking possible errors within the ST</li></ol><p>Identifying and marking errors (5.) is, in general, dependent on steps 1-4. These are achieved through a single pass over the ST of a project. A pass over a single <code>EXPR</code> is achieved through calling a <code>State</code> object on the ST. This <code>State</code> requires an <code>AbstractServer</code> that determines how files within a project are loaded and makes packages available for loading.</p><h3 id="Passes"><a class="docs-heading-anchor" href="#Passes">Passes</a><a id="Passes-1"></a><a class="docs-heading-anchor-permalink" href="#Passes" title="Permalink"></a></h3><p>For a given experssion <code>x</code> this pass will:</p><ul><li>Handle import statements (<code>resolve_import</code>). This either explicitly imports variables into the current state (for statements such as <code>import/using SomeModule: binding1, binding2</code>) or makes the exported bindings of a modules available more generally (e.g. <code>using SomeOtherModule</code>). The availability of includable packages is handled by the <code>getsymbolserver</code> function called on the <code>state.server</code>.</li><li>Determine whether <code>x</code> introduces a new variable. <code>mark_bindings!</code> performs this and may mark bindings for child nodes of <code>x</code> (e.g. when called on an expression that defines a <code>Function</code> this will mark the arguments of the signature as introducing bindings.)</li><li>Adds any binding associated with <code>x</code> to the variable list of the current scope (<code>add_binding</code>).</li><li>Handles global variables (<code>mark_globals</code>).</li><li>Special handling for macros introducing new bindings as necessary, at the moment limited to <code>deprecate</code>, <code>enum</code>, <code>goto</code>, <code>label</code>, and <code>nospecialize</code>.</li><li>Adds new scopes for the interior of <code>x</code> as needed (<code>scopes</code>).</li><li>Resolves references for identifiers (i.e. a variable name), macro name, keywords in function signatures and dotted names (e.g. <code>A.B.c</code>). A name is first checked against bindings introduced within a scope then against exported variables of modules loaded into the scope. If this fails to resolve the name this is repeated for the parent scope. References that fail to resolve at this point, and are within a delayed scope (i.e. within a function) are added to a list to be resolved later.</li><li>If <code>x</code> is a call to <code>include(path_expr)</code> attempt to resolve <code>path_expr</code> to a loadable file from <code>state.server</code> and pass across the files ST (<code>followinclude</code>).</li><li>Traverse across child nodes of <code>x</code> (<code>traverse</code>) in execution order. This means, for example, that in the expression <code>a = b</code> we traverse <code>b</code> then <code>a</code> (ignoring the operator).</li></ul><h3 id="Server"><a class="docs-heading-anchor" href="#Server">Server</a><a id="Server-1"></a><a class="docs-heading-anchor-permalink" href="#Server" title="Permalink"></a></h3><p>As mentioned, an <code>AbstractServer</code> is required to hold files within a project and provide access to user installed packages. An implementation must support the following functions:</p><p><code>StaticLint.hasfile(server, path)::Bool</code> : Does the server have a file matching the name <code>path</code>.</p><p><code>StaticLint.getfile(server, path)::AbstractFile</code> : Retrieves the file <code>path</code> - assumes the server has the file.</p><p><code>StaticLint.setfile(server, path, file)::AbstractFile</code> : Stores <code>file</code> in the server under the name <code>path</code>, returning the file.</p><p><code>StaticLint.canloadfile(server, path)::Bool</code> : Can the server load the file denoted by <code>path</code>, likely from an external source.</p><p><code>StaticLint.loadfile(server, path)::AbstractFile</code> : Load the file at <code>path</code> from an external source (i.e. the hard drive).</p><p><code>StaticLint.getsymbolserver(server)::Dict{String,SymbolServer.ModuleStore}</code> : Retrieve the server's depot of loadable packages.</p><p>An <code>AbstractFile</code> must support the following:</p><p><code>StaticLint.getpath(file)</code> : Retrieve the path of a file.</p><p><code>StaticLint.getroot(file)</code> : Retrieve the root of a file. The root is the main/first file in a file structure. For example the <code>StaticLint.jl</code> file is the root of all files (including itself) in <code>src/</code>.</p><p><code>StaticLint.setroot(file, root)</code> : Set the root of a file.</p><p><code>StaticLint.getcst(file)</code> : Retrieve the cst of a file.</p><p><code>StaticLint.setcst(file, cst::CSTParser.EXPR)</code> : Set the cst of a file.</p><p><code>StaticLint.getserver(file)</code> : Retrieve the server holding of a file.</p><p><code>StaticLint.setserver(file, server::AbstractServer)</code> : Set the server of a file.</p><p><code>StaticLint.semantic_pass(file, target = nothing(optional))</code> : Run a full pass on the ST of a project (i.e. ST of all linked files). It is expected that <code>file</code> is the root of the project.</p></article><nav class="docs-footer"><a class="docs-footer-nextpage" href="syntax/">Syntax Reference »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.3.0 on <span class="colophon-date" title="Friday 5 April 2024 10:43">Friday 5 April 2024</span>. Using Julia version 1.10.2.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> |
Binary file not shown.
Oops, something went wrong.